[aseprite] 39/134: Fix SkinTheme::paintMenuItem() for non AppMenuItem items (e.g. app::NotificationItem)
Tobias Hansen
thansen at moszumanska.debian.org
Sat Mar 14 17:10:00 UTC 2015
This is an automated email from the git hooks/post-receive script.
thansen pushed a commit to branch master
in repository aseprite.
commit dc299423840825e79845dccc78d39074b5affc7d
Author: David Capello <davidcapello at gmail.com>
Date: Thu Nov 6 18:41:18 2014 -0300
Fix SkinTheme::paintMenuItem() for non AppMenuItem items (e.g. app::NotificationItem)
---
src/app/ui/skin/skin_theme.cpp | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/app/ui/skin/skin_theme.cpp b/src/app/ui/skin/skin_theme.cpp
index e05842e..2fdf37d 100644
--- a/src/app/ui/skin/skin_theme.cpp
+++ b/src/app/ui/skin/skin_theme.cpp
@@ -1244,7 +1244,7 @@ void SkinTheme::paintMenuItem(ui::PaintEvent& ev)
{
int scale = jguiscale();
Graphics* g = ev.getGraphics();
- AppMenuItem* widget = static_cast<AppMenuItem*>(ev.getSource());
+ MenuItem* widget = static_cast<MenuItem*>(ev.getSource());
gfx::Rect bounds = widget->getClientBounds();
gfx::Color fg, bg;
int c, bar;
@@ -1326,17 +1326,19 @@ void SkinTheme::paintMenuItem(ui::PaintEvent& ev)
}
}
// Draw the keyboard shortcut
- else if (widget->getKey() && !widget->getKey()->accels().empty()) {
- int old_align = widget->getAlign();
+ else if (AppMenuItem* appMenuItem = dynamic_cast<AppMenuItem*>(widget)) {
+ if (appMenuItem->getKey() && !appMenuItem->getKey()->accels().empty()) {
+ int old_align = appMenuItem->getAlign();
- pos = bounds;
- pos.w -= widget->child_spacing/4;
+ pos = bounds;
+ pos.w -= widget->child_spacing/4;
- std::string buf = widget->getKey()->accels().front().toString();
+ std::string buf = appMenuItem->getKey()->accels().front().toString();
- widget->setAlign(JI_RIGHT | JI_MIDDLE);
- drawTextString(g, buf.c_str(), fg, ColorNone, widget, pos, 0);
- widget->setAlign(old_align);
+ widget->setAlign(JI_RIGHT | JI_MIDDLE);
+ drawTextString(g, buf.c_str(), fg, ColorNone, widget, pos, 0);
+ widget->setAlign(old_align);
+ }
}
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git
More information about the Pkg-games-commits
mailing list