all repos — fluxbox @ 2aef1e67c3fa06157b7607462463f796e881c215

custom fork of the fluxbox windowmanager

added pressed color
fluxgen fluxgen
commit

2aef1e67c3fa06157b7607462463f796e881c215

parent

9911b38f8df93871542e3a7cdd5611e42e9bd106

2 files changed, 13 insertions(+), 2 deletions(-)

jump to
M src/FbTk/Button.ccsrc/FbTk/Button.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Button.cc,v 1.15 2003/09/10 21:24:36 fluxgen Exp $ +// $Id: Button.cc,v 1.16 2003/10/13 23:43:11 fluxgen Exp $ #include "Button.hh"

@@ -36,6 +36,7 @@ ExposureMask | ButtonPressMask | ButtonReleaseMask),

m_foreground_pm(0), m_background_pm(0), m_pressed_pm(0), + m_pressed_color("black", screen_num), m_gc(DefaultGC(FbTk::App::instance()->display(), screen_num)), m_pressed(false) {

@@ -50,6 +51,7 @@ ExposureMask | ButtonPressMask | ButtonReleaseMask),

m_foreground_pm(0), m_background_pm(0), m_pressed_pm(0), + m_pressed_color("black", parent.screenNumber()), m_gc(DefaultGC(FbTk::App::instance()->display(), screenNumber())), m_pressed(false) { // add this to eventmanager

@@ -76,6 +78,10 @@ void Button::setPressedPixmap(Pixmap pm) {

m_pressed_pm = pm; } +void Button::setPressedColor(const FbTk::Color &color) { + m_pressed_color = color; +} + void Button::setBackgroundColor(const Color &color) { m_background_pm = 0; // we're using background color now m_background_color = color;

@@ -90,6 +96,9 @@

void Button::buttonPressEvent(XButtonEvent &event) { if (m_pressed_pm != 0) FbWindow::setBackgroundPixmap(m_pressed_pm); + else if (m_pressed_color.isAllocated()) + FbWindow::setBackgroundColor(m_pressed_color); + m_pressed = true; clear(); updateTransparent();
M src/FbTk/Button.hhsrc/FbTk/Button.hh

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Button.hh,v 1.6 2003/09/10 21:23:36 fluxgen Exp $ +// $Id: Button.hh,v 1.7 2003/10/13 23:43:11 fluxgen Exp $ #ifndef FBTK_BUTTON_HH #define FBTK_BUTTON_HH

@@ -50,6 +50,7 @@ /// sets foreground pixmap

void setPixmap(Pixmap pm); /// sets the pixmap to be viewed when the button is pressed void setPressedPixmap(Pixmap pm); + void setPressedColor(const FbTk::Color &color); /// sets graphic context for drawing void setGC(GC gc) { m_gc = gc; } /// sets background pixmap, this will override background color

@@ -78,6 +79,7 @@ Pixmap m_foreground_pm; ///< foreground pixmap

Pixmap m_background_pm; ///< background pixmap Color m_background_color; ///< background color Pixmap m_pressed_pm; ///< pressed pixmap + Color m_pressed_color; GC m_gc; ///< graphic context for button bool m_pressed; ///< if the button is pressed RefCount<Command> m_onclick[5]; ///< what to do when this button is clicked with button num