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 » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » Window without title bar
Re: Window without title bar [message #14131 is a reply to message #14130] Wed, 13 February 2008 21:06 Go to previous messageGo to previous message
Werner is currently offline  Werner
Messages: 234
Registered: May 2006
Location: Cologne / Germany
Experienced Member
Meanwhile I finished my "single"-ruminations.

At the same time I improved my popup-window test application.

Perhaps the code is interesting to you because it deals with the possible GUI effects "slide" and "fade".

Here it is:

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

class PopUpWin : public LineEdit
{
private:
	bool poppedUp_;

	void RightDown(Point p, dword keyFlags)
	{
		Close();
		poppedUp_ = false;
	}
	
public:
	PopUpWin() : poppedUp_(false) { }
	void SetPoppedUp(bool yesNo) { poppedUp_ = yesNo; }
	bool IsPoppedUp() const { return poppedUp_; }
};

class MainWin : public TopWindow
{
private:
	typedef MainWin CLASSNAME;

	void NoEffect()
	{
		Single<PopUpWin>().SetPoppedUp(true);
		Single<PopUpWin>().SetRect(300, 300, 600, 400);
		Single<PopUpWin>().SetColor(TextCtrl::PAPER_NORMAL, White);
		Single<PopUpWin>().SetColor(TextCtrl::INK_NORMAL, Black);
		Single<PopUpWin>().PopUp
			(
				this,								// Ctrl*	owner		= NULL
				true,								// bool		savebits	= true
				true,								// bool		activate	= true
				true,								// bool		dropshadow	= false
				false								// bool		topmost		= false
			);
	}

	void SlideEffect()
	{
		Single<PopUpWin>().SetPoppedUp(true);
		Single<PopUpWin>().SetRect(300, 300, 6, 4);
		Single<PopUpWin>().SetColor(TextCtrl::PAPER_NORMAL, White);
		Single<PopUpWin>().SetColor(TextCtrl::INK_NORMAL, Black);
		Single<PopUpWin>().PopUp
			(
				this,								// Ctrl*	owner		= NULL
				true,								// bool		savebits	= true
				true,								// bool		activate	= true
				true,								// bool		dropshadow	= false
				false								// bool		topmost		= false
			);
		Ctrl::ProcessEvents();
		Animate(Single<PopUpWin>(), RectC(300, 300, 600, 400), GUIEFFECT_SLIDE);
	}
	
	void FadeEffect()
	{
		Single<PopUpWin>().SetPoppedUp(true);
		Single<PopUpWin>().SetRect(300, 300, 600, 400);
		Single<PopUpWin>().SetColor(TextCtrl::PAPER_NORMAL, White);
		Single<PopUpWin>().SetColor(TextCtrl::INK_NORMAL, Black);
		Single<PopUpWin>().PopUp
			(
				this,								// Ctrl*	owner		= NULL
				true,								// bool		savebits	= true
				true,								// bool		activate	= true
				true,								// bool		dropshadow	= false
				false								// bool		topmost		= false
			);
		Ctrl::ProcessEvents();
		Animate(Single<PopUpWin>(), RectC(300, 300, 600, 400), GUIEFFECT_FADE);
	}

	void local_menu(Bar& bar)
	{
		MenuBar local_menu;

		bar.Add("no effect", THISBACK(NoEffect));
		bar.Add("slide effect", THISBACK(SlideEffect));
		bar.Add("fade effect", THISBACK(FadeEffect));
		local_menu.Execute();
	}

	void LeftDown(Point p, dword keyFlags)
	{
		if (Single<PopUpWin>().IsPoppedUp())
			return;
		MenuBar::Execute(THISBACK(local_menu));	
	}
};

GUI_APP_MAIN
{
	MainWin mainWin;
	mainWin.SetRect(0, 0, 800, 600);
	mainWin.Run();
}

Werner

[Updated on: Wed, 13 February 2008 21:10]

Report message to a moderator

 
Read Message icon5.gif
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: Sometimes, you don't want to update the GUI...
Next Topic: print multiple postscript/PDF in windows
Goto Forum:
  


Current Time: Sun Apr 28 18:03:22 CEST 2024

Total time taken to generate the page: 0.04538 seconds