A simple example of creating icon image from XPM data, included into the code.
const char * const icon1[] =
{
"16 16 8 1",
" c None s None",
". c #808080",
"X c #FFFF00",
"o c #c0c0c0",
"O c black",
"+ c #00FFFF",
"@ c #00FF00",
"# c white",
" ..... ",
" ..XXoooOO ",
" .+XXXoooooO ",
" .@++XXoooo#oO ",
" .@@+XXooo#ooO ",
".oo@@+Xoo#ooooO ",
".ooo@+.O.oooooO ",
".oooo@O#OoooooO ",
".oooo#.O.+ooooO ",
".ooo#oo#@X+oooO ",
" .o#oooo@X++oO ",
" .#ooooo@XX++O ",
" .ooooo@@XXO ",
" ..ooo@@OO ",
" ..OOO ",
" "
};
public:
virtual ~MyMainFrame();
void DoExit();
};
void MyMainFrame::DoExit()
{
}
{
gClient->GetColorByName(
"yellow", yellow);
TGIcon *icon =
new TGIcon(
this, iconpic, 40, 40, kChildFrame, yellow);
SetWindowName("Icon test");
MapSubwindows();
Resize(GetDefaultSize());
MapWindow();
}
MyMainFrame::~MyMainFrame()
{
Cleanup();
}
void iconAsXPMData()
{
new MyMainFrame(
gClient->GetRoot(), 350, 80);
}
- Author
- Ilka Antcheva 27/09/2007
Definition in file iconAsXPMData.C.