now MSW stuff is complete
[wxWidgets.git] / samples / taskbar / tbtest.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: tbtest.cpp
3 // Purpose: wxTaskBarIcon demo
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c)
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15 #ifdef __BORLANDC__
16 #pragma hdrstop
17 #endif
18
19 #ifndef WX_PRECOMP
20 #include "wx.h"
21 #endif
22
23 #include "wx/msw/taskbar.h"
24 #include "tbtest.h"
25
26 // Declare two frames
27 MyDialog *dialog = NULL;
28
29 IMPLEMENT_APP(MyApp)
30
31 bool MyApp::OnInit(void)
32 {
33 wxIcon icon("mondrian_icon");
34
35 if (!m_taskBarIcon.SetIcon(icon, "wxTaskBarIcon Sample"))
36 wxMessageBox("Could not set icon.");
37
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);
40
41 dialog->Show(TRUE);
42
43 return TRUE;
44 }
45
46 BEGIN_EVENT_TABLE(MyDialog, wxDialog)
47 EVT_BUTTON(wxID_OK, MyDialog::OnOK)
48 EVT_BUTTON(wxID_EXIT, MyDialog::OnExit)
49 END_EVENT_TABLE()
50
51 MyDialog::MyDialog(wxWindow* parent, const wxWindowID id, const wxString& title,
52 const wxPoint& pos, const wxSize& size, const long windowStyle):
53 wxDialog(parent, id, title, pos, size, windowStyle)
54 {
55 Init();
56 }
57
58 void MyDialog::OnOK(wxCommandEvent& event)
59 {
60 Show(FALSE);
61 }
62
63 void MyDialog::OnExit(wxCommandEvent& event)
64 {
65 Close(TRUE);
66 }
67
68 void MyDialog::OnCloseWindow(wxCloseEvent& event)
69 {
70 Destroy();
71 }
72
73 void MyDialog::Init(void)
74 {
75 int dialogWidth = 365;
76 int dialogHeight = 290;
77
78 wxStaticText* stat = new wxStaticText(this, -1, "Press OK to hide me, Exit to quit.",
79 wxPoint(10, 20));
80
81 wxStaticText* stat2 = new wxStaticText(this, -1, "Double-click on the taskbar icon to show me again.",
82 wxPoint(10, 40));
83
84 wxButton *okButton = new wxButton(this, wxID_OK, "OK", wxPoint(100, 230), wxSize(80, 25));
85 wxButton *exitButton = new wxButton(this, wxID_EXIT, "Exit", wxPoint(185, 230), wxSize(80, 25));
86 okButton->SetDefault();
87 this->Centre(wxBOTH);
88 }
89
90 // Overridables
91 void MyTaskBarIcon::OnMouseMove(void)
92 {
93 }
94
95 void MyTaskBarIcon::OnLButtonDown(void)
96 {
97 }
98
99 void MyTaskBarIcon::OnLButtonUp(void)
100 {
101 }
102
103 void MyTaskBarIcon::OnRButtonDown(void)
104 {
105 }
106
107 void MyTaskBarIcon::OnRButtonUp(void)
108 {
109 }
110
111 void MyTaskBarIcon::OnLButtonDClick(void)
112 {
113 dialog->Show(TRUE);
114 }
115
116 void MyTaskBarIcon::OnRButtonDClick(void)
117 {
118 }
119
120