← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2199: handle themed / unthemed changes better

 

------------------------------------------------------------
revno: 2199
committer: poy <poy@xxxxxxxxxx>
branch nick: repo
timestamp: Sun 2010-08-08 14:10:20 +0200
message:
  handle themed / unthemed changes better
modified:
  dwt/src/widgets/Menu.cpp
  dwt/src/widgets/TabView.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/src/widgets/Menu.cpp'
--- dwt/src/widgets/Menu.cpp	2010-08-07 16:35:11 +0000
+++ dwt/src/widgets/Menu.cpp	2010-08-08 12:10:20 +0000
@@ -57,6 +57,8 @@
 const int Menu::textIconGap = 8;
 const int Menu::textBorderGap = 4;
 
+/// @todo menus should re-init the cached default colors on WM_SYSCOLORCHANGE
+
 const COLORREF Menu::Colors::text = ::GetSysColor(COLOR_MENUTEXT);
 const COLORREF Menu::Colors::gray = ::GetSysColor(COLOR_GRAYTEXT);
 

=== modified file 'dwt/src/widgets/TabView.cpp'
--- dwt/src/widgets/TabView.cpp	2010-08-07 20:36:06 +0000
+++ dwt/src/widgets/TabView.cpp	2010-08-08 12:10:20 +0000
@@ -89,6 +89,8 @@
 		font = new Font(DefaultGuiFont);
 
 	if(cs.style & TCS_OWNERDRAWFIXED) {
+		dwtassert(dynamic_cast<Control*>(getParent()), _T("Owner-drawn tabs must have a parent derived from dwt::Control"));
+
 		if(widthConfig < 100)
 			widthConfig = 100;
 		TabCtrl_SetMinTabWidth(handle(), widthConfig);
@@ -100,9 +102,7 @@
 
 		loadTheme(VSCLASS_TAB);
 
-		if(!theme || (cs.style & TCS_BUTTONS)) {
-			dwtassert(dynamic_cast<Control*>(getParent()), _T("Owner-drawn tabs must have a parent derived from dwt::Control"));
-		} else {
+		if(!(cs.style & TCS_BUTTONS)) {
 			// we don't want pre-drawn borders to get in the way here, so we fully take over painting.
 			onPainting(std::bind((void (TabView::*)(PaintCanvas&))(&TabView::handlePainting), this, _1));
 		}
@@ -822,6 +822,11 @@
 }
 
 bool TabView::handleMessage( const MSG & msg, LRESULT & retVal ) {
+	if(msg.message == WM_PAINT && !theme) {
+		// let the tab control draw the borders of unthemed tabs (and revert to classic owner-draw callbacks).
+		return false;
+	}
+
 	bool handled = BaseType::handleMessage(msg, retVal);
 
 	if(msg.message == WM_SIZE) {