linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #04179
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2537: respect gradients when partially painting a themed element
------------------------------------------------------------
revno: 2537
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sat 2011-05-28 17:12:11 +0200
message:
respect gradients when partially painting a themed element
modified:
dwt/include/dwt/Theme.h
dwt/src/Theme.cpp
dwt/src/widgets/Splitter.cpp
win32/WinUtil.cpp
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dwt/include/dwt/Theme.h'
--- dwt/include/dwt/Theme.h 2011-05-07 18:52:09 +0000
+++ dwt/include/dwt/Theme.h 2011-05-28 15:12:11 +0000
@@ -36,6 +36,8 @@
#include <uxtheme.h>
+#include <boost/optional/optional.hpp>
+
namespace dwt {
/** helper class to manage a theme. this class:
@@ -52,8 +54,9 @@
/**
* @param drawParent if false, you have to call isThemeBackgroundPartiallyTransparent and handle
* drawing the transparent bits yourself.
+ * @param clip only draw within this rectangle (useful for partial painting from a PaintCanvas).
*/
- void drawBackground(Canvas& canvas, int part, int state, const Rectangle& rect, bool drawParent = true);
+ void drawBackground(Canvas& canvas, int part, int state, const Rectangle& rect, bool drawParent = true, boost::optional<Rectangle> clip = 0);
/**
* @param textFlags see the DrawText doc for possible values.
* @param color text color, or NaC for the default theme color.
=== modified file 'dwt/src/Theme.cpp'
--- dwt/src/Theme.cpp 2011-05-07 18:52:09 +0000
+++ dwt/src/Theme.cpp 2011-05-28 15:12:11 +0000
@@ -115,12 +115,13 @@
}
}
-void Theme::drawBackground(Canvas& canvas, int part, int state, const Rectangle& rect, bool drawParent) {
+void Theme::drawBackground(Canvas& canvas, int part, int state, const Rectangle& rect, bool drawParent, boost::optional<Rectangle> clip) {
::RECT rc = rect;
+ boost::optional<::RECT> rcClip(clip);
if(drawParent && isBackgroundPartiallyTransparent(part, state)) {
- DrawThemeParentBackground(w->handle(), canvas.handle(), &rc);
+ DrawThemeParentBackground(w->handle(), canvas.handle(), clip ? &rcClip.get() : &rc);
}
- DrawThemeBackground(theme, canvas.handle(), part, state, &rc, 0);
+ DrawThemeBackground(theme, canvas.handle(), part, state, &rc, clip ? &rcClip.get() : 0);
}
void Theme::drawText(Canvas& canvas, int part, int state, const tstring& text, unsigned textFlags, const Rectangle& rect, COLORREF color) {
=== modified file 'dwt/src/widgets/Splitter.cpp'
--- dwt/src/widgets/Splitter.cpp 2011-05-27 18:05:51 +0000
+++ dwt/src/widgets/Splitter.cpp 2011-05-28 15:12:11 +0000
@@ -61,12 +61,12 @@
void Splitter::handlePainting(PaintCanvas& canvas) {
if(theme) {
+ Rectangle rect(getClientSize());
// don't draw edges.
- Rectangle rect(canvas.getPaintRect());
(horizontal ? rect.pos.x : rect.pos.y) -= 2;
(horizontal ? rect.size.x : rect.size.y) += 4;
- theme.drawBackground(canvas, WP_CAPTION, hovering ? CS_ACTIVE : CS_INACTIVE, rect);
+ theme.drawBackground(canvas, WP_CAPTION, hovering ? CS_ACTIVE : CS_INACTIVE, rect, true, canvas.getPaintRect());
} else if(hovering) {
// safe to assume that the text color is different enough from the default background.
=== modified file 'win32/WinUtil.cpp'
--- win32/WinUtil.cpp 2011-05-27 11:03:29 +0000
+++ win32/WinUtil.cpp 2011-05-28 15:12:11 +0000
@@ -566,7 +566,7 @@
int b = SettingsManager::getInstance()->get((SettingsManager::IntSetting)n.balloon);
if(b == SettingsManager::BALLOON_ALWAYS || (b == SettingsManager::BALLOON_BACKGROUND && !mainWindow->onForeground())) {
- mainWindow->notify(Text::toT(n.title), balloonText, createIcon(n.icon, 16));
+ mainWindow->notify(T_(n.title), balloonText, createIcon(n.icon, 16));
}
}