From f74ebf3952fb0e2c3a1f1a8aef4e7c9459159d02 Mon Sep 17 00:00:00 2001 From: Mirek Fidler Date: Thu, 29 May 2025 10:44:13 +0200 Subject: [PATCH] dev --- examples/CustomTitlebar/main.cpp | 3 +++ uppsrc/CtrlCore/Win32Proc.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/examples/CustomTitlebar/main.cpp b/examples/CustomTitlebar/main.cpp index a1b069a2c..7bc5b638e 100644 --- a/examples/CustomTitlebar/main.cpp +++ b/examples/CustomTitlebar/main.cpp @@ -16,6 +16,7 @@ struct MyApp : TopWindow { } MenuBar bar; + LineEdit editor; MyApp() { CustomTitleBar(); @@ -23,6 +24,8 @@ struct MyApp : TopWindow { bar.Set([=](Bar& bar) { MainMenu(bar); }); + + Add(editor.HSizePos().VSizePos(50, 0)); }; }; diff --git a/uppsrc/CtrlCore/Win32Proc.cpp b/uppsrc/CtrlCore/Win32Proc.cpp index e9f42c5c3..951f0444e 100644 --- a/uppsrc/CtrlCore/Win32Proc.cpp +++ b/uppsrc/CtrlCore/Win32Proc.cpp @@ -115,6 +115,29 @@ static int getTitlebarButtonWidth(int dpi) int GetWin32TitleBarHeight(HWND hwnd); // implemented in CtrlLib/ChWin32.cpp +/* UHD + +r = [0, 0] - [2854, 60] : (2854, 60) +button_width = 94 + +HD + +r = [0, 0] - [1424, 31] : (1424, 31) +button_width = 47 + +Light + +Bar 238 244 249 +Min/max 230,234,239 + +Dark + +bar 26,34,39 +min/max 39,47,52 +close 232,17,35 + +*/ + static Rect getTitleBarRect(HWND hwnd) // TODO (image, cy) { // Adopted from: https://github.com/oberth/custom-chrome/blob/master/source/gui/window_helper.hpp#L52-L64 const int top_and_bottom_borders = 2; @@ -134,8 +157,10 @@ void Ctrl::PaintWinBar(SystemDraw& w, const Rect& clip) HWND hwnd = GetHWND(); if(topwin && topwin->custom_titlebar && hwnd) { Rect r = getTitleBarRect(hwnd); + DDUMP(r); // draw.DrawRect(r, Yellow()); int button_width = getTitlebarButtonWidth(GetDpiForWindow(hwnd)); + DDUMP(button_width); int x = r.right; int n = 0;