Current problems:
Groups of fltk::RadioButton must be added to one fltk::Group, which is not possible in this context. There are two alternatives:
(This is mostly solved.)
Alpha transparency should be best abstracted by FLTK itself. If not, perhaps different implementations for different window systems could be used. Then, it is for X necessary to use GCs with clipping masks.
Unfortunately, FLTK does not provide a button with Group as parent, so that children may be added to the button. dw::fltk::ui::ComplexButton does exactly this, and is, in an ugly way, a modified copy of the FLTK button.
It would be nice, if this is merged with the standard FLTK button. Furthermore, setting the type is strange.
If the files do not compile, it may be useful to create a new one from the FLTK source:
The following changes should be applied manually.
First of all, the #define's for avoiding multiple includes:
-#ifndef fltk_ComplexButton_h // fltk_Button_h formerly
-#define fltk_ComplexButton_h
+#ifndef __FLTK_COMPLEX_BUTTON_HH__
+#define __FLTK_COMPLEX_BUTTON_HH__
at the beginning and
-#endif
+#endif // __FLTK_COMPLEX_BUTTON_HH__
at the end. Then, the namespace is changed:
-namespace fltk { +namespace dw { +namespace fltk { +namespace ui {
at the beginning and
-} +} // namespace ui +} // namespace fltk +} // namespace dw
at the end. Most important, the base class is changed:
-#ifndef fltk_Widget_h
-#include "Widget.h"
-#endif
+#include <fltk/Group.h>
and
-class FL_API ComplexButton : public Widget { +class ComplexButton: public ::fltk::Group +{
Finally, for dw::fltk::ui::ComplexButton::default_style, there is a namespace conflict:
- static NamedStyle* default_style;
+ static ::fltk::NamedStyle* default_style;
First, #include's:
#include <fltk/events.h> #include <fltk/damage.h> -#include <fltk/ComplexButton.h> // <fltk/Button.h> formerly #include <fltk/Group.h> #include <fltk/Box.h> #include <stdlib.h> + +#include "fltkcomplexbutton.hh"
Second, namespaces:
+using namespace dw::fltk::ui; using namespace fltk;
Since the base class is now Group, the constructor must be changed:
-ComplexButton::ComplexButton(int x,int y,int w,int h, const char *l) : Widget(x,y,w,h,l) { +ComplexButton::ComplexButton(int x,int y,int w,int h, const char *l) : + Group(x,y,w,h,l) +{
At the end of the constructor,
+ type (NORMAL); }
must be added (I've forgotten, what this is for).
Finally, the button must draw its children (end of dw::fltk::ui::ComplexButton::draw()):
+ + for (int i = 0; i < children (); i++) + draw_child (*child (i)); }
1.5.9