show icon changing on all platforms

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27538 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2004-05-31 22:04:58 +00:00
parent a7d174bf49
commit 0dc6da2d7d
2 changed files with 53 additions and 11 deletions

49
samples/taskbar/smile.xpm Normal file
View File

@@ -0,0 +1,49 @@
/* XPM */
static char * smile_xpm[] = {
"24 24 22 1",
" c None",
". c #404000",
"+ c #333300",
"@ c #7F7F00",
"# c #FFFF00",
"$ c #000000",
"% c #CFCF00",
"& c #9F9F00",
"* c #DFDF00",
"= c #303000",
"- c #808000",
"; c #BFBF00",
"> c #202000",
", c #707000",
"' c #606000",
") c #EFEF00",
"! c #9F1000",
"~ c #603000",
"{ c #DF0000",
"] c #FF0000",
"^ c #804000",
"/ c #800000",
" ...... ",
" +@@######@@+ ",
" $%##########%$ ",
" &##############& ",
" &################& ",
" $##################$ ",
" +%####*==*##*==*####%+ ",
" -#####-$$-##-$$-#####- ",
" -#####-$$-##-$$-#####- ",
".######-$$-##-$$-######.",
".######;>>;##;>>;######.",
".#####,#%%####%%#,#####.",
".####%,##########,%####.",
".##-->############>--##.",
".##;;;,##########,;;;##.",
" -####;')######)';####- ",
" -####*.'&####&'.*####- ",
" +%####*=!....!=*####%+ ",
" $######~{]]{~######$ ",
" &#####*^//^*#####& ",
" &#####*;;*#####& ",
" $%##########%$ ",
" +--######--+ ",
" ...... "};

View File

@@ -25,6 +25,8 @@
#include "../sample.xpm"
#endif
#include "smile.xpm"
#include "wx/taskbar.h"
#include "tbtest.h"
@@ -91,7 +93,6 @@ void MyDialog::Init(void)
(new wxButton(this, wxID_OK, _T("Hide me"), wxPoint(100, 230), wxSize(80, 25)))->SetDefault();
Centre(wxBOTH);
m_taskBarIcon = new MyTaskBarIcon();
if (!m_taskBarIcon->SetIcon(wxICON(sample), wxT("wxTaskBarIcon Sample")))
wxMessageBox(wxT("Could not set icon."));
@@ -130,12 +131,10 @@ void MyTaskBarIcon::OnMenuExit(wxCommandEvent& )
void MyTaskBarIcon::OnMenuSetNewIcon(wxCommandEvent&)
{
#ifdef __WXMSW__
wxIcon icon(wxT("wxDEFAULT_FRAME"));
wxIcon icon(smile_xpm);
if (!SetIcon(icon, wxT("wxTaskBarIcon Sample")))
if (!SetIcon(icon, wxT("wxTaskBarIcon Sample - a different icon")))
wxMessageBox(wxT("Could not set new icon."));
#endif
}
// Overridables
@@ -144,9 +143,7 @@ void MyTaskBarIcon::OnRButtonUp(wxEvent&)
wxMenu menu;
menu.Append(PU_RESTORE, _T("&Restore TBTest"));
#ifdef __WXMSW__
menu.Append(PU_NEW_ICON,_T("&Set New Icon"));
#endif
menu.Append(PU_EXIT, _T("E&xit"));
PopupMenu(&menu);
@@ -156,7 +153,3 @@ void MyTaskBarIcon::OnLButtonDClick(wxEvent&)
{
dialog->Show(true);
}