brewpanel/sdlgui.h

Sat, 12 Sep 2020 16:50:35 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 12 Sep 2020 16:50:35 +0200
changeset 609
ee433a47fc13
parent 443
6b80a37fdf8d
child 637
21e542c15832
permissions
-rw-r--r--

Version 0.9.10.

#ifndef _SDLGUI_H
#define _SDLGUI_H

#ifdef HAVE_SDL_SDL_H

enum
{
  SGBOX,
  SGTEXT,
  SGTTF,
  SGBUTTON,
  SGLCD,
  SGLEDRED,
  SGLEDGREEN,
  SGLEDBLUE,
  SGLEDYELLOW
};


/* Object flags: */
#define SG_TOUCHEXIT		 1   /* Exit immediately when mouse button is pressed down */
#define SG_EXIT			 2   /* Exit when mouse button has been pressed (and released) */
#define SG_DEFAULT		 4   /* Marks a default button, selectable with return key */
#define SG_CANCEL		 8   /* Marks a cancel button, selectable with ESC key */
#define SG_HIDE			16   /* Button is inactive */

/* Object states: */
#define SG_SELECTED		 1
#define	SG_LCD_BLINK		 2
#define	SG_LCD_CURSOR		 4
#define	SG_LCD_DISPLAY		 8
#define	SG_LCD_BLIGHT		16

/* Return codes: */
#define SDLGUI_ERROR		-1
#define SDLGUI_QUIT		-2
#define SDLGUI_UNKNOWNEVENT	-3


typedef struct
{
    int		type;			/* What type of object */
    int		flags;			/* Object flags */
    int		state;			/* Object state */
    int		x, y;			/* The offset to the upper left corner */
    int		w, h;			/* Width and height */
    char	*txt;			/* Text string */
}  SGOBJ;



void SDLGui_LED(SGOBJ *dlg, int fd, int LED, int on);
void SDLGui_Cursor(SGOBJ *dlg, int fd, int x, int y, int on, int blink);
void SDLGui_CGChar(SGOBJ *dlg, int fd, int x, int y, Uint8 dataf[8]);
void SDLGui_Char(SGOBJ *dlg, int fd, int x, int y, Uint8 c);
void SDLGui_DrawLCD(SGOBJ *bdlg, int objnum);
int  SDLGui_Init(void);
int  SDLGui_UnInit(void);
int  SDLGui_SetScreen(SDL_Surface *pScrn);
void SDLGui_DrawDialog(SGOBJ *dlg);
int  SDLGui_DoDialogInit(SGOBJ *dlg);
int  SDLGui_DoDialogLoop(SGOBJ *dlg);
void SDLGui_DoDialogEnd(void);
void SDLGui_CenterDlg(SGOBJ *dlg);
int  SDLGui_LCDinit(SGOBJ *dlg, int *x, int *y, int *w, int *h, int *cols, int *rows, int lcdindex);
void SDLGui_LCDwrite(SGOBJ *dlg, int fd, int x, int y, Uint8 c, int lcdindex);

#endif

#endif

mercurial