Home » U++ Library support » TopWindow&PopUp, TrayIcon » Chameleon background/paper skinning for TopWindow  
	
		
		
			| Chameleon background/paper skinning for TopWindow [message #41940] | 
			Fri, 07 February 2014 21:33   | 
		 
		
			
				
				
				
					
						  
						galious
						 Messages: 28 Registered: March 2008 
						
					 | 
					Promising Member  | 
					 | 
		 
		 
	 | 
 
	
		Hi, 
 
I'm using Windows 8. In Windows 8 all U++ windows are by default shown with a black window background. Normally this wouldn't be a problem since I already set the window background in all of my. However also the dialog windows (e.g. PromptOK(...)) do show up with a black window background. 
 
Since I do not like this, I decided to patch the TopWindow to be able to set a global background skin. I've made the following changes: 
 
TopWindow.cpp 
void TopWindow::Paint(Draw& w)
{
	background.Paint(w, Rect(GetSize()), SColorText, SColorShadow);
	Size sz = GetSize();
	ChPaint(w, sz, st->paper);
}
CH_STYLE(TopWindow, TopStyle, StyleDefault)
{
	paper = Null;
}
TopWindow& TopWindow::SetStyle(const TopStyle& s)
{
	st = &s;
	RefreshLayout();
	RefreshFrame();
	return *this;
}
TopWindow::TopWindow()
{
	GuiLock __;
	TransparentBackPaint();
	background = PaintRect(Single<DialogBackground>(), Null);
	center = 1;
	minsize = Size(80, 20);
	GuiPlatformConstruct();
	maximizebox = minimizebox = sizeable = tool = noclosebox = false;
	state = OVERLAPPED;
	WhenClose = THISBACK(Close);
	overlapped.Clear();
	dokeys = true;
	fullscreen = frameless = urgent = false;
	SetStyle(StyleDefault());
}
 
 
and in TopWindow.h 
public:
	struct TopStyle : ChStyle<TopStyle> {
		Color paper;
	};
protected:
	const TopStyle *st;
public:
	static const TopStyle& StyleDefault();
	TopWindow&  SetStyle(const TopStyle& s);
 
 
This code is backwards compatible (as in that it doesn't have any new styling and just shows the old behaviour). Any chance to have this included in trunk? 
 
Best regards, 
--Martin
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
  
 
Goto Forum:
 
 Current Time: Tue Nov 04 03:44:11 CET 2025 
 Total time taken to generate the page: 0.10661 seconds 
 |