From 7fd13acab19dd449343fe8357946aa0c97d97f77 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20L=C3=BCbking?= <thomas.luebking@gmail.com>
Date: Wed, 14 Sep 2016 18:09:58 +0200
Subject: button: export pressed state and assigned commands

latter protected only.
---
 src/FbTk/Button.hh | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/FbTk/Button.hh b/src/FbTk/Button.hh
index c3276a6..7a8cf56 100644
--- a/src/FbTk/Button.hh
+++ b/src/FbTk/Button.hh
@@ -47,6 +47,7 @@ public:
     /// sets the pixmap to be viewed when the button is pressed
     virtual void setPressedPixmap(Pixmap pm);
     virtual void setPressedColor(const FbTk::Color &color);
+    bool isPressed() const { return m_pressed; }
     /// sets graphic context for drawing
     void setGC(GC gc) { m_gc = gc; }
     /// sets background pixmap, this will override background color
@@ -79,6 +80,12 @@ public:
     Pixmap pressedPixmap() const { return m_pressed_pm; }
     const Color &backgroundColor() const { return m_background_color; }
     const Color &pressedColor() const { return m_pressed_color; }
+protected:
+    RefCount<Command<void> > command(int button) const {
+        if (button < 2) return m_onclick[0];
+        if (button > 4) return m_onclick[4];
+        return m_onclick[button - 1];
+    }
 private:
     Pixmap m_background_pm; ///< background pixmap
     Color m_background_color; ///< background color
-- 
cgit v0.11.2