]>
git.saurik.com Git - wxWidgets.git/blob - samples/taskbar/tbtest.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxTaskBarIcon demo
4 // Author: Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
23 #include "wx/msw/taskbar.h"
27 MyDialog
*dialog
= NULL
;
31 bool MyApp::OnInit(void)
33 wxIcon
icon("mondrian_icon");
35 if (!m_taskBarIcon
.SetIcon(icon
, "wxTaskBarIcon Sample"))
36 wxMessageBox("Could not set icon.");
38 // Create the main frame window
39 dialog
= new MyDialog(NULL
, -1, "wxTaskBarIcon Test Dialog", wxPoint(-1, -1), wxSize(365, 290), wxDIALOG_MODELESS
|wxDEFAULT_DIALOG_STYLE
);
47 BEGIN_EVENT_TABLE(MyDialog
, wxDialog
)
48 EVT_BUTTON(wxID_OK
, MyDialog::OnOK
)
49 EVT_BUTTON(wxID_EXIT
, MyDialog::OnExit
)
54 MyDialog::MyDialog(wxWindow
* parent
, const wxWindowID id
, const wxString
& title
,
55 const wxPoint
& pos
, const wxSize
& size
, const long windowStyle
):
56 wxDialog(parent
, id
, title
, pos
, size
, windowStyle
)
61 void MyDialog::OnOK(wxCommandEvent
& event
)
66 void MyDialog::OnExit(wxCommandEvent
& event
)
71 void MyDialog::OnCloseWindow(wxCloseEvent
& event
)
76 void MyDialog::Init(void)
78 int dialogWidth
= 365;
79 int dialogHeight
= 290;
81 wxStaticText
* stat
= new wxStaticText(this, -1, "Press OK to hide me, Exit to quit.",
84 wxStaticText
* stat2
= new wxStaticText(this, -1, "Double-click on the taskbar icon to show me again.",
87 wxButton
*okButton
= new wxButton(this, wxID_OK
, "OK", wxPoint(100, 230), wxSize(80, 25));
88 wxButton
*exitButton
= new wxButton(this, wxID_EXIT
, "Exit", wxPoint(185, 230), wxSize(80, 25));
89 okButton
->SetDefault();
100 BEGIN_EVENT_TABLE(MyTaskBarIcon
, wxTaskBarIcon
)
101 EVT_MENU(PU_RESTORE
, MyTaskBarIcon::OnMenuRestore
)
102 EVT_MENU(PU_EXIT
, MyTaskBarIcon::OnMenuExit
)
105 void MyTaskBarIcon::OnMenuRestore(wxEvent
& )
110 void MyTaskBarIcon::OnMenuExit(wxEvent
& )
117 void MyTaskBarIcon::OnMouseMove(wxEvent
&)
121 void MyTaskBarIcon::OnLButtonDown(wxEvent
&)
125 void MyTaskBarIcon::OnLButtonUp(wxEvent
&)
129 void MyTaskBarIcon::OnRButtonDown(wxEvent
&)
133 void MyTaskBarIcon::OnRButtonUp(wxEvent
&)
137 menu
.Append(PU_RESTORE
, "&Restore TBTest");
138 menu
.Append(PU_EXIT
, "E&xit");
143 void MyTaskBarIcon::OnLButtonDClick(wxEvent
&)
148 void MyTaskBarIcon::OnRButtonDClick(wxEvent
&)