From: <arn...@us...> - 2008-03-30 08:29:01
|
Revision: 1091 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1091&view=rev Author: arnetheduck Date: 2008-03-30 01:28:59 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Don't use control id's Modified Paths: -------------- dcplusplus/trunk/smartwin/include/smartwin/Widget.h dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectClickable.h 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/Label.h dcplusplus/trunk/smartwin/include/smartwin/widgets/StatusBar.h dcplusplus/trunk/smartwin/include/smartwin/widgets/TextBox.h dcplusplus/trunk/smartwin/source/Message.cpp Property Changed: ---------------- dcplusplus/trunk/ Property changes on: dcplusplus/trunk ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2008-03-29 13:49:26.227999926 +0100 committer: Jacek Sieka <arn...@gm...> properties: branch-nick: dcplusplus + timestamp: 2008-03-29 16:09:01.500000000 +0100 committer: Jacek Sieka <arn...@gm...> properties: branch-nick: dcplusplus Name: bzr:file-ids - x2po.py x2po.py-20080329124851-4mzy5m3ojyowxxbv-1 + 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 + 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 Modified: dcplusplus/trunk/smartwin/include/smartwin/Widget.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/Widget.h 2008-03-30 08:28:27 UTC (rev 1090) +++ dcplusplus/trunk/smartwin/include/smartwin/Widget.h 2008-03-30 08:28:59 UTC (rev 1091) @@ -34,7 +34,6 @@ #include "../../SmartUtil/tstring.h" #include <boost/noncopyable.hpp> -#include <memory> #include <list> #include <functional> #include <tr1/unordered_map> Modified: dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectClickable.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectClickable.h 2008-03-30 08:28:27 UTC (rev 1090) +++ dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectClickable.h 2008-03-30 08:28:59 UTC (rev 1091) @@ -55,7 +55,7 @@ * something else. No parameters are passed. */ void onClicked(const typename Dispatcher::F& f) { - W().addCallback(W().getClickMessage(), Dispatcher(f)); + W().addCallback(WidgetType::getClickMessage(), Dispatcher(f)); } protected: Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/Button.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/Button.h 2008-03-30 08:28:27 UTC (rev 1090) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Button.h 2008-03-30 08:28:59 UTC (rev 1091) @@ -28,6 +28,8 @@ public AspectPainting< Button >, public AspectText< Button > { + friend class AspectClickable<Button>; + friend class AspectDblClickable<Button>; friend class WidgetCreator<Button>; public: /// Class type @@ -49,12 +51,6 @@ Seed(const SmartUtil::tstring& caption_ = SmartUtil::tstring()); }; - // Contract needed by AspectClickable Aspect class - Message getClickMessage(); - - // Contract needed by AspectDblClickable Aspect class - Message getDblClickMessage(); - template<typename SeedType> void create(const SeedType& cs); @@ -62,14 +58,22 @@ typedef Button ButtonType; Button(Widget* parent); + +private: + // Contract needed by AspectClickable Aspect class + static Message getClickMessage(); + + // Contract needed by AspectDblClickable Aspect class + static Message getDblClickMessage(); + }; inline Message Button::getClickMessage() { - return Message( WM_COMMAND, MAKEWPARAM(getControlId(), BN_CLICKED) ); + return Message( WM_COMMAND, MAKEWPARAM(0, BN_CLICKED) ); } inline Message Button::getDblClickMessage() { - return Message( WM_COMMAND, MAKEWPARAM(getControlId(), BN_DBLCLK) ); + return Message( WM_COMMAND, MAKEWPARAM(0, BN_DBLCLK) ); } inline Button::Button(Widget* parent) : ControlType(parent) { Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/ComboBox.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/ComboBox.h 2008-03-30 08:28:27 UTC (rev 1090) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/ComboBox.h 2008-03-30 08:28:59 UTC (rev 1091) @@ -74,6 +74,8 @@ friend class AspectCollection<ComboBox, int>; friend class AspectColor<ComboBox>; friend class AspectSelection<ComboBox, int>; + friend class AspectClickable<ComboBox>; + friend class AspectDblClickable<ComboBox>; public: /// Class type typedef ComboBox ThisType; @@ -99,15 +101,6 @@ Seed(); }; - // Aspect expectation implementation - Message getSelectionChangedMessage(); - - // Aspect expectation implementation - Message getClickMessage(); - - // Aspect expectation implementation - Message getDblClickMessage(); - /// Return the selected value of the ComboBox /** If no item is actually selected the return value is "". */ @@ -157,25 +150,31 @@ void clearImpl(); size_t sizeImpl() const; + // Aspect expectation implementation + static Message getSelectionChangedMessage(); + + // Aspect expectation implementation + static Message getClickMessage(); + + // Aspect expectation implementation + static Message getDblClickMessage(); + }; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Implementation of class /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -inline Message ComboBox::getSelectionChangedMessage() -{ - return Message( WM_COMMAND, MAKEWPARAM(this->getControlId(), CBN_SELENDOK) ); +inline Message ComboBox::getSelectionChangedMessage() { + return Message( WM_COMMAND, MAKEWPARAM(0, CBN_SELENDOK) ); } -inline Message ComboBox::getClickMessage() -{ - return Message( WM_COMMAND, MAKEWPARAM(this->getControlId(), CBN_DROPDOWN) ); +inline Message ComboBox::getClickMessage() { + return Message( WM_COMMAND, MAKEWPARAM(0, CBN_DROPDOWN) ); } -inline Message ComboBox::getDblClickMessage() -{ - return Message( WM_COMMAND, MAKEWPARAM(this->getControlId(), CBN_DBLCLK) ); +inline Message ComboBox::getDblClickMessage() { + return Message( WM_COMMAND, MAKEWPARAM(0, CBN_DBLCLK) ); } inline int ComboBox::getSelectedImpl() const { Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/Control.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/Control.h 2008-03-30 08:28:27 UTC (rev 1090) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Control.h 2008-03-30 08:28:59 UTC (rev 1091) @@ -17,7 +17,6 @@ namespace SmartWin { /** Base class is for windows common controls */ - class Control : public MessageMap< Policies::Subclassed >, Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/DateTime.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/DateTime.h 2008-03-30 08:28:27 UTC (rev 1090) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/DateTime.h 2008-03-30 08:28:59 UTC (rev 1091) @@ -61,6 +61,9 @@ public AspectFont< DateTime >, public AspectPainting< DateTime > { + friend class WidgetCreator< DateTime >; + friend class AspectClickable<DateTime>; + struct Dispatcher { typedef std::tr1::function<void (const SYSTEMTIME &)> F; @@ -82,8 +85,6 @@ /// Object type typedef ThisType* ObjectType; - friend class WidgetCreator< DateTime >; - /// Seed class /** This class contains all of the values needed to create the widget. It also * knows the type of the class whose seed values it contains. Every widget @@ -108,9 +109,6 @@ Seed(); }; - // Aspect expectation implementation - static Message & getClickMessage(); - /// Member function Setting the event handler for the "date changed" event /** The event handler must have the signature "void foo( DateTimePtr * date, const SYSTEMTIME & st )" <br> @@ -209,16 +207,18 @@ // WidgetFactory class which is friend virtual ~DateTime() {} + +private: + // Aspect expectation implementation + static Message getClickMessage(); }; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Implementation of class /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -inline Message & DateTime::getClickMessage() -{ - static Message retVal = Message( WM_NOTIFY, DTN_DROPDOWN ); - return retVal; +inline Message DateTime::getClickMessage() { + return Message( WM_NOTIFY, DTN_DROPDOWN ); } inline SYSTEMTIME DateTime::getDateTime() Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/Label.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/Label.h 2008-03-30 08:28:27 UTC (rev 1090) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Label.h 2008-03-30 08:28:59 UTC (rev 1091) @@ -72,6 +72,8 @@ public AspectText< Label > { friend class WidgetCreator< Label >; + friend class AspectClickable<Label>; + friend class AspectDblClickable<Label>; public: /// Class type typedef Label ThisType; @@ -94,12 +96,6 @@ Seed(const SmartUtil::tstring& caption_ = SmartUtil::tstring()); }; - // Contract needed by AspectClickable Aspect class - Message getClickMessage(); - - // Contract needed by AspectDblClickable Aspect class - Message getDblClickMessage(); - /// Actually creates the Static Control /** You should call WidgetFactory::createStatic if you instantiate class * directly. <br> @@ -126,16 +122,20 @@ BitmapPtr itsBitmap; void setBitmap( HBITMAP bitmap ); + + // Contract needed by AspectClickable Aspect class + static Message getClickMessage(); + + // Contract needed by AspectDblClickable Aspect class + static Message getDblClickMessage(); }; -inline Message Label::getClickMessage() -{ - return Message( WM_COMMAND, MAKEWPARAM(this->getControlId(), STN_CLICKED) ); +inline Message Label::getClickMessage() { + return Message( WM_COMMAND, MAKEWPARAM(0, STN_CLICKED) ); } -inline Message Label::getDblClickMessage() -{ - return Message( WM_COMMAND, MAKEWPARAM(this->getControlId(), STN_DBLCLK) ); +inline Message Label::getDblClickMessage() { + return Message( WM_COMMAND, MAKEWPARAM(0, STN_DBLCLK) ); } inline Label::Label( Widget * parent ) Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/StatusBar.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/StatusBar.h 2008-03-30 08:28:27 UTC (rev 1090) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/StatusBar.h 2008-03-30 08:28:59 UTC (rev 1091) @@ -113,6 +113,8 @@ public AspectPainting< StatusBar< TypeOfStatusBar > > { friend class WidgetCreator< StatusBar >; + friend class AspectClickable< StatusBar< TypeOfStatusBar > >; + friend class AspectDblClickable< StatusBar< TypeOfStatusBar > >; public: /// Class type typedef StatusBar<TypeOfStatusBar> ThisType; @@ -145,12 +147,6 @@ */ void refresh(); - // Contract needed by AspectClickable Aspect class - static const Message& getClickMessage(); - - // Contract needed by AspectDblClickable Aspect class - static const Message& getDblClickMessage(); - /// Actually creates the StatusBar /** You should call WidgetFactory::createStatusBar if you instantiate class * directly. <br> @@ -166,6 +162,12 @@ // WidgetFactory class which is friend virtual ~StatusBar() {} + + // Contract needed by AspectClickable Aspect class + static Message getClickMessage(); + + // Contract needed by AspectDblClickable Aspect class + static Message getDblClickMessage(); }; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -220,17 +222,15 @@ } template< class TypeOfStatusBar > -const Message & StatusBar< TypeOfStatusBar >::getClickMessage() +Message StatusBar< TypeOfStatusBar >::getClickMessage() { - static Message retVal = Message( WM_NOTIFY, NM_CLICK ); - return retVal; + return Message( WM_NOTIFY, NM_CLICK ); } template< class TypeOfStatusBar > -const Message & StatusBar< TypeOfStatusBar >::getDblClickMessage() +Message StatusBar< TypeOfStatusBar >::getDblClickMessage() { - static Message retVal = Message( WM_NOTIFY, NM_DBLCLK ); - return retVal; + return Message( WM_NOTIFY, NM_DBLCLK ); } template< class TypeOfStatusBar > Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/TextBox.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/TextBox.h 2008-03-30 08:28:27 UTC (rev 1090) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/TextBox.h 2008-03-30 08:28:59 UTC (rev 1091) @@ -75,13 +75,11 @@ public AspectUpdate< TextBoxBase > { friend class WidgetCreator< TextBoxBase >; - + friend class AspectUpdate<TextBoxBase>; + typedef Dispatchers::VoidVoid<> Dispatcher; public: - // Contract needed by AspectUpdate Aspect class - Message getUpdateMessage(); - /// Sets the current selection of the Edit Control /** Start means the offset of where the current selection shall start, if it is * omitted it defaults to 0. <br> @@ -187,6 +185,12 @@ // is supposed to do so when parent is killed... virtual ~TextBoxBase() {} + +private: + // Contract needed by AspectUpdate Aspect class + static Message getUpdateMessage(); + + }; class TextBox : @@ -280,9 +284,8 @@ // Implementation of class /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -inline Message TextBoxBase::getUpdateMessage() -{ - return Message( WM_COMMAND, MAKEWPARAM(this->getControlId(), EN_UPDATE) ); +inline Message TextBoxBase::getUpdateMessage() { + return Message( WM_COMMAND, MAKEWPARAM(0, EN_UPDATE) ); } inline void TextBoxBase::setSelection( long start, long end ) @@ -356,7 +359,7 @@ inline void TextBoxBase::onTextChanged( const Dispatcher::F& f ) { this->addCallback( - Message( WM_COMMAND, MAKEWPARAM(this->getControlId(), EN_CHANGE) ), Dispatcher(f) + Message( WM_COMMAND, MAKEWPARAM(0, EN_CHANGE) ), Dispatcher(f) ); } Modified: dcplusplus/trunk/smartwin/source/Message.cpp =================================================================== --- dcplusplus/trunk/smartwin/source/Message.cpp 2008-03-30 08:28:27 UTC (rev 1090) +++ dcplusplus/trunk/smartwin/source/Message.cpp 2008-03-30 08:28:59 UTC (rev 1091) @@ -71,9 +71,9 @@ } break; case WM_COMMAND: { if(msg_.lParam == 0) { - param = LOWORD( msg_.wParam ); + param = LOWORD(msg_.wParam); } else { - param = msg_.wParam; + param = HIWORD(msg_.wParam); } } break; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |