← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2493: change some styles

 

------------------------------------------------------------
revno: 2493
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sat 2011-04-16 16:19:18 +0200
message:
  change some styles
modified:
  dwt/include/dwt/widgets/RichTextBox.h
  dwt/src/widgets/RichTextBox.cpp
  dwt/src/widgets/Tree.cpp
  win32/ConnectivityPage.cpp
  win32/SettingsDialog.cpp
  win32/WinUtil.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dwt/include/dwt/widgets/RichTextBox.h'
--- dwt/include/dwt/widgets/RichTextBox.h	2011-03-29 20:40:28 +0000
+++ dwt/include/dwt/widgets/RichTextBox.h	2011-04-16 14:19:18 +0000
@@ -80,8 +80,8 @@
 		typedef RichTextBox::ThisType WidgetType;
 
 		FontPtr font;
-		COLORREF foregroundColor;
-		COLORREF backgroundColor;
+		int64_t foregroundColor; /// either a COLORREF or -1 for the default
+		int64_t backgroundColor; /// either a COLORREF or -1 for the default
 		bool scrollBarHorizontallyFlag;
 		bool scrollBarVerticallyFlag;
 
@@ -96,14 +96,9 @@
 	  */
 	void create( const Seed & cs = Seed() );
 
-	/// Sets the background color of the RichTextBox
-	/** Call this function to alter the background color of the WidgetRichEdit. <br>
-	  * To create a COLORREF ( color ) use the RGB macro.
-	  */
-	void setBackgroundColor( COLORREF color );
+	void setBackgroundColor(COLORREF color);
 
-	/// Sets default character formatting of the WidgetRichTextBox
-	void setDefaultCharFormat( CHARFORMAT cf );
+	void setDefaultCharFormat(const CHARFORMAT& cf);
 
 	int charFromPos(const ScreenCoordinate& pt);
 
@@ -175,14 +170,12 @@
 {
 }
 
-inline void RichTextBox::setBackgroundColor( COLORREF color )
-{
-	this->sendMessage(EM_SETBKGNDCOLOR, 0, static_cast< LPARAM >( color ) );
+inline void RichTextBox::setBackgroundColor(COLORREF color) {
+	this->sendMessage(EM_SETBKGNDCOLOR, 0, static_cast<LPARAM>(color));
 }
 
-inline void RichTextBox::setDefaultCharFormat( CHARFORMAT cf )
-{
-	this->sendMessage(EM_SETCHARFORMAT, 0, reinterpret_cast< LPARAM >(&cf));
+inline void RichTextBox::setDefaultCharFormat(const CHARFORMAT& cf) {
+	this->sendMessage(EM_SETCHARFORMAT, 0, reinterpret_cast<LPARAM>(&cf));
 }
 
 // end namespace dwt

=== modified file 'dwt/src/widgets/RichTextBox.cpp'
--- dwt/src/widgets/RichTextBox.cpp	2011-03-29 20:40:28 +0000
+++ dwt/src/widgets/RichTextBox.cpp	2011-04-16 14:19:18 +0000
@@ -49,8 +49,8 @@
 RichTextBox::Seed::Seed() :
 	BaseType::Seed(WS_CHILD | WS_TABSTOP | WS_VSCROLL | ES_LEFT | ES_AUTOVSCROLL | ES_MULTILINE | ES_NOHIDESEL),
 	font(new Font(DefaultGuiFont)),
-	foregroundColor(RGB( 0, 0, 0 )),
-	backgroundColor(RGB( 255, 255, 255 )),
+	foregroundColor(-1),
+	backgroundColor(-1),
 	scrollBarHorizontallyFlag(false),
 	scrollBarVerticallyFlag(false)
 {
@@ -63,22 +63,18 @@
 }
 
 void RichTextBox::create(const Seed& cs) {
-	dwtassert((cs.style & WS_CHILD) == WS_CHILD, _T("Widget must have WS_CHILD style"));
-	BaseType::create( cs );
+	BaseType::create(cs);
 	if(cs.font)
-		setFont( cs.font );
-
-	setBackgroundColor( cs.backgroundColor );
-
-	CHARFORMAT textFormat;
-	textFormat.cbSize = sizeof(textFormat);
-	textFormat.dwMask = CFM_COLOR;
-	textFormat.dwEffects = 0;
-	textFormat.crTextColor = cs.foregroundColor;
+		setFont(cs.font);
+
+	setBackgroundColor((cs.backgroundColor == -1) ? ::GetSysColor(COLOR_WINDOW) : cs.backgroundColor);
+
+	CHARFORMAT textFormat = { sizeof(CHARFORMAT), CFM_COLOR };
+	textFormat.crTextColor = (cs.foregroundColor == -1) ? ::GetSysColor(COLOR_WINDOWTEXT) : cs.foregroundColor;
 	setDefaultCharFormat(textFormat);
 
-	setScrollBarHorizontally( cs.scrollBarHorizontallyFlag );
-	setScrollBarVertically( cs.scrollBarVerticallyFlag );
+	setScrollBarHorizontally(cs.scrollBarHorizontallyFlag);
+	setScrollBarVertically(cs.scrollBarVerticallyFlag);
 
 	sendMessage(EM_AUTOURLDETECT, FALSE);
 

=== modified file 'dwt/src/widgets/Tree.cpp'
--- dwt/src/widgets/Tree.cpp	2011-01-02 17:12:02 +0000
+++ dwt/src/widgets/Tree.cpp	2011-04-16 14:19:18 +0000
@@ -36,7 +36,7 @@
 const TCHAR Tree::windowClass[] = WC_TREEVIEW;
 
 Tree::Seed::Seed() :
-	BaseType::Seed(WS_CHILD | WS_TABSTOP),
+	BaseType::Seed(WS_CHILD | WS_TABSTOP | TVS_DISABLEDRAGDROP | TVS_HASLINES | TVS_SHOWSELALWAYS),
 	font(new Font(DefaultGuiFont))
 {
 }

=== modified file 'win32/ConnectivityPage.cpp'
--- win32/ConnectivityPage.cpp	2011-04-11 20:39:22 +0000
+++ win32/ConnectivityPage.cpp	2011-04-16 14:19:18 +0000
@@ -61,9 +61,7 @@
 		group = cur->addChild(GroupBox::Seed(T_("Detection log")));
 		group->setHelpId(IDH_SETTINGS_CONNECTIVITY_DETECTION_LOG);
 
-		auto seed = WinUtil::Seeds::Dialog::richTextBox;
-		seed.lines = 0;
-		log = group->addChild(seed);
+		log = group->addChild(WinUtil::Seeds::Dialog::richTextBox);
 	}
 
 	PropPage::read(items);

=== modified file 'win32/SettingsDialog.cpp'
--- win32/SettingsDialog.cpp	2011-04-15 20:53:17 +0000
+++ win32/SettingsDialog.cpp	2011-04-16 14:19:18 +0000
@@ -178,6 +178,7 @@
 		auto ts = WinUtil::Seeds::Dialog::richTextBox;
 		ts.style &= ~ES_SUNKEN;
 		ts.exStyle &= ~WS_EX_CLIENTEDGE;
+		ts.lines = 6;
 		help = cur->addChild(ts);
 		help->onRaw([this](WPARAM w, LPARAM) { return helpDlgCode(w); }, dwt::Message(WM_GETDLGCODE));
 	}

=== modified file 'win32/WinUtil.cpp'
--- win32/WinUtil.cpp	2011-04-07 14:57:29 +0000
+++ win32/WinUtil.cpp	2011-04-16 14:19:18 +0000
@@ -242,7 +242,7 @@
 
 	xTabs.font = font;
 
-	xtreeView.style |= TVS_HASBUTTONS | TVS_LINESATROOT | TVS_HASLINES | TVS_SHOWSELALWAYS | TVS_DISABLEDRAGDROP;
+	xtreeView.style |= TVS_HASBUTTONS | TVS_LINESATROOT;
 	xtreeView.exStyle = WS_EX_CLIENTEDGE;
 	xtreeView.font = font;
 
@@ -255,10 +255,6 @@
 
 	xdRichTextBox.style |= ES_READONLY | ES_SUNKEN;
 	xdRichTextBox.exStyle = WS_EX_CLIENTEDGE;
-	xdRichTextBox.font = font;
-	xdRichTextBox.lines = 6;
-	xdRichTextBox.foregroundColor = ::GetSysColor(COLOR_WINDOWTEXT);
-	xdRichTextBox.backgroundColor = ::GetSysColor(COLOR_WINDOW);
 
 	xdTable.style |= WS_HSCROLL | WS_VSCROLL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER;
 	xdTable.exStyle = WS_EX_CLIENTEDGE;