Author: matt
Date: 2012-07-04 11:58:48 -0700 (Wed, 04 Jul 2012)
New Revision: 9634
Log:
FLTK3: added a default style for buttons. This seems to work quite well.

Modified:
   branches/branch-3.0/include/fltk3/Button.h
   branches/branch-3.0/include/fltk3/Style.h
   branches/branch-3.0/src/fltk3/Button.cxx

Modified: branches/branch-3.0/include/fltk3/Button.h
===================================================================
--- branches/branch-3.0/include/fltk3/Button.h  2012-07-04 15:10:05 UTC (rev 
9633)
+++ branches/branch-3.0/include/fltk3/Button.h  2012-07-04 18:58:48 UTC (rev 
9634)
@@ -84,6 +84,8 @@
    */
   class FLTK3_EXPORT Button : public Widget {
     
+    static Style* default_button_style_;
+    
     unsigned int shortcut_;
     char value_;
     char oldval;

Modified: branches/branch-3.0/include/fltk3/Style.h
===================================================================
--- branches/branch-3.0/include/fltk3/Style.h   2012-07-04 15:10:05 UTC (rev 
9633)
+++ branches/branch-3.0/include/fltk3/Style.h   2012-07-04 18:58:48 UTC (rev 
9634)
@@ -36,7 +36,7 @@
 
 
 namespace fltk3 {
-  
+    
   class Style {
     
   protected:

Modified: branches/branch-3.0/src/fltk3/Button.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Button.cxx    2012-07-04 15:10:05 UTC (rev 
9633)
+++ branches/branch-3.0/src/fltk3/Button.cxx    2012-07-04 18:58:48 UTC (rev 
9634)
@@ -32,6 +32,7 @@
 
 
 fltk3::WidgetTracker *fltk3::Button::key_release_tracker = 0;
+fltk3::Style* fltk3::Button::default_button_style_ = 0L;
 
 
 // There are a lot of subclasses, named Fl_*_Button.  Some of
@@ -228,7 +229,11 @@
 fltk3::Button::Button(int X, int Y, int W, int H, const char *L)
 : fltk3::Widget(X,Y,W,H,L) 
 {
-  box(fltk3::UP_BOX);
+  if (!default_button_style_) {
+    default_button_style_ = new Style(fltk3::default_style);
+    default_button_style_->box(fltk3::UP_BOX);
+  }
+  style(default_button_style_);
   down_box(fltk3::NO_BOX);
   value_ = oldval = 0;
   shortcut_ = 0;

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

Reply via email to