@@ -8,8 +8,8 @@ IWCdeWindow::IWCdeWindow(IWApproachDefinition selectedApproach, IWStyling stylin
88 , lightColor(AdjustColorBrightness(styling.windowFrameColor, 1.4 ))
99 , darkColor(AdjustColorBrightness(styling.windowFrameColor, 0.4 ))
1010{
11- COLORREF textColor = RGB (styling. windowFrameTextColor . r , styling.windowFrameTextColor . g , styling. windowFrameTextColor . b );
12- this ->titleBar = new IWCdeTitleBar (windowBorderColor, textColor, lightColor, darkColor, this ) ;
11+ this -> titleBar = new IWCdeTitleBar (windowBorderColor , styling.windowFrameTextColor , lightColor, darkColor, this );
12+ this ->extraMenuItemWidth = 20 ;
1313}
1414
1515int IWCdeWindow::GetEdgeCursorPosition (CPoint point)
@@ -76,28 +76,28 @@ void IWCdeWindow::DrawBorder(CDC* pdc, CRect rect)
7676 leftBorderRect.left = leftBorderRect.left + 1 ;
7777 leftBorderRect.right = leftBorderRect.left + WINDOW_BORDER_THICKNESS - 1 ;
7878 leftBorderRect.bottom = leftBorderRect.bottom - TITLE_BAR_HEIGHT;
79- Draw3dRect (pdc, leftBorderRect, border3dSteps, lightColor, darkColor);
79+ DrawThick3dRect (pdc, leftBorderRect, border3dSteps, lightColor, darkColor);
8080
8181 CRect bottomBorderRect = rect;
8282 bottomBorderRect.top = bottomBorderRect.bottom - WINDOW_BORDER_THICKNESS;
8383 bottomBorderRect.left = bottomBorderRect.left + TITLE_BAR_HEIGHT;
8484 bottomBorderRect.right = bottomBorderRect.right - TITLE_BAR_HEIGHT;
8585 bottomBorderRect.bottom = bottomBorderRect.bottom - 1 ;
86- Draw3dRect (pdc, bottomBorderRect, border3dSteps, lightColor, darkColor);
86+ DrawThick3dRect (pdc, bottomBorderRect, border3dSteps, lightColor, darkColor);
8787
8888 CRect rightBorderRect = rect;
8989 rightBorderRect.top = rightBorderRect.top + TITLE_BAR_HEIGHT;
9090 rightBorderRect.left = rightBorderRect.right - WINDOW_BORDER_THICKNESS;
9191 rightBorderRect.right = rightBorderRect.right - 1 ;
9292 rightBorderRect.bottom = rightBorderRect.bottom - TITLE_BAR_HEIGHT;
93- Draw3dRect (pdc, rightBorderRect, border3dSteps, lightColor, darkColor);
93+ DrawThick3dRect (pdc, rightBorderRect, border3dSteps, lightColor, darkColor);
9494
9595 CRect topBorderRect = rect;
9696 topBorderRect.top = topBorderRect.top + 1 ;
9797 topBorderRect.left = topBorderRect.left + TITLE_BAR_HEIGHT;
9898 topBorderRect.right = topBorderRect.right - TITLE_BAR_HEIGHT;
9999 topBorderRect.bottom = topBorderRect.top + WINDOW_BORDER_THICKNESS - 1 ;
100- Draw3dRect (pdc, topBorderRect, border3dSteps, lightColor, darkColor);
100+ DrawThick3dRect (pdc, topBorderRect, border3dSteps, lightColor, darkColor);
101101
102102 // Corners
103103
@@ -106,36 +106,38 @@ void IWCdeWindow::DrawBorder(CDC* pdc, CRect rect)
106106 topLeftCornerRect.left = topLeftCornerRect.left + 1 ;
107107 topLeftCornerRect.right = topLeftCornerRect.left + TITLE_BAR_HEIGHT - 2 ;
108108 topLeftCornerRect.bottom = topLeftCornerRect.top + TITLE_BAR_HEIGHT - 2 ;
109- Draw3dCorner (pdc, topLeftCornerRect, WINDOW_BORDER_THICKNESS, border3dSteps, lightColor, darkColor, true , true );
109+ DrawThick3dCorner (pdc, topLeftCornerRect, WINDOW_BORDER_THICKNESS, border3dSteps, lightColor, darkColor, true , true );
110110
111111 CRect topRightCornerRect = rect;
112112 topRightCornerRect.top = topRightCornerRect.top + 1 ;
113113 topRightCornerRect.left = topRightCornerRect.right - TITLE_BAR_HEIGHT;
114114 topRightCornerRect.right = topRightCornerRect.right - 2 ;
115115 topRightCornerRect.bottom = topRightCornerRect.top + TITLE_BAR_HEIGHT - 2 ;
116- Draw3dCorner (pdc, topRightCornerRect, WINDOW_BORDER_THICKNESS, border3dSteps, lightColor, darkColor, true , false );
116+ DrawThick3dCorner (pdc, topRightCornerRect, WINDOW_BORDER_THICKNESS, border3dSteps, lightColor, darkColor, true , false );
117117
118118 CRect bottomRightCornerRect = rect;
119119 bottomRightCornerRect.top = bottomRightCornerRect.bottom - TITLE_BAR_HEIGHT;
120120 bottomRightCornerRect.left = bottomRightCornerRect.right - TITLE_BAR_HEIGHT;
121121 bottomRightCornerRect.right = bottomRightCornerRect.right - 2 ;
122122 bottomRightCornerRect.bottom = bottomRightCornerRect.bottom - 2 ;
123- Draw3dCorner (pdc, bottomRightCornerRect, WINDOW_BORDER_THICKNESS, border3dSteps, lightColor, darkColor, false , false );
123+ DrawThick3dCorner (pdc, bottomRightCornerRect, WINDOW_BORDER_THICKNESS, border3dSteps, lightColor, darkColor, false , false );
124124
125125 CRect bottomLeftCornerRect = rect;
126126 bottomLeftCornerRect.top = bottomLeftCornerRect.bottom - TITLE_BAR_HEIGHT;
127127 bottomLeftCornerRect.left = bottomLeftCornerRect.left + 1 ;
128128 bottomLeftCornerRect.right = bottomLeftCornerRect.left + TITLE_BAR_HEIGHT - 2 ;
129129 bottomLeftCornerRect.bottom = bottomLeftCornerRect.bottom - 2 ;
130- Draw3dCorner (pdc, bottomLeftCornerRect, WINDOW_BORDER_THICKNESS, border3dSteps, lightColor, darkColor, false , true );
130+ DrawThick3dCorner (pdc, bottomLeftCornerRect, WINDOW_BORDER_THICKNESS, border3dSteps, lightColor, darkColor, false , true );
131131}
132132
133- COLORREF IWCdeWindow::AdjustColorBrightness (RGB color, double factor)
133+ COLORREF IWCdeWindow::AdjustColorBrightness (COLORREF color, double factor)
134134{
135+ GetRValue (color);
136+
135137 // Adjust each component
136- int red = static_cast < int > (color. r * factor) ;
137- int green = static_cast < int > (color. g * factor) ;
138- int blue = static_cast < int > (color. b * factor) ;
138+ int red = GetRValue (color) * factor;
139+ int green = GetGValue (color) * factor;
140+ int blue = GetBValue (color) * factor;
139141
140142 // Ensure the components are within the valid range
141143 red = max (0 , min (255 , red));
@@ -145,3 +147,32 @@ COLORREF IWCdeWindow::AdjustColorBrightness(RGB color, double factor)
145147 // Combine them back into a COLORREF
146148 return RGB (red, green, blue);
147149}
150+
151+ void IWCdeWindow::DrawMenuItem (CDC* pdc, CRect bounds, CString text, bool isHovered, bool isChecked)
152+ {
153+ COLORREF bgColor = isHovered ? RGB (130 , 130 , 130 ) : RGB (152 , 152 , 152 );
154+ COLORREF textColor = RGB (255 , 255 , 255 ); // White text
155+
156+ std::string fullText = isChecked ? " ¤ " : " " ;
157+ fullText += text;
158+
159+ CBrush brush (bgColor);
160+ pdc->FillRect (&bounds, &brush);
161+
162+ if (isHovered) {
163+ COLORREF darkened = AdjustColorBrightness (bgColor, 0.6 );
164+ COLORREF lightened = AdjustColorBrightness (bgColor, 1.4 );
165+ DrawThick3dRect (pdc, bounds, 2 , darkened, lightened);
166+ }
167+
168+ // Draw text
169+ pdc->SetTextColor (textColor);
170+ pdc->SetBkMode (TRANSPARENT);
171+
172+ CRect textArea = bounds;
173+ textArea.left += 10 ;
174+
175+ CFont* oldFont = pdc->SelectObject (&mainFont);
176+ pdc->DrawText (fullText.c_str (), &textArea, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
177+ pdc->SelectObject (&oldFont);
178+ }
0 commit comments