]> Dogcows Code - chaz/openbox/blobdiff - otk/button.cc
alloc colors only when needed, and free them properly on destruction
[chaz/openbox] / otk / button.cc
index 8d63ed0c3b71a6268b353904d31040a668907ddd..774aa11bf87eeb10e03a9a332604074297b21737 100644 (file)
@@ -1,15 +1,14 @@
 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
 
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
+#include "config.h"
 
 #include "button.hh"
 
 namespace otk {
 
 Button::Button(Widget *parent)
-  : Label(parent), _default(false), _pressed(false)
+  : Label(parent),
+    _pressed(false)
 {
   setHorizontalJustify(RenderStyle::CenterJustify);
   setVerticalJustify(RenderStyle::CenterJustify);
@@ -53,16 +52,9 @@ void Button::buttonReleaseHandler(const XButtonEvent &e)
   release(e.button);
 }
 
-void Button::setDefault(bool d)
-{
-  _default = d;
-  styleChanged(*RenderStyle::style(screen()));
-  refresh();
-}
-
 void Button::styleChanged(const RenderStyle &style)
 {
-  if (_default) {
+  if (isHighlighted()) {
     if (_pressed)
       _texture = style.buttonPressFocusBackground();
     else
@@ -75,7 +67,7 @@ void Button::styleChanged(const RenderStyle &style)
       _texture = style.buttonUnpressUnfocusBackground();
     _forecolor = style.buttonUnfocusColor();
   }
-  Widget::styleChanged(style);
+  refresh();
 }
 
 }
This page took 0.022043 seconds and 4 git commands to generate.