00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _FL_DIALOG_H_
00023 #define _FL_DIALOG_H_
00024
00025 #include "Fl_Window.h"
00026 #include "Fl_Scroll.h"
00027 #include "Fl_Widget_List.h"
00028 #include "Fl_Variant.h"
00029 #include "Fl_Pixmap.h"
00030
00031 #include "Fl_Dialog_DS.h"
00032
00033 class Fl_Button;
00034 class Fl_Tabs;
00035
00040 class FL_API Fl_Dialog : public Fl_Window {
00041 public:
00047 Fl_Dialog(int w, int h, const char *label=0, Fl_Data_Source *ds=0);
00048
00052 ~Fl_Dialog();
00053
00057 enum ButtonTypes {
00058 BTN_OK = 1,
00059 BTN_CANCEL = 2,
00060 BTN_YES = 4,
00061 BTN_NO = 8,
00062 BTN_RETRY = 16,
00063 BTN_REFRESH = 32,
00064 BTN_CONFIRM = 64,
00065 BTN_IGNORE = 128,
00066 BTN_HELP = 256
00067 };
00068
00076 virtual bool load_data(Fl_Data_Source *ds=0);
00077
00088 virtual bool save_data(Fl_Data_Source *ds=0);
00089
00098 const Fl_Variant& operator [] (const char *field_name) const;
00099
00108 Fl_Variant& operator [] (const char *field_name);
00109
00114 int show_modal();
00115
00122 void submit(int button_id);
00123
00132 void buttons(int buttons_mask, int default_button);
00133
00141 void enable_button(int button_id, bool enable=true);
00142
00146 void clear_buttons();
00147
00157 void user_button(int button_id, Fl_String label, Fl_Pixmap *pixmap=NULL);
00158
00165 Fl_Scroll *new_scroll(const char *label);
00166
00171 Fl_Group *new_page(const char *label) { return (Fl_Group*)new_scroll(label); }
00172
00179 Fl_Group *new_group(const char *label);
00180
00185 virtual int handle(int event);
00186
00187 protected:
00188
00192 Fl_Widget *find_widget(const char *field_name) const;
00193
00195 static void buttons_callback(Fl_Button *btn, long id);
00196
00197 Fl_Tabs *m_tabs;
00198
00199 private:
00200 typedef Fl_Window inherited;
00201
00202 static void escape_callback(Fl_Dialog *dialog, void *);
00203
00204 Fl_Widget *m_defaultButton;
00205 Fl_Group *m_buttonPanel;
00206 Fl_Widget_List m_buttonList;
00207 int m_buttons;
00208 int m_modalResult;
00209 bool m_alloc_ds;
00210 };
00211
00212
00213 #define FL_DLG_OK Fl_Dialog::BTN_OK
00214 #define FL_DLG_CANCEL Fl_Dialog::BTN_CANCEL
00215 #define FL_DLG_YES Fl_Dialog::BTN_YES
00216 #define FL_DLG_NO Fl_Dialog::BTN_NO
00217 #define FL_DLG_RETRY Fl_Dialog::BTN_RETRY
00218 #define FL_DLG_REFRESH Fl_Dialog::BTN_REFRESH
00219 #define FL_DLG_CONFIRM Fl_Dialog::BTN_CONFIRM
00220 #define FL_DLG_IGNORE Fl_Dialog::BTN_IGNORE
00221 #define FL_DLG_HELP Fl_Dialog::BTN_HELP
00222
00223 #endif