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