White space fixes, tabs -> space, removed trailing white space.
[AROS.git] / workbench / libs / muimaster / tutorial / examples / HGroup.c
blobaab72c1b02ef04ae868e873bd75b055c8a7a7b63
1 /*
2 Copyright © 2003, The AROS Development Team.
3 All rights reserved.
5 $Id$
6 */
8 /* "muizunesupport.h" contains misc includes and
9 init stuff which is not important at the moment. */
11 #include "muizunesupport.h"
14 /* Objects */
16 Object *app;
17 Object *WD_Main;
18 Object *BT_1, *BT_2, *BT_3;
21 /****************************************************************
22 Allocate resources for gui
23 *****************************************************************/
25 BOOL init_gui(void)
27 app = ApplicationObject,
28 MUIA_Application_Title , (IPTR) "HGroup",
29 MUIA_Application_Version , (IPTR) "$VER: HGroup 0.1 (14.01.03)",
30 MUIA_Application_Copyright , (IPTR) "© 2003, The AROS Development Team",
31 MUIA_Application_Author , (IPTR) "The AROS Development Team",
32 MUIA_Application_Description, (IPTR) "Layout with HGroup",
33 MUIA_Application_Base , (IPTR) "HGroup",
35 SubWindow, WD_Main = WindowObject,
36 MUIA_Window_Title, (IPTR) "Layout with HGroup",
38 WindowContents,
41 Layout: HGroup - Three buttons in one horizontal line
43 | Button 1 | | Button 2 | | Button 3 |
46 HGroup,
47 Child, BT_1 = SimpleButton("Button 1"),
48 Child, BT_2 = SimpleButton("Button 2"),
49 Child, BT_3 = SimpleButton("Button 3"),
50 End, /* HGroup */
52 End, /* WindowObject */
54 End; /* ApplicationObject */
56 if(app)
58 /* Quit application if the windowclosegadget or the esc key is pressed. */
60 DoMethod(WD_Main, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
61 app, 2,
62 MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
64 return(TRUE);
67 return(FALSE);
68 } /* init_gui(void) */
71 /****************************************************************
72 Deallocates all gui resources
73 *****************************************************************/
75 void deinit_gui(void)
77 if(app){MUI_DisposeObject(app);}
78 } /* deinit_gui(void) */
82 /****************************************************************
83 The message loop
84 *****************************************************************/
86 void loop(void)
88 ULONG sigs = 0;
90 while((LONG) DoMethod(app, MUIM_Application_NewInput, &sigs) != MUIV_Application_ReturnID_Quit)
92 if (sigs)
94 sigs = Wait(sigs | SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D);
95 if(sigs & SIGBREAKF_CTRL_C){break;}
96 if(sigs & SIGBREAKF_CTRL_D){break;}
99 } /* loop(void)*/
102 /****************************************************************
103 The main entry point
104 *****************************************************************/
106 int main(int argc, char *argv[])
108 if(open_libs())
110 if(init_gui())
112 set(WD_Main, MUIA_Window_Open, TRUE);
114 if(xget(WD_Main, MUIA_Window_Open))
116 loop();
119 set(WD_Main, MUIA_Window_Open, FALSE);
121 deinit_gui();
124 close_libs();
126 } /* main(int argc, char *argv[]) */