> ­Can you show me some of your work, using FLTK with some "modern" C++? Just 
> so as I know how to do that.

The templates belong to the modern C++, aren't ? ;-)
For example, I use them to create "highlighted" buttons:

template<class T> class Fl_Simple_Highlight : public T
{
public:
    Fl_Simple_Highlight(int x, int y, int w, int h, const char* l=0)
        :T(x,y,w,h,l)
        ,hover_(false)
        ,keep_color_(FL_WHITE)
    { }
    virtual void draw() {
        if (hover_ && active_r())
            predraw();
        T::draw();
        if (hover_ && active_r())
            postdraw();
    }
    virtual int handle(int event) {
        switch (event) {
        case FL_ENTER:
            hover_ = true;
            redraw();
            break;
        case FL_LEAVE:
            hover_ = false;
            redraw();
            break;
        }
        return T::handle(event);
    }
protected:
    bool hover_;
    Fl_Color keep_color_;
    virtual void predraw() {
        keep_color_ = color();
        color(fl_lighter(keep_color_));
    }
    virtual void postdraw() {
        color(keep_color_);
    }
};

Fl_Simple_Highlight<Fl_Button> *button1;
Fl_Simple_Highlight<Fl_Return_Button> *button2;
and so on...
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to