diff options
author | jcid <devnull@localhost> | 2008-10-05 18:43:23 +0200 |
---|---|---|
committer | jcid <devnull@localhost> | 2008-10-05 18:43:23 +0200 |
commit | 08d630de498346b85ab160742ace332692e3dd73 (patch) | |
tree | 1b89d628f2e561be14248d6f98371d1da3b3eb20 /dw | |
parent | acac1e2b0b0d88e02512344b3d3650e31e161122 (diff) |
- Fixed check and radio buttons size_request.
Diffstat (limited to 'dw')
-rw-r--r-- | dw/fltkui.cc | 16 | ||||
-rw-r--r-- | dw/fltkui.hh | 5 |
2 files changed, 17 insertions, 4 deletions
diff --git a/dw/fltkui.cc b/dw/fltkui.cc index 8c3d9829..7b867797 100644 --- a/dw/fltkui.cc +++ b/dw/fltkui.cc @@ -678,10 +678,18 @@ template <class I> template <class I> void FltkToggleButtonResource<I>::sizeRequest (core::Requisition *requisition) { - /** \bug Random values. */ - requisition->width = 20; - requisition->ascent = 18; - requisition->descent = 5; + FltkFont *font = getFont(); + + if (font) { + ::fltk::setfont(font->font, font->size); + requisition->width = font->ascent + font->descent + 2*RELIEF_X_THICKNESS; + requisition->ascent = font->ascent + RELIEF_Y_THICKNESS; + requisition->descent = font->descent + RELIEF_Y_THICKNESS; + } else { + requisition->width = 1; + requisition->ascent = 1; + requisition->descent = 0; + } } diff --git a/dw/fltkui.hh b/dw/fltkui.hh index 4de99d27..a027a41b 100644 --- a/dw/fltkui.hh +++ b/dw/fltkui.hh @@ -350,6 +350,8 @@ private: protected: virtual ::fltk::Button *createNewButton (core::Allocation *allocation) = 0; + // TODO: maybe getFont() is not the best way to do it... + virtual FltkFont *getFont() = 0; ::fltk::Widget *createNewWidget (core::Allocation *allocation); public: @@ -367,6 +369,8 @@ public: class FltkCheckButtonResource: public FltkToggleButtonResource <dw::core::ui::CheckButtonResource> { +private: + FltkFont *getFont() {return style ? (FltkFont *)style->font : NULL;} protected: ::fltk::Button *createNewButton (core::Allocation *allocation); @@ -427,6 +431,7 @@ private: Group *group; static void widgetCallback (::fltk::Widget *widget, void *data); + FltkFont *getFont() {return style ? (FltkFont *)style->font : NULL;} void buttonClicked (); protected: |