hello,

ive made some custom Fl_Output_Value. basically i just 
replaced format() from Fl_Valuator (see draw() of 
Fl_Value_Output below)

void Fl_Value_Output::draw() {
  Fl_Boxtype b = box() ? box() : FL_DOWN_BOX;
  int X = x()+Fl::box_dx(b);
  int Y = y()+Fl::box_dy(b);
  int W = w()-Fl::box_dw(b);
  int H = h()-Fl::box_dh(b);
  if (damage()&~FL_DAMAGE_CHILD)
    draw_box(b, color());
  else {
    fl_color(color());
    fl_rectf(X, Y, W, H);
  }
  char buf[128];
  format(buf); // replaced
  fl_color(active_r() ? textcolor() : 
fl_inactive(textcolor()));
  fl_font(textfont(), textsize());
  fl_draw(buf,X,Y,W,H,FL_ALIGN_LEFT);
}

so, i subclassed Fl_Value_Output and redefined the draw() 
function (is redefined the correct term?). in that draw 
function however i only change the format(buf); line to 
call my function. how ugly! now, is it possible to 
"redefine" redraw(); (derived from Fl_Valuator) in my 
subclass (derived from Fl_Value_Output, derived from 
Fl_Valuator) instead of draw()?

like this:

class Glide_Rate: public Fl_Value_Output
{
    void format(const char* buf);
public:
    Glide_Rate(int x, int y, int w, int h, char const* label = 0) :
                Fl_Value_Output(x, y, w, h, label)
        {
                ;
        }
};

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

Reply via email to