summaryrefslogtreecommitdiff
path: root/fluid
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2005-07-19 12:12:15 +0000
committerMatthias Melcher <fltk@matthiasm.com>2005-07-19 12:12:15 +0000
commitf64d694799dce27c44858d2b2c7d80b203d83ed3 (patch)
treee3402904af00009421f12cd222aaffea120e9057 /fluid
parentd1808c6165626f5ee5c9664f0c61da57b5475307 (diff)
Better support for Live mode in Fluid. Most Widget attributes are now supported including pulldown menus (in a very simple, but working way).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4433 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid')
-rw-r--r--fluid/Fl_Group_Type.cxx15
-rw-r--r--fluid/Fl_Menu_Type.cxx20
-rw-r--r--fluid/Fl_Type.h4
-rw-r--r--fluid/Fl_Widget_Type.cxx45
4 files changed, 60 insertions, 24 deletions
diff --git a/fluid/Fl_Group_Type.cxx b/fluid/Fl_Group_Type.cxx
index d68a96b8b..c8c89a60d 100644
--- a/fluid/Fl_Group_Type.cxx
+++ b/fluid/Fl_Group_Type.cxx
@@ -249,6 +249,7 @@ Fl_Widget *Fl_Tabs_Type::enter_live_mode(int top) {
}
grp->end();
}
+ grp->value(((Fl_Tabs*)o)->value());
return live_widget;
}
@@ -280,12 +281,26 @@ Fl_Menu_Item scroll_type_menu[] = {
Fl_Scroll_Type Fl_Scroll_type; // the "factory"
+void Fl_Scroll_Type::copy_properties() {
+ Fl_Group_Type::copy_properties();
+ Fl_Scroll *s = (Fl_Scroll*)o, *d = (Fl_Scroll*)live_widget;
+ d->position(s->xposition(), s->yposition());
+ d->type(s->type()); // TODO: get this flag from Fl_Scroll_Type!
+ d->scrollbar.align(s->scrollbar.align());
+ d->hscrollbar.align(s->hscrollbar.align());
+}
+
////////////////////////////////////////////////////////////////
const char tile_type_name[] = "Fl_Tile";
Fl_Tile_Type Fl_Tile_type; // the "factory"
+void Fl_Tile_Type::copy_properties() {
+ Fl_Group_Type::copy_properties();
+ // no additional properties
+}
+
//
// End of "$Id$".
//
diff --git a/fluid/Fl_Menu_Type.cxx b/fluid/Fl_Menu_Type.cxx
index e80199429..7cb6f7724 100644
--- a/fluid/Fl_Menu_Type.cxx
+++ b/fluid/Fl_Menu_Type.cxx
@@ -448,6 +448,16 @@ void Fl_Menu_Type::write_code2() {
Fl_Widget_Type::write_code2();
}
+void Fl_Menu_Type::copy_properties() {
+ Fl_Widget_Type::copy_properties();
+ Fl_Menu_ *s = (Fl_Menu_*)o, *d = (Fl_Menu_*)live_widget;
+ d->menu(s->menu());
+ d->down_box(s->down_box());
+ d->textcolor(s->textcolor());
+ d->textfont(s->textfont());
+ d->textsize(s->textsize());
+}
+
////////////////////////////////////////////////////////////////
#include <FL/Fl_Menu_Button.H>
@@ -472,6 +482,16 @@ Fl_Choice_Type Fl_Choice_type;
Fl_Input_Choice_Type Fl_Input_Choice_type;
+void Fl_Input_Choice_Type::copy_properties() {
+ Fl_Widget_Type::copy_properties();
+ Fl_Input_Choice *s = (Fl_Input_Choice*)o, *d = (Fl_Input_Choice*)live_widget;
+ d->menu(s->menu());
+ d->down_box(s->down_box());
+ d->textcolor(s->textcolor());
+ d->textfont(s->textfont());
+ d->textsize(s->textsize());
+}
+
////////////////////////////////////////////////////////////////
Fl_Menu_Bar_Type Fl_Menu_Bar_type;
diff --git a/fluid/Fl_Type.h b/fluid/Fl_Type.h
index b26e713fd..fd77dafab 100644
--- a/fluid/Fl_Type.h
+++ b/fluid/Fl_Type.h
@@ -430,6 +430,7 @@ public:
virtual const char *type_name() {return scroll_type_name;}
Fl_Widget_Type *_make() {return new Fl_Scroll_Type();}
int pixmapID() { return 19; }
+ void copy_properties();
};
extern const char tile_type_name[];
@@ -439,6 +440,7 @@ public:
virtual const char *type_name() {return tile_type_name;}
Fl_Widget_Type *_make() {return new Fl_Tile_Type();}
int pixmapID() { return 20; }
+ void copy_properties();
};
extern const char wizard_type_name[];
@@ -589,6 +591,7 @@ public:
void remove_child(Fl_Type*) {build_menu();}
Fl_Type* click_test(int x, int y);
void write_code2();
+ void copy_properties();
};
extern Fl_Menu_Item button_type_menu[];
@@ -671,6 +674,7 @@ public:
Fl_Widget_Type *_make() {return new Fl_Input_Choice_Type();}
virtual void build_menu();
int pixmapID() { return 15; }
+ void copy_properties();
};
#include <FL/Fl_Window.H>
diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx
index 89034db48..43f371aa6 100644
--- a/fluid/Fl_Widget_Type.cxx
+++ b/fluid/Fl_Widget_Type.cxx
@@ -2315,25 +2315,12 @@ void Fl_Widget_Type::copy_properties() {
if (!live_widget)
return;
+ // copy all attributes common to all widget types
Fl_Widget *w = live_widget;
w->label(o->label());
w->tooltip(o->tooltip());
w->type(o->type());
w->box(o->box());
-/* move this into the derived _type classes
- if (is_button()) {
- Fl_Button* d = (Fl_Button*)live_widget, *s = (Fl_Button*)o;
- d->down_box(s->down_box());
- d->shortcut(s->shortcut());
- d->value(s->value());
- } else if (!strcmp(type_name(), "Fl_Input_Choice")) {
- Fl_Input_Choice* d = (Fl_Input_Choice*)live_widget, *s = (Fl_Input_Choice*)o;
- d->down_box(s->down_box());
- } else if (is_menu_button()) {
- Fl_Menu_* d = (Fl_Menu_*)live_widget, *s = (Fl_Menu_*)o;
- d->down_box(s->down_box());
- }
-*/
w->color(o->color());
w->selection_color(o->selection_color());
w->labeltype(o->labeltype());
@@ -2341,28 +2328,38 @@ void Fl_Widget_Type::copy_properties() {
w->labelsize(o->labelsize());
w->labelcolor(o->labelcolor());
w->align(o->align());
-/* move this into the derived _type classes
+
+ // copy all attributes specific to widgets derived from Fl_Button
+ if (is_button()) {
+ Fl_Button* d = (Fl_Button*)live_widget, *s = (Fl_Button*)o;
+ d->down_box(s->down_box());
+ d->shortcut(s->shortcut());
+ d->value(s->value());
+ }
+
+ // copy all attributes specific to Fl_Valuator and derived classes
if (is_valuator()) {
Fl_Valuator* d = (Fl_Valuator*)live_widget, *s = (Fl_Valuator*)o;
d->minimum(s->minimum());
d->maximum(s->maximum());
d->step(s->step());
d->value(s->value());
- //if (is_valuator()==2) {
- // double x = ((Fl_Slider*)v)->slider_size();
- // double y = ((Fl_Slider*)f)->slider_size();
- // if (x != y) write_string("slider_size %g", x);
- //}
- }
-*/
-/* move this into the derived _type classes
+ if (is_valuator()==2) {
+ Fl_Slider *d = (Fl_Slider*)live_widget, *s = (Fl_Slider*)o;
+ d->slider_size(s->slider_size());
+ }
+ }
+
+/* TODO: implement this
{Fl_Font ff; int fs; Fl_Color fc; if (textstuff(4,ff,fs,fc)) {
Fl_Font f; int s; Fl_Color c; textstuff(0,f,s,c);
if (f != ff) write_string("textfont %d", f);
if (s != fs) write_string("textsize %d", s);
if (c != fc) write_string("textcolor %d", c);
}}*/
- /// hmmm: if (!o->visible()) write_string("hide");
+
+ if (!o->visible())
+ w->hide();
if (!o->active())
w->deactivate();
if (resizable() && w->parent())