8 MSG_OK,MSG_OKCANCEL,MSG_YESNO
28 static void triggerOk() {
29 messageBox->returnValue = 0;
30 messageBox->dispose();
33 static void triggerCancel() {
34 messageBox->returnValue = 1;
35 messageBox->dispose();
38 static void triggerYes() {
39 messageBox->returnValue = 0;
40 messageBox->dispose();
43 static void triggerNo() {
44 messageBox->returnValue = 1;
45 messageBox->dispose();
48 static void triggerButton(MessageBoxType type) {
54 MessageBox(
const char title[],
const char text[], MessageBoxType type)
55 :
Frame(100,100,strlen(text)*6+20,70,title) {
57 int msgWidth = strlen(text)*6;
59 add( info =
new Label(10,10,msgWidth,20,text) );
62 add( buttons[0] =
new Button(10,40,msgWidth,20,
"Ok") );
63 buttons[0]->action = &triggerOk;
66 add( buttons[0] =
new Button(10,40,msgWidth/2-5,20,
"Ok") );
67 add( buttons[1] =
new Button(20+msgWidth/2-5,40,msgWidth/2-5,20,
"Cancel") );
68 buttons[0]->action = &triggerOk;
69 buttons[1]->action = &triggerCancel;
72 add( buttons[0] =
new Button(10,40,msgWidth/2-5,20,
"Yes") );
73 add( buttons[1] =
new Button(20+msgWidth/2-5,40,msgWidth/2-5,20,
"No") );
74 buttons[0]->action = &triggerYes;
75 buttons[1]->action = &triggerNo;
80 static int show(
const char title[],
const char text[], MessageBoxType type=MSG_OK) {
83 return messageBox->returnValue;
The Label class is the most simple visual class, useful show information to an application final user...
Definition: simplegui.h:106
The MessageBox class is a frame useful to show rapid information, this frame can be customized to ret...
Definition: messagebox.h:21
The Frame class manage all visual objects: Labels, InputText, Buttons, Lists, so on. One frame works like a window, and send all actions to each object after use them.
Definition: simplegui.h:454