Century Embedded Technologies Nano-X SDK and Developer's Guide | ||
---|---|---|
Prev | Chapter 13. Extending and Adding Widgets | Next |
The constructor should have the following arguments:
MyClass(int x, int y, int w, int h, const char *label = 0);
This will allow the class to be used in FLUID without problems.
The constructor must call the constructor for the base class and pass the same arguments:
MyClass::MyClass(int x, int y, int w, int h, const char *label) : Fl_Widget(x, y, w, h, label) { // do initialization stuff... }
Fl_Widget's protected constructor sets x(), y(), w(), h(), and label() to the passed values and initializes the other instance variables to:
type(0); box(FL_NO_BOX); color(FL_GRAY); selection_color(FL_GRAY); labeltype(FL_NORMAL_LABEL); labelstyle(FL_NORMAL_STYLE); labelsize(FL_NORMAL_SIZE); labelcolor(FL_BLACK); align(FL_ALIGN_CENTER); callback(default_callback,0); flags(ACTIVE|VISIBLE);