From: <arn...@us...> - 2008-03-30 08:33:33
|
Revision: 1095 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1095&view=rev Author: arnetheduck Date: 2008-03-30 01:33:27 -0700 (Sun, 30 Mar 2008) Log Message: ----------- make frame a control, fix toolbar Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/smartwin/include/smartwin/widgets/Button.h dcplusplus/trunk/smartwin/include/smartwin/widgets/ComboBox.h dcplusplus/trunk/smartwin/include/smartwin/widgets/Control.h dcplusplus/trunk/smartwin/include/smartwin/widgets/DateTime.h dcplusplus/trunk/smartwin/include/smartwin/widgets/Frame.h dcplusplus/trunk/smartwin/include/smartwin/widgets/Label.h dcplusplus/trunk/smartwin/include/smartwin/widgets/ProgressBar.h dcplusplus/trunk/smartwin/include/smartwin/widgets/Slider.h dcplusplus/trunk/smartwin/include/smartwin/widgets/Spinner.h dcplusplus/trunk/smartwin/include/smartwin/widgets/StatusBar.h dcplusplus/trunk/smartwin/include/smartwin/widgets/TabSheet.h dcplusplus/trunk/smartwin/include/smartwin/widgets/Table.h dcplusplus/trunk/smartwin/include/smartwin/widgets/TextBox.h dcplusplus/trunk/smartwin/include/smartwin/widgets/ToolBar.h dcplusplus/trunk/smartwin/include/smartwin/widgets/Tree.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h dcplusplus/trunk/smartwin/source/widgets/ToolBar.cpp dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp dcplusplus/trunk/win32/AboutDlg.cpp dcplusplus/trunk/win32/DCPlusPlus.rc dcplusplus/trunk/win32/MainWindow.cpp dcplusplus/trunk/win32/MainWindow.h dcplusplus/trunk/win32/resource.h Property Changed: ---------------- dcplusplus/trunk/ Property changes on: dcplusplus/trunk ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2008-03-30 00:47:06.986000061 +0100 committer: zouzou123gen properties: branch-nick: bzr + timestamp: 2008-03-30 10:12:32.273999929 +0200 committer: Jacek Sieka <arn...@gm...> properties: branch-nick: dcplusplus Name: bzr:ancestry:v3-trunk1 - arn...@gm...-20080329054606-ubefm4h98xjgvif9 + arn...@gm...-20080329054606-ubefm4h98xjgvif9 arn...@gm...-20080329220538-g3f1nvcfh1ycetw7 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 + 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 Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/changelog.txt 2008-03-30 08:33:27 UTC (rev 1095) @@ -14,6 +14,7 @@ * Minor improvements to load / save dialogs * [L#208684] Fixed line history when "Use Ctrl ..." is disabled (poy) * [L#208917] Fixed menu background colors (poy) +* [L#208344] Fix about dialog up/down stats -- 0.705 2008-03-14 -- * Several patches for better *nix compatibility of the core (thanks steven sheehy et al) Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/Button.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/Button.h 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Button.h 2008-03-30 08:33:27 UTC (rev 1095) @@ -18,7 +18,7 @@ /** Common stuff for all buttons */ class Button : - public Control, + public CommonControl, public AspectClickable<Button>, public AspectColor<Button>, public AspectColorCtlImpl<Button>, Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/ComboBox.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/ComboBox.h 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/ComboBox.h 2008-03-30 08:33:27 UTC (rev 1095) @@ -57,12 +57,12 @@ * value at a time from a list of values. */ class ComboBox : + public CommonControl, // Aspects public AspectClickable< ComboBox >, public AspectCollection<ComboBox, int>, public AspectColor< ComboBox >, public AspectColorCtlImpl<ComboBox>, - public Control, public AspectDblClickable< ComboBox >, public AspectFocus< ComboBox >, public AspectFont< ComboBox >, Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/Control.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/Control.h 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Control.h 2008-03-30 08:33:27 UTC (rev 1095) @@ -16,43 +16,36 @@ namespace SmartWin { -/** Base class is for windows common controls */ -class Control : - public MessageMap< Policies::Subclassed >, +/** Base class for all windows */ +template<typename Policy> +class Control: + public MessageMap<Policy>, - public AspectBorder<Control>, - public AspectContextMenu<Control>, - public AspectEnabled<Control>, - public AspectHelp<Control>, - public AspectKeyboard<Control>, - public AspectMouse<Control>, - public AspectRaw<Control>, - public AspectSizable<Control>, - public AspectVisible<Control> + public AspectBorder<Control<Policy> >, + public AspectContextMenu<Control<Policy> >, + public AspectEnabled<Control<Policy> >, + public AspectHelp<Control<Policy> >, + public AspectKeyboard<Control<Policy> >, + public AspectMouse<Control<Policy> >, + public AspectRaw<Control<Policy> >, + public AspectSizable<Control<Policy> >, + public AspectVisible<Control<Policy> > { public: - unsigned int getControlId(); - virtual HWND create(const Seed& cs); protected: - typedef Control ControlType; + typedef Control<Policy> ControlType; Control(Widget* parent); }; -inline Control::Control(Widget* parent) : PolicyType(parent) { - xAssert( parent, _T( "Common Controls must have a parent" ) ); +template<typename Policy> +Control<Policy>::Control(Widget* parent) : MessageMap<Policy>(parent) { + } -inline HWND Control::create(const Seed& cs) { - xAssert((cs.style & WS_CHILD) == WS_CHILD, _T("Common controls must have WS_CHILD style")); - return PolicyType::create(cs); -} +typedef Control<Policies::Subclassed> CommonControl; -inline unsigned int Control::getControlId() { - return static_cast<unsigned int>(::GetWindowLongPtr(handle(), GWLP_ID)); } -} - #endif /*CONTROL_H_*/ Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/DateTime.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/DateTime.h 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/DateTime.h 2008-03-30 08:33:27 UTC (rev 1095) @@ -54,7 +54,7 @@ * declare a point in time within 1800 - 2100 */ class DateTime : - public Control, + public CommonControl, // Aspects public AspectClickable< DateTime >, public AspectFocus< DateTime >, Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/Frame.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/Frame.h 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Frame.h 2008-03-30 08:33:27 UTC (rev 1095) @@ -30,26 +30,16 @@ #include "../Application.h" #include "../Rectangle.h" -#include "../Policies.h" #include "../aspects/AspectActivate.h" -#include "../aspects/AspectBorder.h" #include "../aspects/AspectCommand.h" -#include "../aspects/AspectContextMenu.h" #include "../aspects/AspectDragDrop.h" -#include "../aspects/AspectEnabled.h" #include "../aspects/AspectEraseBackground.h" #include "../aspects/AspectFocus.h" #include "../aspects/AspectFont.h" -#include "../aspects/AspectHelp.h" -#include "../aspects/AspectKeyboard.h" #include "../aspects/AspectMinMax.h" -#include "../aspects/AspectMouse.h" #include "../aspects/AspectPainting.h" -#include "../aspects/AspectRaw.h" -#include "../aspects/AspectSizable.h" #include "../aspects/AspectText.h" -#include "../aspects/AspectVisible.h" -#include "../xCeption.h" +#include "Control.h" namespace SmartWin { @@ -83,27 +73,18 @@ */ template< class Policy > class Frame : - public MessageMap< Policy >, + public Control< Policy >, // Aspects public AspectActivate< Frame< Policy > >, - public AspectBorder< Frame< Policy > >, public AspectCommand< Frame< Policy > >, - public AspectContextMenu< Frame< Policy > >, public AspectDragDrop< Frame< Policy > >, - public AspectEnabled< Frame< Policy > >, public AspectEraseBackground< Frame< Policy > >, public AspectFocus< Frame< Policy > >, public AspectFont< Frame< Policy > >, - public AspectHelp< Frame< Policy > >, - public AspectKeyboard< Frame< Policy > >, public AspectMinMax<Frame<Policy> >, - public AspectMouse< Frame< Policy > >, public AspectPainting< Frame< Policy > >, - public AspectRaw< Frame< Policy > >, - public AspectSizable< Frame< Policy > >, - public AspectText< Frame< Policy > >, - public AspectVisible< Frame< Policy > > + public AspectText< Frame< Policy > > { struct CloseDispatcher { @@ -359,7 +340,7 @@ template< class Policy > Frame< Policy >::Frame( Widget * parent ) - : Frame<Policy>::PolicyType( parent ) + : Control<Policy>( parent ) { } Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/Label.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/Label.h 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Label.h 2008-03-30 08:33:27 UTC (rev 1095) @@ -60,7 +60,7 @@ * It can load a bitmap. */ class Label : - public Control, + public CommonControl, // Aspects public AspectClickable< Label >, public AspectColor< Label >, Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/ProgressBar.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/ProgressBar.h 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/ProgressBar.h 2008-03-30 08:33:27 UTC (rev 1095) @@ -51,7 +51,7 @@ * jobs, often used when downloading from internet or installing applications etc. */ class ProgressBar : - public Control, + public CommonControl, // Aspects public AspectPainting< ProgressBar > { Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/Slider.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/Slider.h 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Slider.h 2008-03-30 08:33:27 UTC (rev 1095) @@ -56,7 +56,7 @@ * the Spinner control, but have another visual appearance. */ class Slider : - public Control, + public CommonControl, // Aspects public AspectFocus< Slider >, public AspectPainting< Slider >, Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/Spinner.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/Spinner.h 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Spinner.h 2008-03-30 08:33:27 UTC (rev 1095) @@ -54,7 +54,7 @@ * other for softer. */ class Spinner : - public Control, + public CommonControl, // Aspects public AspectFocus< Spinner >, public AspectPainting< Spinner >, Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/StatusBar.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/StatusBar.h 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/StatusBar.h 2008-03-30 08:33:27 UTC (rev 1095) @@ -104,7 +104,7 @@ template< class TypeOfStatusBar = NoSection > class StatusBar : public TypeOfStatusBar, - public Control, + public CommonControl, // Aspects public AspectClickable< StatusBar< TypeOfStatusBar > >, Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/TabSheet.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/TabSheet.h 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/TabSheet.h 2008-03-30 08:33:27 UTC (rev 1095) @@ -63,7 +63,7 @@ * has. */ class TabSheet : - public Control, + public CommonControl, // Aspects public AspectCollection<TabSheet, int>, public AspectFocus< TabSheet >, Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/Table.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/Table.h 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Table.h 2008-03-30 08:33:27 UTC (rev 1095) @@ -68,7 +68,7 @@ * to "map" an LPARAM value to a physical rownumber and vice versa. */ class Table : - public Control, + public CommonControl, // Aspect classes public AspectClickable< Table >, public AspectCollection<Table, int>, Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/TextBox.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/TextBox.h 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/TextBox.h 2008-03-30 08:33:27 UTC (rev 1095) @@ -64,7 +64,7 @@ * < ul > < li >RichTextBox< /li > < /ul > */ class TextBoxBase : - public Control, + public CommonControl, // Aspect classes public AspectColor< TextBoxBase >, public AspectColorCtlImpl<TextBoxBase>, Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/ToolBar.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/ToolBar.h 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/ToolBar.h 2008-03-30 08:33:27 UTC (rev 1095) @@ -38,6 +38,8 @@ #include "../resources/ImageList.h" #include "Control.h" +#include <vector> + namespace SmartWin { // begin namespace SmartWin @@ -57,7 +59,7 @@ * to view the log of URL's you have been to etc... */ class ToolBar : - public Control, +public CommonControl, // Aspects public AspectFocus< ToolBar >, public AspectFont< ToolBar > @@ -109,7 +111,7 @@ */ void appendSeparator(); - void appendItem(unsigned int id, int image, const SmartUtil::tstring& toolTip, const Dispatcher::F& f = Dispatcher::F()); + void appendItem(int image, const SmartUtil::tstring& toolTip, const Dispatcher::F& f = Dispatcher::F()); /// Set the image list with the normal button images. /** normalImageList is the image list that contains the images @@ -180,7 +182,7 @@ ImageListPtr itsHotImageList; ImageListPtr itsDisabledImageList; - //void addBitmap( HBITMAP hBit, unsigned int noButtonsInBitmap ); + std::vector<Dispatcher::F> commands; }; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/Tree.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/Tree.h 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Tree.h 2008-03-30 08:33:27 UTC (rev 1095) @@ -61,7 +61,7 @@ */ class Tree : - public Control, + public CommonControl, // Aspects public AspectClickable< Tree >, public AspectCollection<Tree, HTREEITEM>, Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h 2008-03-30 08:33:27 UTC (rev 1095) @@ -58,8 +58,6 @@ TabSheet::ObjectType getTab(); - virtual bool tryFire(const MSG& msg, LRESULT& retVal); - const Rectangle& getClientSize() const { return clientSize; } void create( const Seed & cs = Seed() ); Modified: dcplusplus/trunk/smartwin/source/widgets/ToolBar.cpp =================================================================== --- dcplusplus/trunk/smartwin/source/widgets/ToolBar.cpp 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/smartwin/source/widgets/ToolBar.cpp 2008-03-30 08:33:27 UTC (rev 1095) @@ -28,8 +28,22 @@ } } -void ToolBar::appendItem( unsigned int id, int image, const SmartUtil::tstring& toolTip, const Dispatcher::F& f) +void ToolBar::appendItem( int image, const SmartUtil::tstring& toolTip, const Dispatcher::F& f) { + int id = -1; + + if(f) { + for(id = 0; id < (int)commands.size(); ++id) { + if(!commands[id]) + break; + } + if(id == (int)commands.size()) { + commands.push_back(f); + } else { + commands[id] = f; + } + } + // Adding button TBBUTTON tb = { 0 }; tb.iBitmap = image; @@ -42,24 +56,17 @@ xCeption x( _T( "Error while trying to add a button to toolbar..." ) ); throw x; } - - if(f) - addCallback(Message(WM_COMMAND, id), Dispatcher(f)); } -bool ToolBar::tryFire( const MSG & msg, LRESULT & retVal ) -{ - bool handled = PolicyType::tryFire(msg, retVal); - - if(!handled && msg.message == WM_COMMAND) { - Widget* parent = getParent(); - if(parent != NULL) { - // Maybe parent knows what to do with the WM_COMMAND (in case of shared menu/toolbar id's) - handled = parent->tryFire(msg, retVal); +bool ToolBar::tryFire( const MSG & msg, LRESULT & retVal ) { + if(msg.message == WM_COMMAND && msg.lParam == reinterpret_cast<LPARAM>(handle())) { + size_t id = LOWORD(msg.wParam); + if(id < commands.size() && commands[id]) { + commands[id](); + return true; } } - - return handled; + return PolicyType::tryFire(msg, retVal); } } Modified: dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp =================================================================== --- dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp 2008-03-30 08:33:27 UTC (rev 1095) @@ -397,15 +397,4 @@ return false; } -bool WidgetTabView::tryFire(const MSG& msg, LRESULT& retVal) { - bool handled = PolicyType::tryFire(msg, retVal); - if(!handled && msg.message == WM_COMMAND && getTab()) { - TabInfo* ti = getTabInfo(getTab()->getSelected()); - if(ti) { - handled = ti->w->tryFire(msg, retVal); - } - } - return handled; } - -} Modified: dcplusplus/trunk/win32/AboutDlg.cpp =================================================================== --- dcplusplus/trunk/win32/AboutDlg.cpp 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/win32/AboutDlg.cpp 2008-03-30 08:33:27 UTC (rev 1095) @@ -58,7 +58,7 @@ setItemText(IDC_VERSION, Text::toT(APPNAME " " VERSIONSTRING) + T_("\n(c) Copyright 2001-2008 Jacek Sieka\nEx-codeveloper: Per Lind\303\251n\nGraphics: Martin Skogevall et al.\nDC++ is licenced under GPL\nhttp://dcplusplus.sourceforge.net/")); attachTextBox(IDC_TTH)->setText(WinUtil::tth); attachTextBox(IDC_THANKS)->setText(Text::toT(thanks)); - setItemText(IDC_TOTALS, str(TF_("Upload: %1%, Download: %2%") % Text::toT(Util::formatBytes(SETTING(TOTAL_UPLOAD))) % Text::toT(Util::formatBytes(SETTING(TOTAL_DOWNLOAD))))); + setItemText(IDC_UPDOWN, str(TF_("Upload: %1%, Download: %2%") % Text::toT(Util::formatBytes(SETTING(TOTAL_UPLOAD))) % Text::toT(Util::formatBytes(SETTING(TOTAL_DOWNLOAD))))); setItemText(IDC_GREETZ, T_("Greetz and Contributors")); setItemText(IDC_TOTALS, T_("Totals")); setItemText(IDC_LATEST_VERSION, T_("Latest stable version")); Modified: dcplusplus/trunk/win32/DCPlusPlus.rc =================================================================== --- dcplusplus/trunk/win32/DCPlusPlus.rc 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/win32/DCPlusPlus.rc 2008-03-30 08:33:27 UTC (rev 1095) @@ -99,7 +99,7 @@ GROUPBOX "Latest stable version",IDC_LATEST_VERSION,7,239,229,24,BS_CENTER CTEXT "0.xxx",IDC_LATEST,13,250,218,8 GROUPBOX "Totals",IDC_TOTALS,7,197,229,39,BS_CENTER - CTEXT "Upload: xx.xx MiB, Download: xx.xx MiB",IDC_TOTALS,13,208,218,8 + CTEXT "Upload: xx.xx MiB, Download: xx.xx MiB",IDC_UPDOWN,13,208,218,8 CTEXT "Ratio (Up/Down): x.xx",IDC_RATIO,13,221,218,8 EDITTEXT IDC_THANKS,13,122,218,66,ES_MULTILINE | ES_READONLY | WS_VSCROLL CTEXT "Static",IDC_VERSION,13,37,218,54 Modified: dcplusplus/trunk/win32/MainWindow.cpp =================================================================== --- dcplusplus/trunk/win32/MainWindow.cpp 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/win32/MainWindow.cpp 2008-03-30 08:33:27 UTC (rev 1095) @@ -279,29 +279,29 @@ } int image = 0; - toolbar->appendItem(IDC_PUBLIC_HUBS, image++, T_("Public Hubs")); + toolbar->appendItem(image++, T_("Public Hubs"), std::tr1::bind(&MainWindow::handleOpenWindow, this, IDC_PUBLIC_HUBS)); toolbar->appendSeparator(); - toolbar->appendItem(IDC_RECONNECT, image++, T_("Reconnect")); - toolbar->appendItem(IDC_FOLLOW, image++, T_("Follow last redirect")); + toolbar->appendItem(image++, T_("Reconnect"), std::tr1::bind(&MainWindow::handleForward, this, IDC_PUBLIC_HUBS)); + toolbar->appendItem(image++, T_("Follow last redirect"), std::tr1::bind(&MainWindow::handleForward, this, IDC_FOLLOW)); toolbar->appendSeparator(); - toolbar->appendItem(IDC_FAVORITE_HUBS, image++, T_("Favorite Hubs")); - toolbar->appendItem(IDC_FAVUSERS, image++, T_("Favorite Users")); + toolbar->appendItem(image++, T_("Favorite Hubs"), std::tr1::bind(&MainWindow::handleOpenWindow, this, IDC_FAVORITE_HUBS)); + toolbar->appendItem(image++, T_("Favorite Users"), std::tr1::bind(&MainWindow::handleOpenWindow, this, IDC_FAVUSERS)); toolbar->appendSeparator(); - toolbar->appendItem(IDC_QUEUE, image++, T_("Download Queue")); - toolbar->appendItem(IDC_FINISHED_DL, image++, T_("Finished Downloads")); - toolbar->appendItem(IDC_WAITING_USERS, image++, T_("Waiting Users")); - toolbar->appendItem(IDC_FINISHED_UL, image++, T_("Finished Uploads")); + toolbar->appendItem(image++, T_("Download Queue"), std::tr1::bind(&MainWindow::handleOpenWindow, this, IDC_QUEUE)); + toolbar->appendItem(image++, T_("Finished Downloads"), std::tr1::bind(&MainWindow::handleOpenWindow, this, IDC_FINISHED_DL)); + toolbar->appendItem(image++, T_("Waiting Users"), std::tr1::bind(&MainWindow::handleOpenWindow, this, IDC_WAITING_USERS)); + toolbar->appendItem(image++, T_("Finished Uploads"), std::tr1::bind(&MainWindow::handleOpenWindow, this, IDC_FINISHED_UL)); toolbar->appendSeparator(); - toolbar->appendItem(IDC_SEARCH, image++, T_("Search")); - toolbar->appendItem(IDC_ADL_SEARCH, image++, T_("ADL Search")); - toolbar->appendItem(IDC_SEARCH_SPY, image++, T_("Search Spy")); + toolbar->appendItem(image++, T_("Search"), std::tr1::bind(&MainWindow::handleOpenWindow, this, IDC_SEARCH)); + toolbar->appendItem(image++, T_("ADL Search"), std::tr1::bind(&MainWindow::handleOpenWindow, this, IDC_ADL_SEARCH)); + toolbar->appendItem(image++, T_("Search Spy"), std::tr1::bind(&MainWindow::handleOpenWindow, this, IDC_SEARCH_SPY)); toolbar->appendSeparator(); - toolbar->appendItem(IDC_OPEN_FILE_LIST, image++, T_("Open file list...")); + toolbar->appendItem(image++, T_("Open file list..."), std::tr1::bind(&MainWindow::handleOpenFileList, this)); toolbar->appendSeparator(); - toolbar->appendItem(IDC_SETTINGS, image++, T_("Settings")); - toolbar->appendItem(IDC_NOTEPAD, image++, T_("Notepad")); + toolbar->appendItem(image++, T_("Settings"), std::tr1::bind(&MainWindow::handleSettings, this)); + toolbar->appendItem(image++, T_("Notepad"), std::tr1::bind(&MainWindow::handleOpenWindow, this, IDC_NOTEPAD)); toolbar->appendSeparator(); - toolbar->appendItem(IDC_WHATS_THIS, image++, T_("\"What's this?\" help"), std::tr1::bind(&MainWindow::handleWhatsThis, this)); + toolbar->appendItem(image++, T_("\"What's this?\""), std::tr1::bind(&MainWindow::handleWhatsThis, this)); } void MainWindow::initStatusBar() { @@ -354,6 +354,13 @@ close(true); } +void MainWindow::handleForward(WPARAM wParam) { + SmartWin::WidgetChildWindow* active = getMDIParent()->getActive(); + if(active) { + active->sendMessage(WM_COMMAND, wParam, 0); + } +} + void MainWindow::handleQuickConnect() { if (SETTING(NICK).empty()) { postMessage(WM_COMMAND, IDC_SETTINGS); Modified: dcplusplus/trunk/win32/MainWindow.h =================================================================== --- dcplusplus/trunk/win32/MainWindow.h 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/win32/MainWindow.h 2008-03-30 08:33:27 UTC (rev 1095) @@ -159,6 +159,7 @@ void handleWhatsThis(); void handleSize(); void handleActivate(bool active); + void handleForward(WPARAM wParam); LRESULT handleEndSession(); LRESULT handleTrayIcon(LPARAM lParam); Modified: dcplusplus/trunk/win32/resource.h =================================================================== --- dcplusplus/trunk/win32/resource.h 2008-03-30 08:32:18 UTC (rev 1094) +++ dcplusplus/trunk/win32/resource.h 2008-03-30 08:33:27 UTC (rev 1095) @@ -442,6 +442,7 @@ #define IDC_SETTINGS_PRIVATE_KEY_FILE 2299 #define IDC_SETTINGS_CERTIFICATE_FILE 2300 #define IDC_SETTINGS_TRUSTED_CERTIFICATES_PATH 2301 +#define IDC_UPDOWN 2302 // Stuff that uses multiple id's #define IDC_BROWSELIST 3000 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |