summaryrefslogtreecommitdiff
path: root/fluid
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2005-03-28 04:23:32 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2005-03-28 04:23:32 +0000
commit2abfda36ab9e32bbd8c93ab43eb006fe6778146a (patch)
tree1baae18ad973e0897fe6f56dd11b1a6da5fa9409 /fluid
parent9f6d4ada32cff2df7bde458ce130edd4379b9c50 (diff)
Preliminary support for widget classes (still need to do code writing
methods...) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4196 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid')
-rw-r--r--fluid/Fl_Function_Type.cxx4
-rw-r--r--fluid/Fl_Type.h14
-rw-r--r--fluid/Fl_Window_Type.cxx54
-rw-r--r--fluid/factory.cxx2
4 files changed, 73 insertions, 1 deletions
diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx
index 9b6b06b8c..f464378aa 100644
--- a/fluid/Fl_Function_Type.cxx
+++ b/fluid/Fl_Function_Type.cxx
@@ -750,7 +750,9 @@ void Fl_Comment_Type::open() {
// remove the last selected comment from the database
if (itempath[0]==0 || last_selected_item==0) {
fl_message("Please select an entry form this menu first.");
- } else if (fl_ask("Are you sure that you want to delete the entry\n\"%s\"\nfrom the database?", itempath)) {
+ } else if (fl_choice("Are you sure that you want to delete the entry\n"
+ "\"%s\"\nfrom the database?", "Cancel", "Delete",
+ NULL, itempath)) {
Fl_Preferences db(Fl_Preferences::USER, "fltk.org", "fluid_comments");
db.deleteEntry(itempath);
comment_predefined->remove(last_selected_item);
diff --git a/fluid/Fl_Type.h b/fluid/Fl_Type.h
index 107460094..ef9048da6 100644
--- a/fluid/Fl_Type.h
+++ b/fluid/Fl_Type.h
@@ -437,6 +437,8 @@ public:
extern Fl_Menu_Item window_type_menu[];
class Fl_Window_Type : public Fl_Widget_Type {
+protected:
+
Fl_Menu_Item* subtypes() {return window_type_menu;}
friend class Overlay_Window;
@@ -486,6 +488,18 @@ public:
int is_window() const {return 1;}
};
+class Fl_Widget_Class_Type : private Fl_Window_Type {
+public:
+ void write_code1();
+ void write_code2();
+ Fl_Type *make();
+ virtual const char *type_name() {return "widget_class";}
+ int is_parent() const {return 1;}
+ int is_decl_block() const {return 1;}
+ int is_class() const {return 1;}
+};
+
+
extern Fl_Menu_Item menu_item_type_menu[];
class Fl_Menu_Item_Type : public Fl_Widget_Type {
diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx
index dbd8a3a1c..7fe924488 100644
--- a/fluid/Fl_Window_Type.cxx
+++ b/fluid/Fl_Window_Type.cxx
@@ -1288,6 +1288,60 @@ int Fl_Window_Type::read_fdesign(const char* propname, const char* value) {
return 1;
}
+///////////////////////////////////////////////////////////////////////
+
+Fl_Widget_Class_Type Fl_Widget_Class_type;
+
+Fl_Type *Fl_Widget_Class_Type::make() {
+ Fl_Type *p = Fl_Type::current;
+ while (p && !p->is_decl_block()) p = p->parent;
+ Fl_Widget_Class_Type *myo = new Fl_Widget_Class_Type();
+ myo->name("UserInterface");
+
+ if (!this->o) {// template widget
+ this->o = new Fl_Window(100,100);
+ Fl_Group::current(0);
+ }
+ // Set the size ranges for this window; in order to avoid opening the
+ // X display we use an arbitrary maximum size...
+ ((Fl_Window *)(this->o))->size_range(gridx, gridy,
+ 3072, 2048,
+ gridx, gridy, 0);
+ myo->factory = this;
+ myo->drag = 0;
+ myo->numselected = 0;
+ Overlay_Window *w = new Overlay_Window(100,100);
+ w->window = myo;
+ myo->o = w;
+ myo->add(p);
+ myo->modal = 0;
+ myo->non_modal = 0;
+
+ return myo;
+}
+
+
+void Fl_Widget_Class_Type::write_code1() {
+ Fl_Widget_Type::write_code1();
+}
+
+void Fl_Widget_Class_Type::write_code2() {
+ write_extra_code();
+ if (modal) write_c("%so->set_modal();\n", indent());
+ else if (non_modal) write_c("%so->set_non_modal();\n", indent());
+ if (!((Fl_Window*)o)->border()) write_c("%so->clear_border();\n", indent());
+ if (xclass) {
+ write_c("%so->xclass(", indent());
+ write_cstring(xclass);
+ write_c(");\n");
+ }
+ write_c("%so->end();\n", indent());
+ if (((Fl_Window*)o)->resizable() == o)
+ write_c("%so->resizable(o);\n", indent());
+ write_block_close();
+}
+
+
//
// End of "$Id$".
//
diff --git a/fluid/factory.cxx b/fluid/factory.cxx
index 88bdaa7c3..e7a174557 100644
--- a/fluid/factory.cxx
+++ b/fluid/factory.cxx
@@ -869,6 +869,7 @@ extern class Fl_DeclBlock_Type Fl_DeclBlock_type;
extern class Fl_Comment_Type Fl_Comment_type;
extern class Fl_Class_Type Fl_Class_type;
extern class Fl_Window_Type Fl_Window_type;
+extern class Fl_Widget_Class_Type Fl_Widget_Class_type;
extern class Fl_Group_Type Fl_Group_type;
extern class Fl_Pack_Type Fl_Pack_type;
extern class Fl_Tabs_Type Fl_Tabs_type;
@@ -934,6 +935,7 @@ Fl_Menu_Item New_Menu[] = {
{"Declaration",0,cb,(void*)&Fl_Decl_type},
{"Declaration Block",0,cb,(void*)&Fl_DeclBlock_type},
{"Class",0,cb,(void*)&Fl_Class_type},
+ {"Widget Class",0,cb,(void*)&Fl_Widget_Class_type},
{"Comment",0,cb,(void*)&Fl_Comment_type},
{0},
{"Group",0,0,0,FL_SUBMENU},