|
From: <arn...@us...> - 2008-04-07 19:05:13
|
Revision: 1103
http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1103&view=rev
Author: arnetheduck
Date: 2008-04-07 12:04:50 -0700 (Mon, 07 Apr 2008)
Log Message:
-----------
Rework seeds, needs more work
Modified Paths:
--------------
dcplusplus/trunk/smartwin/include/smartwin/Widget.h
dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectText.h
dcplusplus/trunk/smartwin/include/smartwin/widgets/Button.h
dcplusplus/trunk/smartwin/include/smartwin/widgets/CheckBox.h
dcplusplus/trunk/smartwin/include/smartwin/widgets/ComboBox.h
dcplusplus/trunk/smartwin/include/smartwin/widgets/Composite.h
dcplusplus/trunk/smartwin/include/smartwin/widgets/Container.h
dcplusplus/trunk/smartwin/include/smartwin/widgets/Control.h
dcplusplus/trunk/smartwin/include/smartwin/widgets/CoolBar.h
dcplusplus/trunk/smartwin/include/smartwin/widgets/DateTime.h
dcplusplus/trunk/smartwin/include/smartwin/widgets/Frame.h
dcplusplus/trunk/smartwin/include/smartwin/widgets/GroupBox.h
dcplusplus/trunk/smartwin/include/smartwin/widgets/Label.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/ModelessDialog.h
dcplusplus/trunk/smartwin/include/smartwin/widgets/RadioButton.h
dcplusplus/trunk/smartwin/include/smartwin/widgets/TextBox.h
dcplusplus/trunk/smartwin/source/widgets/Button.cpp
dcplusplus/trunk/smartwin/source/widgets/CheckBox.cpp
dcplusplus/trunk/smartwin/source/widgets/ComboBox.cpp
dcplusplus/trunk/smartwin/source/widgets/CoolBar.cpp
dcplusplus/trunk/smartwin/source/widgets/DateTime.cpp
dcplusplus/trunk/smartwin/source/widgets/GroupBox.cpp
dcplusplus/trunk/smartwin/source/widgets/Label.cpp
dcplusplus/trunk/smartwin/source/widgets/MDIChild.cpp
dcplusplus/trunk/smartwin/source/widgets/MDIFrame.cpp
dcplusplus/trunk/smartwin/source/widgets/MDIParent.cpp
dcplusplus/trunk/smartwin/source/widgets/ProgressBar.cpp
dcplusplus/trunk/smartwin/source/widgets/RadioButton.cpp
dcplusplus/trunk/smartwin/source/widgets/TextBox.cpp
dcplusplus/trunk/smartwin/source/widgets/Window.cpp
dcplusplus/trunk/win32/SearchFrame.cpp
dcplusplus/trunk/win32/SystemFrame.cpp
Property Changed:
----------------
dcplusplus/trunk/
Property changes on: dcplusplus/trunk
___________________________________________________________________
Name: bzr:revision-info
- timestamp: 2008-03-31 20:44:36.398000002 +0200
committer: Jacek Sieka <arn...@gm...>
properties:
branch-nick: dcplusplus
+ timestamp: 2008-04-01 00:06:48.601000071 +0200
committer: Jacek Sieka <arn...@gm...>
properties:
branch-nick: dcplusplus
Name: bzr:file-ids
- smartwin/include/smartwin/aspects/AspectCloseable.h aspectcloseable.h-20080331184314-ain6peu31zweti0t-1
smartwin/include/smartwin/aspects/AspectTimer.h aspecttimer.h-20080331184314-ain6peu31zweti0t-2
smartwin/include/smartwin/widgets/Composite.h composite.h-20080331184314-ain6peu31zweti0t-3
smartwin/include/smartwin/widgets/Container.h container.h-20080331184314-ain6peu31zweti0t-4
smartwin/source/widgets/ModalDialog.cpp 800@f586c4b0-9d0d-0410-bc51-f1fe239209fc:dcplusplus%2Ftrunk:smartwin%2Fsource%2Fwidgets%2FWidgetModalDialog.cpp
smartwin/source/widgets/ModelessDialog.cpp 800@f586c4b0-9d0d-0410-bc51-f1fe239209fc:dcplusplus%2Ftrunk:smartwin%2Fsource%2Fwidgets%2FWidgetDialog.cpp
smartwin/source/widgets/Window.cpp 800@f586c4b0-9d0d-0410-bc51-f1fe239209fc:dcplusplus%2Ftrunk:smartwin%2Fsource%2Fwidgets%2FWidgetWindow.cpp
+
Name: bzr:revision-id:v3-trunk1
- 1027 arn...@gm...-20080323183926-schknwnkgeo7ivdn
1028 zouzou123gen-20080323220411-r8usuc3qxwuh7zsn
1029 zouzou123gen-20080323221249-0su72zaj13e706mk
1030 arn...@gm...-20080324140623-muba1dl46m000o8c
1031 zouzou123gen-20080324141933-qbgr93ugpe0297m6
1032 arn...@gm...-20080324153706-siidja05n84i00b1
1033 arn...@gm...-20080324153823-lhn3awurnu77riln
1034 arn...@gm...-20080324165650-zapppziji67yf5a2
1035 zouzou123gen-20080324175936-4mqc2kh0lo5wtdu2
1036 zouzou123gen-20080325004602-6wdsoym95mjuhwd3
1037 arn...@gm...-20080325100659-8fqy6q65itmghlep
1038 zouzou123gen-20080325175216-s297sdiucukfvijh
1039 arn...@gm...-20080325210137-3dfqyoi8ykosy087
1040 arn...@gm...-20080325211747-nwwy1eb33r071sca
1041 arn...@gm...-20080326084110-qbselrjckku275xi
1042 zouzou123gen-20080326123631-35642mgbk2i4ty32
1043 zouzou123gen-20080326124345-f4xwn2d3ty8ubd6r
1044 arn...@gm...-20080326162031-il0nyms30w0mky43
1045 arn...@gm...-20080326164801-8dru8mjc06xgzjpv
1046 arn...@gm...-20080326170438-uzl2rx8fqnohak7g
1047 zouzou123gen-20080326172821-d6uqcbmfb0c6rwlv
1048 arn...@gm...-20080326213257-qlgdh7m2712p2l0q
1049 arn...@gm...-20080326214313-ktnoekgk3s0wmatz
1050 arn...@gm...-20080326215256-0j1iqrf286b9g7zf
1051 arn...@gm...-20080327082121-hoi22wh1gwjdfbyd
1052 arn...@gm...-20080327120639-um3tukdt374rwvgm
1053 zouzou123gen-20080327130703-6vtek6uxy3vua543
1054 arn...@gm...-20080327215831-dmg5mkufskabwkro
1055 arn...@gm...-20080327231459-cdztcv25alsuyqmf
1056 arn...@gm...-20080328085925-gceybsr53oml1p24
1057 arn...@gm...-20080328200512-1sjuu6bcnl2dyd2a
1058 arn...@gm...-20080328210347-bussqjrm5mfswh7o
1059 arn...@gm...-20080329055630-braiir1dskv7a4qm
1060 arn...@gm...-20080329061558-rck8dz60wpj3c5ja
1061 arn...@gm...-20080329081253-if6o5jn329mbzfpl
1062 arn...@gm...-20080329081619-cb4x930j8sp55cs0
1063 arn...@gm...-20080329103216-hgjzo7ra2zixbztd
1064 arn...@gm...-20080329124042-q3aw4iodmo5kafyp
1065 arn...@gm...-20080329124926-2je1z18p0272zpua
1066 arn...@gm...-20080329150901-ehj9t32en7eps2dp
1067 zouzou123gen-20080329153653-36xlvpik2ns9r84r
1068 zouzou123gen-20080329162703-51xr8hg073pg7wq5
1069 zouzou123gen-20080329234706-8ddipdqu0xeudkql
1070 arn...@gm...-20080330081232-ubqr1171ewalrd4q
1071 zouzou123gen-20080330131607-yppbs3mgyjef1cux
1072 zouzou123gen-20080330134835-yv1nogy77ib1uehd
1073 zouzou123gen-20080331124549-alyw7vugdn30piqy
1074 zouzou123gen-20080331135108-q8frtqsin5bosfzm
1075 zouzou123gen-20080331140757-u94q52yccl5lsifk
1076 zouzou123gen-20080331152513-ue1x5qhigcw51348
1077 arn...@gm...-20080331184436-a8g6chibmg8nswls
+ 1027 arn...@gm...-20080323183926-schknwnkgeo7ivdn
1028 zouzou123gen-20080323220411-r8usuc3qxwuh7zsn
1029 zouzou123gen-20080323221249-0su72zaj13e706mk
1030 arn...@gm...-20080324140623-muba1dl46m000o8c
1031 zouzou123gen-20080324141933-qbgr93ugpe0297m6
1032 arn...@gm...-20080324153706-siidja05n84i00b1
1033 arn...@gm...-20080324153823-lhn3awurnu77riln
1034 arn...@gm...-20080324165650-zapppziji67yf5a2
1035 zouzou123gen-20080324175936-4mqc2kh0lo5wtdu2
1036 zouzou123gen-20080325004602-6wdsoym95mjuhwd3
1037 arn...@gm...-20080325100659-8fqy6q65itmghlep
1038 zouzou123gen-20080325175216-s297sdiucukfvijh
1039 arn...@gm...-20080325210137-3dfqyoi8ykosy087
1040 arn...@gm...-20080325211747-nwwy1eb33r071sca
1041 arn...@gm...-20080326084110-qbselrjckku275xi
1042 zouzou123gen-20080326123631-35642mgbk2i4ty32
1043 zouzou123gen-20080326124345-f4xwn2d3ty8ubd6r
1044 arn...@gm...-20080326162031-il0nyms30w0mky43
1045 arn...@gm...-20080326164801-8dru8mjc06xgzjpv
1046 arn...@gm...-20080326170438-uzl2rx8fqnohak7g
1047 zouzou123gen-20080326172821-d6uqcbmfb0c6rwlv
1048 arn...@gm...-20080326213257-qlgdh7m2712p2l0q
1049 arn...@gm...-20080326214313-ktnoekgk3s0wmatz
1050 arn...@gm...-20080326215256-0j1iqrf286b9g7zf
1051 arn...@gm...-20080327082121-hoi22wh1gwjdfbyd
1052 arn...@gm...-20080327120639-um3tukdt374rwvgm
1053 zouzou123gen-20080327130703-6vtek6uxy3vua543
1054 arn...@gm...-20080327215831-dmg5mkufskabwkro
1055 arn...@gm...-20080327231459-cdztcv25alsuyqmf
1056 arn...@gm...-20080328085925-gceybsr53oml1p24
1057 arn...@gm...-20080328200512-1sjuu6bcnl2dyd2a
1058 arn...@gm...-20080328210347-bussqjrm5mfswh7o
1059 arn...@gm...-20080329055630-braiir1dskv7a4qm
1060 arn...@gm...-20080329061558-rck8dz60wpj3c5ja
1061 arn...@gm...-20080329081253-if6o5jn329mbzfpl
1062 arn...@gm...-20080329081619-cb4x930j8sp55cs0
1063 arn...@gm...-20080329103216-hgjzo7ra2zixbztd
1064 arn...@gm...-20080329124042-q3aw4iodmo5kafyp
1065 arn...@gm...-20080329124926-2je1z18p0272zpua
1066 arn...@gm...-20080329150901-ehj9t32en7eps2dp
1067 zouzou123gen-20080329153653-36xlvpik2ns9r84r
1068 zouzou123gen-20080329162703-51xr8hg073pg7wq5
1069 zouzou123gen-20080329234706-8ddipdqu0xeudkql
1070 arn...@gm...-20080330081232-ubqr1171ewalrd4q
1071 zouzou123gen-20080330131607-yppbs3mgyjef1cux
1072 zouzou123gen-20080330134835-yv1nogy77ib1uehd
1073 zouzou123gen-20080331124549-alyw7vugdn30piqy
1074 zouzou123gen-20080331135108-q8frtqsin5bosfzm
1075 zouzou123gen-20080331140757-u94q52yccl5lsifk
1076 zouzou123gen-20080331152513-ue1x5qhigcw51348
1077 arn...@gm...-20080331184436-a8g6chibmg8nswls
1078 arn...@gm...-20080331220648-81485k28qmwruwz6
Modified: dcplusplus/trunk/smartwin/include/smartwin/Widget.h
===================================================================
--- dcplusplus/trunk/smartwin/include/smartwin/Widget.h 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/include/smartwin/Widget.h 2008-04-07 19:04:50 UTC (rev 1103)
@@ -64,45 +64,6 @@
: public boost::noncopyable
{
public:
- /** Most Widgets can override the creational parameters which sets the style and the
- * initial position of the Widget, those Widgets will take an object of this type to
- * their creational function(s).
- */
- struct Seed {
- LPCTSTR className;
-
- /// Initial caption
- /** Windows with a title bar will use this string in the title bar. Controls with
- * caption (e.g. static control, edit control) will use it in the control. <br>
- * It is feed directly to CreateWindowEx, this means that it follows its
- * conventions. In particular, the string "#num" has a special meaning.
- */
- SmartUtil::tstring caption;
-
- /// The style of the object (starts with WS_ or BS_ etc...)
- /** WARNING: The creation of most of the controls require WS_CHILD to be set.
- * This is done, by default, in the appropriate controls. If you override the
- * default style, then be sure that WS_CHILD is set (if needed).
- */
- DWORD style;
-
- /// The Extended Style of the object (starts often with WS_EX_ etc)
- DWORD exStyle;
-
- /// The initial position / size of the Widget
- Rectangle location;
-
- HMENU menuHandle;
-
- /// Constructor initializing all member variables to default values
- Seed(LPCTSTR className_, DWORD style_ = WS_VISIBLE, DWORD exStyle_ = 0,
- const SmartUtil::tstring& caption_ = SmartUtil::tstring(),
- const Rectangle& location_ = letTheSystemDecide, HMENU menuHandle_ = NULL)
- : className(className_), caption(caption_), style( style_ ), exStyle( exStyle_ ), location( location_ ), menuHandle( menuHandle_ )
- {}
-
- };
-
/// Returns the HWND to the Widget
/** Returns the HWND to the inner window of the Widget. <br>
* If you need to do directly manipulation of the window use this function to
@@ -178,17 +139,58 @@
*/
void attach( unsigned id );
- virtual void attach(HWND wnd);
+protected:
+ /** Most Widgets can override the creational parameters which sets the style and the
+ * initial position of the Widget, those Widgets will take an object of this type to
+ * their creational function(s).
+ */
+ struct Seed {
+ LPCTSTR className;
-protected:
+ /// Initial caption
+ /** Windows with a title bar will use this string in the title bar. Controls with
+ * caption (e.g. static control, edit control) will use it in the control. <br>
+ * It is feed directly to CreateWindowEx, this means that it follows its
+ * conventions. In particular, the string "#num" has a special meaning.
+ */
+ SmartUtil::tstring caption;
+
+ /// The style of the object (starts with WS_ or BS_ etc...)
+ /** WARNING: The creation of most of the controls require WS_CHILD to be set.
+ * This is done, by default, in the appropriate controls. If you override the
+ * default style, then be sure that WS_CHILD is set (if needed).
+ */
+ DWORD style;
+
+ /// The Extended Style of the object (starts often with WS_EX_ etc)
+ DWORD exStyle;
+
+ /// The initial position / size of the Widget
+ Rectangle location;
+
+ HMENU menuHandle;
+
+ /// Constructor initializing all member variables to default values
+ Seed(LPCTSTR className_, DWORD style_ = WS_VISIBLE, DWORD exStyle_ = 0,
+ const SmartUtil::tstring& caption_ = SmartUtil::tstring(),
+ const Rectangle& location_ = letTheSystemDecide, HMENU menuHandle_ = NULL)
+ : className(className_), caption(caption_), style( style_ ), exStyle( exStyle_ ), location( location_ ), menuHandle( menuHandle_ )
+ {}
+
+ };
+
+
+
Widget(Widget * parent);
virtual ~Widget();
- // Creates the Widget, should NOT be called directly but overridden in the
- // derived class (with no parameters)
- virtual HWND create( const Seed & cs );
+ // Creates the Widget, should not be called directly but overridden in the
+ // derived class - otherwise the wrong seed will be used
+ HWND create(const Seed & cs);
+ virtual void attach(HWND wnd);
+
private:
friend class Application;
template<typename T> friend T hwnd_cast(HWND hwnd);
Modified: dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectText.h
===================================================================
--- dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectText.h 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectText.h 2008-04-07 19:04:50 UTC (rev 1103)
@@ -41,35 +41,24 @@
* E.g. the AspectTextBox have a "text" Aspect therefore they realize the AspectText
* through inheritance.
*/
-template< class WidgetType >
+template<typename WidgetType>
class AspectText
{
WidgetType& W() { return *static_cast<WidgetType*>(this); }
const WidgetType& W() const { return *static_cast<const WidgetType*>(this); }
- static SmartUtil::tstring isActive(const MSG& msg) {
+ static SmartUtil::tstring getText(const MSG& msg) {
return SmartUtil::tstring( reinterpret_cast< TCHAR * >( msg.lParam ) );
}
- typedef Dispatchers::ConvertBase<SmartUtil::tstring, &AspectText<WidgetType>::isActive, false> Dispatcher;
- friend class Dispatchers::ConvertBase<SmartUtil::tstring, &AspectText<WidgetType>::isActive, false>;
+ typedef Dispatchers::ConvertBase<SmartUtil::tstring, &AspectText<WidgetType>::getText, false> Dispatcher;
+ friend class Dispatchers::ConvertBase<SmartUtil::tstring, &AspectText<WidgetType>::getText, false>;
public:
/// Sets the text of the AspectText realizing class
/** The txt parameter is the new text to put into the realizing object.
*/
void setText( const SmartUtil::tstring & txt );
- /// Sets the text in the Edit Control so that endl causes a new line.
- /** Just the same as setText except that CR are expanded to LF CR
- * Replaces \n with \r\n so that Windows textbox understands "endl"
- */
- void setTextLines( const SmartUtil::tstring & txt );
-
- /// Returns a string in which \n is replaced with with \r\n
- /** The purpose is to enable Windows textboxs to understand "endl"
- */
- static SmartUtil::tstring replaceEndlWithLfCr( const SmartUtil::tstring & txt );
-
/// Gets the text of the AspectText realizing class
/** The Return value is the text of the realizing class.
*/
@@ -87,7 +76,6 @@
void onTextChanging(const typename Dispatcher::F& f) {
W().addCallback(Message( WM_SETTEXT ), Dispatcher(f));
}
-
protected:
virtual ~AspectText()
{}
@@ -97,38 +85,11 @@
// Implementation of class
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template< class WidgetType >
-void AspectText< WidgetType >::setText( const SmartUtil::tstring & txt )
-{
+void AspectText< WidgetType >::setText( const SmartUtil::tstring & txt ) {
W().sendMessage(WM_SETTEXT, 0, reinterpret_cast< LPARAM >(txt.c_str()) );
}
-
template< class WidgetType >
-SmartUtil::tstring AspectText< WidgetType >::replaceEndlWithLfCr( const SmartUtil::tstring & txt )
-{
- // Replaces \n with \r\n so that Windows textbox understands "endl"
- SmartUtil::tstring txtEndl= txt;
-
- SmartUtil::tstring::size_type pos= txtEndl.find( _T('\n'), 0 );
- while ( SmartUtil::tstring::npos != pos ) {
- if(pos > 0 && txtEndl[pos-1] != _T('\r')) {
- txtEndl.replace( pos, 1, _T("\r\n") );
- pos += 2; // Don't find the replacement \n.
- } else {
- pos++;
- }
- pos = txtEndl.find( _T('\n'), pos );
- }
- return txtEndl;
-}
-
-template< class WidgetType >
-void AspectText< WidgetType >::setTextLines( const SmartUtil::tstring & inTxt )
-{
- setText( replaceEndlWithLfCr( inTxt ) );
-}
-
-template< class WidgetType >
size_t AspectText< WidgetType >::length( ) const {
return W().sendMessage(WM_GETTEXTLENGTH);
}
Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/Button.h
===================================================================
--- dcplusplus/trunk/smartwin/include/smartwin/widgets/Button.h 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Button.h 2008-04-07 19:04:50 UTC (rev 1103)
@@ -43,17 +43,17 @@
* knows the type of the class whose seed values it contains. Every widget
* should define one of these.
*/
- class Seed : public Widget::Seed {
- public:
+ struct Seed : public BaseType::Seed {
+ typedef ThisType WidgetType;
+
FontPtr font;
/// Fills with default parameters
- Seed(const SmartUtil::tstring& caption_ = SmartUtil::tstring());
+ Seed(const SmartUtil::tstring& caption_ = SmartUtil::tstring(), DWORD style = 0);
};
template<typename SeedType>
- void create(const SeedType& cs);
-
+ void create(const SeedType& cs = SeedType());
protected:
typedef Button ButtonType;
Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/CheckBox.h
===================================================================
--- dcplusplus/trunk/smartwin/include/smartwin/widgets/CheckBox.h 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/include/smartwin/widgets/CheckBox.h 2008-04-07 19:04:50 UTC (rev 1103)
@@ -59,14 +59,17 @@
/// Object type
typedef ThisType* ObjectType;
+
+ typedef Button BaseType;
/// 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
* should define one of these.
*/
- class Seed : public Widget::Seed {
- public:
+ struct Seed : public BaseType::Seed {
+ typedef ThisType WidgetType;
+
FontPtr font;
/// Fills with default parameters
Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/ComboBox.h
===================================================================
--- dcplusplus/trunk/smartwin/include/smartwin/widgets/ComboBox.h 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/include/smartwin/widgets/ComboBox.h 2008-04-07 19:04:50 UTC (rev 1103)
@@ -82,16 +82,17 @@
/// Object type
typedef ThisType* ObjectType;
+
+ typedef CommonControl BaseType;
/// 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
* should define one of these.
*/
- class Seed
- : public Widget::Seed
- {
- public:
+ struct Seed : public BaseType::Seed {
+ typedef ThisType WidgetType;
+
FontPtr font;
/// Use extended ui
@@ -101,11 +102,6 @@
Seed();
};
- /// Return the selected value of the ComboBox
- /** If no item is actually selected the return value is "".
- */
- SmartUtil::tstring getSelectedValue();
-
/// Appends a value to the ComboBox.
/** The return value is the index of the new item appended.
*/
@@ -185,14 +181,6 @@
ComboBox_SetCurSel( handle(), idx );
}
-inline SmartUtil::tstring ComboBox::getSelectedValue()
-{
- int txtLength = ::GetWindowTextLength( handle() );
- SmartUtil::tstring retVal(txtLength, '\0');
- ::GetWindowText( handle(), &retVal[0], txtLength );
- return retVal;
-}
-
inline void ComboBox::clearImpl()
{
ComboBox_ResetContent( handle() );
@@ -229,17 +217,8 @@
return static_cast<size_t>(ComboBox_GetCount( handle() )); // Number of items present.
}
-inline SmartUtil::tstring ComboBox::getValue( int index )
-{
- // Uses CB_GETLBTEXTLEN and CB_GETLBTEXT
- int txtLength = ComboBox_GetLBTextLen( handle(), index );
- SmartUtil::tstring retVal(txtLength, '\0');
- ComboBox_GetLBText( handle(), index, &retVal[0] );
- return retVal;
-}
-
inline ComboBox::ComboBox( Widget * parent )
- : ControlType( parent )
+ : BaseType( parent )
{
}
Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/Composite.h
===================================================================
--- dcplusplus/trunk/smartwin/include/smartwin/widgets/Composite.h 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Composite.h 2008-04-07 19:04:50 UTC (rev 1103)
@@ -52,13 +52,12 @@
HCURSOR cursor;
/// Fills with default parameters
- Seed(DWORD style);
+ Seed(const SmartUtil::tstring& caption, DWORD style, DWORD exStyle);
};
-
- template<typename ChildSeed>
- typename ChildSeed::ObjectType add(const ChildSeed& seed) {
- return WidgetCreator<typename ChildSeed::WidgetType>::create(this, seed);
+ template<typename SeedType>
+ typename SeedType::WidgetType::ObjectType addChild(const SeedType& seed) {
+ return WidgetCreator<typename SeedType::WidgetType>::create(this, seed);
}
virtual void create(const Seed& cs);
@@ -73,8 +72,8 @@
};
template<typename Policy>
-Composite<Policy>::Seed::Seed(DWORD style) :
- BaseType::Seed(NULL, style | WS_CLIPCHILDREN),
+Composite<Policy>::Seed::Seed(const SmartUtil::tstring& caption, DWORD style, DWORD exStyle) :
+ BaseType::Seed(NULL, style | WS_CLIPCHILDREN, 0, caption),
background(( HBRUSH )( COLOR_APPWORKSPACE + 1 )),
menuName(NULL),
cursor(NULL)
Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/Container.h
===================================================================
--- dcplusplus/trunk/smartwin/include/smartwin/widgets/Container.h 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Container.h 2008-04-07 19:04:50 UTC (rev 1103)
@@ -18,17 +18,19 @@
typedef Composite<Policies::Normal> BaseType;
struct Seed : public BaseType::Seed {
+ typedef ThisType WidgetType;
+
Seed();
};
// Use our seed type
- virtual void create( const Seed& cs = Seed() );
+ void create( const Seed& cs = Seed() );
protected:
Container(Widget* parent) : BaseType(parent) { }
};
-inline Container::Seed::Seed() : BaseType::Seed(WS_CHILD | WS_CLIPSIBLINGS) {
+inline Container::Seed::Seed() : BaseType::Seed(NULL, WS_CHILD | WS_CLIPSIBLINGS, 0) {
}
Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/Control.h
===================================================================
--- dcplusplus/trunk/smartwin/include/smartwin/widgets/Control.h 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Control.h 2008-04-07 19:04:50 UTC (rev 1103)
@@ -38,26 +38,26 @@
public:
typedef MessageMap<Policy> BaseType;
+protected:
struct Seed : public BaseType::Seed {
- Seed(LPCTSTR className, DWORD style);
+ Seed(LPCTSTR className, DWORD style, DWORD exStyle = 0, const SmartUtil::tstring& caption = SmartUtil::tstring());
};
-protected:
typedef Control<Policy> ControlType;
Control(Widget* parent);
};
+typedef Control<Policies::Subclassed> CommonControl;
+
template<typename Policy>
Control<Policy>::Control(Widget* parent) : MessageMap<Policy>(parent) {
}
-typedef Control<Policies::Subclassed> CommonControl;
-
template<typename Policy>
-Control<Policy>::Seed::Seed(LPCTSTR className, DWORD style) :
- BaseType::Seed(NULL, style | WS_VISIBLE)
+Control<Policy>::Seed::Seed(LPCTSTR className, DWORD style, DWORD exStyle, const SmartUtil::tstring& caption) :
+ BaseType::Seed(NULL, style | WS_VISIBLE, exStyle, caption)
{
}
Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/CoolBar.h
===================================================================
--- dcplusplus/trunk/smartwin/include/smartwin/widgets/CoolBar.h 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/include/smartwin/widgets/CoolBar.h 2008-04-07 19:04:50 UTC (rev 1103)
@@ -38,16 +38,6 @@
#include "../aspects/AspectSizable.h"
#include "../aspects/AspectVisible.h"
#include "../xCeption.h"
-#include "Button.h"
-#include "CheckBox.h"
-#include "ComboBox.h"
-#include "DateTime.h"
-#include "GroupBox.h"
-#include "WidgetMenu.h"
-#include "Spinner.h"
-#include "TextBox.h"
-#include "Tree.h"
-#include "RadioButton.h"
namespace SmartWin
{
@@ -66,7 +56,9 @@
* of buttons, one for going "home", one to stop rendering of the current page, one
* to view the log of URL's you have been to etc... In addition to serving like a
* dockable toolbar ( see ToolBar ) a Coolbar Widget can also contain more
- * complex Widgets lke for instance a ComboBox, a TextBox and so on...
+ * complex Widgets lke for instance a ComboBox, a TextBox and so on...
+ *
+ * @todo This class needs some love...
*/
class CoolBar :
public MessageMap< Policies::Subclassed >,
@@ -99,50 +91,21 @@
typedef CoolBar ThisType;
/// Object type
- typedef ThisType * ObjectType;
+ typedef ThisType* ObjectType;
+
+ typedef MessageMap<Policies::Subclassed> BaseType;
/// 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
* should define one of these.
*/
- class Seed
- : public Widget::Seed
- {
- public:
+ struct Seed : public BaseType::Seed {
+ typedef ThisType WidgetType;
+
Seed();
};
- /// ComboBox object type.
- typedef ComboBox::ObjectType ComboBoxPtr;
-
- /// TextBox object type.
- typedef TextBox::ObjectType TextBoxPtr;
-
- /// Button object type.
- typedef Button::ObjectType ButtonPtr;
-
- /// Button object type.
- typedef Tree::ObjectType TreePtr;
-
- /// CheckBox object type.
- typedef CheckBox::ObjectType CheckBoxPtr;
-
- /// Spinner object type.
- typedef Spinner::ObjectType SpinnerPtr;
-
- /// GroupBox object type.
- typedef GroupBox::ObjectType GroupBoxPtr;
-
- /// RadioButton object type.
- typedef RadioButton::ObjectType RadioButtonPtr;
-
- /// DateTimePicker object type.
- typedef DateTime::ObjectType DateTimePtr;
-
- /// Menu object type.
- typedef WidgetMenu::ObjectType WidgetMenuPtr;
-
/// Actually creates the Coolbar
/** You should call WidgetFactory::createCoolbar if you instantiate class
* directly. <br>
@@ -150,55 +113,6 @@
*/
void create( const Seed & cs = Seed() );
- RadioButtonPtr sow( GroupBoxPtr & parent, const RadioButton::Seed & cs )
- {
-#ifdef PORT_ME
- RadioButtonPtr retVal ( WidgetCreator< RadioButton >::create( parent, internal_::getTypedParentOrThrow < EventHandlerClass * >( this ), cs ) );
- retVal->setBounds( 0, 0, cs.location.width(), cs.location.size.y );
- parent->addChild( retVal );
- return retVal;
-#endif
- return NULL;
- }
-
- /// Creates a Widget using its CreationalInfo
- /** Adds up the created widget into a new band in the Coolbar control
- */
- template< class A_Seed >
- typename A_Seed::WidgetType::ObjectType sow( const /*typename*/ A_Seed & cs, const SmartUtil::tstring & label = _T("") )
- {
- typename A_Seed::WidgetType::ObjectType retVal ( WidgetCreator< typename A_Seed::WidgetType >::create( this, cs ) );
- retVal->setBounds( 0, 0, cs.location.width(), cs.location.size.y );
- this->addChild( retVal, cs.location.width(), cs.location.size.y, label );
- return retVal;
- }
-
- //TODO: update this help
- /// Creates a ComboBox Widget inside the Coolbar
- /** The returned ComboBox is roughly the same object type as a "normal"
- * ComboBox, though size and position doesn't count since the Coolbar will
- * control these properties itself. Apart from that the combobox has the same
- * properties as a normal ComboBox. The width and the openedHeight
- * properties is the width of the combobox and the height of the dropped down
- * viewable area of the ComboBox. The bandHeight is the height of the actual
- * band Note that the rect part of the CreationalStruct passed is more or less
- * ignored...
- */
-
- //template< >
- //typename CoolBar< EventHandlerClass >::ComboBoxPtr // Bug in VC++7.1 Koenig Lookup forces us to give full type of return value...
- //sow< typename CoolBar< EventHandlerClass >::ComboBox::Seed >
- // ( const typename CoolBar< EventHandlerClass >::Seed & cs, const SmartUtil::tstring & label = _T("") )
- //{
- // typename CoolBar< EventHandlerClass >::ObjectType retVal (WidgetCreator< typename CoolBar< EventHandlerClass > >::create( this, cs ));
- // retVal->setBounds( 0, 0, cs.rect.width(), cs.rect.size.y );
- // //TODO: use something like cs.itsOpenedHeight
- // this->addChild( retVal, cs.rect.width(), cs.rect.size.y, label );
- // return retVal;
- //}
-
- //TODO: Menu specialization
-
/// Refreshes the Coolbar
/** Call this one after the container widget has been resized to make sure the
* coolbar is having the right size...
@@ -223,8 +137,8 @@
// Implementation of class
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-inline CoolBar::CoolBar( SmartWin::Widget * parent )
- : PolicyType( parent )
+inline CoolBar::CoolBar( Widget * parent )
+ : BaseType( parent )
{
// Can't have a text box without a parent...
xAssert( parent, _T( "Can't have a Button without a parent..." ) );
Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/DateTime.h
===================================================================
--- dcplusplus/trunk/smartwin/include/smartwin/widgets/DateTime.h 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/include/smartwin/widgets/DateTime.h 2008-04-07 19:04:50 UTC (rev 1103)
@@ -39,7 +39,6 @@
{
// begin namespace SmartWin
-
// Forward declaring friends
template< class WidgetType >
class WidgetCreator;
@@ -84,16 +83,17 @@
/// Object type
typedef ThisType* ObjectType;
+
+ typedef CommonControl BaseType;
/// 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
* should define one of these.
*/
- class Seed
- : public Widget::Seed
- {
- public:
+ struct Seed : public BaseType::Seed {
+ typedef ThisType WidgetType;
+
FontPtr font;
SmartUtil::tstring format;
@@ -117,9 +117,7 @@
* when the DateTime date value is changed.
*/
void onDateTimeChanged(const Dispatcher::F& f) {
- addCallback(
- Message( WM_NOTIFY, DTN_DATETIMECHANGE ), Dispatcher(f)
- );
+ addCallback(Message( WM_NOTIFY, DTN_DATETIMECHANGE ), Dispatcher(f));
}
/// Retrieves the time value of the DateTimePicker control
@@ -221,7 +219,7 @@
return Message( WM_NOTIFY, DTN_DROPDOWN );
}
-inline SYSTEMTIME DateTime::getDateTime()
+inline SYSTEMTIME DateTime::getDateTime()
{
SYSTEMTIME st;
DateTime_GetSystemtime( this->handle(), & st );
@@ -238,8 +236,8 @@
DateTime_SetFormat( this->handle(), format.c_str() );
}
-inline DateTime::DateTime( SmartWin::Widget * parent )
- : ControlType( parent )
+inline DateTime::DateTime( Widget* parent )
+ : BaseType( parent )
{
// Can't have a text box without a parent...
xAssert( parent, _T( "Can't have a TextBox without a parent..." ) );
Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/Frame.h
===================================================================
--- dcplusplus/trunk/smartwin/include/smartwin/widgets/Frame.h 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Frame.h 2008-04-07 19:04:50 UTC (rev 1103)
@@ -77,11 +77,6 @@
typedef Composite< Policy > BaseType;
- struct Seed : public BaseType::Seed {
- Seed(DWORD style);
- };
-
- // 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
@@ -133,6 +128,10 @@
void setCursor( const SmartUtil::tstring & filePathName );
protected:
+ struct Seed : public BaseType::Seed {
+ Seed(const SmartUtil::tstring& caption, DWORD style, DWORD exStyle);
+ };
+
// Protected since this Widget we HAVE to inherit from
explicit Frame( Widget * parent = 0 );
@@ -147,7 +146,9 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<typename Policy>
-Frame<Policy>::Seed::Seed(DWORD style) : Frame<Policy>::BaseType::Seed(WS_OVERLAPPEDWINDOW) {
+Frame<Policy>::Seed::Seed(const SmartUtil::tstring& caption, DWORD style, DWORD exStyle) :
+ BaseType::Seed(caption, WS_OVERLAPPEDWINDOW, exStyle)
+{
}
Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/GroupBox.h
===================================================================
--- dcplusplus/trunk/smartwin/include/smartwin/widgets/GroupBox.h 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/include/smartwin/widgets/GroupBox.h 2008-04-07 19:04:50 UTC (rev 1103)
@@ -59,16 +59,17 @@
/// Object type
typedef ThisType* ObjectType;
+
+ typedef Button BaseType;
/// 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
* should define one of these.
*/
- class Seed : public Widget::Seed {
- public:
- FontPtr font;
-
+ struct Seed : public BaseType::Seed {
+ typedef ThisType WidgetType;
+
/// Fills with default parameters
Seed(const SmartUtil::tstring& caption_ = SmartUtil::tstring());
};
@@ -89,7 +90,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
inline GroupBox::GroupBox( Widget * parent )
- : ButtonType( parent )
+ : BaseType( parent )
{
}
// end namespace SmartWin
Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/Label.h
===================================================================
--- dcplusplus/trunk/smartwin/include/smartwin/widgets/Label.h 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/include/smartwin/widgets/Label.h 2008-04-07 19:04:50 UTC (rev 1103)
@@ -39,8 +39,7 @@
#include "../resources/Bitmap.h"
#include "Control.h"
-namespace SmartWin
-{
+namespace SmartWin {
// begin namespace SmartWin
// Forward declaring friends
@@ -81,15 +80,16 @@
/// Object type
typedef ThisType* ObjectType;
+ typedef CommonControl BaseType;
+
/// 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
* should define one of these.
*/
- class Seed
- : public Widget::Seed
- {
- public:
+ struct Seed : public BaseType::Seed {
+ typedef ThisType WidgetType;
+
FontPtr font;
/// Fills with default parameters
@@ -121,8 +121,6 @@
private:
BitmapPtr itsBitmap;
- void setBitmap( HBITMAP bitmap );
-
// Contract needed by AspectClickable Aspect class
static Message getClickMessage();
@@ -139,20 +137,14 @@
}
inline Label::Label( Widget * parent )
- : ControlType( parent )
+ : BaseType( parent )
{
}
-inline void Label::setBitmap( HBITMAP bitmap )
-{
- this->addRemoveStyle( SS_BITMAP, true );
- this->sendMessage(STM_SETIMAGE, ( WPARAM ) IMAGE_BITMAP, ( LPARAM ) bitmap );
-}
-
-inline void Label::setBitmap( const BitmapPtr& bitmap )
-{
- this->setBitmap( bitmap->handle() );
+inline void Label::setBitmap( const BitmapPtr& bitmap ) {
itsBitmap = bitmap;
+ addRemoveStyle( SS_BITMAP, true );
+ sendMessage(STM_SETIMAGE, ( WPARAM ) IMAGE_BITMAP, reinterpret_cast<LPARAM>(bitmap->handle()));
}
// end namespace SmartWin
Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIChild.h
===================================================================
--- dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIChild.h 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIChild.h 2008-04-07 19:04:50 UTC (rev 1103)
@@ -31,13 +31,12 @@
#ifndef WINCE
#include "../../SmartUtil.h"
-#include "../Rectangle.h"
#include "../resources/Icon.h"
#include "../Policies.h"
#include "../WindowClass.h"
#include "MDIParent.h"
#include "Frame.h"
-#include <sstream>
+
#include <boost/scoped_ptr.hpp>
namespace SmartWin
@@ -59,11 +58,14 @@
* Related classes: <br>
* MDIParent
*/
-class MDIChild
- : public Frame< Policies::MDIChild >
+class MDIChild :
+ public Composite< Policies::MDIChild >,
+
+ public AspectMinMax<MDIChild>
+
{
public:
- typedef Frame<Policies::MDIChild> BaseType;
+ typedef Composite<Policies::MDIChild> BaseType;
/// Class type
typedef MDIChild ThisType;
@@ -76,15 +78,9 @@
* knows the type of the class whose seed values it contains. Every widget
* should define one of these.
*/
- class Seed
- : public Widget::Seed
- {
- public:
- typedef MDIChild::ThisType WidgetType;
+ struct Seed : public BaseType::Seed {
+ typedef ThisType WidgetType;
- IconPtr smallIcon;
- IconPtr icon;
- HBRUSH background;
bool activate;
/// Fills with default parameters
@@ -96,14 +92,14 @@
/** This version creates a MessageMapMDIChildWidget to plug into MDIParent
* container window.
*/
- void createMDIChild( Seed cs = Seed() );
+ void createMDIChild( const Seed& cs = Seed() );
- virtual bool tryFire(const MSG& msg, LRESULT& retVal);
-
void activate();
MDIParent* getParent() { return static_cast<MDIParent*>(PolicyType::getParent()); }
protected:
+ virtual bool tryFire(const MSG& msg, LRESULT& retVal);
+
// Protected since this Widget we HAVE to inherit from
explicit MDIChild( Widget * parent );
Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIFrame.h
===================================================================
--- dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIFrame.h 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIFrame.h 2008-04-07 19:04:50 UTC (rev 1103)
@@ -65,12 +65,10 @@
* knows the type of the class whose seed values it contains. Every widget
* should define one of these.
*/
- class Seed
- : public BaseType::Seed
+ struct Seed : public BaseType::Seed
{
- public:
/// Fills with default parameters
- Seed();
+ Seed(const SmartUtil::tstring& caption = SmartUtil::tstring());
};
/// Actually creates the window
Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIParent.h
===================================================================
--- dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIParent.h 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/include/smartwin/widgets/MDIParent.h 2008-04-07 19:04:50 UTC (rev 1103)
@@ -64,14 +64,8 @@
* MDIChild
*/
class MDIParent :
- public MessageMap< Policies::Subclassed >,
+ public Control< Policies::Subclassed >
- // Aspects
- public AspectSizable< MDIParent >,
- public AspectVisible< MDIParent >,
- public AspectEnabled< MDIParent >,
- public AspectFocus< MDIParent >,
- public AspectRaw< MDIParent >
{
friend class WidgetCreator< MDIParent >;
public:
@@ -80,16 +74,15 @@
/// Object type
typedef ThisType * ObjectType;
+
+ typedef Control<Policies::Subclassed> BaseType;
/// 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
* should define one of these.
*/
- class Seed
- : public Widget::Seed
- {
- public:
+ struct Seed : public BaseType::Seed {
/**
* First child id for mdi menu, must be different from any other main menu id.
* Also, the menuHandle parameter of cs should point to the menu that will receive
@@ -143,7 +136,7 @@
MDIFrame* getParent() { return static_cast<MDIFrame*>(PolicyType::getParent()); }
protected:
/// Constructor Taking pointer to parent
- explicit MDIParent( SmartWin::Widget * parent );
+ explicit MDIParent( Widget * parent );
// Protected to avoid direct instantiation, you can inherit and use WidgetFactory class which is friend
virtual ~MDIParent()
@@ -155,10 +148,10 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
inline MDIParent::MDIParent( Widget * parent )
- : PolicyType( parent )
+ : BaseType( parent )
{
// Can't have a text box without a parent...
- xAssert( parent, _T( "Can't have a Button without a parent..." ) );
+ xAssert( parent, _T( "Can't have a MDIParent without a parent..." ) );
}
// end namespace SmartWin
Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/ModelessDialog.h
===================================================================
--- dcplusplus/trunk/smartwin/include/smartwin/widgets/ModelessDialog.h 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/include/smartwin/widgets/ModelessDialog.h 2008-04-07 19:04:50 UTC (rev 1103)
@@ -49,13 +49,13 @@
public AspectDialog<ModelessDialog >
{
public:
- typedef Frame< Policies::ModelessDialog > BaseType;
/// Class type
typedef ModelessDialog ThisType;
/// Object type
typedef ThisType * ObjectType;
+ typedef Frame< Policies::ModelessDialog > BaseType;
/// Creates a Dialog Window
/** This version creates a window from the given Dialog Resource Id.
*/
Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/RadioButton.h
===================================================================
--- dcplusplus/trunk/smartwin/include/smartwin/widgets/RadioButton.h 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/include/smartwin/widgets/RadioButton.h 2008-04-07 19:04:50 UTC (rev 1103)
@@ -63,14 +63,17 @@
/// Object type
typedef ThisType* ObjectType;
+
+ typedef Button BaseType;
/// 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
* should define one of these.
*/
- class Seed : public Widget::Seed {
- public:
+ struct Seed : public BaseType::Seed {
+ typedef ThisType WidgetType;
+
FontPtr font;
/// Fills with default parameters
Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/TextBox.h
===================================================================
--- dcplusplus/trunk/smartwin/include/smartwin/widgets/TextBox.h 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/include/smartwin/widgets/TextBox.h 2008-04-07 19:04:50 UTC (rev 1103)
@@ -98,12 +98,6 @@
*/
void addText( const SmartUtil::tstring & txt );
- /// Appends the text in the text box so that endl causes a new line.
- /** Just the same as addText except that CR are expanded to LF CR
- * Replaces \n with \r\n so that Windows textbox understands "endl"
- */
- void addTextLines( const SmartUtil::tstring & txt );
-
/// Replaces the currently selected text in the text box with the given text parameter
/** If canUndo is true this operation is stacked into the undo que ( can be
* undone ), else this operation cannot be undone. <br>
@@ -206,14 +200,13 @@
* knows the type of the class whose seed values it contains. Every widget
* should define one of these.
*/
- class Seed
- : public Widget::Seed
- {
- public:
+ struct Seed : public BaseType::Seed {
+ typedef ThisType WidgetType;
+
FontPtr font;
/// Fills with default parameters
- Seed();
+ Seed(const SmartUtil::tstring& caption = SmartUtil::tstring());
};
/// Adds (or removes) the numbers property
@@ -304,12 +297,6 @@
replaceSelection( addtxt );
}
-inline void TextBoxBase::addTextLines( const SmartUtil::tstring & addtxt )
-{
- setSelection( ( long ) this->getText().size() );
- replaceSelection( this->replaceEndlWithLfCr( addtxt ) );
-}
-
inline long TextBoxBase::findText( const SmartUtil::tstring & txt, unsigned offset ) const
{
SmartUtil::tstring txtOfBox = this->getText();
Modified: dcplusplus/trunk/smartwin/source/widgets/Button.cpp
===================================================================
--- dcplusplus/trunk/smartwin/source/widgets/Button.cpp 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/source/widgets/Button.cpp 2008-04-07 19:04:50 UTC (rev 1103)
@@ -2,8 +2,8 @@
namespace SmartWin {
-Button::Seed::Seed(const SmartUtil::tstring& caption) :
- Widget::Seed(WC_BUTTON, WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON, 0, caption),
+Button::Seed::Seed(const SmartUtil::tstring& caption, DWORD style) :
+ BaseType::Seed(WC_BUTTON, style | WS_CHILD, 0, caption),
font(new Font(DefaultGuiFont))
{
}
Modified: dcplusplus/trunk/smartwin/source/widgets/CheckBox.cpp
===================================================================
--- dcplusplus/trunk/smartwin/source/widgets/CheckBox.cpp 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/source/widgets/CheckBox.cpp 2008-04-07 19:04:50 UTC (rev 1103)
@@ -3,9 +3,9 @@
namespace SmartWin {
CheckBox::Seed::Seed(const SmartUtil::tstring& caption) :
- Widget::Seed(WC_BUTTON, WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX | BS_CHECKBOX, 0, caption),
- font(new Font(DefaultGuiFont))
+ BaseType::Seed(caption, BS_AUTOCHECKBOX | BS_CHECKBOX)
{
+
}
}
Modified: dcplusplus/trunk/smartwin/source/widgets/ComboBox.cpp
===================================================================
--- dcplusplus/trunk/smartwin/source/widgets/ComboBox.cpp 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/source/widgets/ComboBox.cpp 2008-04-07 19:04:50 UTC (rev 1103)
@@ -3,14 +3,13 @@
namespace SmartWin {
ComboBox::Seed::Seed() :
- Widget::Seed(WC_COMBOBOX, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_AUTOHSCROLL),
+ BaseType::Seed(WC_COMBOBOX, WS_CHILD | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_AUTOHSCROLL),
font(new Font(DefaultGuiFont)),
extended(true)
{
}
-void ComboBox::create( const Seed & cs )
-{
+void ComboBox::create( const Seed & cs ) {
ControlType::create(cs);
if(cs.font)
setFont( cs.font );
@@ -18,4 +17,12 @@
sendMessage(CB_SETEXTENDEDUI, TRUE);
}
+SmartUtil::tstring ComboBox::getValue( int index ) {
+ // Uses CB_GETLBTEXTLEN and CB_GETLBTEXT
+ int txtLength = ComboBox_GetLBTextLen( handle(), index );
+ SmartUtil::tstring retVal(txtLength, '\0');
+ ComboBox_GetLBText( handle(), index, &retVal[0] );
+ return retVal;
}
+
+}
Modified: dcplusplus/trunk/smartwin/source/widgets/CoolBar.cpp
===================================================================
--- dcplusplus/trunk/smartwin/source/widgets/CoolBar.cpp 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/source/widgets/CoolBar.cpp 2008-04-07 19:04:50 UTC (rev 1103)
@@ -1,3 +1,5 @@
+#include "../../include/smartwin/Policies.h"
+#include "../../include/smartwin/aspects/AspectFocus.h"
#include "../../include/smartwin/widgets/CoolBar.h"
namespace SmartWin {
@@ -7,11 +9,8 @@
{
}
-void CoolBar::create( const Seed & cs )
-{
- xAssert((cs.style & WS_CHILD) == WS_CHILD, _T("Widget must have WS_CHILD style"));
- PolicyType::create(cs);
- //TODO: use CreationalInfo parameters
+void CoolBar::create( const Seed & cs ) {
+ BaseType::create(cs);
}
void CoolBar::addChild( Widget * child,
@@ -31,7 +30,7 @@
rbBand.cyMinChild = height;
rbBand.cx = width;
rbBand.fStyle = 0; //RBBS_GRIPPERALWAYS;
- if ( SendMessage( this->handle(), RB_INSERTBAND, ( WPARAM ) - 1, ( LPARAM ) & rbBand ) == 0 )
+ if ( sendMessage( RB_INSERTBAND, ( WPARAM ) - 1, ( LPARAM ) & rbBand ) == 0 )
{
throw xCeption( _T( "There was a problem when trying to insert a band into your Coolbar object!" ) );
}
Modified: dcplusplus/trunk/smartwin/source/widgets/DateTime.cpp
===================================================================
--- dcplusplus/trunk/smartwin/source/widgets/DateTime.cpp 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/source/widgets/DateTime.cpp 2008-04-07 19:04:50 UTC (rev 1103)
@@ -3,7 +3,7 @@
namespace SmartWin {
DateTime::Seed::Seed() :
- Widget::Seed(DATETIMEPICK_CLASS, WS_CHILD | WS_VISIBLE | WS_TABSTOP | DTS_SHORTDATEFORMAT),
+ BaseType::Seed(DATETIMEPICK_CLASS, WS_CHILD | DTS_SHORTDATEFORMAT),
font(new Font(DefaultGuiFont)),
format(_T( "yyyy.MM.dd" )),
backgroundColor(0x000080),
Modified: dcplusplus/trunk/smartwin/source/widgets/GroupBox.cpp
===================================================================
--- dcplusplus/trunk/smartwin/source/widgets/GroupBox.cpp 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/source/widgets/GroupBox.cpp 2008-04-07 19:04:50 UTC (rev 1103)
@@ -2,10 +2,10 @@
namespace SmartWin {
-GroupBox::Seed::Seed(const SmartUtil::tstring& caption) :
- Widget::Seed(WC_BUTTON, WS_CHILD | WS_VISIBLE | BS_GROUPBOX, 0, caption),
- font(new Font(DefaultGuiFont))
+GroupBox::Seed::Seed(const SmartUtil::tstring& caption) :
+ BaseType::Seed(caption, BS_GROUPBOX)
{
+
}
}
Modified: dcplusplus/trunk/smartwin/source/widgets/Label.cpp
===================================================================
--- dcplusplus/trunk/smartwin/source/widgets/Label.cpp 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/source/widgets/Label.cpp 2008-04-07 19:04:50 UTC (rev 1103)
@@ -3,14 +3,14 @@
namespace SmartWin {
Label::Seed::Seed(const SmartUtil::tstring& caption) :
- Widget::Seed(WC_STATIC, WS_CHILD | WS_VISIBLE | SS_NOTIFY, 0, caption),
+ BaseType::Seed(WC_STATIC, WS_CHILD | SS_NOTIFY, 0, caption),
font(new Font(DefaultGuiFont))
{
}
void Label::create( const Seed & cs ) {
- ControlType::create(cs);
+ BaseType::create(cs);
if(cs.font)
setFont( cs.font );
}
Modified: dcplusplus/trunk/smartwin/source/widgets/MDIChild.cpp
===================================================================
--- dcplusplus/trunk/smartwin/source/widgets/MDIChild.cpp 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/source/widgets/MDIChild.cpp 2008-04-07 19:04:50 UTC (rev 1103)
@@ -3,15 +3,13 @@
namespace SmartWin {
MDIChild::Seed::Seed(const SmartUtil::tstring& caption) :
- Widget::Seed(NULL, WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_MDICHILD, caption),
- background((HBRUSH)(COLOR_WINDOW + 1)),
+ BaseType::Seed(caption, WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS, WS_EX_MDICHILD),
activate(true)
{
}
-void MDIChild::createMDIChild( Seed cs )
-{
- windowClass.reset(new WindowClass(WindowClass::getNewClassName(this), &ThisType::wndProc, NULL, cs.background, cs.icon, cs.smallIcon));
+void MDIChild::createMDIChild( const Seed& cs ) {
+ windowClass.reset(new WindowClass(WindowClass::getNewClassName(this), &ThisType::wndProc, NULL, cs.background, cs.icon, cs.smallIcon, cs.cursor));
getParent()->sendMessage(WM_SETREDRAW, FALSE);
HWND active = (HWND)(cs.activate ? NULL : getParent()->sendMessage(WM_MDIGETACTIVE));
Modified: dcplusplus/trunk/smartwin/source/widgets/MDIFrame.cpp
===================================================================
--- dcplusplus/trunk/smartwin/source/widgets/MDIFrame.cpp 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/source/widgets/MDIFrame.cpp 2008-04-07 19:04:50 UTC (rev 1103)
@@ -4,8 +4,9 @@
namespace SmartWin {
-MDIFrame::Seed::Seed() :
- BaseType::Seed(0)
+// TODO Fix caption
+MDIFrame::Seed::Seed(const SmartUtil::tstring& caption) :
+ BaseType::Seed(caption, 0, 0)
{
}
Modified: dcplusplus/trunk/smartwin/source/widgets/MDIParent.cpp
===================================================================
--- dcplusplus/trunk/smartwin/source/widgets/MDIParent.cpp 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/source/widgets/MDIParent.cpp 2008-04-07 19:04:50 UTC (rev 1103)
@@ -4,7 +4,7 @@
namespace SmartWin {
MDIParent::Seed::Seed() :
- Widget::Seed(_T("MDICLIENT"), WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VSCROLL | WS_HSCROLL, WS_EX_CLIENTEDGE),
+ BaseType::Seed(_T("MDICLIENT"), WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VSCROLL | WS_HSCROLL, WS_EX_CLIENTEDGE),
idFirstChild(0),
windowMenu(NULL)
{
Modified: dcplusplus/trunk/smartwin/source/widgets/ProgressBar.cpp
===================================================================
--- dcplusplus/trunk/smartwin/source/widgets/ProgressBar.cpp 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/source/widgets/ProgressBar.cpp 2008-04-07 19:04:50 UTC (rev 1103)
@@ -3,7 +3,7 @@
namespace SmartWin {
ProgressBar::Seed::Seed() :
- Widget::Seed(PROGRESS_CLASS, WS_CHILD | WS_VISIBLE)
+ Widget::Seed(PROGRESS_CLASS, WS_CHILD)
{
}
Modified: dcplusplus/trunk/smartwin/source/widgets/RadioButton.cpp
===================================================================
--- dcplusplus/trunk/smartwin/source/widgets/RadioButton.cpp 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/source/widgets/RadioButton.cpp 2008-04-07 19:04:50 UTC (rev 1103)
@@ -3,8 +3,7 @@
namespace SmartWin {
RadioButton::Seed::Seed(const SmartUtil::tstring& caption) :
- Widget::Seed(WC_BUTTON, WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTORADIOBUTTON, 0, caption),
- font(new Font(DefaultGuiFont))
+ BaseType::Seed(caption, BS_AUTORADIOBUTTON)
{
}
Modified: dcplusplus/trunk/smartwin/source/widgets/TextBox.cpp
===================================================================
--- dcplusplus/trunk/smartwin/source/widgets/TextBox.cpp 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/source/widgets/TextBox.cpp 2008-04-07 19:04:50 UTC (rev 1103)
@@ -2,14 +2,13 @@
namespace SmartWin {
-TextBox::Seed::Seed() :
- Widget::Seed(WC_EDIT, WS_CHILD | WS_VISIBLE | WS_TABSTOP, WS_EX_CLIENTEDGE),
+TextBox::Seed::Seed(const SmartUtil::tstring& caption) :
+ BaseType::Seed(WC_EDIT, WS_CHILD | WS_TABSTOP, WS_EX_CLIENTEDGE, caption),
font(new Font(DefaultGuiFont))
{
}
-void TextBox::create( const Seed & cs )
-{
+void TextBox::create( const Seed & cs ) {
ControlType::create(cs);
if(cs.font)
setFont( cs.font );
Modified: dcplusplus/trunk/smartwin/source/widgets/Window.cpp
===================================================================
--- dcplusplus/trunk/smartwin/source/widgets/Window.cpp 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/smartwin/source/widgets/Window.cpp 2008-04-07 19:04:50 UTC (rev 1103)
@@ -2,7 +2,8 @@
namespace SmartWin {
-Window::Seed::Seed() : BaseType::Seed(0) {
+// TODO add caption
+Window::Seed::Seed() : BaseType::Seed(SmartUtil::tstring(), 0, 0) {
}
Modified: dcplusplus/trunk/win32/SearchFrame.cpp
===================================================================
--- dcplusplus/trunk/win32/SearchFrame.cpp 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/win32/SearchFrame.cpp 2008-04-07 19:04:50 UTC (rev 1103)
@@ -113,7 +113,7 @@
cs.exStyle = WS_EX_TRANSPARENT;
cs.caption = T_("Search for");
- searchLabel = createLabel(cs);
+ searchLabel = addChild(cs);
searchLabel->setHelpId(IDH_SEARCH_SEARCH_FOR);
cs.caption = T_("Size");
Modified: dcplusplus/trunk/win32/SystemFrame.cpp
===================================================================
--- dcplusplus/trunk/win32/SystemFrame.cpp 2008-04-07 18:56:50 UTC (rev 1102)
+++ dcplusplus/trunk/win32/SystemFrame.cpp 2008-04-07 19:04:50 UTC (rev 1103)
@@ -61,7 +61,7 @@
log->setSelection(0, log->lineIndex(log->lineFromChar(limit / 10)));
log->replaceSelection(_T(""));
}
- log->addTextLines(Text::toT("\r\n[" + Util::getShortTimeString(t) + "] ") + msg);
+ log->addText(Text::toT("\r\n[" + Util::getShortTimeString(t) + "] ") + msg);
if(scroll)
log->sendMessage(WM_VSCROLL, SB_BOTTOM);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|