brewpanel/sdlgui.h

Wed, 01 May 2024 14:38:37 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 01 May 2024 14:38:37 +0200
changeset 715
f5d85af156ab
parent 638
186f0c2d3e76
permissions
-rw-r--r--

Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.

#ifndef _SDLGUI_H
#define _SDLGUI_H

#ifdef HAVE_SDL2_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(void);
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