From: <arn...@us...> - 2008-03-29 07:48:27
|
Revision: 1082 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1082&view=rev Author: arnetheduck Date: 2008-03-29 00:48:13 -0700 (Sat, 29 Mar 2008) Log Message: ----------- Fix fontdialog Modified Paths: -------------- dcplusplus/trunk/smartwin/include/smartwin/WidgetFactoryPlatformSmartWinDesktop.h dcplusplus/trunk/win32/Appearance2Page.cpp Added Paths: ----------- dcplusplus/trunk/smartwin/include/smartwin/widgets/FontDialog.h dcplusplus/trunk/smartwin/source/widgets/FontDialog.cpp Removed Paths: ------------- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetChooseFont.h Property Changed: ---------------- dcplusplus/trunk/ Property changes on: dcplusplus/trunk ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2008-03-28 09:59:25.875999928 +0100 committer: Jacek Sieka <arn...@gm...> properties: branch-nick: dcplusplus + timestamp: 2008-03-28 21:05:12.553999901 +0100 committer: Jacek Sieka <arn...@gm...> properties: branch-nick: dcplusplus Name: bzr:file-ids - + smartwin/include/smartwin/widgets/FontDialog.h 712@f586c4b0-9d0d-0410-bc51-f1fe239209fc:dcplusplus%2Ftrunk:smartwin%2Finclude%2Fsmartwin%2Fwidgets%2FWidgetChooseFont.h smartwin/source/widgets/FontDialog.cpp fontdialog.cpp-20080328195932-jj456z98hdfqyes8-1 Name: bzr:revision-id:v3-trunk1 - 1027 arn...@gm...-20080323183926-schknwnkgeo7ivdn 1028 zouzou123gen-20080323220411-r8usuc3qxwuh7zsn 1029 zouzou123gen-20080323221249-0su72zaj13e706mk 1030 arn...@gm...-20080324140623-muba1dl46m000o8c 1031 zouzou123gen-20080324141933-qbgr93ugpe0297m6 1032 arn...@gm...-20080324153706-siidja05n84i00b1 1033 arn...@gm...-20080324153823-lhn3awurnu77riln 1034 arn...@gm...-20080324165650-zapppziji67yf5a2 1035 zouzou123gen-20080324175936-4mqc2kh0lo5wtdu2 1036 zouzou123gen-20080325004602-6wdsoym95mjuhwd3 1037 arn...@gm...-20080325100659-8fqy6q65itmghlep 1038 zouzou123gen-20080325175216-s297sdiucukfvijh 1039 arn...@gm...-20080325210137-3dfqyoi8ykosy087 1040 arn...@gm...-20080325211747-nwwy1eb33r071sca 1041 arn...@gm...-20080326084110-qbselrjckku275xi 1042 zouzou123gen-20080326123631-35642mgbk2i4ty32 1043 zouzou123gen-20080326124345-f4xwn2d3ty8ubd6r 1044 arn...@gm...-20080326162031-il0nyms30w0mky43 1045 arn...@gm...-20080326164801-8dru8mjc06xgzjpv 1046 arn...@gm...-20080326170438-uzl2rx8fqnohak7g 1047 zouzou123gen-20080326172821-d6uqcbmfb0c6rwlv 1048 arn...@gm...-20080326213257-qlgdh7m2712p2l0q 1049 arn...@gm...-20080326214313-ktnoekgk3s0wmatz 1050 arn...@gm...-20080326215256-0j1iqrf286b9g7zf 1051 arn...@gm...-20080327082121-hoi22wh1gwjdfbyd 1052 arn...@gm...-20080327120639-um3tukdt374rwvgm 1053 zouzou123gen-20080327130703-6vtek6uxy3vua543 1054 arn...@gm...-20080327215831-dmg5mkufskabwkro 1055 arn...@gm...-20080327231459-cdztcv25alsuyqmf 1056 arn...@gm...-20080328085925-gceybsr53oml1p24 + 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 Modified: dcplusplus/trunk/smartwin/include/smartwin/WidgetFactoryPlatformSmartWinDesktop.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/WidgetFactoryPlatformSmartWinDesktop.h 2008-03-29 07:47:37 UTC (rev 1081) +++ dcplusplus/trunk/smartwin/include/smartwin/WidgetFactoryPlatformSmartWinDesktop.h 2008-03-29 07:48:13 UTC (rev 1082) @@ -31,7 +31,7 @@ #include "WidgetFactoryPlatformCommon.h" #include "widgets/WidgetRichTextBox.h" -#include "widgets/WidgetChooseFont.h" +#include "widgets/FontDialog.h" #include "widgets/WidgetMenu.h" #include "widgets/WidgetToolbar.h" #include "widgets/WidgetCoolbar.h" @@ -63,7 +63,7 @@ typedef typename WidgetMenu::ObjectType WidgetMenuPtr; /// ChooseFont class and object type. - typedef SmartWin::WidgetChooseFont WidgetChooseFont; + typedef SmartWin::FontDialog FontDialog; /// Toolbar class type. typedef SmartWin::WidgetToolbar WidgetToolbar; @@ -85,13 +85,11 @@ : ContainerWidgetType( parent ) {} - /// Creates a WidgetChooseFont and returns it. + /// Creates a FontDialog and returns it. /** Usable to let user choose font from the system installed fonts. */ - WidgetChooseFont createChooseFont() - { - WidgetChooseFont retVal( this ); - return retVal; + FontDialog createFontDialog() { + return FontDialog( this ); } /// Creates a Rich Edit Control and returns a pointer to it. Copied: dcplusplus/trunk/smartwin/include/smartwin/widgets/FontDialog.h (from rev 1081, dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetChooseFont.h) =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/FontDialog.h (rev 0) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/FontDialog.h 2008-03-29 07:48:13 UTC (rev 1082) @@ -0,0 +1,87 @@ +/* + 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 WINCE +#ifndef FontDialog_h +#define FontDialog_h + +#include "../Widget.h" + +namespace SmartWin +{ +// begin namespace SmartWin + +/// ChooseFontDialog class +/** \ingroup WidgetControls + * \image html choosefont.PNG + * Class for showing a common ChooseFontDialog box. <br> + * Either derive from it or call WidgetFactory::createChooseFont. <br> + * Note! <br> + * If you wish to use this class with Parent classes other than those from SmartWin + * you need to expose a public function called "parent" taking no arguments returning + * an HWND on the template parameter class. <br> + * the complete signature of the function will then be "HWND parent()" + */ +class FontDialog +{ +public: + /// Class type + typedef FontDialog ThisType; + + /// Object type + /** Note, not a pointer!!!! + */ + typedef ThisType ObjectType; + + /// Shows the dialog + bool open(DWORD dwFlags, LOGFONT& font, DWORD& rgbColors); + + /// Constructor Taking pointer to parent + explicit FontDialog( Widget* parent = 0 ); + + ~FontDialog() { } + +private: + Widget* itsParent; + + HWND getParentHandle() { return itsParent ? itsParent->handle() : NULL; } +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Implementation of class +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +inline FontDialog::FontDialog( Widget * parent ) + : itsParent( parent ) +{ +} + +// end namespace SmartWin +} + +#endif +#endif //! WINCE Deleted: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetChooseFont.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetChooseFont.h 2008-03-29 07:47:37 UTC (rev 1081) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetChooseFont.h 2008-03-29 07:48:13 UTC (rev 1082) @@ -1,107 +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 WINCE -#ifndef WidgetChooseFont_h -#define WidgetChooseFont_h - -#include "../Widget.h" -#include "../resources/Font.h" - -namespace SmartWin -{ -// begin namespace SmartWin - -/// ChooseFontDialog class -/** \ingroup WidgetControls - * \image html choosefont.PNG - * Class for showing a common ChooseFontDialog box. <br> - * Either derive from it or call WidgetFactory::createChooseFont. <br> - * Note! <br> - * If you wish to use this class with Parent classes other than those from SmartWin - * you need to expose a public function called "parent" taking no arguments returning - * an HWND on the template parameter class. <br> - * the complete signature of the function will then be "HWND parent()" - */ -class WidgetChooseFont -{ -public: - /// Class type - typedef WidgetChooseFont ThisType; - - /// Object type - /** Note, not a pointer!!!! - */ - typedef ThisType ObjectType; - - /// Shows the dialog - bool showDialog(DWORD dwFlags, LPLOGFONT lplf, DWORD& rgbColors); - - /// Constructor Taking pointer to parent - explicit WidgetChooseFont( Widget* parent = 0 ); - - virtual ~WidgetChooseFont() - {} - -private: - Widget* itsParent; - - HWND getParentHandle() { return itsParent ? itsParent->handle() : NULL; } -}; - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Implementation of class -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -inline bool WidgetChooseFont::showDialog(DWORD dwFlags, LPLOGFONT lplf, DWORD& rgbColors) -{ - CHOOSEFONT cf = { sizeof(CHOOSEFONT) }; - - // Initialize CHOOSEFONT - cf.hwndOwner = getParentHandle(); - cf.Flags = dwFlags | CF_INITTOLOGFONTSTRUCT; - cf.lpLogFont = lplf; - cf.rgbColors = rgbColors; - - if ( ::ChooseFont( & cf ) ) - { - lplf = cf.lpLogFont; - rgbColors = cf.rgbColors; - return true; - } - return false; -} - -inline WidgetChooseFont::WidgetChooseFont( Widget * parent ) - : itsParent( parent ) -{ -} - -// end namespace SmartWin -} - -#endif -#endif //! WINCE Added: dcplusplus/trunk/smartwin/source/widgets/FontDialog.cpp =================================================================== --- dcplusplus/trunk/smartwin/source/widgets/FontDialog.cpp (rev 0) +++ dcplusplus/trunk/smartwin/source/widgets/FontDialog.cpp 2008-03-29 07:48:13 UTC (rev 1082) @@ -0,0 +1,23 @@ +#include "../../include/smartwin/widgets/FontDialog.h" + +namespace SmartWin { + +bool FontDialog::open(DWORD dwFlags, LOGFONT& font, DWORD& rgbColors) +{ + CHOOSEFONT cf = { sizeof(CHOOSEFONT) }; + + // Initialize CHOOSEFONT + cf.hwndOwner = getParentHandle(); + cf.Flags = dwFlags | CF_INITTOLOGFONTSTRUCT; + cf.lpLogFont = &font; + cf.rgbColors = rgbColors; + + if ( ::ChooseFont( & cf ) ) + { + rgbColors = cf.rgbColors; + return true; + } + return false; +} + +} Modified: dcplusplus/trunk/win32/Appearance2Page.cpp =================================================================== --- dcplusplus/trunk/win32/Appearance2Page.cpp 2008-03-29 07:47:37 UTC (rev 1081) +++ dcplusplus/trunk/win32/Appearance2Page.cpp 2008-03-29 07:48:13 UTC (rev 1082) @@ -127,7 +127,7 @@ void Appearance2Page::handleTextClicked() { LOGFONT logFont_ = logFont; DWORD fg_ = fg; - if(createChooseFont().showDialog(CF_EFFECTS | CF_SCREENFONTS, &logFont_, fg_)) { + if(createFontDialog().open(CF_EFFECTS | CF_SCREENFONTS, logFont_, fg_)) { logFont = logFont_; fg = fg_; font = SmartWin::FontPtr(new SmartWin::Font(::CreateFontIndirect(&logFont), true)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |