00001 #ifndef ALERT_BOX_H_INCLUDED
00002 #define ALERT_BOX_H_INCLUDED
00003
00004 #include "std/support.H"
00005
00006
00007
00008
00009
00010 class AlertBox
00011 {
00012 public :
00013
00014 enum icon_t {
00015 NO_ICON = -1,
00016 JOT_ICON = 0,
00017 INFO_ICON,
00018 QUESTION_ICON,
00019 EXCLAMATION_ICON,
00020 WARNING_ICON,
00021 ICON_NUM
00022 };
00023
00024
00025 typedef void (*alert_cb_t) (void *,void *,int,int);
00026
00027 protected:
00028
00029
00030 public :
00031
00032
00033 protected:
00034
00035
00036 str_ptr _title;
00037
00038 str_list _text;
00039 str_list _buttons;
00040
00041 int _default;
00042
00043 icon_t _icon;
00044
00045
00046 public:
00047 AlertBox() : _title(""), _default(-1), _icon(NO_ICON) { }
00048 virtual ~AlertBox() {}
00049
00050
00051
00052 virtual bool set_title(Cstr_ptr &s) { if (is_displaying()) return false; _title = s; return true; }
00053 virtual bool set_icon(icon_t i) { if (is_displaying()) return false; _icon = i; return true; }
00054 virtual bool set_default(int d) { if (is_displaying()) return false; _default = d; return true; }
00055 virtual bool add_button(Cstr_ptr &s) { if (is_displaying()) return false; _buttons.add(s); return true; }
00056 virtual bool add_text(Cstr_ptr &s) { if (is_displaying()) return false; _text.add(s); return true; }
00057
00058 virtual bool clear_title() { if (is_displaying()) return false; _title = ""; return true; }
00059 virtual bool clear_icon() { if (is_displaying()) return false; _icon = NO_ICON; return true; }
00060 virtual bool clear_default() { if (is_displaying()) return false; _default = -1; return true; }
00061 virtual bool clear_buttons() { if (is_displaying()) return false; _buttons.clear(); return true; }
00062 virtual bool clear_text() { if (is_displaying()) return false; _text.clear(); return true; }
00063
00064 virtual str_ptr get_title() { return _title; }
00065 virtual icon_t get_icon() { return _icon; }
00066 virtual int get_default() { return _default; }
00067 virtual str_list get_buttons() { return _buttons; }
00068 virtual str_list get_text() { return _text; }
00069
00070
00071 public:
00072 virtual bool is_displaying() = 0;
00073 virtual bool display(bool blocking, alert_cb_t cb, void *vp, void *vpd, int idx) = 0;
00074 protected:
00075 virtual bool undisplay(int button) = 0;
00076
00077 };
00078
00079 #endif