2 * Copyright 2003 Martin Fuchs
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 // Explorer and Desktop clone
25 // Martin Fuchs, 22.08.2003
29 #define CLASSNAME_TRAYNOTIFY _T("TrayNotifyWnd")
30 #define TITLE_TRAYNOTIFY _T("")
32 #define CLASSNAME_CLOCKWINDOW _T("TrayClockWClass")
34 #define NOTIFYAREA_WIDTH 244
35 #define CLOCKWINDOW_WIDTH 32
38 struct NotifyIconIndex
40 NotifyIconIndex(NOTIFYICONDATA* pnid);
43 friend bool operator<(const NotifyIconIndex& a, const NotifyIconIndex& b)
44 {return a._hWnd<b._hWnd || (a._hWnd==b._hWnd && a._uID<b._uID);}
53 struct NotifyInfo : public NotifyIconIndex
58 friend bool operator<(const NotifyInfo& a, const NotifyInfo& b)
59 {return a._idx < b._idx;}
61 NotifyInfo& operator=(NOTIFYICONDATA* pnid);
63 int _idx; // display index
66 UINT _uCallbackMessage;
69 typedef map<NotifyIconIndex, NotifyInfo> NotifyIconMap;
70 typedef set<NotifyInfo> NotifyIconSet;
73 /// tray notification area aka "tray"
74 struct NotifyArea : public Window
78 NotifyArea(HWND hwnd);
81 static HWND Create(HWND hwndParent);
83 LRESULT ProcessTrayNotification(int notify_code, NOTIFYICONDATA* pnid);
86 NotifyIconMap _icon_map;
87 NotifyIconSet _sorted_icons;
90 WindowHandle _hwndClock;
92 LRESULT Init(LPCREATESTRUCT pcs);
93 LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
100 NotifyIconSet::iterator IconHitTest(const POINT& pos);
104 /// window for displaying the time in the tray notification area
105 struct ClockWindow : public Window
107 typedef Window super;
109 ClockWindow(HWND hwnd);
111 static HWND Create(HWND hwndParent);
116 LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
117 int Notify(int id, NMHDR* pnmh);