More window chrome improvements

This commit is contained in:
elasota
2020-05-18 02:03:17 -04:00
parent f590613f83
commit ea16d0ffca
41 changed files with 804 additions and 429 deletions

View File

@@ -8,6 +8,11 @@
#include "FontFamily.h"
#include "Vec2i.h"
static const int kLightGray = 238;
static const int kMidGray = 221;
static const int kMidDarkGray = 170;
static const int kDarkGray = 102;
namespace PortabilityLayer
{
PopupMenuWidget::PopupMenuWidget(const WidgetBasicState &state)
@@ -21,7 +26,7 @@ namespace PortabilityLayer
m_menu.Dispose();
}
bool PopupMenuWidget::Init(const WidgetBasicState &state)
bool PopupMenuWidget::Init(const WidgetBasicState &state, const void *additionalData)
{
m_menu = ::GetMenu(state.m_resID);
if (!m_menu)
@@ -73,18 +78,29 @@ namespace PortabilityLayer
const Rect rect = m_rect;
const Rect innerRect = rect.Inset(2, 2);
surface->SetForeColor(StdColors::White());
surface->FillRect(m_rect.Inset(1, 1));
surface->SetForeColor(StdColors::Black());
surface->FrameRect(m_rect);
surface->FillRect(rect);
surface->SetForeColor(StdColors::White());
surface->FillRect(rect.Inset(1, 1));
surface->SetForeColor(RGBAColor::Create(kMidGray, kMidGray, kMidGray, 255));
surface->FillRect(rect.Inset(2, 2));
const Rect inset2Rect = rect.Inset(2, 2);
surface->SetForeColor(RGBAColor::Create(kDarkGray, kDarkGray, kDarkGray, 255));
surface->FillRect(Rect::Create(inset2Rect.bottom, inset2Rect.left, inset2Rect.bottom + 1, inset2Rect.right + 1));
surface->FillRect(Rect::Create(inset2Rect.top, inset2Rect.right, inset2Rect.bottom + 1, inset2Rect.right + 1));
Rect textRect = innerRect;
textRect.right -= 9;
surface->SetSystemFont(12, PortabilityLayer::FontFamilyFlag_Bold);
Point basePoint = Point::Create(textRect.left + 2, (textRect.top + textRect.bottom + surface->MeasureFontAscender() + 1) / 2);
Point basePoint = Point::Create(textRect.left + 2, (textRect.top + textRect.bottom + surface->MeasureFontAscender() + 1) / 2 - 1);
surface->SetForeColor(StdColors::Black());
surface->DrawStringConstrained(basePoint, GetString(), true, textRect);
Point arrowMidPoint = Point::Create(textRect.right + 5, (textRect.top + textRect.bottom + 1) / 2);