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