aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-10-13 23:43:11 (GMT)
committerfluxgen <fluxgen>2003-10-13 23:43:11 (GMT)
commit2aef1e67c3fa06157b7607462463f796e881c215 (patch)
tree6b9183f9d9e4a0d84815f5c130db65640af04050
parent9911b38f8df93871542e3a7cdd5611e42e9bd106 (diff)
downloadfluxbox_pavel-2aef1e67c3fa06157b7607462463f796e881c215.zip
fluxbox_pavel-2aef1e67c3fa06157b7607462463f796e881c215.tar.bz2
added pressed color
-rw-r--r--src/FbTk/Button.cc11
-rw-r--r--src/FbTk/Button.hh4
2 files changed, 13 insertions, 2 deletions
diff --git a/src/FbTk/Button.cc b/src/FbTk/Button.cc
index bcbde70..03e1386 100644
--- a/src/FbTk/Button.cc
+++ b/src/FbTk/Button.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Button.cc,v 1.15 2003/09/10 21:24:36 fluxgen Exp $ 22// $Id: Button.cc,v 1.16 2003/10/13 23:43:11 fluxgen Exp $
23 23
24#include "Button.hh" 24#include "Button.hh"
25 25
@@ -36,6 +36,7 @@ Button::Button(int screen_num, int x, int y,
36 m_foreground_pm(0), 36 m_foreground_pm(0),
37 m_background_pm(0), 37 m_background_pm(0),
38 m_pressed_pm(0), 38 m_pressed_pm(0),
39 m_pressed_color("black", screen_num),
39 m_gc(DefaultGC(FbTk::App::instance()->display(), screen_num)), 40 m_gc(DefaultGC(FbTk::App::instance()->display(), screen_num)),
40 m_pressed(false) { 41 m_pressed(false) {
41 42
@@ -50,6 +51,7 @@ Button::Button(const FbWindow &parent, int x, int y,
50 m_foreground_pm(0), 51 m_foreground_pm(0),
51 m_background_pm(0), 52 m_background_pm(0),
52 m_pressed_pm(0), 53 m_pressed_pm(0),
54 m_pressed_color("black", parent.screenNumber()),
53 m_gc(DefaultGC(FbTk::App::instance()->display(), screenNumber())), 55 m_gc(DefaultGC(FbTk::App::instance()->display(), screenNumber())),
54 m_pressed(false) { 56 m_pressed(false) {
55 // add this to eventmanager 57 // add this to eventmanager
@@ -76,6 +78,10 @@ void Button::setPressedPixmap(Pixmap pm) {
76 m_pressed_pm = pm; 78 m_pressed_pm = pm;
77} 79}
78 80
81void Button::setPressedColor(const FbTk::Color &color) {
82 m_pressed_color = color;
83}
84
79void Button::setBackgroundColor(const Color &color) { 85void Button::setBackgroundColor(const Color &color) {
80 m_background_pm = 0; // we're using background color now 86 m_background_pm = 0; // we're using background color now
81 m_background_color = color; 87 m_background_color = color;
@@ -90,6 +96,9 @@ void Button::setBackgroundPixmap(Pixmap pm) {
90void Button::buttonPressEvent(XButtonEvent &event) { 96void Button::buttonPressEvent(XButtonEvent &event) {
91 if (m_pressed_pm != 0) 97 if (m_pressed_pm != 0)
92 FbWindow::setBackgroundPixmap(m_pressed_pm); 98 FbWindow::setBackgroundPixmap(m_pressed_pm);
99 else if (m_pressed_color.isAllocated())
100 FbWindow::setBackgroundColor(m_pressed_color);
101
93 m_pressed = true; 102 m_pressed = true;
94 clear(); 103 clear();
95 updateTransparent(); 104 updateTransparent();
diff --git a/src/FbTk/Button.hh b/src/FbTk/Button.hh
index 2bbe74b..dbbdeda 100644
--- a/src/FbTk/Button.hh
+++ b/src/FbTk/Button.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Button.hh,v 1.6 2003/09/10 21:23:36 fluxgen Exp $ 22// $Id: Button.hh,v 1.7 2003/10/13 23:43:11 fluxgen Exp $
23 23
24#ifndef FBTK_BUTTON_HH 24#ifndef FBTK_BUTTON_HH
25#define FBTK_BUTTON_HH 25#define FBTK_BUTTON_HH
@@ -50,6 +50,7 @@ public:
50 void setPixmap(Pixmap pm); 50 void setPixmap(Pixmap pm);
51 /// sets the pixmap to be viewed when the button is pressed 51 /// sets the pixmap to be viewed when the button is pressed
52 void setPressedPixmap(Pixmap pm); 52 void setPressedPixmap(Pixmap pm);
53 void setPressedColor(const FbTk::Color &color);
53 /// sets graphic context for drawing 54 /// sets graphic context for drawing
54 void setGC(GC gc) { m_gc = gc; } 55 void setGC(GC gc) { m_gc = gc; }
55 /// sets background pixmap, this will override background color 56 /// sets background pixmap, this will override background color
@@ -78,6 +79,7 @@ private:
78 Pixmap m_background_pm; ///< background pixmap 79 Pixmap m_background_pm; ///< background pixmap
79 Color m_background_color; ///< background color 80 Color m_background_color; ///< background color
80 Pixmap m_pressed_pm; ///< pressed pixmap 81 Pixmap m_pressed_pm; ///< pressed pixmap
82 Color m_pressed_color;
81 GC m_gc; ///< graphic context for button 83 GC m_gc; ///< graphic context for button
82 bool m_pressed; ///< if the button is pressed 84 bool m_pressed; ///< if the button is pressed
83 RefCount<Command> m_onclick[5]; ///< what to do when this button is clicked with button num 85 RefCount<Command> m_onclick[5]; ///< what to do when this button is clicked with button num