Version 1, last updated by wycc at September 29, 2010 05:16 UTC

Message Box Widget

The message box widget will display some fixed layout content on the screen and then grab all mouse and keyboard events until it is closed.

The following type of messagebox are supported

  • Confirmation message box
  • YesNo message box
  • OKCancel message box
  • generic message box

Each type of message box will display one title and one message string and a couple of buttons.

When the mb_messagebox_show is called, the messagebox will be displayed in its designed position according to the SVG file. In addition, all mouse and keyboard events will be grabbed by the messagebox and ignored. Other elements will not be able to receive any events until the messagebox is closed.

objects

  • message: This should be a group or text elements in the SVG. The messagebox will change the text of it according to the message provided by the programmer.
  • okbtn: This is used by both confirmation and okcancel message box.
  • cancelbtn: This is used by the okcancel message box.
  • yesbtn: This is used by the yesno message box.
  • nobtn: This is used by the yesno message box.
  • title: This should be a group of text element of the SVG. The messagebox will change the content of it accordsing to the information provided by the programmer.

API

mb_messagebox_t *mb_messagebox_new(MBAPP *app, mb_sprite_t *sprite, char *obj,int type, void (*callback)(int btn,void *arg),void *arg);

mb_messagebox_t *mb_confimarionbox_new(MPAPP *app, mb_sprite_t *sprite,char *obj, void (*callback)(int btn,void *arg),void *arg);

mb_messagebox_t *mb_yesnobox_new(MPAPP *app, mb_sprite_t *sprite,char *obj, void (*callback)(int btn,void *arg),void *arg);

mb_messagebox_t *mb_okcancel_new(MPAPP *app, mb_sprite_t *sprite,char *obj, void (*callback)(int btn,void *arg),void *arg);

void mb_messagebox_set_title(mb_messagebox_t *msg, char *title);

void mb_messagebox_set_message(mb_messagebox_t *msg, char *message);

void mb_messagebox_destroy(mb_messagebox_t *msg);

void mb_messagebox_show(mb_messagebox_t *msg);