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 » 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 Go to next message
galious is currently offline  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
Re: Chameleon background/paper skinning for TopWindow [message #42553 is a reply to message #41940] Mon, 24 March 2014 13:19 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14175
Registered: November 2005
Ultimate Member
Hi,

Adding style to TopWindow makes sense, I have improved a little bit upon your version (it does not need to be Color, Value is more flexible as it allows e.g. putting image there).

HOWEVER, the original claim that background is black is quite weird - I see no such behaviour (and I am using Win8 too, plus apps deployed do too). Have you checked with latest sources (svn/nightly build)? If yes, can you elaborate on your Win8 setup or anything that could help me reproduce this undesirable behaviour? (perhaps some screenshots would help too). Does even theide have black backgrounds?

Mirek
Re: Chameleon background/paper skinning for TopWindow [message #42964 is a reply to message #41940] Thu, 17 April 2014 22:10 Go to previous message
galious is currently offline  galious
Messages: 28
Registered: March 2008
Promising Member
Using the latest nightly it works: no black is shown anymore. The observed behaviour was with build 6688.

Best regards,
--Martin
Previous Topic: TrayIcon does not work correctly with GTK backend.
Next Topic: ok and cancel button reversed on Linux
Goto Forum:
  


Current Time: Sat Dec 21 16:06:10 CET 2024

Total time taken to generate the page: 0.04638 seconds