1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __messagedialog_hh
3 #define __messagedialog_hh
19 DialogButton(char *label) : _label(label), _default(false)
21 DialogButton(ustring label) : _label(label), _default(false)
23 DialogButton(ustring label, bool def) : _label(label), _default(def)
25 inline const ustring& label() const { return _label; }
26 inline const bool& isDefault() const { return _default; }
29 class MessageDialog : public Widget {
31 MessageDialog(int screen, EventDispatcher *ed, ustring title,
33 MessageDialog(EventDispatcher *ed, ustring title, ustring caption);
34 MessageDialog(Widget *parent, ustring title, ustring caption);
35 virtual ~MessageDialog();
37 virtual void addButton(const DialogButton &b) { _buttons.push_back(b); }
39 virtual const DialogButton& run();
44 virtual const DialogButton& result() const { return *_result; }
45 virtual void setResult(const DialogButton &result) { _result = &result; }
47 virtual void keyPressHandler(const XKeyEvent &e);
48 virtual void clientMessageHandler(const XClientMessageEvent &e);
51 static DialogButton _default_result;
53 void init(const ustring &title, const ustring &caption);
55 std::vector<DialogButton> _buttons;
56 std::vector<Button *> _button_widgets;
58 Widget *_button_holder;
61 const DialogButton *_result;
66 #endif // __messagedialog_hh