ReactOS 0.4.15-dev-7674-gc0b4db1
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
59protected:
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
124protected:
126};
127
128
130struct 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
141protected:
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
198struct TrayNotifyDlg : public ResizeController<Dialog>
199{
201
204
205protected:
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
238struct ClockWindow : public Window
239{
240 typedef Window super;
241
243
244 static HWND Create(HWND hwndParent);
245
246 void TimerTick();
247
248protected:
250 int Notify(int id, NMHDR* pnmh);
251
252 bool FormatTime();
253 void Paint();
254
257};
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
@ Create
Definition: registry.c:563
Definition: list.h:37
Definition: _map.h:48
Definition: _set.h:50
_Rep_type::iterator iterator
Definition: _set.h:73
static HWND hwndParent
Definition: cryptui.c:300
unsigned long DWORD
Definition: ntddk_ex.h:95
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum mode
Definition: glext.h:6217
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
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
void Refresh(void)
Definition: magnifier.c:317
static HDC
Definition: imagelist.c:92
static HICON
Definition: imagelist.c:84
unsigned int UINT
Definition: ndis.h:50
window for displaying the time in the tray notification area
Definition: traynotify.h:239
TCHAR _time[16]
Definition: traynotify.h:255
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
void TimerTick()
bool FormatTime()
int Notify(int id, NMHDR *pnmh)
Window super
Definition: traynotify.h:240
ToolTip _tooltip
Definition: traynotify.h:256
Definition: shell.h:41
tray notification area aka "tray"
Definition: traynotify.h:131
int _next_idx
Definition: traynotify.h:176
bool DetermineHideState(NotifyInfo &entry)
Definition: traynotify.cpp:837
void show_clock(bool flag)
Definition: traynotify.cpp:332
bool _show_button
Definition: traynotify.h:150
size_t _last_icon_count
Definition: traynotify.h:177
void CancelModes()
Definition: traynotify.cpp:572
Window super
Definition: traynotify.h:132
NotifyIconSet::iterator IconHitTest(const POINT &pos)
search for a icon at a given client coordinate position
Definition: traynotify.cpp:789
NotifyHook _hook
Definition: traynotify.h:146
NotifyIconMap _icon_map
Definition: traynotify.h:174
ToolTip _tooltip
Definition: traynotify.h:145
LRESULT ProcessTrayNotification(int notify_code, NOTIFYICONDATA *pnid)
Definition: traynotify.cpp:580
bool _hide_inactive
Definition: traynotify.h:149
int Notify(int id, NMHDR *pnmh)
Definition: traynotify.cpp:539
void UpdateIcons()
Definition: traynotify.cpp:646
void write_config()
Definition: traynotify.cpp:294
bool _show_hidden
Definition: traynotify.h:148
void read_config()
Definition: traynotify.cpp:243
int _clock_width
Definition: traynotify.h:143
NotifyIconSet _sorted_icons
Definition: traynotify.h:175
NotifyIconCfgList _cfg
Definition: traynotify.h:170
void Paint()
Definition: traynotify.cpp:697
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: traynotify.cpp:378
map< HWND, String > _window_modules
Definition: traynotify.h:172
WindowHandle _hwndClock
Definition: traynotify.h:142
bool ModulePathCopyData(LPARAM lparam, HWND *phwnd, String &path)
Definition: traynotify.cpp:50
const UINT WM_GETMODULEPATH
Definition: traynotify.h:125
void GetModulePath(HWND hwnd, HWND hwndCallback)
Definition: traynotify.cpp:45
configuration for the display mode of a notification icon
Definition: traynotify.h:72
String _windowTitle
Definition: traynotify.h:80
String _modulePath
Definition: traynotify.h:81
NOTIFYICONMODE _mode
Definition: traynotify.h:83
NotifyIconConfig super
Definition: traynotify.h:185
NotifyIconDlgInfo(const NotifyIconConfig &cfg)
Definition: traynotify.h:188
NotifyIconDlgInfo(const NotifyInfo &info)
Definition: traynotify.h:187
NotifyIconIndex is used for maintaining the order of notification icons.
Definition: traynotify.h:49
friend bool operator<(const NotifyIconIndex &a, const NotifyIconIndex &b)
Definition: traynotify.h:53
structure for maintaining informations about one notification icon
Definition: traynotify.h:94
UINT _uCallbackMessage
Definition: traynotify.h:106
DWORD _dwState
Definition: traynotify.h:105
UINT _version
Definition: traynotify.h:107
bool modify(NOTIFYICONDATA *pnid)
Definition: traynotify.cpp:104
DWORD _lastChange
Definition: traynotify.h:109
HICON _hIcon
Definition: traynotify.h:104
friend bool operator<(const NotifyInfo &a, const NotifyInfo &b)
Definition: traynotify.h:98
Controller base template class for resizable dialogs.
Definition: window.h:516
encapsulation of tool tip controls
Definition: window.h:851
configuration dialog for notification icons
Definition: traynotify.h:199
void SetIconMode(NOTIFYICONMODE mode)
virtual int Notify(int id, NMHDR *pnmh)
NotifyIconDlgInfoMap _info
Definition: traynotify.h:210
HTREEITEM _hitemCurrent_hidden
Definition: traynotify.h:221
void RefreshProperties(const NotifyIconDlgInfo &entry)
HTREEITEM _selectedItem
Definition: traynotify.h:223
HTREEITEM _hitemCurrent_visible
Definition: traynotify.h:220
bool _show_hidden_org
Definition: traynotify.h:217
HTREEITEM _hitemConfig
Definition: traynotify.h:222
HIMAGELIST _himl
Definition: traynotify.h:208
HTREEITEM _hitemCurrent
Definition: traynotify.h:219
IconStateMap _icon_states_org
Definition: traynotify.h:216
NotifyIconCfgList _cfg_org
Definition: traynotify.h:215
pair< NOTIFYICONMODE, DWORD > IconStatePair
Definition: traynotify.h:212
virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
NotifyArea * _pNotifyArea
Definition: traynotify.h:209
ResizeController< Dialog > super
Definition: traynotify.h:200
map< NotifyIconIndex, IconStatePair > IconStateMap
Definition: traynotify.h:213
HACCEL _haccel
Definition: traynotify.h:207
void InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyInfo &, HDC)
Definition: window.c:28
Definition: inflate.c:139
Definition: match.c:28
Definition: _pair.h:47
__inline int after(__u32 seq1, __u32 seq2)
Definition: tcpcore.h:2395
String string_from_mode(NOTIFYICONMODE mode)
Definition: traynotify.cpp:863
NOTIFYICONMODE
Definition: traynotify.h:64
@ NIM_SHOW
Definition: traynotify.h:65
@ NIM_HIDE
Definition: traynotify.h:65
@ NIM_AUTO
Definition: traynotify.h:65
map< NotifyIconIndex, NotifyInfo > NotifyIconMap
Definition: traynotify.h:112
map< int, NotifyIconDlgInfo > NotifyIconDlgInfoMap
Definition: traynotify.h:194
set< NotifyInfo > NotifyIconSet
Definition: traynotify.h:113
list< NotifyIconConfig > NotifyIconCfgList
list of NotifyIconConfig structures
Definition: traynotify.h:89
static const WCHAR props[]
Definition: wbemdisp.c:288
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
char TCHAR
Definition: xmlstorage.h:189