From: <arn...@us...> - 2008-03-30 08:17:36
|
Revision: 1089 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1089&view=rev Author: arnetheduck Date: 2008-03-30 01:17:30 -0700 (Sun, 30 Mar 2008) Log Message: ----------- rename windows&dialogs Modified Paths: -------------- dcplusplus/trunk/smartwin/include/smartwin/Anchors.h dcplusplus/trunk/smartwin/include/smartwin/Application.h dcplusplus/trunk/smartwin/include/smartwin/Policies.h dcplusplus/trunk/smartwin/include/smartwin/SmartWin.h dcplusplus/trunk/smartwin/include/smartwin/Widget.h dcplusplus/trunk/smartwin/include/smartwin/WidgetFactory.h dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectColor.h dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectDragDrop.h dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectEraseBackground.h dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectMinMax.h dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectMouse.h dcplusplus/trunk/smartwin/include/smartwin/widgets/Control.h dcplusplus/trunk/smartwin/include/smartwin/widgets/CoolBar.h dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIChild.h dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIFrame.h dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIParent.h dcplusplus/trunk/smartwin/include/smartwin/widgets/StatusBar.h dcplusplus/trunk/smartwin/include/smartwin/widgets/ToolTip.h dcplusplus/trunk/smartwin/include/smartwin/widgets/Tree.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenu.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h dcplusplus/trunk/smartwin/source/widgets/WidgetDialog.cpp dcplusplus/trunk/smartwin/source/widgets/WidgetModalDialog.cpp dcplusplus/trunk/smartwin/source/widgets/WidgetWindow.cpp dcplusplus/trunk/win32/ADLSProperties.cpp dcplusplus/trunk/win32/ADLSProperties.h dcplusplus/trunk/win32/AboutDlg.cpp dcplusplus/trunk/win32/AboutDlg.h dcplusplus/trunk/win32/CommandDlg.cpp dcplusplus/trunk/win32/CommandDlg.h dcplusplus/trunk/win32/FavHubProperties.cpp dcplusplus/trunk/win32/FavHubProperties.h dcplusplus/trunk/win32/HashProgressDlg.cpp dcplusplus/trunk/win32/HashProgressDlg.h dcplusplus/trunk/win32/HubListsDlg.cpp dcplusplus/trunk/win32/HubListsDlg.h dcplusplus/trunk/win32/LineDlg.cpp dcplusplus/trunk/win32/LineDlg.h dcplusplus/trunk/win32/MagnetDlg.cpp dcplusplus/trunk/win32/MagnetDlg.h dcplusplus/trunk/win32/MainWindow.cpp dcplusplus/trunk/win32/MainWindow.h dcplusplus/trunk/win32/PropPage.cpp dcplusplus/trunk/win32/PropPage.h dcplusplus/trunk/win32/SettingsDialog.cpp dcplusplus/trunk/win32/SettingsDialog.h dcplusplus/trunk/win32/SplashWindow.cpp dcplusplus/trunk/win32/SplashWindow.h dcplusplus/trunk/win32/WidgetPaned.h Added Paths: ----------- dcplusplus/trunk/smartwin/include/smartwin/widgets/Frame.h dcplusplus/trunk/smartwin/include/smartwin/widgets/ModalDialog.h dcplusplus/trunk/smartwin/include/smartwin/widgets/ModelessDialog.h dcplusplus/trunk/smartwin/include/smartwin/widgets/Window.h Removed Paths: ------------- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetDialog.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetModalDialog.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetWindow.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetWindowBase.h Property Changed: ---------------- dcplusplus/trunk/ Property changes on: dcplusplus/trunk ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2008-03-29 11:32:16.434999943 +0100 committer: Jacek Sieka <arn...@gm...> properties: branch-nick: dcplusplus + timestamp: 2008-03-29 13:40:42.691999912 +0100 committer: Jacek Sieka <arn...@gm...> properties: branch-nick: dcplusplus Name: bzr:file-ids - smartwin/source/widgets/LoadDialog.cpp loaddialog.cpp-20080329103151-2zvxbm5b87on29pc-1 smartwin/source/widgets/SaveDialog.cpp savedialog.cpp-20080329103151-2zvxbm5b87on29pc-2 + smartwin/include/smartwin/widgets/Frame.h 712@f586c4b0-9d0d-0410-bc51-f1fe239209fc:dcplusplus%2Ftrunk:smartwin%2Finclude%2Fsmartwin%2Fwidgets%2FWidgetWindowBase.h smartwin/include/smartwin/widgets/ModalDialog.h 712@f586c4b0-9d0d-0410-bc51-f1fe239209fc:dcplusplus%2Ftrunk:smartwin%2Finclude%2Fsmartwin%2Fwidgets%2FWidgetModalDialog.h smartwin/include/smartwin/widgets/ModelessDialog.h 712@f586c4b0-9d0d-0410-bc51-f1fe239209fc:dcplusplus%2Ftrunk:smartwin%2Finclude%2Fsmartwin%2Fwidgets%2FWidgetDialog.h smartwin/include/smartwin/widgets/Window.h 712@f586c4b0-9d0d-0410-bc51-f1fe239209fc:dcplusplus%2Ftrunk:smartwin%2Finclude%2Fsmartwin%2Fwidgets%2FWidgetWindow.h 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 + 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 Modified: dcplusplus/trunk/smartwin/include/smartwin/Anchors.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/Anchors.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/Anchors.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -42,7 +42,7 @@ * the files in the current directory, grows or shrinks according to the size of the dialog. * * That's what Anchors does. After the widgets were created, you add them to a special list, -* and in the event handler of OnSize (of your WidgetWindow), you call a special method that +* and in the event handler of OnSize (of your Window), you call a special method that * resizes all the widgets you've added before. * * Supposed to be simple. Modified: dcplusplus/trunk/smartwin/include/smartwin/Application.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/Application.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/Application.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -59,7 +59,7 @@ class Widget; namespace Policies { -class ModalDialog; +class ModelessDialog; } /// Class declaration for the application class @@ -94,7 +94,7 @@ #endif friend class Widget; - friend class Policies::ModalDialog; + friend class Policies::ModelessDialog; public: /// Returns the Application object /** Use this static function to access the Application object. Modified: dcplusplus/trunk/smartwin/include/smartwin/Policies.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/Policies.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/Policies.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -35,11 +35,11 @@ // begin namespace SmartWin template<typename Policy> -class MessageMapPolicy : public Policy { +class MessageMap : public Policy { public: - typedef MessageMapPolicy<Policy> PolicyType; + typedef MessageMap<Policy> PolicyType; - MessageMapPolicy(Widget* parent) : Policy(parent) { } + MessageMap(Widget* parent) : Policy(parent) { } static LRESULT CALLBACK wndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { // Check if this is an init type message - a message that will set the window pointer correctly @@ -119,15 +119,12 @@ }; namespace Policies { -/// Aspect classes for a MessageMapPolicyDialogWidget -/** Used as the third template argument to WidgetFactory if you're creating a - * MessageMapPolicyDialogWidget - */ -class Dialog +/// Policy for modeless dialogs +class ModelessDialog : public Widget { public: - Dialog(Widget* parent) : Widget(parent) { } + ModelessDialog(Widget* parent) : Widget(parent) { } static LRESULT returnDestroyed(HWND hWnd, UINT msg, WPARAM wPar, LPARAM lPar) { return FALSE; @@ -162,21 +159,18 @@ if ( uMsg == WM_INITDIALOG ) { // extracting the this pointer and stuffing it into the Window with SetProp - Dialog* This = reinterpret_cast<Dialog*>(lParam); + ModelessDialog* This = reinterpret_cast<ModelessDialog*>(lParam); This->attach( hwnd ); } } }; -/// Aspect classes for a MessageMapPolicyModalDialogWidget -/** Used as the third template argument to WidgetFactory if you're creating a - * MessageMapPolicyModalDialogWidget - */ +/// Policy for modal dialogs - these are treated the same as modeless dialogs but are not automagically deleted class ModalDialog - : public Dialog + : public ModelessDialog { public: - ModalDialog(Widget* parent) : Dialog(parent) { } + ModalDialog(Widget* parent) : ModelessDialog(parent) { } virtual void kill() { // Modal dialogs are stack allocated, so no delete @@ -242,7 +236,7 @@ virtual void attach(HWND hWnd) { Normal::attach(hWnd); - oldProc = reinterpret_cast< WNDPROC >( ::SetWindowLongPtr( hWnd, GWL_WNDPROC, ( LONG_PTR ) &MessageMapPolicy<Subclassed>::wndProc ) ); + oldProc = reinterpret_cast< WNDPROC >( ::SetWindowLongPtr( hWnd, GWL_WNDPROC, ( LONG_PTR ) &MessageMap<Subclassed>::wndProc ) ); } using Widget::attach; private: Modified: dcplusplus/trunk/smartwin/include/smartwin/SmartWin.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/SmartWin.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/SmartWin.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -63,7 +63,8 @@ #include "resources/Icon.h" #include "resources/ImageList.h" #include "resources/Pen.h" -#include "widgets/WidgetModalDialog.h" +#include "widgets/ModalDialog.h" +#include "widgets/ModelessDialog.h" namespace sw = SmartWin; Modified: dcplusplus/trunk/smartwin/include/smartwin/Widget.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/Widget.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/Widget.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -200,7 +200,7 @@ Widget * itsParent; HWND itsHandle; - /// The atom with which the pointer to the MessageMapBase is registered on the HWND + /// The atom with which the pointer to the Widget is registered on the HWND static GlobalAtom propAtom; }; Modified: dcplusplus/trunk/smartwin/include/smartwin/WidgetFactory.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/WidgetFactory.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/WidgetFactory.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -37,7 +37,6 @@ #include "widgets/ComboBox.h" #include "widgets/Table.h" #include "widgets/DateTime.h" -#include "widgets/WidgetDialog.h" #include "widgets/GroupBox.h" #include "widgets/LoadDialog.h" #include "widgets/MDIChild.h" @@ -55,8 +54,8 @@ #include "widgets/TextBox.h" #include "widgets/Tree.h" #include "widgets/ToolTip.h" -#include "widgets/WidgetWindow.h" -#include "widgets/WidgetWindowBase.h" +#include "widgets/Window.h" +#include "widgets/Frame.h" #include "WidgetFactoryPlatformImplementation.h" #include "WidgetCreator.h" @@ -66,15 +65,15 @@ /// Factory class for creating Widgets from a derived custom class /** This is the class you would normally derive from in your own application. <br> - * < p >Derive directly from WidgetFactory and then supply WidgetWindow as the first + * < p >Derive directly from WidgetFactory and then supply Window as the first * template parameter. The second parameter would then be YOUR CLASS ( this is * needed for the SmartWin type system to function ) Example : < b >class - * MyMainWindow : public SmartWin::WidgetFactory< SmartWin::WidgetWindow, + * MyMainWindow : public SmartWin::WidgetFactory< SmartWin::Window, * MyMainWindow > { ... };< /b > The third template argument is for declaring what * type of Widget you're declaring, for a "normal Widget" this defaults to - * MessageMapPolicyNormalWidget, if this is a Widget constructed from a dialog - * resource, you must state so by adding SmartWin::MessageMapPolicyDialogWidget and - * if it is a MDI Child you must add SmartWin::MessageMapPolicyMDIChildWidget as the + * MessageMapNormalWidget, if this is a Widget constructed from a dialog + * resource, you must state so by adding SmartWin::MessageMapDialogWidget and + * if it is a MDI Child you must add SmartWin::MessageMapMDIChildWidget as the * third argument Then when you need e.g. a Button you would create that * button by calling createButton. Class contains type defs for your * convenience for all Widget types that exists in the SmartWin library.< /p > Note! @@ -217,16 +216,16 @@ /// WidgetChildWindow object type. typedef typename WidgetChildWindow::ObjectType WidgetChildWindowPtr; - /// WidgetWindow class type. - typedef SmartWin::WidgetWindow WidgetWindow; + /// Window class type. + typedef SmartWin::Window Window; - /// WidgetWindow object type. - typedef typename WidgetWindow::ObjectType WidgetWindowPtr; + /// Window object type. + typedef typename Window::ObjectType WindowPtr; /// MDIFrame class type. typedef SmartWin::MDIFrame MDIFrame; - /// WidgetWindow object type. + /// Window object type. typedef typename MDIFrame::ObjectType MDIFramePtr; /// ProgressBar class type. Modified: dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectColor.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectColor.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectColor.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -38,7 +38,7 @@ /// Aspect class used by Widgets that have the possibility of handling the /// erase background property /** \ingroup AspectClasses - * E.g. the WidgetWindow has a background Aspect to it, therefore Table + * E.g. the Window has a background Aspect to it, therefore Table * realizes the AspectEnabled through inheritance. */ template<class WidgetType> Modified: dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectDragDrop.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectDragDrop.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectDragDrop.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -38,7 +38,7 @@ // begin namespace SmartWin /// Aspect class used by dialog Widgets that have the possibility of trapping "drop files events". /** \ingroup AspectClasses - * E.g. the WidgetModalDialog can trap "drop files events" therefore they realize the AspectDragDrop through inheritance. + * E.g. the ModalDialog can trap "drop files events" therefore they realize the AspectDragDrop through inheritance. */ template< class WidgetType > class AspectDragDrop Modified: dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectEraseBackground.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectEraseBackground.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectEraseBackground.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -37,7 +37,7 @@ /// Aspect class used by Widgets that have the possibility of handling the erase /// background property /** \ingroup AspectClasses - * E.g. the WidgetWindow have a AspectEraseBackground Aspect to it therefore + * E.g. the Window have a AspectEraseBackground Aspect to it therefore * Table realize the AspectEraseBackground through inheritance. When the * Widget needs to erase its background this event will be called with a Canvas * object which can be used for manipulating the colors etc the system uses to Modified: dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectMinMax.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectMinMax.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectMinMax.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -69,21 +69,21 @@ /** This will make the window fill the whole area that the window has available. * <br> * This function cannot be called for any Widget types other than those derived - * from WidgetWindowBase. + * from Frame. */ void maximize(); /// Minimize your window /** This will make the window become minimized. <br> * This function cannot be called for any Widget types other than those derived - * from WidgetWindowBase. + * from Frame. */ void minimize(); /// Restores your window /** This will make the window become restored. <br> * This function cannot be called for any Widget types other than those derived - * from WidgetWindowBase. + * from Frame. */ void restore(); Modified: dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectMouse.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectMouse.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectMouse.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -78,7 +78,7 @@ /// Aspect class used by Widgets that have the possibility of trapping "mouse /// clicked" events. /** \ingroup AspectClasses - * E.g. the WidgetWindow can trap "mouse clicked events" therefore it realize the + * E.g. the Window can trap "mouse clicked events" therefore it realize the * AspectMouse through inheritance. */ template< class WidgetType > Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/Control.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/Control.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Control.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -19,7 +19,7 @@ /** Base class is for windows common controls */ class Control : - public MessageMapPolicy< Policies::Subclassed >, + public MessageMap< Policies::Subclassed >, public AspectBorder<Control>, public AspectContextMenu<Control>, Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/CoolBar.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/CoolBar.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/CoolBar.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -69,7 +69,7 @@ * complex Widgets lke for instance a ComboBox, a TextBox and so on... */ class CoolBar : - public MessageMapPolicy< Policies::Subclassed >, + public MessageMap< Policies::Subclassed >, // Aspects public AspectEnabled< CoolBar >, @@ -101,8 +101,6 @@ /// Object type typedef ThisType * ObjectType; - typedef MessageMapPolicy<Policies::Subclassed> PolicyType; - /// 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 Copied: dcplusplus/trunk/smartwin/include/smartwin/widgets/Frame.h (from rev 1088, dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetWindowBase.h) =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/Frame.h (rev 0) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Frame.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -0,0 +1,369 @@ +/* + Copyright (c) 2005, Thomas Hansen + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the SmartWin++ nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#ifndef Frame_h +#define Frame_h + +#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" + +namespace SmartWin +{ +// begin namespace SmartWin + +/// Main Window class +/** \ingroup WidgetControls + * \WidgetUsageInfo + * \image html widgetwindow.png + * This class defines a "normal" window or the most commonly used "container + * Widget", normally you would define your own class which (indirectly) derives from + * this one. <br> + * You would normally derive directly from WidgetFactory and then supply this class + * as the first template parameter. <br> + * The second parameter would then be YOUR CLASS. <br> + * Example <br> + * <b>class MyMainWindow : public SmartWin::WidgetFactory<SmartWin::Window, + * MyMainWindow> { ... };</b> <br> + * Note especially that the second template argument to the WidgetFactory template + * class would almost ALWAYS be the name of your class derived from WidgetFactory. + * <br> + * You can also derive directly from Window and skip around the WidgetFactory + * factory class, the inheritance string would then become: <br> + * <b>class MyMainWindow : public SmartWin::Window<MyMainWindow></b> <br> + * But then you wouldn't have access to all the "createxxx" functions from class + * WidgetFactory which automatically gurantees that your Widgets get the right parent + * etc. <br> + * Look at (almost) any of the example projects distributed with the main download of + * the library residing in the SmartWinUnitTests directory for an example of how to + * use this class with the factory class WidgetFactory. + */ +template< class Policy > +class Frame : + public MessageMap< 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 > > +{ + struct CloseDispatcher + { + typedef std::tr1::function<bool ()> F; + + CloseDispatcher(const F& f_, Widget* widget_) : f(f_), widget(widget_) { } + + bool operator()(const MSG& msg, LRESULT& ret) { + bool destroy = f(); + + if ( destroy ) { + return false; + } + + return true; + } + + F f; + Widget* widget; + }; + + struct TimerDispatcher + { + typedef std::tr1::function<bool ()> F; + + TimerDispatcher(const F& f_) : f(f_) { } + + bool operator()(const MSG& msg, LRESULT& ret) { + bool keep = f(); + + if(!keep) { + ::KillTimer(msg.hwnd, msg.wParam); + // TODO remove from message map as well... + } + return FALSE; + } + + F f; + }; + +public: + /// Class type + typedef Frame< Policy > ThisType; + + /// Object type + typedef ThisType * ObjectType; + + // TODO: Outfactor into WidgetClosable + /// Event Handler setter for the Closing Event + /** If supplied event handler is called before the window is closed. <br> + * Signature of event handler must be "bool foo()" <br> + * If you return true from your event handler the window is closed, otherwise + * the window is NOT allowed to actually close!! + */ + void onClosing(const typename CloseDispatcher::F& f) { + this->addCallback( + Message( WM_CLOSE ), CloseDispatcher(f, this) + ); + } + + // TODO: Outfactor into "time Aspect" class + /// Creates a timer object. + /** The supplied function must have the signature bool foo() <br> + * The event function will be called when at least milliSeconds seconds have elapsed. + * If your event handler returns true, it will keep getting called periodically, otherwise + * it will be removed. + */ + void createTimer(const typename TimerDispatcher::F& f, unsigned int milliSeconds, unsigned int id = 0); + + /// Closes the window + /** Call this function to raise the "Closing" event. <br> + * This will normally try to close the window. <br> + * Note! <br> + * If this event is trapped and we in that event handler state that we DON'T + * want to close the window (by returning false) the window will not be close. + * <br> + * Note! <br> + * If the asyncron argument is true the message will be posted to the message + * que meaning that the close event will be done asyncronously and therefore the + * function will return immediately and the close event will be handled when the + * close event pops up in the event handler que. + */ + void close( bool asyncron = false ); + + // TODO: Outfactor to system implementation type, see e.g. WidgetFactory +#ifndef WINCE + /// Animates a window + /** Slides the window into view from either right or left depending on the + * parameter "left". If "left" is true, then from the left, otherwise from the + * right. <br> + * Show defines if the window shall come INTO view or go OUT of view. <br> + * The "time" parameter is the total duration of the function in milliseconds. + */ + void animateSlide( bool show, bool left, unsigned int msTime ); + + /// Animates a window + /** Blends the window INTO view or OUT of view. <br> + * Show defines if the window shall come INTO view or go OUT of view. <br> + * The "time" parameter is the total duration of the function in milliseconds. + */ + void animateBlend( bool show, int msTime ); + + /// Animates a window + /** Collapses the window INTO view or OUT of view. The collapse can be thought of + * as either an "explosion" or an "implosion". <br> + * Show defines if the window shall come INTO view or go OUT of view. <br> + * The "time" parameter is the total duration of the function in milliseconds. + */ + void animateCollapse( bool show, int msTime ); +#endif + + /// Adds or removes the minimize box from the Widget + void setMinimizeBox( bool value = true ); + + /// Adds or removes the maximize box from the Widget + void setMaximizeBox( bool value = true ); + + /// Sets the small icon for the Widget (the small icon appears typically in the top left corner of the Widget) + void setIconSmall( int resourceId ); + + /// Sets the small icon for the Widget (the small icon appears typically in the top left corner of the Widget) + void setIconSmall( const SmartUtil::tstring & filePathName ); + + /// Sets the large icon for the Widget (the large icon appears e.g. when you press ALT+Tab) + void setIconLarge( int resourceId ); + + /// Sets the large icon for the Widget (the large icon appears e.g. when you press ALT+Tab) + void setIconLarge( const SmartUtil::tstring & filePathName ); + + /// Sets the cursor for the Widget + void setCursor( int resourceId ); + + /// Sets the cursor for the Widget + void setCursor( const SmartUtil::tstring & filePathName ); + +protected: + // Protected since this Widget we HAVE to inherit from + explicit Frame( Widget * parent = 0 ); + + // Protected to avoid direct instantiation, you can inherit but NOT instantiate + // directly + virtual ~Frame() + {} + + +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Implementation of class +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +template< class Policy > +void Frame< Policy >::createTimer( const typename TimerDispatcher::F& f, + unsigned int milliSecond, unsigned int id) +{ + + ::SetTimer( this->handle(), id, static_cast< UINT >( milliSecond ), NULL); + addCallback( + Message( WM_TIMER, id ), TimerDispatcher(f) + ); +} + +template< class Policy > +void Frame< Policy >::close( bool asyncron ) +{ + if ( asyncron ) + this->postMessage(WM_CLOSE); // Return now + else + this->sendMessage(WM_CLOSE); // Return after close is done. +} + +#ifndef WINCE +template< class Policy > +void Frame< Policy >::animateSlide( bool show, bool left, unsigned int time ) +{ + ::AnimateWindow( this->handle(), static_cast< DWORD >( time ), + show ? + left ? AW_SLIDE | AW_HOR_NEGATIVE : + AW_SLIDE | AW_HOR_POSITIVE + : + left ? AW_HIDE | AW_SLIDE | AW_HOR_NEGATIVE : + AW_HIDE | AW_SLIDE | AW_HOR_POSITIVE + ); +} + +//HC: This function gives problems with some non-Microsoft visual styles +template< class Policy > +void Frame< Policy >::animateBlend( bool show, int msTime ) +{ + ::AnimateWindow( this->handle(), static_cast< DWORD >( msTime ), show ? AW_BLEND : AW_HIDE | AW_BLEND ); +} + +template< class Policy > +void Frame< Policy >::animateCollapse( bool show, int msTime ) +{ + ::AnimateWindow( this->handle(), static_cast< DWORD >( msTime ), show ? AW_CENTER : AW_HIDE | AW_CENTER ); +} +#endif + +template< class Policy > +void Frame< Policy >::setMinimizeBox( bool value ) +{ + Widget::addRemoveStyle( WS_MINIMIZEBOX, value ); +} + +template< class Policy > +void Frame< Policy >::setMaximizeBox( bool value ) +{ + Widget::addRemoveStyle( WS_MAXIMIZEBOX, value ); +} + +template< class Policy > +void Frame< Policy >::setIconSmall( int resourceId ) +{ + HICON hIcon = ( HICON )::LoadImage( Application::instance().getAppHandle(), MAKEINTRESOURCE( resourceId ), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR ); + ::SendMessage( this->handle(), WM_SETICON, ICON_SMALL, reinterpret_cast< LPARAM >( hIcon ) ); +} + +template< class Policy > +void Frame< Policy >::setIconLarge( int resourceId ) +{ + HICON hIcon = ( HICON )::LoadImage( Application::instance().getAppHandle(), MAKEINTRESOURCE( resourceId ), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE ); + ::SendMessage( this->handle(), WM_SETICON, ICON_BIG, reinterpret_cast< LPARAM >( hIcon ) ); +} + +template< class Policy > +void Frame< Policy >::setIconSmall( const SmartUtil::tstring & filePathName ) +{ + HICON hIcon = ( HICON )::LoadImage( 0, filePathName.c_str(), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR | LR_LOADFROMFILE ); + ::SendMessage( this->handle(), WM_SETICON, ICON_SMALL, reinterpret_cast< LPARAM >( hIcon ) ); +} + +template< class Policy > +void Frame< Policy >::setIconLarge( const SmartUtil::tstring & filePathName ) +{ + HICON hIcon = ( HICON )::LoadImage( 0, filePathName.c_str(), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE ); + ::SendMessage( this->handle(), WM_SETICON, ICON_BIG, reinterpret_cast< LPARAM >( hIcon ) ); +} + +template< class Policy > +void Frame< Policy >::setCursor( int resourceId ) +{ + HCURSOR hCur = ::LoadCursor( Application::instance().getAppHandle(), MAKEINTRESOURCE( resourceId ) ); + ::SetClassLongPtr( this->handle(), GCLP_HCURSOR, reinterpret_cast< LONG >( hCur ) ); +} + +template< class Policy > +void Frame< Policy >::setCursor( const SmartUtil::tstring & filePathName ) +{ + HICON hCur = ( HICON )::LoadImage( 0, filePathName.c_str(), IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE ); + ::SetClassLongPtr( this->handle(), GCLP_HCURSOR, reinterpret_cast< LONG >( hCur ) ); +} + +template< class Policy > +Frame< Policy >::Frame( Widget * parent ) + : Frame<Policy>::PolicyType( parent ) +{ +} + +// end namespace SmartWin +} + +#endif Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIChild.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIChild.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIChild.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -36,7 +36,7 @@ #include "../Policies.h" #include "../WindowClass.h" #include "MDIParent.h" -#include "WidgetWindowBase.h" +#include "Frame.h" #include <sstream> #include <boost/scoped_ptr.hpp> @@ -51,7 +51,7 @@ * \WidgetUsageInfo * \image html mdi.PNG * Class for creating a MDI Child Widget. <br> - * An MDI Child is a Widget which is kind of like a special case of WidgetWindow, it + * An MDI Child is a Widget which is kind of like a special case of Window, it * exists only for two purposes which is 1. Contained in the MDIParent class * and 2. To serve as a container widget for your control widgets. <br> * Use either the MDIParent::createMDIChild or inherit from this class and roll @@ -60,10 +60,10 @@ * MDIParent */ class MDIChild - : public WidgetWindowBase< Policies::MDIChild > + : public Frame< Policies::MDIChild > { public: - typedef WidgetWindowBase<Policies::MDIChild> BaseType; + typedef Frame<Policies::MDIChild> BaseType; /// Class type typedef MDIChild ThisType; @@ -93,7 +93,7 @@ }; /// Creates a MDIChild Window - /** This version creates a MessageMapPolicyMDIChildWidget to plug into MDIParent + /** This version creates a MessageMapMDIChildWidget to plug into MDIParent * container window. */ void createMDIChild( Seed cs = Seed() ); Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIFrame.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIFrame.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIFrame.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -31,7 +31,7 @@ #include "../WindowsHeaders.h" #include "../Rectangle.h" #include "../WindowClass.h" -#include "WidgetWindowBase.h" +#include "Frame.h" #include <boost/scoped_ptr.hpp> namespace SmartWin @@ -53,9 +53,9 @@ * features of MDIFrameBase. */ class MDIFrame - : public WidgetWindowBase< Policies::MDIFrame<MDIFrame > > + : public Frame< Policies::MDIFrame<MDIFrame > > { - typedef WidgetWindowBase< Policies::MDIFrame<MDIFrame > > BaseType; + typedef Frame< Policies::MDIFrame<MDIFrame > > BaseType; public: /// Class type Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIParent.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIParent.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIParent.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -64,7 +64,7 @@ * MDIChild */ class MDIParent : - public MessageMapPolicy< Policies::Subclassed >, + public MessageMap< Policies::Subclassed >, // Aspects public AspectSizable< MDIParent >, @@ -81,7 +81,6 @@ /// Object type typedef ThisType * ObjectType; - typedef MessageMapPolicy<Policies::Subclassed> PolicyType; /// 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 Copied: dcplusplus/trunk/smartwin/include/smartwin/widgets/ModalDialog.h (from rev 1088, dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetModalDialog.h) =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/ModalDialog.h (rev 0) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/ModalDialog.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -0,0 +1,215 @@ +/* + Copyright ( c ) 2005, Thomas Hansen + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met : + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the SmartWin++ nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + ( INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#ifndef ModalDialog_h +#define ModalDialog_h + +#include "../aspects/AspectDialog.h" +#include "Frame.h" + +namespace SmartWin +{ +// begin namespace SmartWin + +/// Modal Dialog class +/** \ingroup WidgetControls + * \image html dialog.PNG + * Class for creating a Modal Dialog based optionally on an embedded resource. <br> + * Use createDialog( unsigned resourceId ) if you define the dialog in a .rc file, + * and use createDialog() if you define the dialog completly in C++ source. <br> + * Use the createDialog function to actually create a dialog. <br> + * Class is a public superclass of Frame and therefore can use all + * features of Frame. <br> + * Note! <br> + * Usually you create a ModalDialog on the stack. <br> + * This Widget does NOT have selfdestructive semantics and should normally be + * constructed on the stack! <br> + * The createDialog function does NOT return before the Widget is destroyed! <br> + * Thus, you must declare the "onInitDialog" event handler before calling the + * "createDialog()", either in the contructor, or in some intialization routine + * called before createDialog(); + */ + +class ModalDialog : + public Frame< Policies::ModalDialog >, + public AspectDialog<ModalDialog > +{ + struct Dispatcher + { + typedef std::tr1::function<bool ()> F; + + Dispatcher(const F& f_) : f(f_) { } + + bool operator()(const MSG& msg, LRESULT& ret) { + ret = f() ? TRUE : FALSE; + return true; + } + + F f; + }; + +public: + typedef Frame< Policies::ModalDialog > BaseType; + + /// Class type + typedef ModalDialog ThisType; + + /// Object type + /** Note, not a pointer!!!! + */ + typedef ThisType ObjectType; + + /// Creates a Modal Dialog Window from a resource id. + /** This version creates a window from a Dialog Resource ID. <br> + * To be called by the invoker of the dialog. <br> + * The return comes from the parameter to endDialog() <br> + * You must call onInitDialog( &MyDialogWidget::initDialog ); or similar either + * in the constructor of your dialog or right before calling this function. <br> + * And in your initDialog, you must call attachXxxx for all of the controls + * you wish to use, and set the event handlers for all controls and events you + * wish to handle. <br> + * Example : <br> + * LabelPtr prompt = attachStatic( IDC_PROMPT ); <br> + * prompt->onClicked( &X::myClickMethod ); <br> + * ...etc... + */ + virtual int createDialog( unsigned resourceId ); + + /// Creates a Modal Dialog Window defined in C++ alone. + /** This version creates a dialog window without using a Dialog Resource ID. <br> + * To be called by the invoker of the dialog. <br> + * The return comes from the parameter to endDialog() <br> + * You must call onInitDialog( &MyModalDialogWidget::initDialog ); in the + * constructor of your dialog, <br> + * and in your initDialog you create the dialog's Widgets yourself. <br> + * Example : <br> + * LabelPtr prompt = createStatic(); <br> + * prompt->setBounds( 10, 100, 100, 50 ); <br> + * prompt->setText( _T("testing") ); + */ + int createDialog(); + + /// Ends the Modal Dialog Window started with createDialog(). + /** Pass a return value for createDialog() and close the dialog. <br> + * To be called by the dialog class when it should close. <br> + * Note that the member variables of the ModalDialog class still exist, + * but not any subwindows or Control Widgets. + */ + void endDialog( int returnValue ); + + /// Dialog Init Event Handler setter + /** This would normally be the event handler where you attach your Widget + * controls and do all the initializing etc... <br> + * It's important that you declare this event handler BEFORE calling the + * createDialog function since that function doesn't actually return before the + * dialog is destroyed! <br> + * Method signature must be bool foo(); <br> + * If you return true from your Event Handler the system will NOT mess up the + * initial focus you have chosen, if you return false the system will decide + * which control to initially have focus according to the tab order of the + * controls! + */ + void onInitDialog(const Dispatcher::F& f) { + addCallback( + Message( WM_INITDIALOG ), Dispatcher(f) + ); + } + +protected: + // Protected since this Widget we HAVE to inherit from + explicit ModalDialog( Widget * parent = 0 ); + + virtual ~ModalDialog() + {} + + /// Specify how a resourceless dialog's window appears. + /** The derived pure dialog class can control the DLGTEMPLATE parameters used in + * createDialog() with this protected call. <br> + * The calling layer is prevented from doing so. <br> + * See DLGTEMPLATE as used in ::DialogBoxIndirectParam for details. + */ + void setDlgTemplate( DLGTEMPLATE inTemplate ); + + /// Called by default when WM_CLOSE is posted to the dialog + bool defaultClosing() { + endDialog(IDCANCEL); + return true; + } + +private: + DLGTEMPLATE itsDefaultDlgTemplate; // For pure modal dialogs without resource files +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Implementation of class +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +inline ModalDialog::ModalDialog( Widget * parent ) + : BaseType( parent ) +{ + // Default parameters for pure modal dialogs +#ifdef WINCE + itsDefaultDlgTemplate.style = DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CENTER; +#else + itsDefaultDlgTemplate.style = DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CENTER; +#endif + itsDefaultDlgTemplate.dwExtendedStyle = 0; + itsDefaultDlgTemplate.cdit = 0; // No dialog items in the dialog + itsDefaultDlgTemplate.cx = 280; // 4 horizontal units are the width of one character + itsDefaultDlgTemplate.cy = 160; // 8 vertical units are the height of one character + itsDefaultDlgTemplate.x = 0; + itsDefaultDlgTemplate.y = 0; + + onClosing(std::tr1::bind(&ThisType::defaultClosing, this)); +} + +// The derived pure dialog class can control the DLGTEMPLATE parameters used in +// createDialog() with this protected call. The calling layer is prevented from +// doing so. +// + +inline void ModalDialog::setDlgTemplate( DLGTEMPLATE inTemplate ) +{ + itsDefaultDlgTemplate = inTemplate; +} + +// A Pure dialog created at runtime, without any help from a resource editer. The +// derived dialog class can control the DLGTEMPLATE parameters. instead of the +// calling layer. +// + +inline void ModalDialog::endDialog( int retv ) +{ + // Causes createDialog() to return with retv. + // + ::EndDialog( this->handle(), static_cast< INT_PTR >( retv ) ); +} + +// end namespace SmartWin +} + +#endif Copied: dcplusplus/trunk/smartwin/include/smartwin/widgets/ModelessDialog.h (from rev 1088, dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetDialog.h) =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/ModelessDialog.h (rev 0) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/ModelessDialog.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -0,0 +1,82 @@ +/* + Copyright ( c ) 2005, Thomas Hansen + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met : + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the SmartWin++ nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + ( INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#ifndef ModelessDialog_h +#define ModelessDialog_h + +#include "../aspects/AspectDialog.h" +#include "Frame.h" + +namespace SmartWin +{ +// begin namespace SmartWin + +/// Dialog class +/** \ingroup WidgetControls + * \WidgetUsageInfo + * \image html dialog.PNG + * Class for creating a Modeless Dialog based upon an embedded resource. <br> + * Use the createDialog function to actually create a dialog. <br> + * Class is a public superclass of Frame and therefor can use all features + * of Frame. + */ +class ModelessDialog : + public Frame< Policies::ModelessDialog >, + public AspectDialog<ModelessDialog > +{ +public: + typedef Frame< Policies::ModelessDialog > BaseType; + /// Class type + typedef ModelessDialog ThisType; + + /// Object type + typedef ThisType * ObjectType; + + /// Creates a Dialog Window + /** This version creates a window from the given Dialog Resource Id. + */ + void createDialog( unsigned resourceId ); + +protected: + // Protected since this Widget we HAVE to inherit from + explicit ModelessDialog( Widget * parent = 0 ); + + virtual ~ModelessDialog() + {} +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Implementation of class +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +inline ModelessDialog::ModelessDialog( Widget * parent ) + : BaseType( parent ) +{} + +// end namespace SmartWin +} + +#endif Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/StatusBar.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/StatusBar.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/StatusBar.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -87,9 +87,9 @@ * \image html status.PNG * Class for creating a Status Bar Control. <br> * A status bar is a status info line normally residing in the bottom of a - * WidgetWindow or other container type of Widget. <br> + * Window or other container type of Widget. <br> * You can then send text to that window to show e.g. "status info" regarding the - * WidgetWindow which owns the Status Bar Control. A good example of an application + * Window which owns the Status Bar Control. A good example of an application * with a status bar is for instance Internet Explorer which ( unless you have made * it invisible ) has a strip of status information at the bottom showing for * instance the security settings of the current page and how far in the download @@ -140,8 +140,8 @@ * status bar, typical example is when you have resized the container Widget. * <br> * Normally you would call this function after _EVERY_ single resize the main - * WidgetWindow which owns the status bar gets. <br> - * Call this one in the onSized event handler for your WidgetWindow. + * Window which owns the status bar gets. <br> + * Call this one in the onSized event handler for your Window. */ void refresh(); Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/ToolTip.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/ToolTip.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/ToolTip.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -14,7 +14,7 @@ class WidgetCreator; class ToolTip : - public MessageMapPolicy< Policies::Subclassed >, + public MessageMap< Policies::Subclassed >, // Aspects public AspectEnabled< ToolTip >, @@ -46,8 +46,6 @@ /// Object type typedef ThisType * ObjectType; - typedef MessageMapPolicy<Policies::Subclassed> PolicyType; - class Seed : public Widget::Seed { Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/Tree.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/Tree.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Tree.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -234,7 +234,7 @@ /// Sets the event handler for what function to be called when a label is edited. /** Event handler signature is must be "bool foo( Tree *, * SmartUtil::tstring & )" and it must be contained as a member of the class - * that is defined as the EventHandlerClass, normally either the WidgetWindow + * that is defined as the EventHandlerClass, normally either the Window * derived class or the class derived from Tree. <br> * Return true from your event handler if you wish the label to actually become * updated or false if you want to disallow the item to actually become updated! Deleted: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetDialog.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetDialog.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetDialog.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -1,82 +0,0 @@ -/* - Copyright ( c ) 2005, Thomas Hansen - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met : - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the SmartWin++ nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - ( INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#ifndef WidgetDialog_h -#define WidgetDialog_h - -#include "../aspects/AspectDialog.h" -#include "WidgetWindowBase.h" - -namespace SmartWin -{ -// begin namespace SmartWin - -/// Dialog class -/** \ingroup WidgetControls - * \WidgetUsageInfo - * \image html dialog.PNG - * Class for creating a Modeless Dialog based upon an embedded resource. <br> - * Use the createDialog function to actually create a dialog. <br> - * Class is a public superclass of WidgetWindowBase and therefor can use all features - * of WidgetWindowBase. - */ -class WidgetDialog : - public WidgetWindowBase< Policies::Dialog >, - public AspectDialog<WidgetDialog > -{ -public: - typedef WidgetWindowBase< Policies::Dialog > BaseType; - /// Class type - typedef WidgetDialog ThisType; - - /// Object type - typedef ThisType * ObjectType; - - /// Creates a Dialog Window - /** This version creates a window from the given Dialog Resource Id. - */ - void createDialog( unsigned resourceId ); - -protected: - // Protected since this Widget we HAVE to inherit from - explicit WidgetDialog( Widget * parent = 0 ); - - virtual ~WidgetDialog() - {} -}; - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Implementation of class -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -inline WidgetDialog::WidgetDialog( Widget * parent ) - : BaseType( parent ) -{} - -// end namespace SmartWin -} - -#endif Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenu.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenu.h 2008-03-30 08:15:26 UTC (rev 1088) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenu.h 2008-03-30 08:17:30 UTC (rev 1089) @@ -122,7 +122,7 @@ * \WidgetUsageInfo * \image ht... [truncated message content] |