diff --git a/data/skins/default/sheet.png b/data/skins/default/sheet.png index 983a538e3..ec2cad030 100644 Binary files a/data/skins/default/sheet.png and b/data/skins/default/sheet.png differ diff --git a/src/app/ui/button_set.cpp b/src/app/ui/button_set.cpp index ca3d963ca..4002f2af5 100644 --- a/src/app/ui/button_set.cpp +++ b/src/app/ui/button_set.cpp @@ -70,8 +70,14 @@ void ButtonSet::Item::onPaint(ui::PaintEvent& ev) g->fillRect(getBgColor(), g->getClipBounds()); if (isSelected() || hasMouseOver()) { - nw = PART_TOOLBUTTON_HOT_NW; - face = theme->colors.buttonHotFace(); + if (hasCapture()) { + nw = PART_TOOLBUTTON_PUSHED_NW; + face = theme->colors.buttonSelectedFace(); + } + else { + nw = PART_TOOLBUTTON_HOT_NW; + face = theme->colors.buttonHotFace(); + } } else { nw = PART_TOOLBUTTON_LAST_NW; @@ -85,9 +91,13 @@ void ButtonSet::Item::onPaint(ui::PaintEvent& ev) theme->draw_bounds_nw(g, rc, nw, face); if (m_icon) { - g->drawRgbaSurface(m_icon, - rc.x + rc.w/2 - m_icon->width()/2, - rc.y + rc.h/2 - m_icon->height()/2 - 1*guiscale()); + int u = rc.x + rc.w/2 - m_icon->width()/2; + int v = rc.y + rc.h/2 - m_icon->height()/2 - 1*guiscale(); + + if (isSelected() && hasCapture()) + g->drawColoredRgbaSurface(m_icon, theme->colors.buttonSelectedText(), u, v); + else + g->drawRgbaSurface(m_icon, u, v); } } @@ -98,6 +108,8 @@ bool ButtonSet::Item::onProcessMessage(ui::Message* msg) case ui::kMouseDownMessage: captureMouse(); buttonSet()->setSelectedItem(this); + invalidate(); + if (!buttonSet()->m_triggerOnMouseUp) buttonSet()->onItemChange(); break; @@ -105,6 +117,8 @@ bool ButtonSet::Item::onProcessMessage(ui::Message* msg) case ui::kMouseUpMessage: if (hasCapture()) { releaseMouse(); + invalidate(); + if (buttonSet()->m_triggerOnMouseUp) buttonSet()->onItemChange(); } diff --git a/src/ui/graphics.cpp b/src/ui/graphics.cpp index a0be1c08a..475679fb4 100644 --- a/src/ui/graphics.cpp +++ b/src/ui/graphics.cpp @@ -11,6 +11,7 @@ #include "ui/graphics.h" #include "base/string.h" +#include "gfx/clip.h" #include "gfx/point.h" #include "gfx/rect.h" #include "gfx/region.h" @@ -148,6 +149,14 @@ void Graphics::drawRgbaSurface(she::Surface* surface, int x, int y) dst->drawRgbaSurface(src, m_dx+x, m_dy+y); } +void Graphics::drawColoredRgbaSurface(she::Surface* surface, gfx::Color color, int x, int y) +{ + she::ScopedSurfaceLock src(surface); + she::ScopedSurfaceLock dst(m_surface); + dst->drawColoredRgbaSurface(src, color, gfx::ColorNone, + gfx::Clip(m_dx+x, m_dy+y, 0, 0, surface->width(), surface->height())); +} + void Graphics::blit(she::Surface* srcSurface, int srcx, int srcy, int dstx, int dsty, int w, int h) { she::ScopedSurfaceLock src(srcSurface); diff --git a/src/ui/graphics.h b/src/ui/graphics.h index 57b18c3a4..47013fba0 100644 --- a/src/ui/graphics.h +++ b/src/ui/graphics.h @@ -67,6 +67,7 @@ namespace ui { void drawSurface(she::Surface* surface, int x, int y); void drawRgbaSurface(she::Surface* surface, int x, int y); + void drawColoredRgbaSurface(she::Surface* surface, gfx::Color color, int x, int y); void blit(she::Surface* src, int srcx, int srcy, int dstx, int dsty, int w, int h); diff --git a/src/ui/widget.cpp b/src/ui/widget.cpp index c4b47e994..91fac1ff8 100644 --- a/src/ui/widget.cpp +++ b/src/ui/widget.cpp @@ -1263,7 +1263,7 @@ void Widget::offerCapture(ui::MouseMessage* mouseMsg, int widget_type) { if (hasCapture()) { Widget* pick = getManager()->pick(mouseMsg->position()); - if (pick && pick->getType() == widget_type) { + if (pick && pick != this && pick->getType() == widget_type) { releaseMouse(); MouseMessage* mouseMsg2 = new MouseMessage(