linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #05732
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2953: forward messages between the inner & outer tree controls
------------------------------------------------------------
revno: 2953
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Mon 2012-06-18 17:29:50 +0200
message:
forward messages between the inner & outer tree controls
modified:
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/src/widgets/Tree.cpp'
--- dwt/src/widgets/Tree.cpp 2012-06-08 15:27:48 +0000
+++ dwt/src/widgets/Tree.cpp 2012-06-18 15:29:50 +0000
@@ -47,22 +47,8 @@
Tree::TreeView::TreeView(Widget* parent) : Control(parent, ChainingDispatcher::superClass<TreeView>()) { }
bool Tree::TreeView::handleMessage(const MSG& msg, LRESULT &retVal) {
- if(BaseType::handleMessage(msg, retVal)) {
- return true;
- }
-
- if(msg.message == WM_NOTIFY) {
- // Forward tree notifications
- return getParent()->handleMessage(msg, retVal);
- }
-
- if(msg.message == WM_RBUTTONDOWN) {
- // Tree view control does strange things to rbuttondown, preventing wm_contextmenu from reaching it
- retVal = ::DefWindowProc(msg.hwnd, msg.message, msg.wParam, msg.lParam);
- return true;
- }
-
- return false;
+ // give the parent control a chance to handle messages as well.
+ return BaseType::handleMessage(msg, retVal) || getParent()->handleMessage(msg, retVal);
}
Tree::Seed::Seed() :
@@ -80,8 +66,13 @@
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; });
+ /* forward WM_SETREDRAW to the tree control handle. do it with Dispatcher::chain to avoid an
+ infinite loop. */
+ onRedrawChanged([this](bool b) -> bool {
+ MSG msg = { treeHandle(), WM_SETREDRAW, b };
+ tree->getDispatcher().chain(msg);
+ return true;
+ });
tree->onCustomDraw([this](NMTVCUSTOMDRAW& x) { return draw(x); });