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
This commit is contained in:
parent
9f6d4ada32
commit
2abfda36ab
@ -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);
|
||||
|
@ -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 {
|
||||
|
@ -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$".
|
||||
//
|
||||
|
@ -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},
|
||||
|
Loading…
Reference in New Issue
Block a user