linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #05303
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2856: fix tree redraw problems
------------------------------------------------------------
revno: 2856
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sat 2012-02-04 19:51:03 +0100
message:
fix tree redraw problems
modified:
dwt/include/dwt/aspects/Visible.h
dwt/src/widgets/Tree.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/aspects/Visible.h'
--- dwt/include/dwt/aspects/Visible.h 2012-01-13 20:55:20 +0000
+++ dwt/include/dwt/aspects/Visible.h 2012-02-04 18:51:03 +0000
@@ -77,16 +77,18 @@
*/
bool getVisible() const;
- /// \ingroup EventHandlersaspects::Visible
- /// Setting the event handler for the "visible" event
- /** When the visible state of the Widget has changed, this event will be raised.
- * <br>
- * A boolean parameter passed indicates if the Widget is visible or not. <br>
- * If the boolean value is true, the Widget is visible, otherwise it is
- * invisible.
- */
- void onVisibilityChanged(const typename VisibleDispatcher::F& f) {
- W().addCallback(Message( WM_SHOWWINDOW ), VisibleDispatcher(f));
+ /** Intercept visibility changes of this widget (when it is shown / hidden). */
+ void onVisibilityChanged(typename VisibleDispatcher::F f) {
+ W().addCallback(Message(WM_SHOWWINDOW), VisibleDispatcher(f));
+ }
+
+ /** Intercept WM_SETREDRAW messages (used to temporarily disable updating of a widget to
+ implement them better. Return true from the callback to disable regular processing of the
+ message. */
+ void onRedrawChanged(std::function<bool (bool)> f) {
+ W().addCallback(Message(WM_SETREDRAW), [f](const MSG& msg, LRESULT&) -> bool {
+ return f(msg.wParam);
+ });
}
/// Repaints the whole window
=== modified file 'dwt/src/widgets/Tree.cpp'
--- dwt/src/widgets/Tree.cpp 2012-01-13 20:55:20 +0000
+++ dwt/src/widgets/Tree.cpp 2012-02-04 18:51:03 +0000
@@ -78,9 +78,12 @@
BaseType::create(mySeed);
tree = WidgetCreator<TreeView>::create(this, cs);
- onSized([&](const SizedEvent& e) { layout(); });
-
- tree->onCustomDraw([=](NMTVCUSTOMDRAW& x) { return draw(x); });
+ onSized([this](const SizedEvent& e) { layout(); });
+
+ // let the tree control handle WM_SETREDRAW
+ onRedrawChanged([this](bool b) -> bool { tree->sendMessage(WM_SETREDRAW, b); return true; });
+
+ tree->onCustomDraw([this](NMTVCUSTOMDRAW& x) { return draw(x); });
setFont(cs.font);
layout();