FLUID: RTTI improvements, 'is_a90' now const, apply RTTI

This commit is contained in:
Matthias Melcher 2023-07-19 20:41:58 +02:00
parent 35728ac9ec
commit e8eccde8db
24 changed files with 261 additions and 257 deletions

View File

@ -2,6 +2,11 @@
version 1.0400
header_name {.h}
code_name {.cxx}
snap {
ver 1
current_suite FLTK
current_preset 0
}
comment {README FIRST
- - - - - - -
This fluid (.fl) file demonstrates how to create a complete

View File

@ -922,7 +922,7 @@ static bool in_group(Fd_Snap_Data &d) {
}
static bool in_tabs(Fd_Snap_Data &d) {
return (d.wgt && d.wgt->parent && d.wgt->parent->is_tabs());
return (d.wgt && d.wgt->parent && d.wgt->parent->is_a(Fl_Type::ID_Tabs));
}
static Fl_Group *parent(Fd_Snap_Data &d) {

View File

@ -85,7 +85,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Return_Button_Type(); }
ID id() const FL_OVERRIDE { return ID_Return_Button; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Return_Button) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Return_Button) ? true : super::is_a(inID); }
};
Fl_Return_Button_Type Fl_Return_Button_type;
@ -110,7 +110,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Repeat_Button_Type(); }
ID id() const FL_OVERRIDE { return ID_Repeat_Button; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Repeat_Button) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Repeat_Button) ? true : super::is_a(inID); }
};
Fl_Repeat_Button_Type Fl_Repeat_Button_type;
@ -137,7 +137,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Light_Button_Type(); }
ID id() const FL_OVERRIDE { return ID_Light_Button; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Light_Button) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Light_Button) ? true : super::is_a(inID); }
};
Fl_Light_Button_Type Fl_Light_Button_type;
@ -164,7 +164,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Check_Button_Type(); }
ID id() const FL_OVERRIDE { return ID_Check_Button; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Check_Button) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Check_Button) ? true : super::is_a(inID); }
};
Fl_Check_Button_Type Fl_Check_Button_type;
@ -191,7 +191,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Round_Button_Type(); }
ID id() const FL_OVERRIDE { return ID_Round_Button; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Round_Button) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Round_Button) ? true : super::is_a(inID); }
};
Fl_Round_Button_Type Fl_Round_Button_type;

View File

@ -34,7 +34,7 @@ public:
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Button_Type(); }
int is_button() const FL_OVERRIDE { return 1; }
ID id() const FL_OVERRIDE { return ID_Button; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Button) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Button) ? true : super::is_a(inID); }
};
extern Fl_Button_Type Fl_Button_type;

View File

@ -45,7 +45,7 @@ Fl_Class_Type *current_class = NULL;
int has_toplevel_function(const char *rtype, const char *sig) {
Fl_Type *child;
for (child = Fl_Type::first; child; child = child->next) {
if (!child->is_in_class() && (child->id() == Fl_Type::ID_Function)) {
if (!child->is_in_class() && child->is_a(Fl_Type::ID_Function)) {
const Fl_Function_Type *fn = (const Fl_Function_Type*)child;
if (fn->has_signature(rtype, sig))
return 1;
@ -525,7 +525,7 @@ void Fl_Function_Type::write_code2(Fd_Code_Writer& f) {
char havechildren = 0;
for (child = next; child && child->level > level; child = child->next) {
havechildren = 1;
if (child->is_window() && child->name()) var = child->name();
if (child->is_a(ID_Window) && child->name()) var = child->name();
}
if (ismain()) {
@ -1982,7 +1982,7 @@ void Fl_Class_Type::write_code2(Fd_Code_Writer& f) {
int Fl_Class_Type::has_function(const char *rtype, const char *sig) const {
Fl_Type *child;
for (child = next; child && child->level > level; child = child->next) {
if (child->level == level+1 && (child->id() == Fl_Type::ID_Function)) {
if (child->level == level+1 && child->is_a(Fl_Type::ID_Function)) {
const Fl_Function_Type *fn = (const Fl_Function_Type*)child;
if (fn->has_signature(rtype, sig))
return 1;

View File

@ -64,7 +64,7 @@ public:
int is_code_block() const FL_OVERRIDE {return 1;}
int is_public() const FL_OVERRIDE;
ID id() const FL_OVERRIDE { return ID_Function; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Function) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Function) ? true : super::is_a(inID); }
void write_properties(Fd_Project_Writer &f) FL_OVERRIDE;
void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE;
int has_signature(const char *, const char*) const;
@ -91,7 +91,7 @@ public:
int is_code_block() const FL_OVERRIDE {return 0;}
int is_code() const FL_OVERRIDE {return 1;}
ID id() const FL_OVERRIDE { return ID_Code; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Code) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Code) ? true : super::is_a(inID); }
int is_public() const FL_OVERRIDE { return -1; }
int is_editing();
int reap_editor();
@ -117,7 +117,7 @@ public:
int is_parent() const FL_OVERRIDE {return 1;}
int is_public() const FL_OVERRIDE { return -1; }
ID id() const FL_OVERRIDE { return ID_CodeBlock; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_CodeBlock) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_CodeBlock) ? true : super::is_a(inID); }
void write_properties(Fd_Project_Writer &f) FL_OVERRIDE;
void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE;
};
@ -143,7 +143,7 @@ public:
void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE;
int is_public() const FL_OVERRIDE;
ID id() const FL_OVERRIDE { return ID_Decl; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Decl) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Decl) ? true : super::is_a(inID); }
};
// ---- Fl_Data_Type declaration
@ -165,7 +165,7 @@ public:
void write_properties(Fd_Project_Writer &f) FL_OVERRIDE;
void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE;
ID id() const FL_OVERRIDE { return ID_Data; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Data) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Data) ? true : super::is_a(inID); }
};
// ---- Fl_DeclBlock_Type declaration
@ -190,7 +190,7 @@ public:
int is_decl_block() const FL_OVERRIDE {return 1;}
int is_public() const FL_OVERRIDE;
ID id() const FL_OVERRIDE { return ID_DeclBlock; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_DeclBlock) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_DeclBlock) ? true : super::is_a(inID); }
};
// ---- Fl_Comment_Type declaration
@ -212,9 +212,8 @@ public:
void write_properties(Fd_Project_Writer &f) FL_OVERRIDE;
void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE;
int is_public() const FL_OVERRIDE { return 1; }
int is_comment() const FL_OVERRIDE { return 1; }
ID id() const FL_OVERRIDE { return ID_Comment; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Comment) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Comment) ? true : super::is_a(inID); }
};
// ---- Fl_Class_Type declaration
@ -243,7 +242,7 @@ public:
int is_class() const FL_OVERRIDE {return 1;}
int is_public() const FL_OVERRIDE;
ID id() const FL_OVERRIDE { return ID_Class; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Class) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Class) ? true : super::is_a(inID); }
void write_properties(Fd_Project_Writer &f) FL_OVERRIDE;
void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE;

View File

@ -57,6 +57,9 @@ Fl_Type *Fl_Group_Type::make(Strategy strategy) {
return Fl_Widget_Type::make(strategy);
}
/**
\brief Enlarge the group size, so all children fit within.
*/
void fix_group_size(Fl_Type *tt) {
if (!tt || !tt->is_group()) return;
Fl_Group_Type* t = (Fl_Group_Type*)tt;
@ -65,12 +68,13 @@ void fix_group_size(Fl_Type *tt) {
int R = X+t->o->w();
int B = Y+t->o->h();
for (Fl_Type *nn = t->next; nn && nn->level > t->level; nn = nn->next) {
if (!nn->is_widget() || nn->is_menu_item()) continue;
Fl_Widget_Type* n = (Fl_Widget_Type*)nn;
int x = n->o->x(); if (x < X) X = x;
int y = n->o->y(); if (y < Y) Y = y;
int r = x+n->o->w();if (r > R) R = r;
int b = y+n->o->h();if (b > B) B = b;
if (nn->is_true_widget()) {
Fl_Widget_Type* n = (Fl_Widget_Type*)nn;
int x = n->o->x(); if (x < X) X = x;
int y = n->o->y(); if (y < Y) Y = y;
int r = x+n->o->w();if (r > R) R = r;
int b = y+n->o->h();if (b > B) B = b;
}
}
t->o->resize(X,Y,R-X,B-Y);
}
@ -78,8 +82,8 @@ void fix_group_size(Fl_Type *tt) {
void group_cb(Fl_Widget *, void *) {
// Find the current widget:
Fl_Type *qq = Fl_Type::current;
while (qq && (!qq->is_widget() || qq->is_menu_item())) qq = qq->parent;
if (!qq || qq->level < 1 || (qq->level == 1 && (qq->id() == Fl_Type::ID_Widget_Class))) {
while (qq && !qq->is_true_widget()) qq = qq->parent;
if (!qq || qq->level < 1 || (qq->level == 1 && qq->is_a(Fl_Type::ID_Widget_Class))) {
fl_message("Please select widgets to group");
return;
}
@ -106,9 +110,9 @@ void group_cb(Fl_Widget *, void *) {
void ungroup_cb(Fl_Widget *, void *) {
// Find the group:
Fl_Type *q = Fl_Type::current;
while (q && (!q->is_widget() || q->is_menu_item())) q = q->parent;
while (q && !q->is_true_widget()) q = q->parent;
if (q) q = q->parent;
if (!q || q->level < 1 || (q->level == 1 && (q->id() == Fl_Type::ID_Widget_Class))) {
if (!q || q->level < 1 || (q->level == 1 && q->is_a(Fl_Type::ID_Widget_Class))) {
fl_message("Please select widgets in a group");
return;
}
@ -399,13 +403,13 @@ void Fl_Flex_Type::change_subtype_to(int n) {
int Fl_Flex_Type::parent_is_flex(Fl_Type *t) {
return (t->is_widget()
&& t->parent
&& t->parent->is_flex());
&& t->parent->is_a(ID_Flex));
}
int Fl_Flex_Type::size(Fl_Type *t, char fixed_only) {
if (!t->is_widget()) return 0;
if (!t->parent) return 0;
if (!t->parent->is_flex()) return 0;
if (!t->parent->is_a(ID_Flex)) return 0;
Fl_Flex_Type* ft = (Fl_Flex_Type*)t->parent;
Fl_Flex* f = (Fl_Flex*)ft->o;
Fl_Widget *w = ((Fl_Widget_Type*)t)->o;
@ -416,7 +420,7 @@ int Fl_Flex_Type::size(Fl_Type *t, char fixed_only) {
int Fl_Flex_Type::is_fixed(Fl_Type *t) {
if (!t->is_widget()) return 0;
if (!t->parent) return 0;
if (!t->parent->is_flex()) return 0;
if (!t->parent->is_a(ID_Flex)) return 0;
Fl_Flex_Type* ft = (Fl_Flex_Type*)t->parent;
Fl_Flex* f = (Fl_Flex*)ft->o;
Fl_Widget *w = ((Fl_Widget_Type*)t)->o;

View File

@ -54,7 +54,7 @@ public:
int is_parent() const FL_OVERRIDE {return 1;}
int is_group() const FL_OVERRIDE {return 1;}
ID id() const FL_OVERRIDE { return ID_Group; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Group) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Group) ? true : super::is_a(inID); }
Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE;
void leave_live_mode() FL_OVERRIDE;
void copy_properties() FL_OVERRIDE;
@ -74,7 +74,7 @@ public:
const char *alt_type_name() FL_OVERRIDE {return "fltk::PackedGroup";}
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Pack_Type();}
ID id() const FL_OVERRIDE { return ID_Pack; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Pack) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Pack) ? true : super::is_a(inID); }
Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE;
void copy_properties() FL_OVERRIDE;
};
@ -99,7 +99,7 @@ public:
Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE {
Fl_Flex *g = new Fl_Flex(X,Y,W,H); Fl_Group::current(0); return g;}
ID id() const FL_OVERRIDE { return ID_Flex; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Flex) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Flex) ? true : super::is_a(inID); }
void write_properties(Fd_Project_Writer &f) FL_OVERRIDE;
void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE;
Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE;
@ -109,7 +109,6 @@ public:
void add_child(Fl_Type*, Fl_Type*) FL_OVERRIDE;
void move_child(Fl_Type*, Fl_Type*) FL_OVERRIDE;
void remove_child(Fl_Type*) FL_OVERRIDE;
int is_flex() const FL_OVERRIDE {return 1;}
void change_subtype_to(int n);
static int parent_is_flex(Fl_Type*);
static int size(Fl_Type*, char fixed_only=0);
@ -128,7 +127,7 @@ public:
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Table_Type(); }
Fl_Widget *widget(int X, int Y, int W, int H) FL_OVERRIDE;
ID id() const FL_OVERRIDE { return ID_Table; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Table) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Table) ? true : super::is_a(inID); }
Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE;
void add_child(Fl_Type*, Fl_Type*) FL_OVERRIDE;
void move_child(Fl_Type*, Fl_Type*) FL_OVERRIDE;
@ -159,9 +158,8 @@ public:
void add_child(Fl_Type*, Fl_Type*) FL_OVERRIDE;
void remove_child(Fl_Type*) FL_OVERRIDE;
ID id() const FL_OVERRIDE { return ID_Tabs; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Tabs) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Tabs) ? true : super::is_a(inID); }
Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE;
int is_tabs() const FL_OVERRIDE {return 1;}
};
// ---- Fl_Scroll_Type ------------------------------------------------- MARK: -
@ -178,10 +176,9 @@ public:
const char *alt_type_name() FL_OVERRIDE {return "fltk::ScrollGroup";}
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Scroll_Type();}
ID id() const FL_OVERRIDE { return ID_Scroll; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Scroll) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Scroll) ? true : super::is_a(inID); }
Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE;
void copy_properties() FL_OVERRIDE;
int is_scroll() const FL_OVERRIDE { return 1; }
};
// ---- Fl_Tile_Type --------------------------------------------------- MARK: -
@ -196,7 +193,7 @@ public:
const char *alt_type_name() FL_OVERRIDE {return "fltk::TileGroup";}
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Tile_Type();}
ID id() const FL_OVERRIDE { return ID_Tile; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Tile) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Tile) ? true : super::is_a(inID); }
void copy_properties() FL_OVERRIDE;
};
@ -221,7 +218,7 @@ public:
iwizard *g = new iwizard(X,Y,W,H); Fl_Group::current(0); return g;}
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Wizard_Type();}
ID id() const FL_OVERRIDE { return ID_Wizard; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Wizard) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Wizard) ? true : super::is_a(inID); }
};
#endif // _FLUID_FL_GROUP_TYPE_H

View File

@ -137,7 +137,7 @@ void Fl_Input_Choice_Type::build_menu() {
if (q->is_parent()) {lvl++; m->flags |= FL_SUBMENU;}
m++;
int l1 =
(q->next && q->next->is_menu_item()) ? q->next->level : level;
(q->next && q->next->is_a(ID_Menu_Item)) ? q->next->level : level;
while (lvl > l1) {m->label(0); m++; lvl--;}
lvl = l1;
}
@ -155,10 +155,10 @@ Fl_Type *Fl_Menu_Item_Type::make(Strategy strategy) {
Fl_Type* q = Fl_Type::current;
Fl_Type* p = q;
if (p) {
if ( (force_parent && q->is_menu_item()) || !q->is_parent()) p = p->parent;
if ( (force_parent && q->is_a(ID_Menu_Item)) || !q->is_parent()) p = p->parent;
}
force_parent = 0;
if (!p || !(p->is_a(ID_Menu_Manager_) || (p->is_menu_item() && p->is_parent()))) {
if (!p || !(p->is_a(ID_Menu_Manager_) || p->is_a(ID_Submenu))) {
fl_message("Please select a menu to add to");
return 0;
}
@ -230,7 +230,7 @@ int isdeclare(const char *c);
const char* Fl_Menu_Item_Type::menu_name(Fd_Code_Writer& f, int& i) {
i = 0;
Fl_Type* t = prev;
while (t && t->is_menu_item()) {
while (t && t->is_a(ID_Menu_Item)) {
// be sure to count the {0} that ends a submenu:
if (t->level > t->next->level) i += (t->level - t->next->level);
// detect empty submenu:
@ -290,14 +290,14 @@ void Fl_Menu_Item_Type::write_static(Fd_Code_Writer& f) {
if (k) {
f.write_c("void %s::%s(Fl_Menu_* o, %s v) {\n", k, cn, ut);
f.write_c("%s((%s*)(o", f.indent(1), k);
Fl_Type* t = parent; while (t->is_menu_item()) t = t->parent;
Fl_Type* t = parent; while (t->is_a(ID_Menu_Item)) t = t->parent;
Fl_Type *q = 0;
// Go up one more level for Fl_Input_Choice, as these are groups themselves
if (t && (t->id() == Fl_Type::ID_Input_Choice))
if (t && t->is_a(Fl_Type::ID_Input_Choice))
f.write_c("->parent()");
for (t = t->parent; t && t->is_widget() && !is_class(); q = t, t = t->parent)
f.write_c("->parent()");
if (!q || (q->id() != Fl_Type::ID_Widget_Class))
if (!q || !q->is_a(Fl_Type::ID_Widget_Class))
f.write_c("->user_data()");
f.write_c("))->%s_i(o,v);\n}\n", cn);
}
@ -306,7 +306,7 @@ void Fl_Menu_Item_Type::write_static(Fd_Code_Writer& f) {
if (!f.c_contains(image))
image->write_static(f, compress_image_);
}
if (next && next->is_menu_item()) return;
if (next && next->is_a(ID_Menu_Item)) return;
// okay, when we hit last item in the menu we have to write the
// entire array out:
const char* k = class_name(1);
@ -317,20 +317,20 @@ void Fl_Menu_Item_Type::write_static(Fd_Code_Writer& f) {
int i;
f.write_c("\nFl_Menu_Item %s[] = {\n", menu_name(f, i));
}
Fl_Type* t = prev; while (t && t->is_menu_item()) t = t->prev;
for (Fl_Type* q = t->next; q && q->is_menu_item(); q = q->next) {
Fl_Type* t = prev; while (t && t->is_a(ID_Menu_Item)) t = t->prev;
for (Fl_Type* q = t->next; q && q->is_a(ID_Menu_Item); q = q->next) {
((Fl_Menu_Item_Type*)q)->write_item(f);
int thislevel = q->level; if (q->is_parent()) thislevel++;
int nextlevel =
(q->next && q->next->is_menu_item()) ? q->next->level : t->level+1;
(q->next && q->next->is_a(ID_Menu_Item)) ? q->next->level : t->level+1;
while (thislevel > nextlevel) {f.write_c(" {0,0,0,0,0,0,0,0,0},\n"); thislevel--;}
}
f.write_c(" {0,0,0,0,0,0,0,0,0}\n};\n");
if (k) {
// Write menu item variables...
t = prev; while (t && t->is_menu_item()) t = t->prev;
for (Fl_Type* q = t->next; q && q->is_menu_item(); q = q->next) {
t = prev; while (t && t->is_a(ID_Menu_Item)) t = t->prev;
for (Fl_Type* q = t->next; q && q->is_a(ID_Menu_Item); q = q->next) {
Fl_Menu_Item_Type *m = (Fl_Menu_Item_Type*)q;
const char *c = array_name(m);
if (c) {
@ -433,7 +433,7 @@ void start_menu_initialiser(Fd_Code_Writer& f, int &initialized, const char *nam
void Fl_Menu_Item_Type::write_code1(Fd_Code_Writer& f) {
int i; const char* mname = menu_name(f, i);
if (!prev->is_menu_item()) {
if (!prev->is_a(ID_Menu_Item)) {
// for first menu item, declare the array
if (class_name(1)) {
f.write_h("%sstatic Fl_Menu_Item %s[];\n", f.indent(1), mname);
@ -588,7 +588,7 @@ void Fl_Menu_Base_Type::build_menu() {
if (q->is_parent()) {lvl++; m->flags |= FL_SUBMENU;}
m++;
int l1 =
(q->next && q->next->is_menu_item()) ? q->next->level : level;
(q->next && q->next->is_a(ID_Menu_Item)) ? q->next->level : level;
while (lvl > l1) {m->label(0); m++; lvl--;}
lvl = l1;
}
@ -616,7 +616,7 @@ Fl_Type* Fl_Menu_Base_Type::click_test(int, int) {
}
void Fl_Menu_Manager_Type::write_code2(Fd_Code_Writer& f) {
if (next && next->is_menu_item()) {
if (next && next->is_a(ID_Menu_Item)) {
f.write_c("%s%s->menu(%s);\n", f.indent(), name() ? name() : "o",
f.unique_id(this, "menu", name(), label()));
}
@ -718,7 +718,7 @@ void shortcut_in_cb(Fl_Shortcut_Button* i, void* v) {
Fl_Button* b = (Fl_Button*)(((Fl_Widget_Type*)o)->o);
if (b->shortcut() != (int)i->value()) mod = 1;
b->shortcut(i->value());
if (o->is_menu_item()) ((Fl_Widget_Type*)o)->redraw();
if (o->is_a(Fl_Type::ID_Menu_Item)) ((Fl_Widget_Type*)o)->redraw();
} else if (o->selected && o->is_a(Fl_Type::ID_Input)) {
Fl_Input_* b = (Fl_Input_*)(((Fl_Widget_Type*)o)->o);
if (b->shortcut() != (int)i->value()) mod = 1;

View File

@ -48,7 +48,6 @@ public:
const char* type_name() FL_OVERRIDE {return "MenuItem";}
const char* alt_type_name() FL_OVERRIDE {return "fltk::Item";}
Fl_Type* make(Strategy strategy) FL_OVERRIDE;
int is_menu_item() const FL_OVERRIDE {return 1;}
int is_button() const FL_OVERRIDE {return 1;} // this gets shortcut to work
Fl_Widget* widget(int,int,int,int) FL_OVERRIDE {return 0;}
Fl_Widget_Type* _make() FL_OVERRIDE {return 0;}
@ -58,8 +57,9 @@ public:
void write_item(Fd_Code_Writer& f);
void write_code1(Fd_Code_Writer& f) FL_OVERRIDE;
void write_code2(Fd_Code_Writer& f) FL_OVERRIDE;
int is_true_widget() const FL_OVERRIDE { return 0; }
ID id() const FL_OVERRIDE { return ID_Menu_Item; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Menu_Item) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Menu_Item) ? true : super::is_a(inID); }
};
/**
@ -72,7 +72,7 @@ public:
const char* type_name() FL_OVERRIDE {return "RadioMenuItem";}
Fl_Type* make(Strategy strategy) FL_OVERRIDE;
ID id() const FL_OVERRIDE { return ID_Radio_Menu_Item; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Radio_Menu_Item) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Radio_Menu_Item) ? true : super::is_a(inID); }
};
/**
@ -85,7 +85,7 @@ public:
const char* type_name() FL_OVERRIDE {return "CheckMenuItem";}
Fl_Type* make(Strategy strategy) FL_OVERRIDE;
ID id() const FL_OVERRIDE { return ID_Checkbox_Menu_Item; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Checkbox_Menu_Item) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Checkbox_Menu_Item) ? true : super::is_a(inID); }
};
/**
@ -111,7 +111,7 @@ public:
void move_child(Fl_Type*a, Fl_Type*b) FL_OVERRIDE {parent->move_child(a,b);}
void remove_child(Fl_Type*a) FL_OVERRIDE {parent->remove_child(a);}
ID id() const FL_OVERRIDE { return ID_Submenu; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Submenu) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Submenu) ? true : super::is_a(inID); }
};
// -----------------------------------------------------------------------------
@ -136,7 +136,7 @@ public:
void write_code2(Fd_Code_Writer& f) FL_OVERRIDE;
void copy_properties() FL_OVERRIDE = 0;
ID id() const FL_OVERRIDE { return ID_Menu_Manager_; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Menu_Manager_) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Menu_Manager_) ? true : super::is_a(inID); }
};
/**
@ -185,7 +185,7 @@ public:
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Input_Choice_Type();}
void build_menu() FL_OVERRIDE;
ID id() const FL_OVERRIDE { return ID_Input_Choice; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Input_Choice) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Input_Choice) ? true : super::is_a(inID); }
void copy_properties() FL_OVERRIDE;
};
@ -215,7 +215,7 @@ public:
Fl_Type* click_test(int x, int y) FL_OVERRIDE;
void copy_properties() FL_OVERRIDE;
ID id() const FL_OVERRIDE { return ID_Menu_; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Menu_) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Menu_) ? true : super::is_a(inID); }
};
extern Fl_Menu_Item button_type_menu[];
@ -241,7 +241,7 @@ public:
return new Fl_Menu_Button(X,Y,W,H,"menu");}
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Menu_Button_Type();}
ID id() const FL_OVERRIDE { return ID_Menu_Button; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Menu_Button) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Menu_Button) ? true : super::is_a(inID); }
};
@ -272,7 +272,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Choice_Type();}
ID id() const FL_OVERRIDE { return ID_Choice; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Choice) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Choice) ? true : super::is_a(inID); }
};
@ -293,7 +293,7 @@ public:
Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE {return new Fl_Menu_Bar(X,Y,W,H);}
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Menu_Bar_Type();}
ID id() const FL_OVERRIDE { return ID_Menu_Bar; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Menu_Bar) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Menu_Bar) ? true : super::is_a(inID); }
};

View File

@ -409,7 +409,7 @@ Fl_Window_Type *Fl_Type::window() {
if (!is_widget())
return NULL;
for (Fl_Type *t = this; t; t=t->parent)
if (t->is_window())
if (t->is_a(ID_Window))
return (Fl_Window_Type*)t;
return NULL;
}
@ -584,7 +584,7 @@ Fl_Type *Fl_Type::remove() {
}
void Fl_Type::name(const char *n) {
int nostrip = is_comment();
int nostrip = is_a(Fl_Type::ID_Comment);
if (storestring(n,name_,nostrip)) {
if (visible) widget_browser->redraw();
}
@ -842,7 +842,7 @@ void Fl_Type::copy_properties() {
*/
int Fl_Type::user_defined(const char* cbname) const {
for (Fl_Type* p = Fl_Type::first; p ; p = p->next)
if ((p->id() == Fl_Type::ID_Function) && p->name() != 0)
if (p->is_a(Fl_Type::ID_Function) && p->name() != 0)
if (strncmp(p->name(), cbname, strlen(cbname)) == 0)
if (p->name()[strlen(cbname)] == '(')
return 1;

View File

@ -182,25 +182,23 @@ public:
int msgnum();
// fake rtti:
/** Return 1 if the Type chn have children. */
virtual int is_parent() const {return 0;}
/** Return 1 if the type is a widget or menu item. */
virtual int is_widget() const {return 0;}
/// TODO: Misnamed: This is true if the widget is a button or a menu item with button functionality
/** Return 1 if the type is a widget but not a menu item. */
virtual int is_true_widget() const {return 0;}
/** Return 1 if a type behaves like a button (Fl_Button and Fl_Menu_Item and derived. */
virtual int is_button() const {return 0;}
virtual int is_menu_item() const {return 0;}
virtual int is_group() const {return 0;}
virtual int is_tabs() const {return 0;}
virtual int is_scroll() const {return 0;}
virtual int is_flex() const {return 0;}
virtual int is_window() const {return 0;}
virtual int is_code() const {return 0;}
virtual int is_code_block() const {return 0;}
virtual int is_decl_block() const {return 0;}
virtual int is_comment() const {return 0;}
virtual int is_class() const {return 0;}
virtual int is_public() const {return 1;}
virtual ID id() const { return ID_Base_; }
virtual bool is_a(ID inID) { return (inID==ID_Base_); }
virtual bool is_a(ID inID) const { return (inID==ID_Base_); }
const char* class_name(const int need_nest) const;
const class Fl_Class_Type* is_in_class() const;

View File

@ -88,7 +88,7 @@ Fl_Widget_Type::ideal_size(int &w, int &h) {
Fl_Type *Fl_Widget_Type::make(Strategy strategy) {
// Find the current widget, or widget to copy:
Fl_Type *qq = Fl_Type::current;
while (qq && (!qq->is_widget() || qq->is_menu_item())) qq = qq->parent;
while (qq && !qq->is_true_widget()) qq = qq->parent;
if (!qq) {
fl_message("Please select a widget");
return 0;
@ -104,7 +104,7 @@ Fl_Type *Fl_Widget_Type::make(Strategy strategy) {
int B = p->o->w()/2; if (p->o->h()/2 < B) B = p->o->h()/2; if (B>25) B = 25;
int ULX,ULY; // parent's origin in window
if (!p->is_window()) { // if it is a group, add corner
if (!p->is_a(ID_Window)) { // if it is a group, add corner
ULX = p->o->x(); ULY = p->o->y();
} else {
ULX = ULY = 0;
@ -151,7 +151,7 @@ Fl_Type *Fl_Widget_Type::make(Strategy strategy) {
}
void Fl_Widget_Type::setimage(Fluid_Image *i) {
if (i == image || is_window()) return;
if (i == image || is_a(ID_Window)) return;
if (image) image->decrement();
if (i) i->increment();
image = i;
@ -161,7 +161,7 @@ void Fl_Widget_Type::setimage(Fluid_Image *i) {
}
void Fl_Widget_Type::setinactive(Fluid_Image *i) {
if (i == inactive || is_window()) return;
if (i == inactive || is_a(ID_Window)) return;
if (inactive) inactive->decrement();
if (i) i->increment();
inactive = i;
@ -243,9 +243,9 @@ void Fl_Widget_Type::inactive_name(const char *n) {
void Fl_Widget_Type::redraw() {
Fl_Type *t = this;
if (is_menu_item()) {
if (is_a(ID_Menu_Item)) {
// find the menu button that parents this menu:
do t = t->parent; while (t && t->is_menu_item());
do t = t->parent; while (t && t->is_a(ID_Menu_Item));
// kludge to cause build_menu to be called again:
if (t)
t->add_child(0, 0);
@ -261,7 +261,7 @@ Fl_Type *sort(Fl_Type *parent) {
for (f = parent ? parent->next : Fl_Type::first; ; f = n) {
if (!f || (parent && f->level <= parent->level)) return f;
n = sort(f);
if (!f->selected || (!f->is_widget() || f->is_menu_item())) continue;
if (!f->selected || !f->is_true_widget()) continue;
Fl_Widget* fw = ((Fl_Widget_Type*)f)->o;
Fl_Type *g; // we will insert before this
for (g = parent ? parent->next : Fl_Type::first; g != f; g = g->next) {
@ -420,7 +420,7 @@ static Fl_Input *image_input;
void image_cb(Fl_Input* i, void *v) {
if (v == LOAD) {
image_input = i;
if (current_widget->is_widget() && !current_widget->is_window()) {
if (current_widget->is_widget() && !current_widget->is_a(Fl_Type::ID_Window)) {
i->activate();
i->value(((Fl_Widget_Type*)current_widget)->image_name());
} else i->deactivate();
@ -438,7 +438,7 @@ void image_cb(Fl_Input* i, void *v) {
void image_browse_cb(Fl_Button* b, void *v) {
if (v == LOAD) {
if (current_widget->is_widget() && !current_widget->is_window())
if (current_widget->is_widget() && !current_widget->is_a(Fl_Type::ID_Window))
b->activate();
else
b->deactivate();
@ -459,7 +459,7 @@ void image_browse_cb(Fl_Button* b, void *v) {
void bind_image_cb(Fl_Button* b, void *v) {
if (v == LOAD) {
if (current_widget->is_widget() && !current_widget->is_window()) {
if (current_widget->is_widget() && !current_widget->is_a(Fl_Type::ID_Window)) {
b->activate();
b->value(current_widget->bind_image_);
} else {
@ -479,7 +479,7 @@ void bind_image_cb(Fl_Button* b, void *v) {
void compress_image_cb(Fl_Button* b, void *v) {
if (v == LOAD) {
if (current_widget->is_widget() && !current_widget->is_window()) {
if (current_widget->is_widget() && !current_widget->is_a(Fl_Type::ID_Window)) {
b->activate();
b->value(current_widget->compress_image_);
} else {
@ -502,7 +502,7 @@ static Fl_Input *inactive_input;
void inactive_cb(Fl_Input* i, void *v) {
if (v == LOAD) {
inactive_input = i;
if (current_widget->is_widget() && !current_widget->is_window()) {
if (current_widget->is_widget() && !current_widget->is_a(Fl_Type::ID_Window)) {
i->activate();
i->value(((Fl_Widget_Type*)current_widget)->inactive_name());
} else i->deactivate();
@ -520,7 +520,7 @@ void inactive_cb(Fl_Input* i, void *v) {
void inactive_browse_cb(Fl_Button* b, void *v) {
if (v == LOAD) {
if (current_widget->is_widget() && !current_widget->is_window())
if (current_widget->is_widget() && !current_widget->is_a(Fl_Type::ID_Window))
b->activate();
else
b->deactivate();
@ -541,7 +541,7 @@ void inactive_browse_cb(Fl_Button* b, void *v) {
void bind_deimage_cb(Fl_Button* b, void *v) {
if (v == LOAD) {
if (current_widget->is_widget() && !current_widget->is_window()) {
if (current_widget->is_widget() && !current_widget->is_a(Fl_Type::ID_Window)) {
b->activate();
b->value(current_widget->bind_deimage_);
} else {
@ -561,7 +561,7 @@ void bind_deimage_cb(Fl_Button* b, void *v) {
void compress_deimage_cb(Fl_Button* b, void *v) {
if (v == LOAD) {
if (current_widget->is_widget() && !current_widget->is_window()) {
if (current_widget->is_widget() && !current_widget->is_a(Fl_Type::ID_Window)) {
b->activate();
b->value(current_widget->compress_deimage_);
} else {
@ -757,7 +757,7 @@ Fluid_Coord_Input_Vars widget_vars[] = {
void x_cb(Fluid_Coord_Input *i, void *v) {
if (v == LOAD) {
x_input = i;
if (current_widget->is_widget()) {
if (current_widget->is_true_widget()) {
i->value(((Fl_Widget_Type *)current_widget)->o->x());
x_input->activate();
} else x_input->deactivate();
@ -767,7 +767,7 @@ void x_cb(Fluid_Coord_Input *i, void *v) {
int mod = 0;
int v = 0;
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected && o->is_widget()) {
if (o->selected && o->is_true_widget()) {
Fl_Widget *w = ((Fl_Widget_Type *)o)->o;
i->variables(widget_vars, o);
v = i->value();
@ -788,7 +788,7 @@ void x_cb(Fluid_Coord_Input *i, void *v) {
void y_cb(Fluid_Coord_Input *i, void *v) {
if (v == LOAD) {
y_input = i;
if (current_widget->is_widget()) {
if (current_widget->is_true_widget()) {
i->value(((Fl_Widget_Type *)current_widget)->o->y());
y_input->activate();
} else y_input->deactivate();
@ -798,7 +798,7 @@ void y_cb(Fluid_Coord_Input *i, void *v) {
int mod = 0;
int v = 0;
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected && o->is_widget()) {
if (o->selected && o->is_true_widget()) {
Fl_Widget *w = ((Fl_Widget_Type *)o)->o;
i->variables(widget_vars, o);
v = i->value();
@ -818,7 +818,7 @@ void y_cb(Fluid_Coord_Input *i, void *v) {
void w_cb(Fluid_Coord_Input *i, void *v) {
if (v == LOAD) {
w_input = i;
if (current_widget->is_widget()) {
if (current_widget->is_true_widget()) {
i->value(((Fl_Widget_Type *)current_widget)->o->w());
w_input->activate();
} else w_input->deactivate();
@ -828,7 +828,7 @@ void w_cb(Fluid_Coord_Input *i, void *v) {
int mod = 0;
int v = 0;
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected && o->is_widget()) {
if (o->selected && o->is_true_widget()) {
Fl_Widget *w = ((Fl_Widget_Type *)o)->o;
i->variables(widget_vars, o);
v = i->value();
@ -848,7 +848,7 @@ void w_cb(Fluid_Coord_Input *i, void *v) {
void h_cb(Fluid_Coord_Input *i, void *v) {
if (v == LOAD) {
h_input = i;
if (current_widget->is_widget()) {
if (current_widget->is_true_widget()) {
i->value(((Fl_Widget_Type *)current_widget)->o->h());
h_input->activate();
} else h_input->deactivate();
@ -858,7 +858,7 @@ void h_cb(Fluid_Coord_Input *i, void *v) {
int mod = 0;
int v = 0;
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected && o->is_widget()) {
if (o->selected && o->is_true_widget()) {
Fl_Widget *w = ((Fl_Widget_Type *)o)->o;
i->variables(widget_vars, o);
v = i->value();
@ -877,7 +877,7 @@ void h_cb(Fluid_Coord_Input *i, void *v) {
void wc_relative_cb(Fl_Choice *i, void *v) {
if (v == LOAD) {
if (current_widget->id() == Fl_Type::ID_Widget_Class) {
if (current_widget->is_a(Fl_Type::ID_Widget_Class)) {
i->show();
i->value(((Fl_Widget_Class_Type *)current_widget)->wc_relative);
} else {
@ -887,7 +887,7 @@ void wc_relative_cb(Fl_Choice *i, void *v) {
int mod = 0;
undo_checkpoint();
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected && (current_widget->id() == Fl_Type::ID_Widget_Class)) {
if (o->selected && current_widget->is_a(Fl_Type::ID_Widget_Class)) {
Fl_Widget_Class_Type *t = (Fl_Widget_Class_Type *)o;
t->wc_relative = i->value();
mod = 1;
@ -1021,7 +1021,7 @@ int boxnumber(const char *i) {
void box_cb(Fl_Choice* i, void *v) {
if (v == LOAD) {
if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate();
if (current_widget->is_a(Fl_Type::ID_Menu_Item)) {i->deactivate(); return;} else i->activate();
int n = current_widget->o->box(); if (!n) n = ZERO_ENTRY;
for (int j = 0; j < int(sizeof(boxmenu)/sizeof(*boxmenu)); j++)
if (boxmenu[j].argument() == n) {i->value(j); break;}
@ -1048,7 +1048,7 @@ void down_box_cb(Fl_Choice* i, void *v) {
int n;
if (current_widget->is_a(Fl_Type::ID_Button))
n = ((Fl_Button*)(current_widget->o))->down_box();
else if (current_widget->id() == Fl_Type::ID_Input_Choice)
else if (current_widget->is_a(Fl_Type::ID_Input_Choice))
n = ((Fl_Input_Choice*)(current_widget->o))->down_box();
else if (current_widget->is_a(Fl_Type::ID_Menu_Manager_))
n = ((Fl_Menu_*)(current_widget->o))->down_box();
@ -1071,7 +1071,7 @@ void down_box_cb(Fl_Choice* i, void *v) {
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
((Fl_Button*)(q->o))->down_box((Fl_Boxtype)n);
if (((Fl_Button*)(q->o))->value()) q->redraw();
} else if (o->id() == Fl_Type::ID_Input_Choice) {
} else if (o->is_a(Fl_Type::ID_Input_Choice)) {
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
((Fl_Input_Choice*)(q->o))->down_box((Fl_Boxtype)n);
} else if (o->is_a(Fl_Type::ID_Menu_Manager_)) {
@ -1146,7 +1146,7 @@ void set_whenmenu(int n) {
void when_cb(Fl_Menu_Button* i, void *v) {
if (v == LOAD) {
if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate();
if (current_widget->is_a(Fl_Type::ID_Menu_Item)) {i->deactivate(); return;} else i->activate();
int n = current_widget->o->when();
set_whenmenu(n);
w_when_box->copy_label(when_symbol_name(n));
@ -1175,26 +1175,8 @@ void when_cb(Fl_Menu_Button* i, void *v) {
}
}
void when_button_cb(Fl_Box* i, void *v) {
// if (v == LOAD) {
// if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate();
// i->value(current_widget->o->when()&FL_WHEN_NOT_CHANGED);
// } else {
// int mod = 0;
// int n = i->value() ? FL_WHEN_NOT_CHANGED : 0;
// for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
// if (o->selected && o->is_widget()) {
// Fl_Widget_Type* q = (Fl_Widget_Type*)o;
// q->o->when(n|(q->o->when()&~FL_WHEN_NOT_CHANGED));
// mod = 1;
// }
// }
// if (mod) set_modflag(1);
// }
}
uchar Fl_Widget_Type::resizable() const {
if (is_window()) return ((Fl_Window*)o)->resizable() != 0;
if (is_a(ID_Window)) return ((Fl_Window*)o)->resizable() != 0;
Fl_Group* p = (Fl_Group*)o->parent();
if (p) return p->resizable() == o;
else return 0;
@ -1203,14 +1185,14 @@ uchar Fl_Widget_Type::resizable() const {
void Fl_Widget_Type::resizable(uchar v) {
if (v) {
if (resizable()) return;
if (is_window()) ((Fl_Window*)o)->resizable(o);
if (is_a(ID_Window)) ((Fl_Window*)o)->resizable(o);
else {
Fl_Group* p = (Fl_Group*)o->parent();
if (p) p->resizable(o);
}
} else {
if (!resizable()) return;
if (is_window()) {
if (is_a(ID_Window)) {
((Fl_Window*)o)->resizable(0);
} else {
Fl_Group* p = (Fl_Group*)o->parent();
@ -1221,7 +1203,7 @@ void Fl_Widget_Type::resizable(uchar v) {
void resizable_cb(Fl_Light_Button* i,void* v) {
if (v == LOAD) {
if (current_widget->is_menu_item()) {i->deactivate(); return;}
if (current_widget->is_a(Fl_Type::ID_Menu_Item)) {i->deactivate(); return;}
if (numselected > 1) {i->deactivate(); return;}
i->activate();
i->value(current_widget->resizable());
@ -1235,21 +1217,21 @@ void resizable_cb(Fl_Light_Button* i,void* v) {
void hotspot_cb(Fl_Light_Button* i,void* v) {
if (v == LOAD) {
if (numselected > 1) {i->deactivate(); return;}
if (current_widget->is_menu_item()) i->label("divider");
if (current_widget->is_a(Fl_Type::ID_Menu_Item)) i->label("divider");
else i->label("hotspot");
i->activate();
i->value(current_widget->hotspot());
} else {
undo_checkpoint();
current_widget->hotspot(i->value());
if (current_widget->is_menu_item()) {
if (current_widget->is_a(Fl_Type::ID_Menu_Item)) {
current_widget->redraw();
return;
}
if (i->value()) {
Fl_Type *p = current_widget->parent;
if (!p || !p->is_widget()) return;
while (!p->is_window()) p = p->parent;
while (!p->is_a(Fl_Type::ID_Window)) p = p->parent;
for (Fl_Type *o = p->next; o && o->level > p->level; o = o->next) {
if (o->is_widget() && o != current_widget)
((Fl_Widget_Type*)o)->hotspot(0);
@ -1262,7 +1244,7 @@ void hotspot_cb(Fl_Light_Button* i,void* v) {
void visible_cb(Fl_Light_Button* i, void* v) {
if (v == LOAD) {
i->value(current_widget->o->visible());
if (current_widget->is_window()) i->deactivate();
if (current_widget->is_a(Fl_Type::ID_Window)) i->deactivate();
else i->activate();
} else {
int mod = 0;
@ -1277,9 +1259,9 @@ void visible_cb(Fl_Light_Button* i, void* v) {
n ? q->o->show() : q->o->hide();
q->redraw();
if (n && q->parent && q->parent->type_name()) {
if (q->parent->id() == Fl_Type::ID_Tabs) {
if (q->parent->is_a(Fl_Type::ID_Tabs)) {
((Fl_Tabs *)q->o->parent())->value(q->o);
} else if (q->parent->id() == Fl_Type::ID_Wizard) {
} else if (q->parent->is_a(Fl_Type::ID_Wizard)) {
((Fl_Wizard *)q->o->parent())->value(q->o);
}
}
@ -1295,7 +1277,7 @@ void visible_cb(Fl_Light_Button* i, void* v) {
void active_cb(Fl_Light_Button* i, void* v) {
if (v == LOAD) {
i->value(current_widget->o->active());
if (current_widget->is_window()) i->deactivate();
if (current_widget->is_a(Fl_Type::ID_Window)) i->deactivate();
else i->activate();
} else {
int mod = 0;
@ -1438,7 +1420,7 @@ void color_common(Fl_Color c) {
if (o->selected && o->is_widget()) {
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
q->o->color(c); q->o->redraw();
if (q->parent && (q->parent->id() == Fl_Type::ID_Tabs)) {
if (q->parent && q->parent->is_a(Fl_Type::ID_Tabs)) {
if (q->o->parent()) q->o->parent()->redraw();
}
mod = 1;
@ -1450,7 +1432,7 @@ void color_common(Fl_Color c) {
void color_cb(Fl_Button* i, void *v) {
Fl_Color c = current_widget->o->color();
if (v == LOAD) {
if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate();
if (current_widget->is_a(Fl_Type::ID_Menu_Item)) {i->deactivate(); return;} else i->activate();
} else {
Fl_Color d = fl_show_colormap(c);
if (d == c) return;
@ -1463,7 +1445,7 @@ void color_cb(Fl_Button* i, void *v) {
void color_menu_cb(Fl_Menu_Button* i, void *v) {
Fl_Color c = current_widget->o->color();
if (v == LOAD) {
if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate();
if (current_widget->is_a(Fl_Type::ID_Menu_Item)) {i->deactivate(); return;} else i->activate();
} else {
Fl_Color d = (Fl_Color)(i->mvalue()->argument());
if (d == c) return;
@ -1488,7 +1470,7 @@ void color2_common(Fl_Color c) {
void color2_cb(Fl_Button* i, void *v) {
Fl_Color c = current_widget->o->selection_color();
if (v == LOAD) {
if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate();
if (current_widget->is_a(Fl_Type::ID_Menu_Item)) {i->deactivate(); return;} else i->activate();
} else {
Fl_Color d = fl_show_colormap(c);
if (d == c) return;
@ -1501,7 +1483,7 @@ void color2_cb(Fl_Button* i, void *v) {
void color2_menu_cb(Fl_Menu_Button* i, void *v) {
Fl_Color c = current_widget->o->selection_color();
if (v == LOAD) {
if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate();
if (current_widget->is_a(Fl_Type::ID_Menu_Item)) {i->deactivate(); return;} else i->activate();
} else {
Fl_Color d = (Fl_Color)(i->mvalue()->argument());
if (d == c) return;
@ -1573,7 +1555,7 @@ static Fl_Menu_Item alignmenu[] = {
void align_cb(Fl_Button* i, void *v) {
Fl_Align b = Fl_Align(fl_uintptr_t(i->user_data()));
if (v == LOAD) {
if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate();
if (current_widget->is_a(Fl_Type::ID_Menu_Item)) {i->deactivate(); return;} else i->activate();
i->value(current_widget->o->align() & b);
} else {
int mod = 0;
@ -1611,7 +1593,7 @@ void align_cb(Fl_Button* i, void *v) {
void align_position_cb(Fl_Choice *i, void *v) {
if (v == LOAD) {
if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate();
if (current_widget->is_a(Fl_Type::ID_Menu_Item)) {i->deactivate(); return;} else i->activate();
Fl_Menu_Item *mi = (Fl_Menu_Item*)i->menu();
Fl_Align b = current_widget->o->align() & FL_ALIGN_POSITION_MASK;
for (;mi->text;mi++) {
@ -1641,7 +1623,7 @@ void align_position_cb(Fl_Choice *i, void *v) {
void align_text_image_cb(Fl_Choice *i, void *v) {
if (v == LOAD) {
if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate();
if (current_widget->is_a(Fl_Type::ID_Menu_Item)) {i->deactivate(); return;} else i->activate();
Fl_Menu_Item *mi = (Fl_Menu_Item*)i->menu();
Fl_Align b = current_widget->o->align() & FL_ALIGN_IMAGE_MASK;
for (;mi->text;mi++) {
@ -1782,7 +1764,7 @@ void v_input_cb(Fl_Input* i, void* v) {
void subclass_cb(Fl_Input* i, void* v) {
if (v == LOAD) {
if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate();
if (current_widget->is_a(Fl_Type::ID_Menu_Item)) {i->deactivate(); return;} else i->activate();
i->value(current_widget->subclass());
} else {
int mod = 0;
@ -1906,14 +1888,14 @@ void textcolor_menu_cb(Fl_Menu_Button* i, void* v) {
void min_w_cb(Fl_Value_Input* i, void* v) {
if (v == LOAD) {
if (!current_widget->is_window()) return;
if (!current_widget->is_a(Fl_Type::ID_Window)) return;
i->value(((Fl_Window_Type*)current_widget)->sr_min_w);
} else {
int mod = 0;
undo_checkpoint();
int n = (int)i->value();
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected && o->is_window()) {
if (o->selected && o->is_a(Fl_Type::ID_Window)) {
((Fl_Window_Type*)current_widget)->sr_min_w = n;
mod = 1;
}
@ -1924,14 +1906,14 @@ void min_w_cb(Fl_Value_Input* i, void* v) {
void min_h_cb(Fl_Value_Input* i, void* v) {
if (v == LOAD) {
if (!current_widget->is_window()) return;
if (!current_widget->is_a(Fl_Type::ID_Window)) return;
i->value(((Fl_Window_Type*)current_widget)->sr_min_h);
} else {
int mod = 0;
undo_checkpoint();
int n = (int)i->value();
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected && o->is_window()) {
if (o->selected && o->is_a(Fl_Type::ID_Window)) {
((Fl_Window_Type*)current_widget)->sr_min_h = n;
mod = 1;
}
@ -1942,14 +1924,14 @@ void min_h_cb(Fl_Value_Input* i, void* v) {
void max_w_cb(Fl_Value_Input* i, void* v) {
if (v == LOAD) {
if (!current_widget->is_window()) return;
if (!current_widget->is_a(Fl_Type::ID_Window)) return;
i->value(((Fl_Window_Type*)current_widget)->sr_max_w);
} else {
int mod = 0;
undo_checkpoint();
int n = (int)i->value();
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected && o->is_window()) {
if (o->selected && o->is_a(Fl_Type::ID_Window)) {
((Fl_Window_Type*)current_widget)->sr_max_w = n;
mod = 1;
}
@ -1960,14 +1942,14 @@ void max_w_cb(Fl_Value_Input* i, void* v) {
void max_h_cb(Fl_Value_Input* i, void* v) {
if (v == LOAD) {
if (!current_widget->is_window()) return;
if (!current_widget->is_a(Fl_Type::ID_Window)) return;
i->value(((Fl_Window_Type*)current_widget)->sr_max_h);
} else {
int mod = 0;
undo_checkpoint();
int n = (int)i->value();
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected && o->is_window()) {
if (o->selected && o->is_a(Fl_Type::ID_Window)) {
((Fl_Window_Type*)current_widget)->sr_max_h = n;
mod = 1;
}
@ -1982,7 +1964,7 @@ void set_min_size_cb(Fl_Button*, void* v) {
int mod = 0;
undo_checkpoint();
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected && o->is_window()) {
if (o->selected && o->is_a(Fl_Type::ID_Window)) {
Fl_Window_Type *win = (Fl_Window_Type*)current_widget;
win->sr_min_w = win->o->w();
win->sr_min_h = win->o->h();
@ -2000,7 +1982,7 @@ void set_max_size_cb(Fl_Button*, void* v) {
int mod = 0;
undo_checkpoint();
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected && o->is_window()) {
if (o->selected && o->is_a(Fl_Type::ID_Window)) {
Fl_Window_Type *win = (Fl_Window_Type*)current_widget;
win->sr_max_w = win->o->w();
win->sr_max_h = win->o->h();
@ -2162,7 +2144,7 @@ void value_cb(Fl_Value_Input* i, void* v) {
mod = 1;
} else if (q->is_button()) {
((Fl_Button*)(q->o))->value(n != 0);
if (q->is_menu_item()) q->redraw();
if (q->is_a(Fl_Type::ID_Menu_Item)) q->redraw();
mod = 1;
} else if (q->is_a(Fl_Type::ID_Spinner)) {
((Fl_Spinner*)(q->o))->value(n);
@ -2179,9 +2161,9 @@ void value_cb(Fl_Value_Input* i, void* v) {
void values_group_cb(Fl_Group* g, void* v) {
if (v == LOAD) {
if (current_widget->is_flex()) {
if (current_widget->is_a(Fl_Type::ID_Flex)) {
g->hide();
} else if (current_widget->is_window()) {
} else if (current_widget->is_a(Fl_Type::ID_Window)) {
g->hide();
} else {
g->show();
@ -2192,7 +2174,7 @@ void values_group_cb(Fl_Group* g, void* v) {
void flex_margin_group_cb(Fl_Group* g, void* v) {
if (v == LOAD) {
if (current_widget->is_flex()) {
if (current_widget->is_a(Fl_Type::ID_Flex)) {
g->show();
} else {
g->hide();
@ -2203,7 +2185,7 @@ void flex_margin_group_cb(Fl_Group* g, void* v) {
void size_range_group_cb(Fl_Group* g, void* v) {
if (v == LOAD) {
if (current_widget->is_window()) {
if (current_widget->is_a(Fl_Type::ID_Window)) {
g->show();
} else {
g->hide();
@ -2217,14 +2199,14 @@ static void flex_margin_cb(Fl_Value_Input* i, void* v,
void (*load_margin)(Fl_Flex*,Fl_Value_Input*),
int (*update_margin)(Fl_Flex*,int)) {
if (v == LOAD) {
if (current_widget->is_flex()) {
if (current_widget->is_a(Fl_Type::ID_Flex)) {
load_margin((Fl_Flex*)current_widget->o, i);
}
} else {
int mod = 0;
int new_value = (int)i->value();
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected && o->is_flex()) {
if (o->selected && o->is_a(Fl_Type::ID_Flex)) {
Fl_Flex_Type* q = (Fl_Flex_Type*)o;
Fl_Flex* w = (Fl_Flex*)q->o;
if (update_margin(w, new_value)) {
@ -2481,7 +2463,7 @@ void subtype_cb(Fl_Choice* i, void* v) {
if (q->subtypes()==m) {
if (q->is_a(Fl_Type::ID_Spinner))
((Fl_Spinner*)q->o)->type(n);
else if (q->is_flex())
else if (q->is_a(Fl_Type::ID_Flex))
((Fl_Flex_Type*)q)->change_subtype_to(n);
else
q->o->type(n);
@ -2568,7 +2550,7 @@ void live_mode_cb(Fl_Button*o,void *) {
live_window->resizable(live_widget);
live_window->set_modal(); // block all other UI
live_window->callback(leave_live_mode_cb);
if (current_widget->is_window()) {
if (current_widget->is_a(Fl_Type::ID_Window)) {
Fl_Window_Type *w = (Fl_Window_Type*)current_widget;
int mw = w->sr_min_w; if (mw>0) mw += 20;
int mh = w->sr_min_h; if (mh>0) mh += 55;
@ -2811,7 +2793,7 @@ void Fl_Widget_Type::write_static(Fd_Code_Writer& f) {
Fl_Type *q = 0;
for (Fl_Type* p = parent; p && p->is_widget(); q = p, p = p->parent)
f.write_c("->parent()");
if (!q || (q->id() != Fl_Type::ID_Widget_Class))
if (!q || !q->is_a(Fl_Type::ID_Widget_Class))
f.write_c("->user_data()");
f.write_c("))->%s_i(o,v);\n}\n", cn);
}
@ -2843,7 +2825,7 @@ void Fl_Widget_Type::write_code1(Fd_Code_Writer& f) {
f.write_h("%sstatic void %s(%s*, %s);\n", f.indent(1), cn, t, ut);
}
// figure out if local variable will be used (prevent compiler warnings):
int wused = !name() && is_window();
int wused = !name() && is_a(ID_Window);
const char *ptr;
f.varused = wused;
@ -2904,7 +2886,7 @@ void Fl_Widget_Type::write_code1(Fd_Code_Writer& f) {
write_comment_inline_c(f);
if (f.varused) f.write_c("%s* o = ", t);
if (name()) f.write_c("%s = ", name());
if (is_window()) {
if (is_a(ID_Window)) {
// Handle special case where user is faking a Fl_Group type as a window,
// there is no 2-argument constructor in that case:
if (!strstr(t, "Window"))
@ -3010,7 +2992,7 @@ void Fl_Widget_Type::write_widget_code(Fd_Code_Writer& f) {
if (is_a(Fl_Type::ID_Spinner) && ((Fl_Spinner*)o)->type() != ((Fl_Spinner*)tplate)->type())
f.write_c("%s%s->type(%d);\n", f.indent(), var, ((Fl_Spinner*)o)->type());
else if (o->type() != tplate->type() && !is_window())
else if (o->type() != tplate->type() && !is_a(ID_Window))
f.write_c("%s%s->type(%d);\n", f.indent(), var, o->type());
if (o->box() != tplate->box() || subclass())
f.write_c("%s%s->box(FL_%s);\n", f.indent(), var, boxname(o->box()));
@ -3037,7 +3019,7 @@ void Fl_Widget_Type::write_widget_code(Fd_Code_Writer& f) {
if (b->down_box()) f.write_c("%s%s->down_box(FL_%s);\n", f.indent(), var,
boxname(b->down_box()));
if (b->value()) f.write_c("%s%s->value(1);\n", f.indent(), var);
} else if (id() == Fl_Type::ID_Input_Choice) {
} else if (is_a(Fl_Type::ID_Input_Choice)) {
Fl_Input_Choice* b = (Fl_Input_Choice*)o;
if (b->down_box()) f.write_c("%s%s->down_box(FL_%s);\n", f.indent(), var,
boxname(b->down_box()));
@ -3134,7 +3116,7 @@ void Fl_Widget_Type::write_widget_code(Fd_Code_Writer& f) {
if (hotspot()) {
if (is_class())
f.write_c("%shotspot(%s);\n", f.indent(), var);
else if (is_window())
else if (is_a(ID_Window))
f.write_c("%s%s->hotspot(%s);\n", f.indent(), var, var);
else
f.write_c("%s%s->window()->hotspot(%s);\n", f.indent(), var, var);
@ -3189,7 +3171,7 @@ void Fl_Widget_Type::write_properties(Fd_Project_Writer &f) {
if (is_a(Fl_Type::ID_Spinner) && ((Fl_Spinner*)o)->type() != ((Fl_Spinner*)tplate)->type()) {
f.write_string("type");
f.write_word(item_name(subtypes(), ((Fl_Spinner*)o)->type()));
} else if (subtypes() && (o->type() != tplate->type() || is_window())) {
} else if (subtypes() && (o->type() != tplate->type() || is_a(ID_Window))) {
f.write_string("type");
f.write_word(item_name(subtypes(), o->type()));
}
@ -3213,7 +3195,7 @@ void Fl_Widget_Type::write_properties(Fd_Project_Writer &f) {
f.write_string("down_box"); f.write_word(boxname(b->down_box()));}
if (b->shortcut()) f.write_string("shortcut 0x%x", b->shortcut());
if (b->value()) f.write_string("value 1");
} else if (id() == Fl_Type::ID_Input_Choice) {
} else if (is_a(Fl_Type::ID_Input_Choice)) {
Fl_Input_Choice* b = (Fl_Input_Choice*)o;
if (b->down_box()) {
f.write_string("down_box"); f.write_word(boxname(b->down_box()));}
@ -3270,7 +3252,7 @@ void Fl_Widget_Type::write_properties(Fd_Project_Writer &f) {
if (!o->visible() && !override_visible_) f.write_string("hide");
if (!o->active()) f.write_string("deactivate");
if (resizable()) f.write_string("resizable");
if (hotspot()) f.write_string(is_menu_item() ? "divider" : "hotspot");
if (hotspot()) f.write_string(is_a(ID_Menu_Item) ? "divider" : "hotspot");
for (int n=0; n < NUM_EXTRA_CODE; n++) if (extra_code(n)) {
f.write_indent(level+1);
f.write_string("code%d",n);
@ -3345,7 +3327,7 @@ void Fl_Widget_Type::read_property(Fd_Project_Reader &f, const char *c) {
if (x == ZERO_ENTRY) x = 0;
((Fl_Button*)o)->down_box((Fl_Boxtype)x);
}
} else if ((id() == Fl_Type::ID_Input_Choice) && !strcmp(c,"down_box")) {
} else if (is_a(Fl_Type::ID_Input_Choice) && !strcmp(c,"down_box")) {
const char* value = f.read_word();
if ((x = boxnumber(value))) {
if (x == ZERO_ENTRY) x = 0;
@ -3478,7 +3460,7 @@ int Fl_Widget_Type::read_fdesign(const char* propname, const char* value) {
if (sscanf(value,"%f %f %f %f",&x,&y,&w,&h) == 4) {
if (fdesign_flip) {
Fl_Type *p;
for (p = parent; p && !p->is_window(); p = p->parent) {/*empty*/}
for (p = parent; p && !p->is_a(ID_Window); p = p->parent) {/*empty*/}
if (p && p->is_widget()) y = ((Fl_Widget_Type*)p)->o->h()-(y+h);
}
x += pasteoffset;

View File

@ -105,8 +105,9 @@ public:
virtual Fl_Menu_Item *subtypes();
ID id() const FL_OVERRIDE { return ID_Widget_; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Widget_) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Widget_) ? true : super::is_a(inID); }
int is_widget() const FL_OVERRIDE;
int is_true_widget() const FL_OVERRIDE { return 1; }
int is_public() const FL_OVERRIDE;
void write_properties(Fd_Project_Writer &f) FL_OVERRIDE;

View File

@ -316,7 +316,7 @@ void Fl_Window_Type::ideal_size(int &w, int &h) {
void modal_cb(Fl_Light_Button* i, void* v) {
if (v == LOAD) {
if (!current_widget->is_window()) {i->hide(); return;}
if (!current_widget->is_a(Fl_Type::ID_Window)) {i->hide(); return;}
i->show();
i->value(((Fl_Window_Type *)current_widget)->modal);
} else {
@ -328,7 +328,7 @@ void modal_cb(Fl_Light_Button* i, void* v) {
void non_modal_cb(Fl_Light_Button* i, void* v) {
if (v == LOAD) {
if (!current_widget->is_window()) {i->hide(); return;}
if (!current_widget->is_a(Fl_Type::ID_Window)) {i->hide(); return;}
i->show();
i->value(((Fl_Window_Type *)current_widget)->non_modal);
} else {
@ -340,7 +340,7 @@ void non_modal_cb(Fl_Light_Button* i, void* v) {
void border_cb(Fl_Light_Button* i, void* v) {
if (v == LOAD) {
if (!current_widget->is_window()) {i->hide(); return;}
if (!current_widget->is_a(Fl_Type::ID_Window)) {i->hide(); return;}
i->show();
i->value(((Fl_Window*)(current_widget->o))->border());
} else {
@ -352,7 +352,7 @@ void border_cb(Fl_Light_Button* i, void* v) {
void xclass_cb(Fl_Input* i, void* v) {
if (v == LOAD) {
if (current_widget->is_window()) {
if (current_widget->is_a(Fl_Type::ID_Window)) {
i->show();
i->parent()->show();
i->value(((Fl_Window_Type *)current_widget)->xclass);
@ -364,7 +364,7 @@ void xclass_cb(Fl_Input* i, void* v) {
int mod = 0;
undo_checkpoint();
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected && o->is_window()) {
if (o->selected && o->is_a(Fl_Type::ID_Window)) {
mod = 1;
Fl_Window_Type *wt = (Fl_Window_Type *)o;
storestring(i->value(), wt->xclass);
@ -419,7 +419,7 @@ void Fl_Window_Type::newdx() {
if (show_guides && (drag & (FD_DRAG|FD_TOP|FD_LEFT|FD_BOTTOM|FD_RIGHT))) {
Fl_Type *selection = 0L; // special power for the first selected widget
for (Fl_Type *q=next; q && q->level>level; q = q->next) {
if (q->selected && q->is_widget() && !q->is_menu_item()) {
if (q->selected && q->is_true_widget()) {
selection = q;
break;
}
@ -509,7 +509,7 @@ void fd_hatch(int x, int y, int w, int h, int size=6, int offset=0, int pad=3) {
*/
void Fl_Window_Type::draw_out_of_bounds(Fl_Widget_Type *group, int x, int y, int w, int h) {
for (Fl_Type *p = group->next; p && p->level>group->level; p = p->next) {
if (p->level == group->level+1 && p->is_widget() && !p->is_menu_item()) {
if (p->level == group->level+1 && p->is_true_widget()) {
Fl_Widget *o = ((Fl_Widget_Type*)p)->o;
if (o->x() < x) fd_hatch(o->x(), o->y(), x-o->x(), o->h());
if (o->y() < y) fd_hatch(o->x(), o->y(), o->w(), y-o->y());
@ -528,7 +528,7 @@ void Fl_Window_Type::draw_out_of_bounds() {
draw_out_of_bounds(this, 0, 0, o->w(), o->h());
for (Fl_Type *q=next; q && q->level>level; q = q->next) {
// don't do this for Fl_Scroll (which we currently can't handle in FLUID anyway)
if (q->is_group() && !q->is_scroll()) {
if (q->is_group() && !q->is_a(ID_Scroll)) {
Fl_Widget_Type *w = (Fl_Widget_Type*)q;
draw_out_of_bounds(w, w->o->x(), w->o->y(), w->o->w(), w->o->h());
}
@ -544,14 +544,14 @@ void Fl_Window_Type::draw_overlaps() {
// loop through all widgets in this window
for (Fl_Type *q=next; q && q->level>level; q = q->next) {
// is it a valid widget
if (q->is_widget() && !q->is_menu_item()) {
if (q->is_true_widget()) {
Fl_Widget_Type *w = (Fl_Widget_Type*)q;
// is the widget visible
if (w->o->visible()) {
int x = w->o->x(), y = w->o->y();
int r = x + w->o->w(), b = y + w->o->h();
for (Fl_Type *p=q->next; p && p->level>=q->level; p = p->next) {
if (p->level==q->level && p->is_widget() && !p->is_menu_item()) {
if (p->level==q->level && p->is_true_widget()) {
Fl_Widget_Type *wp = (Fl_Widget_Type*)p;
if (wp->o->visible()) {
int px = fd_max(x, wp->o->x());
@ -577,7 +577,7 @@ void Fl_Window_Type::draw_overlay() {
bx = o->w(); by = o->h(); br = 0; bt = 0;
numselected = 0;
for (Fl_Type *q=next; q && q->level>level; q=q->next)
if (q->selected && q->is_widget() && !q->is_menu_item()) {
if (q->selected && q->is_true_widget()) {
numselected++;
Fl_Widget_Type* myo = (Fl_Widget_Type*)q;
if (myo->o->x() < bx) bx = myo->o->x();
@ -609,7 +609,7 @@ void Fl_Window_Type::draw_overlay() {
mybx = mysx = o->w(); myby = mysy = o->h(); mybr = mysr = 0; mybt = myst = 0;
Fl_Type *selection = 0L; // special power for the first selected widget
for (Fl_Type *q=next; q && q->level>level; q = q->next)
if (q->selected && q->is_widget() && !q->is_menu_item()) {
if (q->selected && q->is_true_widget()) {
if (!selection) selection = q;
Fl_Widget_Type* myo = (Fl_Widget_Type*)q;
int x,y,r,t;
@ -694,24 +694,28 @@ void Fl_Window_Type::fix_overlay() {
// check if we must redraw any parent of tabs/wizard type
void check_redraw_corresponding_parent(Fl_Type *s) {
Fl_Widget_Type * prev_parent = 0;
if( !s || !s->selected || !s->is_widget()) return;
for (Fl_Type *i=s; i && i->parent; i=i->parent) {
if (i->is_group() && prev_parent &&
( (i->id() == Fl_Type::ID_Tabs) ||
(i->id() == Fl_Type::ID_Wizard))) {
((Fl_Tabs*)((Fl_Widget_Type*)i)->o)->value(prev_parent->o);
return;
}
if (i->is_group() && s->is_widget())
prev_parent = (Fl_Widget_Type*)i;
Fl_Widget_Type * prev_parent = 0;
if( !s || !s->selected || !s->is_widget()) return;
for (Fl_Type *i=s; i && i->parent; i=i->parent) {
if (i->is_group() && prev_parent) {
if (i->is_a(Fl_Type::ID_Tabs)) {
((Fl_Tabs*)((Fl_Widget_Type*)i)->o)->value(prev_parent->o);
return;
}
if (i->is_a(Fl_Type::ID_Wizard)) {
((Fl_Wizard*)((Fl_Widget_Type*)i)->o)->value(prev_parent->o);
return;
}
}
if (i->is_group() && s->is_widget())
prev_parent = (Fl_Widget_Type*)i;
}
}
// do that for every window (when selected set changes):
void redraw_overlays() {
for (Fl_Type *o=Fl_Type::first; o; o=o->next)
if (o->is_window()) ((Fl_Window_Type*)o)->fix_overlay();
if (o->is_a(Fl_Type::ID_Window)) ((Fl_Window_Type*)o)->fix_overlay();
}
void toggle_overlays(Fl_Widget *,void *) {
@ -726,7 +730,7 @@ void toggle_overlays(Fl_Widget *,void *) {
}
for (Fl_Type *o=Fl_Type::first; o; o=o->next)
if (o->is_window()) {
if (o->is_a(Fl_Type::ID_Window)) {
Fl_Widget_Type* w = (Fl_Widget_Type*)o;
((Overlay_Window*)(w->o))->redraw_overlay();
}
@ -749,7 +753,7 @@ void toggle_guides(Fl_Widget *,void *) {
guides_button->value(show_guides);
for (Fl_Type *o=Fl_Type::first; o; o=o->next) {
if (o->is_window()) {
if (o->is_a(Fl_Type::ID_Window)) {
Fl_Widget_Type* w = (Fl_Widget_Type*)o;
((Overlay_Window*)(w->o))->redraw_overlay();
}
@ -781,7 +785,7 @@ void toggle_restricted(Fl_Widget *,void *) {
restricted_button->value(show_restricted);
for (Fl_Type *o=Fl_Type::first; o; o=o->next) {
if (o->is_window()) {
if (o->is_a(Fl_Type::ID_Window)) {
Fl_Widget_Type* w = (Fl_Widget_Type*)o;
((Overlay_Window*)(w->o))->redraw_overlay();
}
@ -811,7 +815,7 @@ void Fl_Window_Type::moveallchildren()
undo_checkpoint();
Fl_Type *i;
for (i=next; i && i->level>level;) {
if (i->selected && i->is_widget() && !i->is_menu_item()) {
if (i->selected && i->is_true_widget()) {
Fl_Widget_Type* myo = (Fl_Widget_Type*)i;
int x,y,r,t,ow=myo->o->w(),oh=myo->o->h();
newposition(myo,x,y,r,t);
@ -834,7 +838,7 @@ void Fl_Window_Type::moveallchildren()
// move all the children, whether selected or not:
Fl_Type* p;
for (p = myo->next; p && p->level>myo->level; p = p->next)
if (p->is_widget() && !p->is_menu_item() && !myo->is_flex()) {
if (p->is_true_widget() && !myo->is_a(ID_Flex)) {
Fl_Widget_Type* myo2 = (Fl_Widget_Type*)p;
int X,Y,R,T;
newposition(myo2,X,Y,R,T);
@ -992,7 +996,7 @@ int Fl_Window_Type::handle(int event) {
// find the innermost item clicked on:
selection = this;
{for (Fl_Type* i=next; i && i->level>level; i=i->next)
if (i->is_widget() && !i->is_menu_item()) {
if (i->is_true_widget()) {
Fl_Widget_Type* myo = (Fl_Widget_Type*)i;
for (Fl_Widget *o1 = myo->o; o1; o1 = o1->parent())
if (!o1->visible()) goto CONTINUE2;
@ -1022,7 +1026,7 @@ int Fl_Window_Type::handle(int event) {
} else {
deselect();
select(t, 1);
if (t->is_menu_item()) t->open();
if (t->is_a(ID_Menu_Item)) t->open();
}
selection = t;
drag = 0;
@ -1055,7 +1059,7 @@ int Fl_Window_Type::handle(int event) {
if (!toggle) deselect(); else Fl::event_is_click(0);
// select everything in box:
for (Fl_Type*i=next; i&&i->level>level; i=i->next)
if (i->is_widget() && !i->is_menu_item()) {
if (i->is_true_widget()) {
Fl_Widget_Type* myo = (Fl_Widget_Type*)i;
for (Fl_Widget *o1 = myo->o; o1; o1 = o1->parent())
if (!o1->visible()) goto CONTINUE;
@ -1089,7 +1093,7 @@ int Fl_Window_Type::handle(int event) {
if (Fl::event_state(FL_SHIFT)) backtab = 1;
// find current child:
Fl_Type *i = Fl_Type::current;
while (i && (!i->is_widget() || i->is_menu_item())) i = i->parent;
while (i && !i->is_true_widget()) i = i->parent;
if (!i) return 0;
Fl_Type *p = i->parent;
while (p && p != this) p = p->parent;
@ -1100,7 +1104,7 @@ int Fl_Window_Type::handle(int event) {
for (;;) {
i = backtab ? i->prev : i->next;
if (!i || i->level <= level) {i = p; break;}
if (i->is_widget() && !i->is_menu_item()) break;
if (i->is_true_widget()) break;
}
deselect(); select(i,1);
return 1;}

View File

@ -74,7 +74,7 @@ protected:
int recalc; // set by fix_overlay()
void moveallchildren();
ID id() const FL_OVERRIDE { return ID_Window; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Window) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Window) ? true : super::is_a(inID); }
void open_();
public:
@ -115,7 +115,6 @@ public:
int is_parent() const FL_OVERRIDE {return 1;}
int is_group() const FL_OVERRIDE {return 1;}
int is_window() const FL_OVERRIDE {return 1;}
Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE;
void leave_live_mode() FL_OVERRIDE;
@ -149,7 +148,7 @@ public:
Fl_Type *make(Strategy strategy) FL_OVERRIDE;
const char *type_name() FL_OVERRIDE {return "widget_class";}
ID id() const FL_OVERRIDE { return ID_Widget_Class; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Widget_Class) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Widget_Class) ? true : super::is_a(inID); }
int is_parent() const FL_OVERRIDE {return 1;}
int is_code_block() const FL_OVERRIDE {return 1;}
int is_decl_block() const FL_OVERRIDE {return 1;}

View File

@ -656,14 +656,14 @@ Fl_Type* Fd_Code_Writer::write_code(Fl_Type* p) {
}
// write all code that come before the children code
// (but don't write the last comment until the very end)
if (!(p==Fl_Type::last && p->is_comment()))
if (!(p==Fl_Type::last && p->is_a(Fl_Type::ID_Comment)))
p->write_code1(*this);
// recursively write the code of all children
Fl_Type* q;
if (p->is_widget() && p->is_class()) {
// Handle widget classes specially
for (q = p->next; q && q->level > p->level;) {
if (q->id() != Fl_Type::ID_Function) q = write_code(q);
if (!q->is_a(Fl_Type::ID_Function)) q = write_code(q);
else {
int level = q->level;
do {
@ -676,7 +676,7 @@ Fl_Type* Fd_Code_Writer::write_code(Fl_Type* p) {
p->write_code2(*this);
for (q = p->next; q && q->level > p->level;) {
if (q->id() == Fl_Type::ID_Function) q = write_code(q);
if (q->is_a(Fl_Type::ID_Function)) q = write_code(q);
else {
int level = q->level;
do {
@ -733,7 +733,7 @@ int Fd_Code_Writer::write_code(const char *s, const char *t, bool to_sourceview)
// if the first entry in the Type tree is a comment, then it is probably
// a copyright notice. We print that before anything else in the file!
Fl_Type* first_type = Fl_Type::first;
if (first_type && first_type->is_comment()) {
if (first_type && first_type->is_a(Fl_Type::ID_Comment)) {
if (write_sourceview) {
first_type->code_position = (int)ftell(code_file);
first_type->header_position = (int)ftell(header_file);
@ -850,7 +850,7 @@ int Fd_Code_Writer::write_code(const char *s, const char *t, bool to_sourceview)
fprintf(header_file, "#endif\n");
Fl_Type* last_type = Fl_Type::last;
if (last_type && last_type->is_comment()) {
if (last_type && last_type->is_a(Fl_Type::ID_Comment)) {
if (write_sourceview) {
last_type->code_position = (int)ftell(code_file);
last_type->header_position = (int)ftell(header_file);

View File

@ -111,7 +111,7 @@ int Widget_Bin_Window_Button::handle(int inEvent)
Fl_Type *prototype = typename_to_prototype((char*)user_data());
if (prototype) {
Fl_Type *new_type = add_new_widget_from_user(prototype, kAddAfterCurrent);
if (new_type && new_type->is_window()) {
if (new_type && new_type->is_a(Fl_Type::ID_Window)) {
Fl_Window_Type *new_window = (Fl_Window_Type*)new_type;
Fl_Window *w = (Fl_Window *)new_window->o;
w->position(Fl::event_x_root(), Fl::event_y_root());

View File

@ -108,7 +108,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Browser_Base_Type(); }
ID id() const FL_OVERRIDE { return ID_Browser_; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Browser_) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Browser_) ? true : super::is_a(inID); }
};
static Fl_Browser_Base_Type Fl_Browser_Base_type;
@ -141,7 +141,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Browser_Type(); }
ID id() const FL_OVERRIDE { return ID_Browser; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Browser) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Browser) ? true : super::is_a(inID); }
};
static Fl_Browser_Type Fl_Browser_type;
@ -174,7 +174,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Check_Browser_Type(); }
ID id() const FL_OVERRIDE { return ID_Check_Browser; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Check_Browser) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Check_Browser) ? true : super::is_a(inID); }
};
static Fl_Check_Browser_Type Fl_Check_Browser_type;
@ -200,7 +200,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_File_Browser_Type(); }
ID id() const FL_OVERRIDE { return ID_File_Browser; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_File_Browser) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_File_Browser) ? true : super::is_a(inID); }
};
static Fl_File_Browser_Type Fl_File_Browser_type;
@ -243,7 +243,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Tree_Type(); }
ID id() const FL_OVERRIDE { return ID_Tree; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Tree) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Tree) ? true : super::is_a(inID); }
};
static Fl_Tree_Type Fl_Tree_type;
@ -289,7 +289,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Help_View_Type(); }
ID id() const FL_OVERRIDE { return ID_Help_View; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Help_View) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Help_View) ? true : super::is_a(inID); }
};
static Fl_Help_View_Type Fl_Help_View_type;
@ -315,7 +315,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Valuator_Type(); }
ID id() const FL_OVERRIDE { return ID_Valuator_; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Valuator_) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Valuator_) ? true : super::is_a(inID); }
};
static Fl_Valuator_Type Fl_Valuator_type;
@ -361,7 +361,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Counter_Type(); }
ID id() const FL_OVERRIDE { return ID_Counter; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Counter) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Counter) ? true : super::is_a(inID); }
};
static Fl_Counter_Type Fl_Counter_type;
@ -388,7 +388,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Adjuster_Type(); }
ID id() const FL_OVERRIDE { return ID_Adjuster; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Adjuster) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Adjuster) ? true : super::is_a(inID); }
};
static Fl_Adjuster_Type Fl_Adjuster_type;
@ -422,7 +422,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Dial_Type(); }
ID id() const FL_OVERRIDE { return ID_Dial; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Dial) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Dial) ? true : super::is_a(inID); }
};
static Fl_Dial_Type Fl_Dial_type;
@ -455,7 +455,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Roller_Type(); }
ID id() const FL_OVERRIDE { return ID_Roller; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Roller) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Roller) ? true : super::is_a(inID); }
};
static Fl_Roller_Type Fl_Roller_type;
@ -495,7 +495,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Slider_Type(); }
ID id() const FL_OVERRIDE { return ID_Slider; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Slider) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Slider) ? true : super::is_a(inID); }
};
static Fl_Slider_Type Fl_Slider_type;
@ -524,7 +524,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Scrollbar_Type(); }
ID id() const FL_OVERRIDE { return ID_Scrollbar; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Scrollbar) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Scrollbar) ? true : super::is_a(inID); }
};
static Fl_Scrollbar_Type Fl_Scrollbar_type;
@ -556,7 +556,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Value_Slider_Type(); }
ID id() const FL_OVERRIDE { return ID_Value_Slider; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Value_Slider) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Value_Slider) ? true : super::is_a(inID); }
};
static Fl_Value_Slider_Type Fl_Value_Slider_type;
@ -595,7 +595,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Value_Input_Type(); }
ID id() const FL_OVERRIDE { return ID_Value_Input; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Value_Input) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Value_Input) ? true : super::is_a(inID); }
};
static Fl_Value_Input_Type Fl_Value_Input_type;
@ -634,7 +634,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Value_Output_Type(); }
ID id() const FL_OVERRIDE { return ID_Value_Output; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Value_Output) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Value_Output) ? true : super::is_a(inID); }
};
static Fl_Value_Output_Type Fl_Value_Output_type;
@ -690,7 +690,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Input_Type(); }
ID id() const FL_OVERRIDE { return ID_Input; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Input) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Input) ? true : super::is_a(inID); }
void copy_properties() FL_OVERRIDE {
Fl_Widget_Type::copy_properties();
Fl_Input_ *d = (Fl_Input_*)live_widget, *s = (Fl_Input_*)o;
@ -727,7 +727,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_File_Input_Type(); }
ID id() const FL_OVERRIDE { return ID_File_Input; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_File_Input) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_File_Input) ? true : super::is_a(inID); }
};
static Fl_File_Input_Type Fl_File_Input_type;
@ -758,7 +758,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Output_Type(); }
ID id() const FL_OVERRIDE { return ID_Output; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Output) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Output) ? true : super::is_a(inID); }
};
static Fl_Output_Type Fl_Output_type;
@ -808,7 +808,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Text_Display_Type(); }
ID id() const FL_OVERRIDE { return ID_Text_Display; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Text_Display) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Text_Display) ? true : super::is_a(inID); }
};
static Fl_Text_Display_Type Fl_Text_Display_type;
@ -835,7 +835,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Text_Editor_Type(); }
ID id() const FL_OVERRIDE { return ID_Text_Editor; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Text_Editor) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Text_Editor) ? true : super::is_a(inID); }
};
static Fl_Text_Editor_Type Fl_Text_Editor_type;
@ -868,7 +868,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Simple_Terminal_Type();}
ID id() const FL_OVERRIDE { return ID_Simple_Terminal; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Simple_Terminal) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Simple_Terminal) ? true : super::is_a(inID); }
};
static Fl_Simple_Terminal_Type Fl_Simple_Terminal_type;
@ -898,7 +898,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Box_Type(); }
ID id() const FL_OVERRIDE { return ID_Box; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Box) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Box) ? true : super::is_a(inID); }
};
static Fl_Box_Type Fl_Box_type;
@ -925,7 +925,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Clock_Type(); }
ID id() const FL_OVERRIDE { return ID_Clock; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Clock) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Clock) ? true : super::is_a(inID); }
};
static Fl_Clock_Type Fl_Clock_type;
@ -956,7 +956,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Progress_Type(); }
ID id() const FL_OVERRIDE { return ID_Progress; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Progress) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Progress) ? true : super::is_a(inID); }
};
static Fl_Progress_Type Fl_Progress_type;
@ -1002,7 +1002,7 @@ public:
}
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Spinner_Type(); }
ID id() const FL_OVERRIDE { return ID_Spinner; }
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Spinner) ? true : super::is_a(inID); }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Spinner) ? true : super::is_a(inID); }
};
static Fl_Spinner_Type Fl_Spinner_type;
@ -1149,7 +1149,7 @@ Fl_Type *add_new_widget_from_user(Fl_Type *inPrototype, Strategy strategy) {
undo_suspend();
Fl_Type *t = ((Fl_Type*)inPrototype)->make(strategy);
if (t) {
if (t->is_widget() && !t->is_window())
if (t->is_widget() && !t->is_a(Fl_Type::ID_Window))
{
Fl_Widget_Type *wt = (Fl_Widget_Type *)t;
@ -1168,7 +1168,7 @@ Fl_Type *add_new_widget_from_user(Fl_Type *inPrototype, Strategy strategy) {
int w = 0, h = 0;
wt->ideal_size(w, h);
if ((t->parent && t->parent->is_flex())) {
if ((t->parent && t->parent->is_a(Fl_Type::ID_Flex))) {
// Do not resize or layout the widget. Flex will need the widget size.
} else if (wt->is_a(Fl_Type::ID_Menu_Bar)) {
// Move and resize the menubar across the top of the window...
@ -1185,7 +1185,7 @@ Fl_Type *add_new_widget_from_user(Fl_Type *inPrototype, Strategy strategy) {
}
}
}
if (t->is_window()) {
if (t->is_a(Fl_Type::ID_Window)) {
int x = 0, y = 0, w = 480, h = 320;
Fl_Window_Type *wt = (Fl_Window_Type *)t;
wt->ideal_size(w, h);

View File

@ -626,7 +626,7 @@ void save_template_cb(Fl_Widget *, void *) {
for (t = Fl_Type::first; t; t = t->next) {
// Find the first window...
if (t->is_window()) break;
if (t->is_a(Fl_Type::ID_Window)) break;
}
if (!t) return;
@ -1349,7 +1349,7 @@ void print_menu_cb(Fl_Widget *, void *) {
Fl_Window *win;
for (t = Fl_Type::first, num_windows = 0; t; t = t->next) {
if (t->is_window()) {
if (t->is_a(Fl_Type::ID_Window)) {
windows[num_windows] = (Fl_Window_Type *)t;
if (!((Fl_Window*)(windows[num_windows]->o))->shown()) continue;
num_windows ++;

View File

@ -345,11 +345,11 @@ void Widget_Browser::item_draw(void *v, int X, int Y, int, int) const {
}
if ( l->is_widget()
&& !l->is_window()
&& !l->is_a(Fl_Type::ID_Window)
&& ((Fl_Widget_Type*)l)->o
&& !((Fl_Widget_Type*)l)->o->visible()
&& (!l->parent || ( (l->parent->id() != Fl_Type::ID_Tabs)
&& (l->parent->id() != Fl_Type::ID_Wizard) ) )
&& (!l->parent || ( !l->parent->is_a(Fl_Type::ID_Tabs)
&& !l->parent->is_a(Fl_Type::ID_Wizard) ) )
)
{
invisible_pixmap->draw(X - 17, Y);

View File

@ -2,6 +2,11 @@
version 1.0400
header_name {.h}
code_name {.cxx}
snap {
ver 1
current_suite FLTK
current_preset 0
}
comment {//
// Checkers images for the Fast Light Tool Kit (FLTK).
//

View File

@ -2,6 +2,11 @@
version 1.0400
header_name {.h}
code_name {.cxx}
snap {
ver 1
current_suite FLTK
current_preset 0
}
decl {\#include "mandelbrot.h"} {public local
}

View File

@ -2,6 +2,11 @@
version 1.0400
header_name {.h}
code_name {.cxx}
snap {
ver 1
current_suite FLTK
current_preset 0
}
Function {} {open
} {
Fl_Window foo_window {