Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / muimaster / tutorial / examples / Notify.c
blob1d28ed42841f52a6cfcdf2c03348733172cd7b2b
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 *TX_Info, *BT_Hello, *BT_Reset;
21 /****************************************************************
22 Allocate resources for gui
23 *****************************************************************/
25 BOOL init_gui(void)
27 app = ApplicationObject,
28 MUIA_Application_Title , (IPTR) "Notify",
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) "How to use MUIM_Notify",
33 MUIA_Application_Base , (IPTR) "NOTIFY",
35 /*
36 SimpleButton("Hello Notify") -> Set text to "Hello Notify! Press reset"
37 SimpleButton("Reset text") -> Reset text back to "Please press 'Hello MUIM_Notify'"
38 */
40 SubWindow, WD_Main = WindowObject,
41 MUIA_Window_Title, (IPTR) "How to use MUIM_Notify",
43 WindowContents, VGroup,
44 Child, HGroup,
45 Child, TX_Info = SimpleText("Please press 'Hello Notify'"),
46 End,/* HGroup */
48 Child, HGroup,
49 Child, BT_Hello = SimpleButton("Hello Notify"),
50 Child, BT_Reset = SimpleButton("Reset text"),
51 End,/* HGroup */
52 End, /* VGroup */
54 End, /* WindowObject */
56 End; /* ApplicationObject */
58 if(app)
60 /* Bring buttons to live with MUIM_Notify. */
62 DoMethod(BT_Hello, MUIM_Notify, /* Source object which triggers the notification. */
63 MUIA_Pressed, FALSE, /* Trigger if the button is released (MUIA_Pressed -> FALSE) */
64 TX_Info, /* Destination object to recieve the notification. */
65 3, /* Send three parameters. */
66 /* Set MUIA_Text_Contents to given string. */
67 MUIM_Set, MUIA_Text_Contents, (IPTR) "Hello Notify! Press reset");
70 DoMethod(BT_Reset, MUIM_Notify, /* Source object which triggers the notification. */
71 MUIA_Pressed, FALSE, /* Trigger if the button is released (MUIA_Pressed -> FALSE) */
72 TX_Info, /* Destination object to recieve the notification. */
73 3, /* Send three parameters. */
74 /* Set MUIA_Text_Contents to given string. */
75 MUIM_Set, MUIA_Text_Contents, (IPTR) "Please press 'Hello Notify'");
78 /* Quit application if the windowclosegadget or the esc key is pressed. */
80 DoMethod(WD_Main, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
81 app, 2,
82 MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
84 return(TRUE);
87 return(FALSE);
88 } /* init_gui(void) */
91 /****************************************************************
92 Deallocates all gui resources
93 *****************************************************************/
95 void deinit_gui(void)
97 if(app){MUI_DisposeObject(app);}
98 } /* deinit_gui(void) */
102 /****************************************************************
103 The message loop
104 *****************************************************************/
106 void loop(void)
108 ULONG sigs = 0;
110 while((LONG) DoMethod(app, MUIM_Application_NewInput, &sigs) != MUIV_Application_ReturnID_Quit)
112 if (sigs)
114 sigs = Wait(sigs | SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D);
115 if(sigs & SIGBREAKF_CTRL_C){break;}
116 if(sigs & SIGBREAKF_CTRL_D){break;}
119 } /* loop(void)*/
122 /****************************************************************
123 The main entry point
124 *****************************************************************/
126 int main(int argc, char *argv[])
128 if(open_libs())
130 if(init_gui())
132 set(WD_Main, MUIA_Window_Open, TRUE);
134 if(xget(WD_Main, MUIA_Window_Open))
136 loop();
139 set(WD_Main, MUIA_Window_Open, FALSE);
141 deinit_gui();
144 close_libs();
146 } /* main(int argc, char *argv[]) */