← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2202: use the theme to draw the close tab button

 

------------------------------------------------------------
revno: 2202
committer: poy <poy@xxxxxxxxxx>
branch nick: repo
timestamp: Tue 2010-08-10 18:53:56 +0200
message:
  use the theme to draw the close tab button
modified:
  dwt/include/dwt/widgets/TabView.h
  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/include/dwt/widgets/TabView.h'
--- dwt/include/dwt/widgets/TabView.h	2010-08-10 16:28:19 +0000
+++ dwt/include/dwt/widgets/TabView.h	2010-08-10 16:53:56 +0000
@@ -146,6 +146,7 @@
 	};
 
 	Theme theme;
+	Theme windowTheme; // to draw the close button
 	ToolTipPtr tip;
 
 	TitleChangedFunction titleChangedFunction;

=== modified file 'dwt/src/widgets/TabView.cpp'
--- dwt/src/widgets/TabView.cpp	2010-08-10 16:28:19 +0000
+++ dwt/src/widgets/TabView.cpp	2010-08-10 16:53:56 +0000
@@ -100,6 +100,7 @@
 		boldFont = FontPtr(new Font(::CreateFontIndirect(&lf), true));
 
 		theme.load(VSCLASS_TAB, this);
+		windowTheme.load(VSCLASS_WINDOW, this);
 
 		if(!(cs.style & TCS_BUTTONS)) {
 			// we don't want pre-drawn borders to get in the way here, so we fully take over painting.
@@ -708,14 +709,20 @@
 			rect.pos.y += (rect.size.y - 16) / 2; // center the icon vertically
 		rect.size.y = 16;
 
-		UINT format = DFCS_CAPTIONCLOSE | DFCS_FLAT;
-		if(isHighlighted && highlightClose) {
-			format |= DFCS_HOT;
-			if(closeAuthorized)
-				format |= DFCS_PUSHED;
+		if(windowTheme) {
+			windowTheme.drawBackground(canvas, WP_CLOSEBUTTON,
+				(isHighlighted && highlightClose) ? (closeAuthorized ? CBS_PUSHED : CBS_HOT) : CBS_NORMAL, rect);
+
+		} else {
+			UINT format = DFCS_CAPTIONCLOSE | DFCS_FLAT;
+			if(isHighlighted && highlightClose) {
+				format |= DFCS_HOT;
+				if(closeAuthorized)
+					format |= DFCS_PUSHED;
+			}
+			::RECT rc(rect);
+			::DrawFrameControl(canvas.handle(), &rc, DFC_CAPTION, format);
 		}
-		::RECT rc(rect);
-		::DrawFrameControl(canvas.handle(), &rc, DFC_CAPTION, format);
 
 		closeRect = rect;
 		closeRect.pos = ScreenCoordinate(ClientCoordinate(closeRect.pos, this)).getPoint();