I've been trying to develop guidelines for myself to follow
when designing widgets that are derived from Fl_Group.  The
main consideration is what parts of the exposed Fl_Widget
interface ought to be re-implemented.

I'm posting what I've got so far for 3 reasons.
  + Others may find it helpful
  + Any feedback would be appreciated
  + My recent adventures with Fl_Input_Choice suggest that
    some parts of the fltk library might benefit from scrutiny
    in this area... maybe for fltk-2?

Regards,
Stan

//////////////////////////////////////////////////////////////

// Obvious
virtual void draw() = 0;
virtual int handle(int);

// Shouldn't change these
//
Fl_Group* parent() const
void parent(Fl_Group* p)
int x() const
int y() const
int w() const
int h() const
void position(int X,int Y)
void size(int W,int H)
int contains(const Fl_Widget*) const
int inside(const Fl_Widget* o) const
Fl_Window* window() const
int visible()
int visible_r()
void set_visible()
void clear_visible()
int active()
int active_r()
void activate()
void deactivate()
void show()
void hide()
void redraw()
int takesevents() const

// Same with these, I think, but I'm not 100% certain
//
int output() const
void set_output()
void clear_output()

// Consider these on a case by case basis.
// Can leave alone or forward to components,
// depending on design of the specific widget.
//
uchar type() const
void type(uchar t)
virtual void resize(int,int,int,int)
int damage_resize(int,int,int,int)
Fl_Align align()
void align(uchar a)
Fl_Boxtype box()
void box(Fl_Boxtype a)
const char* label() const
void label(const char* a)
void copy_label(const char* a)
void label(Fl_Labeltype a,const char* b)
Fl_Labeltype labeltype() const
void labeltype(Fl_Labeltype a)
Fl_Color labelcolor() const
void labelcolor(unsigned a)
Fl_Font labelfont() const
void labelfont(uchar a)
uchar labelsize() const
void labelsize(uchar a)
Fl_Image* image()
void image(Fl_Image* a)
void image(Fl_Image& a)
Fl_Image* deimage()
void deimage(Fl_Image* a)
void deimage(Fl_Image& a)
const char *tooltip() const
void tooltip(const char *t)
void set_visible_focus()
void clear_visible_focus()
void visible_focus(int v)
int  visible_focus()
void redraw_label()
void draw_label(int, int, int, int, Fl_Align) const
void measure_label(int& xx, int& yy)

// These become essentially no-ops
// if not reimplemented
//
Fl_Color color() const
void color(unsigned a)
Fl_Color selection_color()
void selection_color(unsigned a)
void color(unsigned a, unsigned b)

// These too, in the sense that the
// user's callback won't ever be called
// unless the implementation does something about it.
// The "something" may be forwarding or finding the
// right times to do_callback(), or ...
//
Fl_Callback_p callback()
void callback(Fl_Callback* c, void* p)
void callback(Fl_Callback* c)
void callback(Fl_Callback0*c)
void callback(Fl_Callback1*c, long p=0)
void* user_data() const
void user_data(void* v)
long argument() const
void argument(long v)
Fl_When when() const
void when(uchar i)
void do_callback()
void do_callback(Fl_Widget* o,void* arg=0)
void do_callback(Fl_Widget* o,long arg)

// These probably don't do what you
// want if not reimplemented
//
int changed() const
void set_changed()
void clear_changed()
int take_focus();

// I'm not sure about these
//
int test_shortcut()
static int test_shortcut(const char*)
uchar damage()
void clear_damage(uchar c = 0)
void damage(uchar c)
void damage(uchar c,int,int,int,int)

// Finally, if the Group contains Widgets with
// additional interface (like Fl_*Input or Fl_*Output)
// it's probably useful to forward the additional interface
// to the components.  I'm thinking of things like text*()
// and whatnot





_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to