| 1 | ///////////////////////////////////////////////////////////////////////// |
| 2 | // File: taskbar.cpp |
| 3 | // Purpose: Implements wxTaskBarIcon class for manipulating icons on |
| 4 | // the task bar. |
| 5 | // Author: Julian Smart |
| 6 | // Modified by: Vaclav Slavik |
| 7 | // Created: 24/3/98 |
| 8 | // RCS-ID: $Id$ |
| 9 | // Copyright: (c) |
| 10 | // Licence: wxWindows licence |
| 11 | ///////////////////////////////////////////////////////////////////////// |
| 12 | |
| 13 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
| 14 | #pragma implementation "taskbar.h" |
| 15 | #endif |
| 16 | |
| 17 | // For compilers that support precompilation, includes "wx.h". |
| 18 | #include "wx/wxprec.h" |
| 19 | |
| 20 | #ifdef __BORLANDC__ |
| 21 | #pragma hdrstop |
| 22 | #endif |
| 23 | |
| 24 | #ifndef WX_PRECOMP |
| 25 | #include "wx/defs.h" |
| 26 | #include "wx/window.h" |
| 27 | #include "wx/frame.h" |
| 28 | #include "wx/utils.h" |
| 29 | #include "wx/menu.h" |
| 30 | #endif |
| 31 | |
| 32 | #if defined(__WIN95__) |
| 33 | |
| 34 | #include <string.h> |
| 35 | #include "wx/taskbar.h" |
| 36 | |
| 37 | #if WXWIN_COMPATIBILITY_2_4 |
| 38 | BEGIN_EVENT_TABLE(wxTaskBarIcon, wxTaskBarIconBase) |
| 39 | EVT_TASKBAR_MOVE (wxTaskBarIcon::_OnMouseMove) |
| 40 | EVT_TASKBAR_LEFT_DOWN (wxTaskBarIcon::_OnLButtonDown) |
| 41 | EVT_TASKBAR_LEFT_UP (wxTaskBarIcon::_OnLButtonUp) |
| 42 | EVT_TASKBAR_RIGHT_DOWN (wxTaskBarIcon::_OnRButtonDown) |
| 43 | EVT_TASKBAR_RIGHT_UP (wxTaskBarIcon::_OnRButtonUp) |
| 44 | EVT_TASKBAR_LEFT_DCLICK (wxTaskBarIcon::_OnLButtonDClick) |
| 45 | EVT_TASKBAR_RIGHT_DCLICK (wxTaskBarIcon::_OnRButtonDClick) |
| 46 | END_EVENT_TABLE() |
| 47 | #endif |
| 48 | |
| 49 | |
| 50 | IMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler) |
| 51 | |
| 52 | // ============================================================================ |
| 53 | // implementation |
| 54 | // ============================================================================ |
| 55 | |
| 56 | // ---------------------------------------------------------------------------- |
| 57 | // wxTaskBarIconWindow: helper window |
| 58 | // ---------------------------------------------------------------------------- |
| 59 | |
| 60 | // NB: this class serves two purposes: |
| 61 | // 1. win32 needs a HWND associated with taskbar icon, this provides it |
| 62 | // 2. we need wxTopLevelWindow so that the app doesn't exit when |
| 63 | // last frame is closed but there still is a taskbar icon |
| 64 | class wxTaskBarIconWindow : public wxFrame |
| 65 | { |
| 66 | public: |
| 67 | wxTaskBarIconWindow(wxTaskBarIcon *icon) |
| 68 | : wxFrame(NULL, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0), |
| 69 | m_icon(icon) |
| 70 | { |
| 71 | } |
| 72 | |
| 73 | WXLRESULT MSWWindowProc(WXUINT msg, |
| 74 | WXWPARAM wParam, WXLPARAM lParam) |
| 75 | { |
| 76 | return 0; |
| 77 | } |
| 78 | |
| 79 | private: |
| 80 | wxTaskBarIcon *m_icon; |
| 81 | }; |
| 82 | |
| 83 | // ---------------------------------------------------------------------------- |
| 84 | // wxTaskBarIcon |
| 85 | // ---------------------------------------------------------------------------- |
| 86 | |
| 87 | wxTaskBarIcon::wxTaskBarIcon() |
| 88 | { |
| 89 | } |
| 90 | |
| 91 | wxTaskBarIcon::~wxTaskBarIcon() |
| 92 | { |
| 93 | } |
| 94 | |
| 95 | // Operations |
| 96 | bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip) |
| 97 | { |
| 98 | return false; |
| 99 | } |
| 100 | |
| 101 | bool wxTaskBarIcon::RemoveIcon() |
| 102 | { |
| 103 | return false; |
| 104 | } |
| 105 | |
| 106 | bool wxTaskBarIcon::PopupMenu(wxMenu *menu) |
| 107 | { |
| 108 | return false; |
| 109 | } |
| 110 | |
| 111 | #if WXWIN_COMPATIBILITY_2_4 |
| 112 | // Overridables |
| 113 | void wxTaskBarIcon::OnMouseMove(wxEvent& e) { e.Skip(); } |
| 114 | void wxTaskBarIcon::OnLButtonDown(wxEvent& e) { e.Skip(); } |
| 115 | void wxTaskBarIcon::OnLButtonUp(wxEvent& e) { e.Skip(); } |
| 116 | void wxTaskBarIcon::OnRButtonDown(wxEvent& e) { e.Skip(); } |
| 117 | void wxTaskBarIcon::OnRButtonUp(wxEvent& e) { e.Skip(); } |
| 118 | void wxTaskBarIcon::OnLButtonDClick(wxEvent& e) { e.Skip(); } |
| 119 | void wxTaskBarIcon::OnRButtonDClick(wxEvent& e) { e.Skip(); } |
| 120 | |
| 121 | void wxTaskBarIcon::_OnMouseMove(wxTaskBarIconEvent& e) |
| 122 | { OnMouseMove(e); } |
| 123 | void wxTaskBarIcon::_OnLButtonDown(wxTaskBarIconEvent& e) |
| 124 | { OnLButtonDown(e); } |
| 125 | void wxTaskBarIcon::_OnLButtonUp(wxTaskBarIconEvent& e) |
| 126 | { OnLButtonUp(e); } |
| 127 | void wxTaskBarIcon::_OnRButtonDown(wxTaskBarIconEvent& e) |
| 128 | { OnRButtonDown(e); } |
| 129 | void wxTaskBarIcon::_OnRButtonUp(wxTaskBarIconEvent& e) |
| 130 | { OnRButtonUp(e); } |
| 131 | void wxTaskBarIcon::_OnLButtonDClick(wxTaskBarIconEvent& e) |
| 132 | { OnLButtonDClick(e); } |
| 133 | void wxTaskBarIcon::_OnRButtonDClick(wxTaskBarIconEvent& e) |
| 134 | { OnRButtonDClick(e); } |
| 135 | #endif |
| 136 | |
| 137 | void wxTaskBarIcon::RegisterWindowMessages() |
| 138 | { |
| 139 | } |
| 140 | |
| 141 | // ---------------------------------------------------------------------------- |
| 142 | // wxTaskBarIcon window proc |
| 143 | // ---------------------------------------------------------------------------- |
| 144 | |
| 145 | long wxTaskBarIcon::WindowProc(unsigned int msg, |
| 146 | unsigned int WXUNUSED(wParam), |
| 147 | long lParam) |
| 148 | { |
| 149 | return 0; |
| 150 | } |
| 151 | |
| 152 | #endif // __WIN95__ |
| 153 | |