All,

I have been following FLTK for several years. When I started out using
FLTK, I chose to use 2.x because of several reasons:

1. A built-in hierarchical tree browser widget
2. A separate namespace

However, when it became clear that I would not achieve stability on
Linux and Mac with FLTK2 I switched back to FLTK 1.1.x and have been
mostly happy (using the FLU tree browser). I have not yet explored
switching to 1.3.

I would love to see 1.3 adopt the fltk namespace of the 2.x series. In
my application, as I was switching from FLTK2 to FLTK1.1.x I made some
header translations that helped me write code without a lot of #ifdef
conditionals. Might something like this be useful (perhaps in reverse of
what I have posted below) to help transition programs from 1.1.x to
1.3.x using the fltk namespace?  I include a sample below. I include
this file and can use fltk::functions in place of Fl_functions. I think
using the C++ namespace is cleaner, and easier to type. This type of
translation will be much easier if the function semantics do not change.

Of course, I also vote for a built-in hierarchical browser for FLTK 1.3.

-Eric

------ file: fltk1.h -------

#ifndef DE_FLTK1_H
#define DE_FLTK1_H

/* This header file is used to simplify some differences between FLTK
1.x and FLTK 2.x. It converts some of the old 1.x Fl_* names to be the
same as the fltk::* names found in 2.0, where other semantics are the
same. The new way is much cleaner. */

#ifdef USE_FLTK1

#include <FL/Fl_Box.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Check_Button.H>
#include <FL/Fl_Choice.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Menu_Item.H>
#include <FL/Fl_Pixmap.H>
#include <FL/Fl_Tabs.H>
#include <FL/Fl_Text_Display.H>
#include <FL/Fl_Tooltip.H>
#include <FL/Fl_Valuator.H>
#include <FL/Fl_Value_Input.H>
#include <FL/Fl_Value_Slider.H>
#include <FLU/Flu_Tree_Browser.h>

namespace fltk
{
    typedef Fl_Box InvisibleBox;
    typedef Fl_Button Button;
    typedef Fl_Check_Button CheckButton;
    typedef Fl_Choice Choice;
    typedef Fl_Double_Window Window;
    typedef Fl_Group Group;
    typedef Fl_Input Input;
    typedef Fl_Slider Slider;
    typedef Fl_Pixmap xpmImage;
    typedef Fl_Tabs TabGroup;
    typedef Fl_Text_Buffer TextBuffer;
    typedef Fl_Text_Display TextDisplay;
    typedef Fl_Tooltip Tooltip;
    typedef Fl_Valuator Valuator;
    typedef Fl_Value_Slider ValueSlider;
    typedef Fl_Widget Widget;
    typedef Flu_Tree_Browser Browser;
    enum {
        ALIGN_RIGHT = FL_ALIGN_RIGHT
    };

    const int PUSH = FL_PUSH;
    const int KEY = FL_KEYDOWN;
    const int ENTER = FL_ENTER;
    const int MOVE = FL_MOVE;
    const int HelpKey = FL_Help;
    const int LeftButton = FL_LEFT_MOUSE;
    const int DeleteKey = FL_Delete;

    inline double wait(double time_to_wait) { return
fl::wait(time_to_wait); }
    inline void lock(void) { Fl::lock(); }
    inline void unlock(void) { Fl::unlock(); }
    inline int event_key(void) { return Fl::event_key(); }
}
#endif

#endif

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

Reply via email to