← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2547: pick the menu bar color better

 

------------------------------------------------------------
revno: 2547
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Thu 2011-06-02 20:20:54 +0200
message:
  pick the menu bar color better
modified:
  dwt/include/dwt/widgets/Menu.h
  dwt/src/Application.cpp
  dwt/src/widgets/Menu.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/Menu.h'
--- dwt/include/dwt/widgets/Menu.h	2011-06-01 19:02:45 +0000
+++ dwt/include/dwt/widgets/Menu.h	2011-06-02 18:20:54 +0000
@@ -64,7 +64,6 @@
 		COLORREF text;
 		COLORREF gray;
 		COLORREF background;
-		COLORREF menuBar;
 		COLORREF stripBar;
 		COLORREF highlightBackground;
 		COLORREF highlightText;

=== modified file 'dwt/src/Application.cpp'
--- dwt/src/Application.cpp	2011-01-02 17:12:02 +0000
+++ dwt/src/Application.cpp	2011-06-02 18:20:54 +0000
@@ -66,14 +66,11 @@
 void Application::init(int nCmdShow) {
 	itsInstance = new Application(nCmdShow);
 
-#ifndef WINCE
 	BOOL enable;
-	::SystemParametersInfo(SPI_GETUIEFFECTS, 0, &enable, 0);
-	if (!enable) {
+	if(::SystemParametersInfo(SPI_GETUIEFFECTS, 0, &enable, 0) && !enable) {
 		enable = TRUE;
 		::SystemParametersInfo(SPI_SETUIEFFECTS, 0, &enable, 0);
 	}
-#endif
 
 	// Initializing Common Controls...
 	INITCOMMONCONTROLSEX init = {

=== modified file 'dwt/src/widgets/Menu.cpp'
--- dwt/src/widgets/Menu.cpp	2011-06-01 19:02:45 +0000
+++ dwt/src/widgets/Menu.cpp	2011-06-02 18:20:54 +0000
@@ -68,7 +68,6 @@
 	text = Color::predefined(COLOR_MENUTEXT);
 	gray = Color::predefined(COLOR_GRAYTEXT);
 	background = Color::predefined(COLOR_MENU);
-	menuBar = Color::predefined(util::win32::ensureVersion(util::win32::SEVEN) ? COLOR_MENUBAR : COLOR_3DFACE);
 	stripBar = Color::darken(background, 0.06);
 	highlightBackground = Color::predefined(COLOR_HIGHLIGHT);
 	highlightText = Color::predefined(COLOR_HIGHLIGHTTEXT);
@@ -524,11 +523,18 @@
 		theme.drawBackground(canvas, part, state, rect, false);
 
 	} else {
-		canvas.fill(rect, Brush(
-			highlight ? colors.highlightBackground :
-			!popup ? colors.menuBar :
-			wrapper.isTitle ? colors.stripBar :
-			colors.background));
+		COLORREF color;
+		if(highlight) {
+			color = colors.highlightBackground;
+		} else if(!popup) {
+			BOOL flat;
+			color = (::SystemParametersInfo(SPI_GETFLATMENU, 0, &flat, 0) && flat) ? Color::predefined(COLOR_MENUBAR) : colors.background;
+		} else if(wrapper.isTitle) {
+			color = colors.stripBar;
+		} else {
+			color = colors.background;
+		}
+		canvas.fill(rect, Brush(color));
 	}
 
 	Rectangle stripRect(rect);