summaryrefslogtreecommitdiff
path: root/fluid/Fl_Widget_Type.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'fluid/Fl_Widget_Type.cxx')
-rw-r--r--fluid/Fl_Widget_Type.cxx176
1 files changed, 79 insertions, 97 deletions
diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx
index 96631a149..f24b1d081 100644
--- a/fluid/Fl_Widget_Type.cxx
+++ b/fluid/Fl_Widget_Type.cxx
@@ -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;