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 » Howto set the icon for the application/and or topwindow in the code?
Howto set the icon for the application/and or topwindow in the code? [message #26938] Fri, 11 June 2010 00:02 Go to next message
abductee is currently offline  abductee
Messages: 22
Registered: June 2007
Location: Germany
Promising Member
hi,
i'd like to give my Application an icon.
and i'd like to set that icon from within the code of the app, not using layouteditor or image/draw.

(the icon should change according to the state of the app and the icon gets renderd by my own functions )

so, how would i go about doing this?

thanks in advance,
abductee
Re: Howto set the icon for the application/and or topwindow in the code? [message #26942 is a reply to message #26938] Fri, 11 June 2010 10:54 Go to previous message
Zbych is currently offline  Zbych
Messages: 325
Registered: July 2009
Senior Member
You can use ImageDraw to draw image and Icon to show a new icon.

aqq2.lay:
----------------------------------------------------------
LAYOUT(aqq2Layout, 200, 100)
	ITEM(Button, ChangeIcon, SetLabel(t_("Icon")).LeftPosZ(52, 104).TopPosZ(44, 36))
END_LAYOUT


aqq2.h:
----------------------------------------------------------
#ifndef _aqq2_aqq2_h
#define _aqq2_aqq2_h

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

#define LAYOUTFILE <aqq2/aqq2.lay>
#include <CtrlCore/lay.h>



class aqq2 : public Withaqq2Layout<TopWindow> {
	void SetIcon();
public:
	typedef aqq2 CLASSNAME;
	aqq2();
};


main.cpp:
----------------------------------------------------------
#include "aqq2.h"


void aqq2::SetIcon()
{
	ImageDraw iw(16, 16);
	iw.DrawRect(4,4,8,8,Color(Random(),Random(), Random()));
	Icon(iw);
}

aqq2::aqq2()
{
	CtrlLayout(*this, "Window title");
	ChangeIcon.WhenPush = THISBACK(SetIcon);
}

GUI_APP_MAIN
{
	aqq2().Run();
}

Previous Topic: [SOLVED] topmost menu popup crashes
Next Topic: Simple way of switching dialogs
Goto Forum:
  


Current Time: Thu Mar 28 17:05:40 CET 2024

Total time taken to generate the page: 0.01519 seconds