[WIN32K][CONSRV]
[reactos.git] / rosapps / applications / explorer-old / taskbar / taskbar.h
1 /*
2 * Copyright 2003, 2004, 2005 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 // taskbar.h
24 //
25 // Martin Fuchs, 16.08.2003
26 //
27
28
29 //#include "shellhook.h"
30
31
32 #define CLASSNAME_TASKBAR TEXT("MSTaskSwWClass")
33 #define TITLE_TASKBAR TEXT("Running Applications")
34
35 #define IDC_FIRST_APP 0x2000
36
37 //#define TASKBAR_AT_TOP
38
39 #define TASKBUTTONWIDTH_MIN 38
40 #define TASKBUTTONWIDTH_MAX 160
41
42
43 #define IDW_TASKTOOLBAR 100
44
45
46 #define PM_GET_LAST_ACTIVE (WM_APP+0x1D)
47
48
49 /// internal task bar button management entry
50 struct TaskBarEntry
51 {
52 TaskBarEntry();
53
54 int _id; // ID for WM_COMMAND
55 HBITMAP _hbmp;
56 int _bmp_idx;
57 int _used;
58 int _btn_idx;
59 String _title;
60 BYTE _fsState;
61 };
62
63 /// map for managing the task bar buttons, mapped by application window handle
64 struct TaskBarMap : public map<HWND, TaskBarEntry>
65 {
66 ~TaskBarMap();
67
68 iterator find_id(int id);
69 };
70
71
72 /// Taskbar window
73 struct TaskBar : public Window
74 {
75 typedef Window super;
76
77 TaskBar(HWND hwnd);
78 ~TaskBar();
79
80 static HWND Create(HWND hwndParent);
81
82 protected:
83 WindowHandle _htoolbar;
84 TaskBarMap _map;
85 int _next_id;
86 WindowHandle _last_foreground_wnd;
87 int _last_btn_width;
88 MINIMIZEDMETRICS _mmMetrics_org;
89
90 const UINT WM_SHELLHOOK;
91
92 LRESULT Init(LPCREATESTRUCT pcs);
93 LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
94 int Command(int id, int code);
95 int Notify(int id, NMHDR* pnmh);
96
97 void ActivateApp(TaskBarMap::iterator it, bool can_minimize=true, bool can_restore=true);
98 void ShowAppSystemMenu(TaskBarMap::iterator it);
99
100 static BOOL CALLBACK EnumWndProc(HWND hwnd, LPARAM lparam);
101
102 void Refresh();
103 void ResizeButtons();
104 };