button: export pressed state and assigned commands

latter protected only.
This commit is contained in:
Thomas Lübking 2016-09-14 18:09:58 +02:00 committed by Mathias Gumz
parent 1fc2602499
commit 7fd13acab1

View file

@ -47,6 +47,7 @@ public:
/// sets the pixmap to be viewed when the button is pressed /// sets the pixmap to be viewed when the button is pressed
virtual void setPressedPixmap(Pixmap pm); virtual void setPressedPixmap(Pixmap pm);
virtual void setPressedColor(const FbTk::Color &color); virtual void setPressedColor(const FbTk::Color &color);
bool isPressed() const { return m_pressed; }
/// sets graphic context for drawing /// sets graphic context for drawing
void setGC(GC gc) { m_gc = gc; } void setGC(GC gc) { m_gc = gc; }
/// sets background pixmap, this will override background color /// sets background pixmap, this will override background color
@ -79,6 +80,12 @@ public:
Pixmap pressedPixmap() const { return m_pressed_pm; } Pixmap pressedPixmap() const { return m_pressed_pm; }
const Color &backgroundColor() const { return m_background_color; } const Color &backgroundColor() const { return m_background_color; }
const Color &pressedColor() const { return m_pressed_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: private:
Pixmap m_background_pm; ///< background pixmap Pixmap m_background_pm; ///< background pixmap
Color m_background_color; ///< background color Color m_background_color; ///< background color