Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Dynamic skin changes...
Re: Dynamic skin changes... [message #61186 is a reply to message #61167] Sat, 30 November 2024 13:26 Go to previous messageGo to previous message
Tom1
Messages: 1305
Registered: March 2007
Ultimate Contributor
Tom1 wrote on Wed, 27 November 2024 15:37
Thanks Mirek!

Looks very good now! Smile

As to your question, now we can do this:
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

struct MainWindow : public TopWindow{
	MenuBar menu;

	MainWindow() {
		Title("Dynamic Theming Sample").Sizeable();
		AddFrame(menu);
		menu.Set([=](Bar& bar) {
			bar.Sub("Theme",[=](Bar& bar) {
				bar.Add("Host platform (dynamic)",[=] { Ctrl::SkinChangeSensitive(true);  SetDarkThemeEnabled(true); Ctrl::SetSkin(ChHostSkin); });
				bar.Add("Host platform (forced dark)",[=] { Ctrl::SkinChangeSensitive(false);  SetDarkThemeEnabled(true); Ctrl::SetSkin(ChHostSkin); });
				bar.Add("Host platform (forced light)",[=] { Ctrl::SkinChangeSensitive(false);  SetDarkThemeEnabled(false); Ctrl::SetSkin(ChHostSkin); });
				bar.Add("Custom theme (static)",[=] { Ctrl::SkinChangeSensitive(false);  Ctrl::SetSkin(ChStdSkin); });
			});
		});
	}
	
};

GUI_APP_MAIN{
	Ctrl::SkinChangeSensitive(true);
	Ctrl::SetDarkThemeEnabled(true);

	MainWindow().Run();
}

This new automatic theme responsiveness added with manual control keeps maritime users happy: Many of them like to have the entire desktop with all apps dark at night and light during daytime. Night at sea is really dark and it requires dimming each and every light on the ship's bridge to its minimum to be able to see much anything ahead. (There's even a utility available for Windows that automatically switches between light and dark themes based on Sun rise and Sun set times.) But as always, some users wish to have it exactly their way with different themes on different applications. So, now everyone (excluding some even more difficult users) can have it their way. Smile

Thanks and best regards,

Tom

Mirek,

Can you hold merging this a little while longer? It turned out that I still cannot 'Force Dark' if Windows is currently in 'Light' mode. I will look into this...

Best regards,

Tom
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Github workflow files for building U++ on Windows, Linux & MacOS
Next Topic: Refactoring Moveable
Goto Forum:
  


Current Time: Wed Aug 13 21:21:33 CEST 2025

Total time taken to generate the page: 0.08762 seconds