ReactOS  0.4.13-dev-242-g611e6d7
traynotify.h
Go to the documentation of this file.
1 /*
2  * Copyright 2003, 2004 Martin Fuchs
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 
20  //
21  // Explorer and Desktop clone
22  //
23  // traynotify.h
24  //
25  // Martin Fuchs, 22.08.2003
26  //
27 
28 
29 #define CLASSNAME_TRAYNOTIFY TEXT("TrayNotifyWnd")
30 #define TITLE_TRAYNOTIFY TEXT("")
31 
32 #define CLASSNAME_CLOCKWINDOW TEXT("TrayClockWClass")
33 
34 #define NOTIFYAREA_WIDTH_DEF 100
35 #define NOTIFYICON_DIST 20
36 #define NOTIFYAREA_SPACE 10
37 #define NOTIFYICON_SIZE 16
38 #define NOTIFYICON_X 2
39 #define NOTIFYICON_Y 3
40 
41 #define ICON_AUTOHIDE_SECONDS 300
42 
43 #define PM_GETMODULEPATH_CB (WM_APP+0x21)
44 #define PM_GET_NOTIFYAREA (WM_APP+0x22)
45 
46 
49 {
51 
52  // sort operator
53  friend bool operator<(const NotifyIconIndex& a, const NotifyIconIndex& b)
54  {return a._hWnd<b._hWnd || (a._hWnd==b._hWnd && a._uID<b._uID);}
55 
58 
59 protected:
61 };
62 
63 
66 };
67 
69 
72 {
74 
75  void create_name();
76  bool match(const NotifyIconConfig& props) const;
77 
78  // properties used to identify a notification icon
80  String _windowTitle; // To look at the window title and at the window module path of the notify icon owner window
81  String _modulePath; // to identify notification icons is an extension above XP's behaviour.
82  // (XP seems to store icon image data in the registry instead.)
84 
86 };
87 
90 
91 
94 {
95  NotifyInfo();
96 
97  // sort operator
98  friend bool operator<(const NotifyInfo& a, const NotifyInfo& b)
99  {return a._idx < b._idx;}
100 
101  bool modify(NOTIFYICONDATA* pnid);
102 
103  int _idx; // display index
108 
109  DWORD _lastChange; // timer tick value of the last change
110 };
111 
114 
115 
117 {
118  NotifyHook();
119  ~NotifyHook();
120 
121  void GetModulePath(HWND hwnd, HWND hwndCallback);
123 
124 protected:
126 };
127 
128 
130 struct NotifyArea : public Window
131 {
132  typedef Window super;
133 
135  ~NotifyArea();
136 
137  static HWND Create(HWND hwndParent);
138 
139  LRESULT ProcessTrayNotification(int notify_code, NOTIFYICONDATA* pnid);
140 
141 protected:
142  WindowHandle _hwndClock;
144 
147 
151 
154  int Command(int id, int code);
155  int Notify(int id, NMHDR* pnmh);
156 
157  void UpdateIcons();
158  void Paint();
159  void Refresh(bool do_refresh=false);
160  void CancelModes();
161 
164 
165  void read_config();
166  void write_config();
167 
168  friend struct TrayNotifyDlg;
169 
171 
173 
178 
179  void show_clock(bool flag);
180 };
181 
182 
184 {
186 
190 
192 };
193 
195 
196 
198 struct TrayNotifyDlg : public ResizeController<Dialog>
199 {
201 
203  ~TrayNotifyDlg();
204 
205 protected:
207  HACCEL _haccel;
211 
214 
218 
224 
225  virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
226  virtual int Command(int id, int code);
227  virtual int Notify(int id, NMHDR* pnmh);
228 
229  void Refresh();
230  void InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyInfo&, HDC);
234 };
235 
236 
238 struct ClockWindow : public Window
239 {
240  typedef Window super;
241 
243 
244  static HWND Create(HWND hwndParent);
245 
246  void TimerTick();
247 
248 protected:
250  int Notify(int id, NMHDR* pnmh);
251 
252  bool FormatTime();
253  void Paint();
254 
257 };
DWORD _dwState
Definition: traynotify.h:105
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT ProcessTrayNotification(int notify_code, NOTIFYICONDATA *pnid)
Definition: traynotify.cpp:580
map< NotifyIconIndex, NotifyInfo > NotifyIconMap
Definition: traynotify.h:112
static HICON
Definition: imagelist.c:84
HTREEITEM _hitemCurrent_visible
Definition: traynotify.h:220
bool match(const NotifyIconConfig &props) const
Definition: traynotify.cpp:820
list< NotifyIconConfig > NotifyIconCfgList
list of NotifyIconConfig structures
Definition: traynotify.h:89
virtual int Command(int id, int code)
ToolTip _tooltip
Definition: traynotify.h:145
HICON _hIcon
Definition: traynotify.h:104
NOTIFYICONMODE _mode
Definition: traynotify.h:83
int _clock_width
Definition: traynotify.h:143
bool _show_button
Definition: traynotify.h:150
void UpdateIcons()
Definition: traynotify.cpp:646
WindowHandle _hwndClock
Definition: traynotify.h:142
TCHAR _time[16]
Definition: traynotify.h:255
HIMAGELIST _himl
Definition: traynotify.h:208
void GetModulePath(HWND hwnd, HWND hwndCallback)
Definition: traynotify.cpp:45
static HDC
Definition: imagelist.c:92
const UINT WM_GETMODULEPATH
Definition: traynotify.h:125
HACCEL _haccel
Definition: traynotify.h:207
NotifyArea(HWND hwnd)
Definition: traynotify.cpp:204
NotifyIconMap _icon_map
Definition: traynotify.h:174
static WCHAR String[]
Definition: stringtable.c:55
UINT_PTR WPARAM
Definition: windef.h:207
set< NotifyInfo > NotifyIconSet
Definition: traynotify.h:113
Window super
Definition: traynotify.h:132
void TimerTick()
NotifyIconDlgInfoMap _info
Definition: traynotify.h:210
int Notify(int id, NMHDR *pnmh)
NotifyIconCfgList _cfg
Definition: traynotify.h:170
void read_config()
Definition: traynotify.cpp:243
ToolTip _tooltip
Definition: traynotify.h:256
static HWND Create(HWND hwndParent)
map< NotifyIconIndex, IconStatePair > IconStateMap
Definition: traynotify.h:213
void show_clock(bool flag)
Definition: traynotify.cpp:332
bool _show_hidden
Definition: traynotify.h:148
NotifyIconSet::iterator IconHitTest(const POINT &pos)
search for a icon at a given client coordinate position
Definition: traynotify.cpp:789
UINT _version
Definition: traynotify.h:107
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: traynotify.cpp:378
Definition: window.c:29
NotifyIconDlgInfo(const NotifyIconConfig &cfg)
Definition: traynotify.h:188
void SetIconMode(NOTIFYICONMODE mode)
NotifyIconIndex is used for maintaining the order of notification icons.
Definition: traynotify.h:48
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
HTREEITEM _hitemCurrent
Definition: traynotify.h:219
size_t _last_icon_count
Definition: traynotify.h:177
DWORD _lastChange
Definition: traynotify.h:109
NotifyIconSet _sorted_icons
Definition: traynotify.h:175
int _next_idx
Definition: traynotify.h:176
void InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyInfo &, HDC)
NOTIFYICONMODE
Definition: traynotify.h:64
void CancelModes()
Definition: traynotify.cpp:572
configuration for the display mode of a notification icon
Definition: traynotify.h:71
static HWND hwndParent
Definition: cryptui.c:300
map< HWND, String > _window_modules
Definition: traynotify.h:172
LONG_PTR LPARAM
Definition: windef.h:208
window for displaying the time in the tray notification area
Definition: traynotify.h:238
friend bool operator<(const NotifyInfo &a, const NotifyInfo &b)
Definition: traynotify.h:98
pair< NOTIFYICONMODE, DWORD > IconStatePair
Definition: traynotify.h:212
HTREEITEM _hitemCurrent_hidden
Definition: traynotify.h:221
virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
char TCHAR
Definition: xmlstorage.h:189
ClockWindow(HWND hwnd)
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Controller base template class for resizable dialogs.
Definition: window.h:515
_Rep_type::iterator iterator
Definition: _set.h:73
void write_config()
Definition: traynotify.cpp:294
LRESULT Init(LPCREATESTRUCT pcs)
Definition: traynotify.cpp:355
unsigned long DWORD
Definition: ntddk_ex.h:95
tray notification area aka "tray"
Definition: traynotify.h:130
structure for maintaining informations about one notification icon
Definition: traynotify.h:93
String _windowTitle
Definition: traynotify.h:80
HTREEITEM _selectedItem
Definition: traynotify.h:223
bool FormatTime()
virtual int Notify(int id, NMHDR *pnmh)
String string_from_mode(NOTIFYICONMODE mode)
Definition: traynotify.cpp:863
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
uint32_t entry
Definition: isohybrid.c:63
TrayNotifyDlg(HWND hwnd)
Definition: traynotify.cpp:878
NotifyArea * _pNotifyArea
Definition: traynotify.h:209
__inline int after(__u32 seq1, __u32 seq2)
Definition: tcpcore.h:2419
bool modify(NOTIFYICONDATA *pnid)
Definition: traynotify.cpp:104
GLenum mode
Definition: glext.h:6217
bool DetermineHideState(NotifyInfo &entry)
Definition: traynotify.cpp:837
ResizeController< Dialog > super
Definition: traynotify.h:200
int Notify(int id, NMHDR *pnmh)
Definition: traynotify.cpp:539
IconStateMap _icon_states_org
Definition: traynotify.h:216
bool _hide_inactive
Definition: traynotify.h:149
static HWND Create(HWND hwndParent)
Definition: traynotify.cpp:367
void Paint()
Definition: traynotify.cpp:697
NotifyIconDlgInfo(const NotifyInfo &info)
Definition: traynotify.h:187
Definition: services.c:325
Definition: _pair.h:47
unsigned int UINT
Definition: ndis.h:50
bool _show_hidden_org
Definition: traynotify.h:217
String _modulePath
Definition: traynotify.h:81
static const WCHAR props[]
Definition: wbemdisp.c:288
int Command(int id, int code)
Definition: traynotify.cpp:511
map< int, NotifyIconDlgInfo > NotifyIconDlgInfoMap
Definition: traynotify.h:194
NotifyHook _hook
Definition: traynotify.h:146
void RefreshProperties(const NotifyIconDlgInfo &entry)
bool ModulePathCopyData(LPARAM lparam, HWND *phwnd, String &path)
Definition: traynotify.cpp:50
HTREEITEM _hitemConfig
Definition: traynotify.h:222
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
LONG_PTR LRESULT
Definition: windef.h:209
void Refresh(bool do_refresh=false)
Definition: traynotify.cpp:737
encapsulation of tool tip controls
Definition: window.h:850
Window super
Definition: traynotify.h:240
friend bool operator<(const NotifyIconIndex &a, const NotifyIconIndex &b)
Definition: traynotify.h:53
configuration dialog for notification icons
Definition: traynotify.h:198
NotifyIconCfgList _cfg_org
Definition: traynotify.h:215
static UINT WPARAM wparam
Definition: combo.c:716
NotifyIconConfig super
Definition: traynotify.h:185
UINT _uCallbackMessage
Definition: traynotify.h:106