From: <arn...@us...> - 2008-04-07 18:50:40
|
Revision: 1098 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1098&view=rev Author: arnetheduck Date: 2008-04-07 11:50:33 -0700 (Mon, 07 Apr 2008) Log Message: ----------- help in the tab control Modified Paths: -------------- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp dcplusplus/trunk/win32/MainWindow.cpp Property Changed: ---------------- dcplusplus/trunk/ Property changes on: dcplusplus/trunk ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2008-03-30 15:48:35.204999924 +0200 committer: zouzou123gen properties: branch-nick: bzr + timestamp: 2008-03-31 14:45:49.411999941 +0200 committer: zouzou123gen properties: branch-nick: bzr Name: bzr:revision-id:v3-trunk1 - 1027 arn...@gm...-20080323183926-schknwnkgeo7ivdn 1028 zouzou123gen-20080323220411-r8usuc3qxwuh7zsn 1029 zouzou123gen-20080323221249-0su72zaj13e706mk 1030 arn...@gm...-20080324140623-muba1dl46m000o8c 1031 zouzou123gen-20080324141933-qbgr93ugpe0297m6 1032 arn...@gm...-20080324153706-siidja05n84i00b1 1033 arn...@gm...-20080324153823-lhn3awurnu77riln 1034 arn...@gm...-20080324165650-zapppziji67yf5a2 1035 zouzou123gen-20080324175936-4mqc2kh0lo5wtdu2 1036 zouzou123gen-20080325004602-6wdsoym95mjuhwd3 1037 arn...@gm...-20080325100659-8fqy6q65itmghlep 1038 zouzou123gen-20080325175216-s297sdiucukfvijh 1039 arn...@gm...-20080325210137-3dfqyoi8ykosy087 1040 arn...@gm...-20080325211747-nwwy1eb33r071sca 1041 arn...@gm...-20080326084110-qbselrjckku275xi 1042 zouzou123gen-20080326123631-35642mgbk2i4ty32 1043 zouzou123gen-20080326124345-f4xwn2d3ty8ubd6r 1044 arn...@gm...-20080326162031-il0nyms30w0mky43 1045 arn...@gm...-20080326164801-8dru8mjc06xgzjpv 1046 arn...@gm...-20080326170438-uzl2rx8fqnohak7g 1047 zouzou123gen-20080326172821-d6uqcbmfb0c6rwlv 1048 arn...@gm...-20080326213257-qlgdh7m2712p2l0q 1049 arn...@gm...-20080326214313-ktnoekgk3s0wmatz 1050 arn...@gm...-20080326215256-0j1iqrf286b9g7zf 1051 arn...@gm...-20080327082121-hoi22wh1gwjdfbyd 1052 arn...@gm...-20080327120639-um3tukdt374rwvgm 1053 zouzou123gen-20080327130703-6vtek6uxy3vua543 1054 arn...@gm...-20080327215831-dmg5mkufskabwkro 1055 arn...@gm...-20080327231459-cdztcv25alsuyqmf 1056 arn...@gm...-20080328085925-gceybsr53oml1p24 1057 arn...@gm...-20080328200512-1sjuu6bcnl2dyd2a 1058 arn...@gm...-20080328210347-bussqjrm5mfswh7o 1059 arn...@gm...-20080329055630-braiir1dskv7a4qm 1060 arn...@gm...-20080329061558-rck8dz60wpj3c5ja 1061 arn...@gm...-20080329081253-if6o5jn329mbzfpl 1062 arn...@gm...-20080329081619-cb4x930j8sp55cs0 1063 arn...@gm...-20080329103216-hgjzo7ra2zixbztd 1064 arn...@gm...-20080329124042-q3aw4iodmo5kafyp 1065 arn...@gm...-20080329124926-2je1z18p0272zpua 1066 arn...@gm...-20080329150901-ehj9t32en7eps2dp 1067 zouzou123gen-20080329153653-36xlvpik2ns9r84r 1068 zouzou123gen-20080329162703-51xr8hg073pg7wq5 1069 zouzou123gen-20080329234706-8ddipdqu0xeudkql 1070 arn...@gm...-20080330081232-ubqr1171ewalrd4q 1071 zouzou123gen-20080330131607-yppbs3mgyjef1cux 1072 zouzou123gen-20080330134835-yv1nogy77ib1uehd + 1027 arn...@gm...-20080323183926-schknwnkgeo7ivdn 1028 zouzou123gen-20080323220411-r8usuc3qxwuh7zsn 1029 zouzou123gen-20080323221249-0su72zaj13e706mk 1030 arn...@gm...-20080324140623-muba1dl46m000o8c 1031 zouzou123gen-20080324141933-qbgr93ugpe0297m6 1032 arn...@gm...-20080324153706-siidja05n84i00b1 1033 arn...@gm...-20080324153823-lhn3awurnu77riln 1034 arn...@gm...-20080324165650-zapppziji67yf5a2 1035 zouzou123gen-20080324175936-4mqc2kh0lo5wtdu2 1036 zouzou123gen-20080325004602-6wdsoym95mjuhwd3 1037 arn...@gm...-20080325100659-8fqy6q65itmghlep 1038 zouzou123gen-20080325175216-s297sdiucukfvijh 1039 arn...@gm...-20080325210137-3dfqyoi8ykosy087 1040 arn...@gm...-20080325211747-nwwy1eb33r071sca 1041 arn...@gm...-20080326084110-qbselrjckku275xi 1042 zouzou123gen-20080326123631-35642mgbk2i4ty32 1043 zouzou123gen-20080326124345-f4xwn2d3ty8ubd6r 1044 arn...@gm...-20080326162031-il0nyms30w0mky43 1045 arn...@gm...-20080326164801-8dru8mjc06xgzjpv 1046 arn...@gm...-20080326170438-uzl2rx8fqnohak7g 1047 zouzou123gen-20080326172821-d6uqcbmfb0c6rwlv 1048 arn...@gm...-20080326213257-qlgdh7m2712p2l0q 1049 arn...@gm...-20080326214313-ktnoekgk3s0wmatz 1050 arn...@gm...-20080326215256-0j1iqrf286b9g7zf 1051 arn...@gm...-20080327082121-hoi22wh1gwjdfbyd 1052 arn...@gm...-20080327120639-um3tukdt374rwvgm 1053 zouzou123gen-20080327130703-6vtek6uxy3vua543 1054 arn...@gm...-20080327215831-dmg5mkufskabwkro 1055 arn...@gm...-20080327231459-cdztcv25alsuyqmf 1056 arn...@gm...-20080328085925-gceybsr53oml1p24 1057 arn...@gm...-20080328200512-1sjuu6bcnl2dyd2a 1058 arn...@gm...-20080328210347-bussqjrm5mfswh7o 1059 arn...@gm...-20080329055630-braiir1dskv7a4qm 1060 arn...@gm...-20080329061558-rck8dz60wpj3c5ja 1061 arn...@gm...-20080329081253-if6o5jn329mbzfpl 1062 arn...@gm...-20080329081619-cb4x930j8sp55cs0 1063 arn...@gm...-20080329103216-hgjzo7ra2zixbztd 1064 arn...@gm...-20080329124042-q3aw4iodmo5kafyp 1065 arn...@gm...-20080329124926-2je1z18p0272zpua 1066 arn...@gm...-20080329150901-ehj9t32en7eps2dp 1067 zouzou123gen-20080329153653-36xlvpik2ns9r84r 1068 zouzou123gen-20080329162703-51xr8hg073pg7wq5 1069 zouzou123gen-20080329234706-8ddipdqu0xeudkql 1070 arn...@gm...-20080330081232-ubqr1171ewalrd4q 1071 zouzou123gen-20080330131607-yppbs3mgyjef1cux 1072 zouzou123gen-20080330134835-yv1nogy77ib1uehd 1073 zouzou123gen-20080331124549-alyw7vugdn30piqy Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h 2008-04-07 18:49:38 UTC (rev 1097) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h 2008-04-07 18:50:33 UTC (rev 1098) @@ -18,6 +18,10 @@ public AspectRaw<WidgetTabView>, public AspectSizable<WidgetTabView> { + typedef std::tr1::function<void (const SmartUtil::tstring&)> TitleChangedFunction; + typedef std::tr1::function<void (HWND, unsigned)> HelpFunction; + typedef std::tr1::function<bool (const ScreenCoordinate&)> ContextMenuFunction; + public: /// Class type typedef WidgetTabView ThisType; @@ -48,12 +52,16 @@ SmartUtil::tstring getTabText(WidgetChildWindow* w); - void onTitleChanged(const std::tr1::function<void (const SmartUtil::tstring&)>& f) { + void onTitleChanged(const TitleChangedFunction& f) { titleChangedFunction = f; } - void onTabContextMenu(WidgetChildWindow* w, const std::tr1::function<bool (const ScreenCoordinate& pt)>& f); + void onHelp(const HelpFunction& f) { + helpFunction = f; + } + void onTabContextMenu(WidgetChildWindow* w, const ContextMenuFunction& f); + bool filter(const MSG& msg); TabSheet::ObjectType getTab(); @@ -75,7 +83,7 @@ struct TabInfo { TabInfo(WidgetChildWindow* w_) : w(w_) { } WidgetChildWindow* w; - std::tr1::function<bool (const ScreenCoordinate& pt)> handleContextMenu; + ContextMenuFunction handleContextMenu; }; static WindowClass windowClass; @@ -83,7 +91,8 @@ TabSheet::ObjectType tab; ToolTip::ObjectType tip; - std::tr1::function<void (const SmartUtil::tstring&)> titleChangedFunction; + TitleChangedFunction titleChangedFunction; + HelpFunction helpFunction; bool toggleActive; @@ -114,6 +123,7 @@ void handleLeftMouseUp(const MouseEventResult& mouseEventResult); bool handleContextMenu(SmartWin::ScreenCoordinate pt); void handleMiddleMouseDown(const MouseEventResult& mouseEventResult); + void handleHelp(HWND hWnd, unsigned id); SmartUtil::tstring formatTitle(SmartUtil::tstring title); void layout(); Modified: dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp =================================================================== --- dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp 2008-04-07 18:49:38 UTC (rev 1097) +++ dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp 2008-04-07 18:50:33 UTC (rev 1098) @@ -37,6 +37,7 @@ tab->onLeftMouseUp(std::tr1::bind(&WidgetTabView::handleLeftMouseUp, this, _1)); tab->onContextMenu(std::tr1::bind(&WidgetTabView::handleContextMenu, this, _1)); tab->onMiddleMouseDown(std::tr1::bind(&WidgetTabView::handleMiddleMouseDown, this, _1)); + tab->onHelp(std::tr1::bind(&WidgetTabView::handleHelp, this, _1, _2)); tip = WidgetCreator<ToolTip>::attach(this, tab->getToolTips()); // created and managed by the tab control thanks to the TCS_TOOLTIPS style if(tip) { @@ -104,7 +105,7 @@ return SmartUtil::tstring(); } -void WidgetTabView::onTabContextMenu(WidgetChildWindow* w, const std::tr1::function<bool (const ScreenCoordinate& pt)>& f) { +void WidgetTabView::onTabContextMenu(WidgetChildWindow* w, const ContextMenuFunction& f) { TabInfo* ti = getTabInfo(w); if(ti) { ti->handleContextMenu = f; @@ -378,6 +379,18 @@ ti->w->close(); } +void WidgetTabView::handleHelp(HWND hWnd, unsigned id) { + if(helpFunction) { + // hWnd and id are those of the whole tab control; not those of the specific tab on which the user wants help for + TabInfo* ti = getTabInfo(tab->hitTest(ScreenCoordinate(Point::fromLParam(::GetMessagePos())))); + if(ti) + id = ti->w->getHelpId(); + + // even if no tab was found below the cursor, forward the message to the application so that it can display its default help + helpFunction(hWnd, id); + } +} + bool WidgetTabView::filter(const MSG& msg) { if(tip) tip->relayEvent(msg); Modified: dcplusplus/trunk/win32/MainWindow.cpp =================================================================== --- dcplusplus/trunk/win32/MainWindow.cpp 2008-04-07 18:49:38 UTC (rev 1097) +++ dcplusplus/trunk/win32/MainWindow.cpp 2008-04-07 18:50:33 UTC (rev 1098) @@ -171,7 +171,9 @@ cs.icon = SmartWin::IconPtr(new SmartWin::Icon(IDR_MAINFRAME)); cs.background = (HBRUSH)(COLOR_3DFACE + 1); createWindow(cs); - + + setHelpId(IDH_STARTPAGE); + paned = createHPaned(); paned->setRelativePos(0.7); } @@ -318,6 +320,7 @@ cs.toggleActive = BOOLSETTING(TOGGLE_ACTIVE_WINDOW); tabs = createTabView(cs); tabs->onTitleChanged(std::tr1::bind(&MainWindow::handleTabsTitleChanged, this, _1)); + tabs->onHelp(std::tr1::bind(&WinUtil::help, _1, _2)); paned->setFirst(tabs); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |