summaryrefslogtreecommitdiff
path: root/fluid/Fl_Window_Type.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2005-08-30 21:57:23 +0000
committerMatthias Melcher <fltk@matthiasm.com>2005-08-30 21:57:23 +0000
commit09783875e44acb5c306ed578999c8c4f2bcce40a (patch)
tree7cc6ea6800fe89daedc73a139564ac5e9635c2ca /fluid/Fl_Window_Type.cxx
parentaa897faeb38d238f8a82f0205d9e74feb87639c1 (diff)
FLUD: This fixes the problem that the children of a Widget_Class_Type are positioned with absolute coordintes. The patch adds another button to the FLUID interface named 'Relative' to the right of the widget position. It is only visible if a Widget_Class_Type is selected. If checked, code will be added that creates an Fl_Group at 0, 0 and later repositions it and all its children into the final position.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4554 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid/Fl_Window_Type.cxx')
-rw-r--r--fluid/Fl_Window_Type.cxx19
1 files changed, 18 insertions, 1 deletions
diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx
index 52bef08ea..45dc2ea4a 100644
--- a/fluid/Fl_Window_Type.cxx
+++ b/fluid/Fl_Window_Type.cxx
@@ -1355,10 +1355,23 @@ Fl_Type *Fl_Widget_Class_Type::make() {
myo->add(p);
myo->modal = 0;
myo->non_modal = 0;
+ myo->wc_relative = 0;
return myo;
}
+void Fl_Widget_Class_Type::write_properties() {
+ Fl_Window_Type::write_properties();
+ if (wc_relative) write_string("position_relative");
+}
+
+void Fl_Widget_Class_Type::read_property(const char *c) {
+ if (!strcmp(c,"position_relative")) {
+ wc_relative = 1;
+ } else {
+ Fl_Window_Type::read_property(c);
+ }
+}
void Fl_Widget_Class_Type::write_code1() {
#if 0
@@ -1399,7 +1412,10 @@ void Fl_Widget_Class_Type::write_code1() {
write_h(" %s(int X, int Y, int W, int H, const char *L = 0);\n", name());
write_c("%s::%s(int X, int Y, int W, int H, const char *L)\n", name(), name());
- write_c(" : %s(X, Y, W, H, L) {\n", c);
+ if (wc_relative)
+ write_c(" : %s(0, 0, W, H, L) {\n", c);
+ else
+ write_c(" : %s(X, Y, W, H, L) {\n", c);
}
write_c(" %s *o = this;\n", name());
@@ -1409,6 +1425,7 @@ void Fl_Widget_Class_Type::write_code1() {
void Fl_Widget_Class_Type::write_code2() {
write_extra_code();
+ if (wc_relative) write_c("%sposition(X, Y);\n", indent());
if (modal) write_c("%sset_modal();\n", indent());
else if (non_modal) write_c("%sset_non_modal();\n", indent());
if (!((Fl_Window*)o)->border()) write_c("%sclear_border();\n", indent());