]> git.saurik.com Git - wxWidgets.git/blob - include/wx/taskbar.h
added stock buttons support
[wxWidgets.git] / include / wx / taskbar.h
1 #ifndef _WX_TASKBAR_H_BASE_
2 #define _WX_TASKBAR_H_BASE_
3
4 #include "wx/defs.h"
5
6 #ifdef wxHAS_TASK_BAR_ICON
7
8 #include "wx/event.h"
9
10 class WXDLLIMPEXP_ADV wxTaskBarIconEvent;
11
12 // ----------------------------------------------------------------------------
13 // wxTaskBarIconBase: define wxTaskBarIcon interface
14 // ----------------------------------------------------------------------------
15
16 class WXDLLIMPEXP_ADV wxTaskBarIconBase : public wxEvtHandler
17 {
18 public:
19 wxTaskBarIconBase() { }
20
21 // Operations:
22 virtual bool SetIcon(const wxIcon& icon,
23 const wxString& tooltip = wxEmptyString) = 0;
24 virtual bool RemoveIcon() = 0;
25 virtual bool PopupMenu(wxMenu *menu) = 0;
26
27 protected:
28 // creates menu to be displayed when user clicks on the icon
29 virtual wxMenu *CreatePopupMenu() { return NULL; }
30
31 private:
32 // default events handling, calls CreatePopupMenu:
33 void OnRightButtonDown(wxTaskBarIconEvent& event);
34
35 DECLARE_EVENT_TABLE()
36 DECLARE_NO_COPY_CLASS(wxTaskBarIconBase)
37 };
38
39
40 // ----------------------------------------------------------------------------
41 // now include the actual class declaration
42 // ----------------------------------------------------------------------------
43
44 #if defined(__WXMSW__)
45 #include "wx/msw/taskbar.h"
46 #elif defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__)
47 #include "wx/unix/taskbarx11.h"
48 #elif defined(__DARWIN__)
49 #include "wx/mac/taskbarosx.h"
50 #endif
51
52 // ----------------------------------------------------------------------------
53 // wxTaskBarIcon events
54 // ----------------------------------------------------------------------------
55
56 class WXDLLIMPEXP_ADV wxTaskBarIconEvent : public wxEvent
57 {
58 public:
59 wxTaskBarIconEvent(wxEventType evtType, wxTaskBarIcon *tbIcon)
60 : wxEvent(-1, evtType)
61 {
62 SetEventObject(tbIcon);
63 }
64
65 virtual wxEvent *Clone() const { return new wxTaskBarIconEvent(*this); }
66
67 private:
68 DECLARE_NO_ASSIGN_CLASS(wxTaskBarIconEvent)
69 };
70
71 typedef void (wxEvtHandler::*wxTaskBarIconEventFunction)(wxTaskBarIconEvent&);
72
73 BEGIN_DECLARE_EVENT_TYPES()
74 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_MOVE,1550)
75 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_LEFT_DOWN,1551)
76 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_LEFT_UP,1552)
77 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_RIGHT_DOWN,1553)
78 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_RIGHT_UP,1554)
79 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_LEFT_DCLICK,1555)
80 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_RIGHT_DCLICK,1556)
81 END_DECLARE_EVENT_TYPES()
82
83 #define EVT_TASKBAR_MOVE(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_MOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTaskBarIconEventFunction, &fn ), NULL),
84 #define EVT_TASKBAR_LEFT_DOWN(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTaskBarIconEventFunction, &fn ), NULL),
85 #define EVT_TASKBAR_LEFT_UP(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTaskBarIconEventFunction, &fn ), NULL),
86 #define EVT_TASKBAR_RIGHT_DOWN(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTaskBarIconEventFunction, &fn ), NULL),
87 #define EVT_TASKBAR_RIGHT_UP(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTaskBarIconEventFunction, &fn ), NULL),
88 #define EVT_TASKBAR_LEFT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTaskBarIconEventFunction, &fn ), NULL),
89 #define EVT_TASKBAR_RIGHT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTaskBarIconEventFunction, &fn ), NULL),
90
91 #endif
92 // wxHAS_TASK_BAR_ICON
93
94 #endif
95 // _WX_TASKBAR_H_BASE_