Using fluid we can design our user interface visually and fluid generates the
c++ code, but it lacks write a constructor without parameters for windows
forcing us to rewrite the window size and label again on instantiation.
I did added the following to "void Fl_Widget_Class_Type::write_code1()" on
Fl_Window_Type.cxx:
write_h(" %s(int W, int H, const char *L = 0);\n", name());
write_h(" %s();\n", name()); //!!!!!! my new code
..
write_c("%s::%s(int W, int H, const char *L)\n", name(), name());
write_c(" : %s(0, 0, W, H, L) {\n", c);
write_c(" clear_flag(16);\n");
write_c(" _%s();\n", name());
write_c("}\n\n");
//my new code bellow
write_c("%s::%s()\n", name(), name());
write_c(" : %s(0, 0, %d, %d, ", c, o->w(), o->h());
const char *cstr = label();
if (cstr) write_cstring(cstr);
else write_c("0");
write_c(") {\n");
write_c(" clear_flag(16);\n");
write_c(" _%s();\n", name());
write_c("}\n\n");
//end my new code
write_c("void %s::_%s() {\n", name(), name());
..
With this added code fluid now generates a constructor without parameters that
uses our assigned design time size and label.
So instead of:
MyNewWindow *w = new MyNewWindow(newWidth, newHeight, newLabel);
we can simply:
MyNewWindow *w = new MyNewWindow();
I propose this code to be added to fluid official distribution !
Thanks for any comments/sugestions !
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev