brewpanel/dlgBrew.c

changeset 409
cdf68044adaf
child 410
e3f8a51b566a
equal deleted inserted replaced
408:ec507c1f1df7 409:cdf68044adaf
1 /*****************************************************************************
2 * Copyright (C) 2015
3 *
4 * Michiel Broek <mbroek at mbse dot eu>
5 *
6 * This file is part of the mbsePi-apps
7 *
8 * The gui code is based on the gui from the emulator ARAnyM,
9 * Copyright (c) 2004 Petr Stehlik of ARAnyM dev team
10 *
11 * mbsePi-apps is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2, or (at your option) any
14 * later version.
15 *
16 * mbsePi-apps is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with mbsePi-apps; see the file COPYING. If not, write to the Free
23 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
24 *****************************************************************************/
25
26 #include "brewpanel.h"
27 #include "dlgBrew.h"
28 #include "sdlgui.h"
29
30 extern SDL_Surface *PAN_surface;
31 extern int my_shutdown;
32
33
34 #define MAINDLG_B1 2
35 #define MAINDLG_B2 3
36 #define MAINDLG_B3 4
37 #define MAINDLG_B4 5
38 #define MAINDLG_QUIT 6
39
40
41 /* The main dialog: */
42 static SGOBJ maindlg[] =
43 {
44 /* type flags state x y w h txt */
45 { SGBOX, 0, 0, 0, 0, 374, 470, NULL },
46 { SGLCD, 0, 0, -1, 44, 20, 4, NULL },
47 { SGBUTTON, 0, 0, 85, 130, 20, 20, (char *)"1" },
48 { SGBUTTON, 0, 0, 145, 130, 20, 20, (char *)"2" },
49 { SGBUTTON, 0, 0, 205, 130, 20, 20, (char *)"3" },
50 { SGBUTTON, 0, 0, 265, 130, 20, 20, (char *)"4" },
51 { SGBUTTON, 0, 0, 147, 430, 80, 20, (char *)"Quit" },
52 { SGTTF, 0, 0, 5, 280, 0, 0, (char *)"The quick brown fox jumps over the lazy dog" },
53 { -1, 0, 0, 0, 0, 0, 0, NULL }
54 };
55
56
57
58
59 /*
60 * This functions sets up the actual font and then displays the brew panel dialog.
61 */
62 int Dialog_BrewDlg(void)
63 {
64 int retbut;
65 int bOldMouseVisibility;
66 int nOldMouseX, nOldMouseY;
67
68 if (SDLGui_SetScreen(PAN_surface)) {
69 syslog(LOG_NOTICE, "SDLGui_SetScreen(PAN_surface) failed: %s", SDL_GetError());
70 return FALSE;
71 }
72
73 SDL_GetMouseState(&nOldMouseX, &nOldMouseY);
74 bOldMouseVisibility = SDL_ShowCursor(SDL_QUERY);
75 SDL_ShowCursor(SDL_ENABLE);
76
77 SDLGui_CenterDlg(maindlg);
78
79 do {
80 retbut = SDLGui_DoDialog(maindlg, NULL);
81 SDLGui_LCDwrite(maindlg, 0, 0, 'A', 0);
82
83 fprintf(stdout, "SDLGui_DoDialog retbut=%d\n", retbut);
84
85 switch (retbut) {
86 case MAINDLG_B1: fprintf(stdout, "Button 1\n");
87 break;
88 case MAINDLG_B2: fprintf(stdout, "Button 2\n");
89 break;
90 case MAINDLG_B3: fprintf(stdout, "Button 3\n");
91 break;
92 case MAINDLG_B4: fprintf(stdout, "Button 4\n");
93 break;
94 case MAINDLG_QUIT: my_shutdown = TRUE;
95 break;
96 }
97
98 } while (retbut != SDLGUI_QUIT && retbut != SDLGUI_ERROR && !my_shutdown);
99
100 SDL_ShowCursor(bOldMouseVisibility);
101
102 return TRUE;
103 }
104

mercurial