White space fixes, tabs -> space, removed trailing white space.
[AROS.git] / workbench / libs / muimaster / tutorial / examples / HelloZune.c
blob43edc9fa3219b2cf7bf953cb8a21dafc0f8ab24c
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_Hello;
21 /****************************************************************
22 Allocate resources for gui
23 *****************************************************************/
25 BOOL init_gui(void)
27 app = ApplicationObject,
28 MUIA_Application_Title , (IPTR) "HelloZune",
29 MUIA_Application_Version , (IPTR) "$VER: HelloZune 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) "Show basic structure of a MUI/Zune application",
33 MUIA_Application_Base , (IPTR) "HELLOZUNE",
35 SubWindow, WD_Main = WindowObject,
36 MUIA_Window_Title, (IPTR) "Hello Zune",
38 WindowContents, VGroup,
39 Child, HGroup,
40 Child, BT_Hello = SimpleButton("Hello Zune"),
41 End, /* HGroup */
42 End, /* VGroup */
44 End, /* WindowObject */
46 End; /* ApplicationObject */
48 if(app)
50 /* Quit application if the windowclosegadget or the esc key is pressed. */
52 DoMethod(WD_Main, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
53 app, 2,
54 MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
56 return(TRUE);
59 return(FALSE);
60 } /* init_gui(void) */
63 /****************************************************************
64 Deallocates all gui resources
65 *****************************************************************/
67 void deinit_gui(void)
69 if(app){MUI_DisposeObject(app);}
70 } /* deinit_gui(void) */
74 /****************************************************************
75 The message loop
76 *****************************************************************/
78 void loop(void)
80 ULONG sigs = 0;
82 while((LONG) DoMethod(app, MUIM_Application_NewInput, &sigs) != MUIV_Application_ReturnID_Quit)
84 if (sigs)
86 sigs = Wait(sigs | SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D);
87 if(sigs & SIGBREAKF_CTRL_C){break;}
88 if(sigs & SIGBREAKF_CTRL_D){break;}
91 } /* loop(void)*/
94 /****************************************************************
95 The main entry point
96 *****************************************************************/
98 int main(int argc, char *argv[])
100 if(open_libs())
102 if(init_gui())
104 set(WD_Main, MUIA_Window_Open, TRUE);
106 if(xget(WD_Main, MUIA_Window_Open))
108 loop();
111 set(WD_Main, MUIA_Window_Open, FALSE);
113 deinit_gui();
116 close_libs();
118 } /* main(int argc, char *argv[]) */