White space fixes, tabs -> space, removed trailing white space.
[AROS.git] / workbench / libs / muimaster / tutorial / examples / HVGroup.c
blob60e1869f2326abed298be60b13333c9d9fbfb5aa
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_One;
19 Object *BT_1, *BT_2, *BT_3;
22 /****************************************************************
23 Allocalte resources for gui
24 *****************************************************************/
26 BOOL init_gui(void)
28 app = ApplicationObject,
29 MUIA_Application_Title , (IPTR) "HVGroup",
30 MUIA_Application_Version , (IPTR) "$VER: HVGroup 0.1 (14.01.03)",
31 MUIA_Application_Copyright , (IPTR) "© 2003, The AROS Development Team",
32 MUIA_Application_Author , (IPTR) "The AROS Development Team",
33 MUIA_Application_Description, (IPTR) "Layout with HGroup + VGroup",
34 MUIA_Application_Base , (IPTR) "HVGroup",
36 SubWindow, WD_Main = WindowObject,
37 MUIA_Window_Title, (IPTR) "Layout with HGroup + VGroup",
40 Start HGroup of window here. All other GUI objects are childs
41 of this HGroup.
44 WindowContents, HGroup,
47 Layout: HGroup + VGroup for more complex layout.
49 One horizontal group with two vertical groups.
51 HGroup
53 +- VGroup
55 +- VGroup
57 To display one button on the left and three buttons
58 on the right.
61 | Button 1 |
62 | One | | Button 2 |
63 | Button 3 |
66 /* One button on the left */
68 Child, VGroup,
69 Child, BT_One = SimpleButton("One"),
70 End, /* VGroup */
73 /* Three buttons on the right */
75 Child, VGroup,
76 Child, BT_1 = SimpleButton("Button 1"),
77 Child, BT_2 = SimpleButton("Button 2"),
78 Child, BT_3 = SimpleButton("Button 3"),
79 End, /* VGroup */
81 End, /* HGroup */
83 End, /* WindowObject */
85 End; /* ApplicationObject */
87 if(app)
89 /* Quit application if the windowclosegadget or the esc key is pressed. */
91 DoMethod(WD_Main, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
92 app, 2,
93 MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
95 return(TRUE);
98 return(FALSE);
99 } /* init_gui(void) */
102 /****************************************************************
103 Deallocates all gui resources
104 *****************************************************************/
106 void deinit_gui(void)
108 if(app){MUI_DisposeObject(app);}
109 } /* deinit_gui(void) */
113 /****************************************************************
114 The message loop
115 *****************************************************************/
117 void loop(void)
119 ULONG sigs = 0;
121 while((LONG) DoMethod(app, MUIM_Application_NewInput, &sigs) != MUIV_Application_ReturnID_Quit)
123 if (sigs)
125 sigs = Wait(sigs | SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D);
126 if(sigs & SIGBREAKF_CTRL_C){break;}
127 if(sigs & SIGBREAKF_CTRL_D){break;}
130 } /* loop(void)*/
133 /****************************************************************
134 The main entry point
135 *****************************************************************/
137 int main(int argc, char *argv[])
139 if(open_libs())
141 if(init_gui())
143 set(WD_Main, MUIA_Window_Open, TRUE);
145 if(xget(WD_Main, MUIA_Window_Open))
147 loop();
150 set(WD_Main, MUIA_Window_Open, FALSE);
152 deinit_gui();
155 close_libs();
157 } /* main(int argc, char *argv[]) */