On 10.12.2011, at 21:34, Greg Ercolano wrote:

>> A global option to disable '@' processing
> 
>    On a slightly related tangent, one of the few things I've had
>    to actually /modify/ fltk for to support my commercial app is
>    adding ANSI escape sequences (eg. \033[xxx) to control per-character
>    foreground and background color attributes in Fl_Browser.

OK guys, I think we are trying to reinvent the wheel here.

First of, using Fl::option is plain wrong, because this is nothing the user 
should set. Fl::option is an interface for the user to say, if he prefers the 
native file chooser, or how tab works in FLTK apps, but not for programming 
details.

Secondly, a global option is also wrong. Imagine you want to link your app with 
another FLTK widget developed by someone else. Maybe that widget depends on the 
@ prefix. Now if we can globally enable and disable it, this widget may no 
longer work.

Let's follow Obi Wan Kenobis suggestion and use the source, Luke. In the code 
below, you will see that we had an option to enable and disable the @ prefix 
all along, using the label type FL_NORMAL_LABEL or FL_SYMBOL_LABEL. At some 
point, someone must have thought that the @ should always be enabled and made 
them the same.

Now all we have to do is make those two different values again, and all labels 
will now have their own flag for @ handling. Even better, we can add another 
248 label types, for example one for VT100 interpretation, and even one for 
HTML encoded labels.

Cool?

 - Matthias

PS: MULTI_LABEL, ICON_LABEL and IMAGE LABEL are rather dubious comrades. It 
would be nice to find better interfaces for 3.0.

---

/**
   The labeltype() method sets the type of the label.
   
   The following standard label types are included:
   
   \todo        The doxygen comments are incomplete, and some labeltypes
                are starting with an underscore. Also, there are three
                external functions undocumented (yet):
                  - fl_define_FL_SHADOW_LABEL()
                  - fl_define_FL_ENGRAVED_LABEL()
                  - fl_define_FL_EMBOSSED_LABEL()
*/
enum Fl_Labeltype {     // labeltypes:
  FL_NORMAL_LABEL       = 0,    ///< draws the text (0)
  FL_NO_LABEL,                  ///< does nothing
  _FL_SHADOW_LABEL,             ///< draws a drop shadow under the text
  _FL_ENGRAVED_LABEL,           ///< draws edges as though the text is engraved
  _FL_EMBOSSED_LABEL,           ///< draws edges as thought the text is raised
  _FL_MULTI_LABEL,              ///< ?
  _FL_ICON_LABEL,               ///< draws the icon associated with the text
  _FL_IMAGE_LABEL,              ///< ?

  FL_FREE_LABELTYPE             ///< first free labeltype to use for creating 
own labeltypes
};

/** 
  Sets the current  label type end return its corresponding Fl_Labeltype value. 
  @{
*/
#define FL_SYMBOL_LABEL FL_NORMAL_LABEL
extern Fl_Labeltype FL_EXPORT fl_define_FL_SHADOW_LABEL();
#define FL_SHADOW_LABEL fl_define_FL_SHADOW_LABEL()
extern Fl_Labeltype FL_EXPORT fl_define_FL_ENGRAVED_LABEL();
#define FL_ENGRAVED_LABEL fl_define_FL_ENGRAVED_LABEL()
extern Fl_Labeltype FL_EXPORT fl_define_FL_EMBOSSED_LABEL();
#define FL_EMBOSSED_LABEL fl_define_FL_EMBOSSED_LABEL()

_______________________________________________
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to