Fix MSVC linking error due to wrong titlebar global variables declaration (#279)

* Fix MSVC compilation due to wrong titlebar global variables declarations.

* Fix CustomTitleBar example

* Added description to CustomTitleBar example
This commit is contained in:
Zbigniew Rębacz 2025-06-09 09:35:23 +02:00 committed by GitHub
parent 7b291a1a5d
commit bac5bd062b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 5 deletions

View file

@ -1,3 +1,5 @@
description "Demonstrates how to implement and use a custom title bar\377";
uses
CtrlLib;

View file

@ -36,7 +36,7 @@ struct MyApp : TopWindow {
int h = menubar.GetStdHeight();
CustomTitleBar(h); // h is suggested minimum height
if(IsCustomTitleBar() && 0) {
if(IsCustomTitleBar()) {
menubar.Transparent();
auto cm = GetCustomTitleBarMetrics();
bararea.Height(cm.height);

View file

@ -228,6 +228,9 @@ void Ctrl::InstallPanicBox()
InstallPanicMessageBox(&Win32PanicMessageBox);
}
extern bool is_custom_titlebar_available__;
extern Event<const TopWindow *, TopWindow::CustomTitleBarMetrics&> custom_titlebar_metrics__;
void Ctrl::InitWin32(HINSTANCE hInstance)
{
GuiLock __;
@ -289,12 +292,8 @@ void Ctrl::InitWin32(HINSTANCE hInstance)
GlobalBackPaint();
extern bool is_custom_titlebar_available__;
is_custom_titlebar_available__ = IsWin11();
extern Event<const TopWindow *, TopWindow::CustomTitleBarMetrics&> custom_titlebar_metrics__;
custom_titlebar_metrics__ = [=](const TopWindow *tw, TopWindow::CustomTitleBarMetrics& m) {
if(!tw->custom_titlebar)
return;