|
|
1.1 root 1: /*
1.1.1.2 root 2: Hatari - sdlgui.h
3:
1.1.1.11 root 4: This file is distributed under the GNU General Public License, version 2
5: or at your option any later version. Read the file gpl.txt for details.
1.1 root 6:
7: Header for the tiny graphical user interface for Hatari.
8: */
9:
1.1.1.2 root 10: #ifndef HATARI_SDLGUI_H
11: #define HATARI_SDLGUI_H
12:
1.1 root 13: #include <SDL.h>
14:
15: enum
16: {
17: SGBOX,
18: SGTEXT,
1.1.1.3 root 19: SGEDITFIELD,
1.1 root 20: SGBUTTON,
21: SGRADIOBUT,
22: SGCHECKBOX,
1.1.1.9 root 23: SGPOPUP,
24: SGSCROLLBAR
1.1 root 25: };
26:
27:
28: /* Object flags: */
1.1.1.7 root 29: #define SG_TOUCHEXIT 1 /* Exit immediately when mouse button is pressed down */
30: #define SG_EXIT 2 /* Exit when mouse button has been pressed (and released) */
1.1.1.12! root 31: #define SG_DEFAULT 4 /* Marks a default button, selectable with Enter & Return keys */
1.1.1.7 root 32: #define SG_CANCEL 8 /* Marks a cancel button, selectable with ESC key */
1.1.1.12! root 33: #define SG_SHORTCUT 16 /* Marks a shortcut button, selectable with masked letter */
1.1 root 34:
35: /* Object states: */
1.1.1.9 root 36: #define SG_SELECTED 1
1.1.1.12! root 37: #define SG_MOUSEDOWN 2
! 38: #define SG_FOCUSED 4 /* Marks an object that has selection focus */
! 39: #define SG_WASFOCUSED 8 /* Marks an object that had selection focus & its bg needs redraw */
! 40:
! 41: /* special shortcut keys, something that won't conflict with text shortcuts */
! 42: #define SG_SHORTCUT_LEFT '<'
! 43: #define SG_SHORTCUT_RIGHT '>'
! 44: #define SG_SHORTCUT_UP '^'
! 45: #define SG_SHORTCUT_DOWN '|'
1.1 root 46:
1.1.1.3 root 47: /* Special characters: */
48: #define SGRADIOBUTTON_NORMAL 12
49: #define SGRADIOBUTTON_SELECTED 13
1.1.1.9 root 50: #define SGCHECKBOX_NORMAL 14
51: #define SGCHECKBOX_SELECTED 15
52: #define SGARROWUP 1
53: #define SGARROWDOWN 2
54: #define SGFOLDER 5
1.1.1.3 root 55:
1.1.1.5 root 56: /* Return codes: */
57: #define SDLGUI_ERROR -1
58: #define SDLGUI_QUIT -2
59: #define SDLGUI_UNKNOWNEVENT -3
60:
1.1 root 61:
62: typedef struct
63: {
64: int type; /* What type of object */
65: int flags; /* Object flags */
1.1.1.4 root 66: int state; /* Object state */
1.1 root 67: int x, y; /* The offset to the upper left corner */
1.1.1.9 root 68: int w, h; /* Width and height (for scrollbar : height and position) */
1.1 root 69: char *txt; /* Text string */
1.1.1.12! root 70: int shortcut; /* shortcut key */
1.1 root 71: } SGOBJ;
72:
1.1.1.10 root 73: extern int sdlgui_fontwidth; /* Width of the actual font */
74: extern int sdlgui_fontheight; /* Height of the actual font */
1.1 root 75:
1.1.1.3 root 76: extern int SDLGui_Init(void);
77: extern int SDLGui_UnInit(void);
1.1.1.5 root 78: extern int SDLGui_SetScreen(SDL_Surface *pScrn);
1.1.1.8 root 79: extern void SDLGui_GetFontSize(int *width, int *height);
80: extern void SDLGui_Text(int x, int y, const char *txt);
1.1.1.6 root 81: extern void SDLGui_DrawDialog(const SGOBJ *dlg);
1.1.1.12! root 82: extern int SDLGui_DoDialog(SGOBJ *dlg, SDL_Event *pEventOut, bool KeepCurrentObject);
1.1.1.3 root 83: extern void SDLGui_CenterDlg(SGOBJ *dlg);
1.1.1.12! root 84: extern char* SDLGui_FileSelect(const char *title, const char *path_and_name, char **zip_path, bool bAllowNew);
! 85: extern bool SDLGui_FileConfSelect(const char *title, char *dlgname, char *confname, int maxlen, bool bAllowNew);
1.1.1.2 root 86:
87: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.