From: <arn...@us...> - 2008-03-22 14:41:14
|
Revision: 1050 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1050&view=rev Author: arnetheduck Date: 2008-03-22 07:41:09 -0700 (Sat, 22 Mar 2008) Log Message: ----------- Fix messages for subclassed windows Modified Paths: -------------- dcplusplus/trunk/smartwin/include/smartwin/Policies.h dcplusplus/trunk/smartwin/include/smartwin/Widget.h dcplusplus/trunk/win32/HubFrame.cpp dcplusplus/trunk/win32/MDIChildFrame.h Modified: dcplusplus/trunk/smartwin/include/smartwin/Policies.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/Policies.h 2008-03-21 20:03:18 UTC (rev 1049) +++ dcplusplus/trunk/smartwin/include/smartwin/Policies.h 2008-03-22 14:41:09 UTC (rev 1050) @@ -232,15 +232,12 @@ } virtual HWND create(const Widget::Seed& seed) { - attach(Widget::create(seed)); + HWND hWnd = Widget::create(seed); + oldProc = reinterpret_cast< WNDPROC >( ::SetWindowLongPtr( hWnd, GWL_WNDPROC, ( LONG_PTR ) &MessageMapPolicy<Subclassed>::wndProc ) ); + attach(hWnd); + return hWnd; } - virtual void attach(HWND hwnd) { - Normal::attach(hwnd); - oldProc = reinterpret_cast< WNDPROC >( ::SetWindowLongPtr( handle(), GWL_WNDPROC, ( LONG_PTR ) &MessageMapPolicy<Subclassed>::wndProc ) ); - } - using Normal::attach; - private: WNDPROC oldProc; }; Modified: dcplusplus/trunk/smartwin/include/smartwin/Widget.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/Widget.h 2008-03-21 20:03:18 UTC (rev 1049) +++ dcplusplus/trunk/smartwin/include/smartwin/Widget.h 2008-03-22 14:41:09 UTC (rev 1050) @@ -168,6 +168,16 @@ /** This will be called when it's time to delete the widget */ virtual void kill(); + /// Subclasses the dialog item with the given dialog item id + /** Subclasses a dialog item, the id is the dialog item id from the resource + * editor. <br> + * Should normally not be called directly but rather called from e.g. one of the + * creational functions found in the WidgetFactory class. + */ + void attach( unsigned id ); + + void attach(HWND wnd); + protected: Widget(Widget * parent); @@ -177,16 +187,6 @@ // derived class (with no parameters) virtual HWND create( const Seed & cs ); - virtual void attach(HWND wnd); - - /// Subclasses the dialog item with the given dialog item id - /** Subclasses a dialog item, the id is the dialog item id from the resource - * editor. <br> - * Should normally not be called directly but rather called from e.g. one of the - * creational functions found in the WidgetFactory class. - */ - void attach( unsigned id ); - private: friend class Application; template<typename T> friend T hwnd_cast(HWND hwnd); Modified: dcplusplus/trunk/win32/HubFrame.cpp =================================================================== --- dcplusplus/trunk/win32/HubFrame.cpp 2008-03-21 20:03:18 UTC (rev 1049) +++ dcplusplus/trunk/win32/HubFrame.cpp 2008-03-22 14:41:09 UTC (rev 1050) @@ -95,7 +95,7 @@ WidgetTextBox::Seed cs = WinUtil::Seeds::textBox; cs.style = WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE; message = createTextBox(cs); - addWidget(message, true); + addWidget(message, true, false); message->onRaw(std::tr1::bind(&HubFrame::handleMessageGetDlgCode, this), SmartWin::Message(WM_GETDLGCODE)); message->onKeyDown(std::tr1::bind(&HubFrame::handleMessageKeyDown, this, _1)); message->onChar(std::tr1::bind(&HubFrame::handleMessageChar, this, _1)); Modified: dcplusplus/trunk/win32/MDIChildFrame.h =================================================================== --- dcplusplus/trunk/win32/MDIChildFrame.h 2008-03-21 20:03:18 UTC (rev 1049) +++ dcplusplus/trunk/win32/MDIChildFrame.h 2008-03-22 14:41:09 UTC (rev 1050) @@ -89,9 +89,11 @@ void postClosing() { } template<typename W> - void addWidget(W* widget, bool alwaysFocus = false) { - addDlgCodeMessage(widget); - + void addWidget(W* widget, bool alwaysFocus = false, bool autoTab = true) { + if(autoTab) { + addDlgCodeMessage(widget); + } + addColor(widget); if(alwaysFocus || (lastFocus == NULL)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |