work around GCC's wide string constant bug to fix tree list image loading
[reactos.git] / reactos / subsys / system / explorer / shell / mainframe.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19
20 //
21 // Explorer clone
22 //
23 // mainframe.h
24 //
25 // Martin Fuchs, 23.07.2003
26 //
27
28
29 #define PM_OPEN_WINDOW (WM_APP+0x07)
30 enum OPEN_WINDOW_MODE {OWM_EXPLORE=1, OWM_DETAILS=2, OWM_PIDL=4, OWM_SEPARATE=8};
31
32
33 /// Explorer frame window base class
34 struct MainFrameBase : public PreTranslateWindow
35 {
36 typedef PreTranslateWindow super;
37
38 MainFrameBase(HWND hwnd);
39 ~MainFrameBase();
40
41 static HWND Create(LPCTSTR path, bool mdi=true, UINT cmdshow=SW_SHOWNORMAL);
42 static int OpenShellFolders(LPIDA pida, HWND hFrameWnd);
43
44 WindowHandle _hwndrebar;
45
46 WindowHandle _htoolbar;
47 WindowHandle _hstatusbar;
48
49 WindowHandle _haddressedit;
50 WindowHandle _hcommandedit;
51
52 WindowHandle _hsidebar;
53 HIMAGELIST _himl;
54
55 HMENU _hMenuFrame;
56 HMENU _hMenuWindow;
57
58 MenuInfo _menu_info;
59
60 protected:
61 FullScreenParameters _fullscreen;
62
63 HACCEL _hAccel;
64 HIMAGELIST _himl_old;
65
66 LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
67 bool ProcessMessage(UINT nmsg, WPARAM wparam, LPARAM lparam, LRESULT* pres);
68 int Command(int id, int code);
69 int Notify(int id, NMHDR* pnmh);
70
71 virtual BOOL TranslateMsg(MSG* pmsg);
72
73 void toggle_child(HWND hwnd, UINT cmd, HWND hchild, int band_idx=-1);
74
75 void resize_frame_client();
76 virtual void resize_frame(int cx, int cy);
77 virtual void frame_get_clientspace(PRECT prect);
78
79 BOOL toggle_fullscreen();
80 void fullscreen_move();
81
82 void FillBookmarks();
83 virtual bool go_to(LPCTSTR url, bool new_window);
84 };
85
86
87 #ifndef _NO_MDI
88
89 struct MDIMainFrame : public MainFrameBase
90 {
91 typedef MainFrameBase super;
92
93 MDIMainFrame(HWND hwnd);
94
95 static HWND Create();
96 static HWND Create(LPCTSTR path, int mode=OWM_EXPLORE|OWM_DETAILS);
97 static HWND Create(LPCITEMIDLIST pidl, int mode=OWM_EXPLORE|OWM_DETAILS|OWM_PIDL);
98
99 ChildWindow* CreateChild(LPCTSTR path=NULL, int mode=OWM_EXPLORE|OWM_DETAILS);
100 ChildWindow* CreateChild(LPCITEMIDLIST pidl, int mode=OWM_EXPLORE|OWM_DETAILS|OWM_PIDL);
101
102 protected:
103 HWND _hmdiclient;
104
105 WindowHandle _hextrabar;
106 WindowHandle _hdrivebar;
107
108 protected:
109 LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
110 int Command(int id, int code);
111
112 virtual BOOL TranslateMsg(MSG* pmsg);
113
114 bool activate_drive_window(LPCTSTR path);
115 bool activate_child_window(LPCTSTR filesys);
116
117 virtual void resize_frame(int cx, int cy);
118 virtual void frame_get_clientspace(PRECT prect);
119
120 virtual bool go_to(LPCTSTR url, bool new_window);
121
122 TCHAR _drives[BUFFER_LEN];
123 };
124
125 #endif
126
127
128 struct SDIMainFrame : public ExtContextMenuHandlerT<
129 ShellBrowserChildT<MainFrameBase>
130 >
131 {
132 typedef ExtContextMenuHandlerT<
133 ShellBrowserChildT<MainFrameBase>
134 > super;
135
136 SDIMainFrame(HWND hwnd);
137
138 static HWND Create();
139 static HWND Create(LPCTSTR path, int mode=OWM_EXPLORE|OWM_DETAILS);
140 static HWND Create(LPCITEMIDLIST pidl, int mode=OWM_EXPLORE|OWM_DETAILS|OWM_PIDL);
141
142 protected:
143 ShellPathInfo _shellpath_info;
144
145 WindowHandle _left_hwnd;
146 WindowHandle _right_hwnd;
147
148 /**@todo focus handling for TAB switching
149 int _focus_pane; // 0: left 1: right
150 */
151
152 int _split_pos;
153 int _last_split;
154 RECT _clnt_rect;
155
156 String _url;
157
158 LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
159 int Command(int id, int code);
160
161 void resize_frame(int cx, int cy);
162 void resize_children();
163 void update_clnt_rect();
164
165 void update_shell_browser();
166 void jump_to(LPCTSTR path, int mode);
167 void jump_to(LPCITEMIDLIST path, int mode);
168
169 // interface BrowserCallback
170 virtual void entry_selected(Entry* entry);
171
172 void set_url(LPCTSTR url);
173 };