ReactOS  0.4.12-dev-75-g00dd17e
FileChildWindow Struct Reference

MDI child window displaying file lists. More...

#include <filechild.h>

Inheritance diagram for FileChildWindow:
Collaboration diagram for FileChildWindow:

Public Types

typedef ExtContextMenuHandlerT< ChildWindowsuper
 
- Public Types inherited from ExtContextMenuHandlerT< ChildWindow >
typedef ChildWindow super
 
- Public Types inherited from ChildWindow
typedef PreTranslateWindow super
 
- Public Types inherited from PreTranslateWindow
typedef Window super
 
- Public Types inherited from Window
typedef map< HWND, Window * > WindowMap
 
typedef Window *(* CREATORFUNC) (HWND)
 
typedef Window *(* CREATORFUNC_INFO) (HWND, const void *)
 

Public Member Functions

 FileChildWindow (HWND hwnd, const FileChildWndInfo &info)
 
const Rootget_root () const
 
void set_focus_pane (Pane *pane)
 
void switch_focus_pane ()
 
- Public Member Functions inherited from ExtContextMenuHandlerT< ChildWindow >
 ExtContextMenuHandlerT (HWND hwnd)
 
 ExtContextMenuHandlerT (HWND hwnd, const PARA &info)
 
LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
 
- Public Member Functions inherited from ChildWindow
 ChildWindow (HWND hwnd, const ChildWndInfo &info)
 
bool go_to (LPCTSTR url)
 
- Public Member Functions inherited from PreTranslateWindow
 PreTranslateWindow (HWND)
 
 ~PreTranslateWindow ()
 
- Public Member Functions inherited from Window
 Window (HWND hwnd)
 
virtual ~Window ()
 
LRESULT SendParent (UINT nmsg, WPARAM wparam=0, LPARAM lparam=0)
 
LRESULT PostParent (UINT nmsg, WPARAM wparam=0, LPARAM lparam=0)
 

Static Public Member Functions

static FileChildWindowcreate (const FileChildWndInfo &info)
 
- Static Public Member Functions inherited from ChildWindow
static ChildWindowcreate (const ChildWndInfo &info, const RECT &rect, CREATORFUNC_INFO creator, LPCTSTR classname, LPCTSTR title=NULL, DWORD style=0)
 
- Static Public Member Functions inherited from Window
static HWND Create (CREATORFUNC creator, DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int w, int h, HWND hwndParent=0, HMENU hMenu=0)
 
static HWND Create (CREATORFUNC_INFO creator, const void *info, DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int w, int h, HWND hwndParent=0, HMENU hMenu=0)
 
static Windowcreate_mdi_child (const ChildWndInfo &info, const MDICREATESTRUCT &mcs, CREATORFUNC_INFO creator)
 
static LRESULT CALLBACK WindowWndProc (HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR CALLBACK DialogProc (HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 
static Windowget_window (HWND hwnd)
 get window controller from window handle More...
 
template<typename CLASS >
static CLASS * get_window (HWND hwnd)
 
static void register_pretranslate (HWND hwnd)
 
static void unregister_pretranslate (HWND hwnd)
 
static BOOL pretranslate_msg (LPMSG pmsg)
 
static void register_dialog (HWND hwnd)
 
static void unregister_dialog (HWND hwnd)
 
static BOOL dispatch_dialog_msg (LPMSG pmsg)
 
static int MessageLoop ()
 
static void CancelModes ()
 

Protected Member Functions

LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
 
int Command (int id, int code)
 
int Notify (int id, NMHDR *pnmh)
 
virtual void resize_children (int cx, int cy)
 
virtual String jump_to_int (LPCTSTR url)
 
void scan_entry (Entry *entry)
 
bool expand_entry (Entry *dir)
 
void set_curdir (Entry *entry)
 
void activate_entry (Pane *pane)
 
void refresh ()
 
- Protected Member Functions inherited from ChildWindow
void set_url (LPCTSTR url)
 
- Protected Member Functions inherited from Window
virtual LRESULT Init (LPCREATESTRUCT pcs)
 

Static Protected Member Functions

static void collapse_entry (Pane *pane, Entry *dir)
 
- Static Protected Member Functions inherited from Window
static Windowcreate_controller (HWND hwnd)
 create controller for a new window More...
 
static StaticWindowDataGetStaticWindowData ()
 
static LRESULT CALLBACK MDICBTHookProc (int code, WPARAM wparam, LPARAM lparam)
 
static LRESULT CALLBACK PropSheetCBTHookProc (int code, WPARAM wparam, LPARAM lparam)
 

Protected Attributes

Root _root
 
Pane_left
 
Pane_right
 
TCHAR _path [MAX_PATH]
 
bool _header_wdths_ok
 
- Protected Attributes inherited from ExtContextMenuHandlerT< ChildWindow >
CtxMenuInterfaces _cm_ifs
 
- Protected Attributes inherited from ChildWindow
MenuInfo_menu_info
 
WindowHandle _left_hwnd
 
WindowHandle _right_hwnd
 
int _focus_pane
 
int _split_pos
 
int _last_split
 
HWND _hwndFrame
 
String _statusText
 
String _url
 
stack< String_url_history
 

Additional Inherited Members

- Public Attributes inherited from Window
IAccessible IAccessible_iface
 
IOleWindow IOleWindow_iface
 
IEnumVARIANT IEnumVARIANT_iface
 
LONG ref
 
- Static Protected Attributes inherited from Window
static WindowMap s_wnd_map
 
static const voids_new_info = NULL
 
static CREATORFUNC s_window_creator = NULL
 
static HHOOK s_hcbtHook = 0
 
static WindowSet s_pretranslate_windows
 
static WindowSet s_dialogs
 

Detailed Description

MDI child window displaying file lists.

Definition at line 88 of file filechild.h.

Member Typedef Documentation

◆ super

Constructor & Destructor Documentation

◆ FileChildWindow()

FileChildWindow::FileChildWindow ( HWND  hwnd,
const FileChildWndInfo info 
)
Todo:
use OWM_ROOTED flag
Todo:
Is not-explore-mode for FileChildWindow completely implemented?

Definition at line 124 of file filechild.cpp.

125  : super(hwnd, info)
126 {
127  CONTEXT("FileChildWindow::FileChildWindow()");
128 
129  TCHAR drv[_MAX_DRIVE+1];
130  Entry* entry = NULL;
131 
132  _left = NULL;
133  _right = NULL;
134 
135  switch(info._etype) {
136 #ifdef __WINE__
137  case ET_UNIX:
138  _root._drive_type = GetDriveType(info._path);
139  _root._sort_order = SORT_NAME;
140 
141  _tsplitpath(info._path, drv, NULL, NULL, NULL);
142  lstrcat(drv, TEXT("/"));
143  lstrcpy(_root._volname, TEXT("root fs"));
144  _root._fs_flags = 0;
145  lstrcpy(_root._fs, TEXT("unixfs"));
146  lstrcpy(_root._path, TEXT("/"));
147  _root._entry = new UnixDirectory(_root._path);
148  entry = _root.read_tree(info._path+_tcslen(_root._path));
149  break;
150 #endif
151 
152  case ET_NTOBJS:
153  _root._drive_type = DRIVE_UNKNOWN;
154  _root._sort_order = SORT_NAME;
155 
156  _tsplitpath_s(info._path, drv, COUNTOF(drv), NULL, 0, NULL, 0, NULL, 0);
157  lstrcat(drv, TEXT("\\"));
158  lstrcpy(_root._volname, TEXT("NT Object Namespace"));
159  lstrcpy(_root._fs, TEXT("NTOBJ"));
160  lstrcpy(_root._path, drv);
161  _root._entry = new NtObjDirectory(_root._path);
162  entry = _root.read_tree(info._path+_tcslen(_root._path));
163  break;
164 
165  case ET_REGISTRY:
166  _root._drive_type = DRIVE_UNKNOWN;
167  _root._sort_order = SORT_NONE;
168 
169  _tsplitpath_s(info._path, drv, COUNTOF(drv), NULL, 0, NULL, 0, NULL, 0);
170  lstrcat(drv, TEXT("\\"));
171  lstrcpy(_root._volname, TEXT("Registry"));
172  lstrcpy(_root._fs, TEXT("Registry"));
173  lstrcpy(_root._path, drv);
174  _root._entry = new RegistryRoot();
175  entry = _root.read_tree(info._path+_tcslen(_root._path));
176  break;
177 #ifdef _DEBUG
178  case ET_FAT: {
179  _root._drive_type = DRIVE_UNKNOWN;
180  _root._sort_order = SORT_NONE;
181 
182  _tsplitpath_s(info._path, drv, COUNTOF(drv), NULL, 0, NULL, 0, NULL, 0);
183  lstrcat(drv, TEXT("\\"));
184  lstrcpy(_root._volname, TEXT("FAT XXX")); //@@
185  lstrcpy(_root._fs, TEXT("FAT"));
186  lstrcpy(_root._path, drv);
187  FATDrive* drive = new FATDrive(TEXT("c:/reactos-emu/c.img")); //TEXT("\\\\.\\F:")); //@@
188 
189  if (drive->_hDrive != INVALID_HANDLE_VALUE) {
190  _root._entry = drive;
191  entry = _root.read_tree(info._path+_tcslen(_root._path));
192  }
193  break;}
194 #endif
195 #ifndef _NO_WIN_FS
196  default: // ET_WINDOWS
197  _root._drive_type = GetDriveType(info._path);
198  _root._sort_order = SORT_NAME;
199 
200  _tsplitpath_s(info._path, drv, COUNTOF(drv), NULL, 0, NULL, 0, NULL, 0);
201  lstrcat(drv, TEXT("\\"));
202  GetVolumeInformation(drv, _root._volname, _MAX_FNAME, 0, 0, &_root._fs_flags, _root._fs, COUNTOF(_root._fs));
203  lstrcpy(_root._path, drv);
204  _root._entry = new WinDirectory(_root._path);
205  entry = _root.read_tree(info._path+_tcslen(_root._path));
206  break;
207 #else
208  default:
209 #endif
210 
211  case ET_SHELL: { //@@ separate FileChildWindow into ShellChildWindow, WinChildWindow, UnixChildWindow ?
212  _root._drive_type = DRIVE_UNKNOWN;
213  _root._sort_order = SORT_NAME;
214 
215  lstrcpy(drv, TEXT("\\"));
216  lstrcpy(_root._volname, TEXT("Desktop"));
217  _root._fs_flags = 0;
218  lstrcpy(_root._fs, TEXT("Shell"));
219 
220  _root._entry = new ShellDirectory(GetDesktopFolder(), DesktopFolderPath(), hwnd);
221  const ShellChildWndInfo& shell_info = static_cast<const ShellChildWndInfo&>(info);
222  entry = _root.read_tree(&*shell_info._shell_path);
223  break;}
224  }
225 
226  if (_root._entry) {
227  if (info._etype != ET_SHELL)
228  wsprintf(_root._entry->_data.cFileName, TEXT("%s - %s"), drv, _root._fs);
229  /*@@else
230  lstrcpy(_root._entry->_data.cFileName, TEXT("GetDesktopFolder"));*/
231 
232  _root._entry->_data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
233 
234 
236 
237  if (info._open_mode & OWM_EXPLORE)
238  _left_hwnd = *(_left=new Pane(_hwnd, IDW_TREE_LEFT, IDW_HEADER_LEFT, _root._entry, true, COL_CONTENT));
239 
240  _right_hwnd = *(_right=new Pane(_hwnd, IDW_TREE_RIGHT, IDW_HEADER_RIGHT, NULL, false,
242  }
243 
244  _header_wdths_ok = false;
245 
246  if (!_left_hwnd && !_right_hwnd)
247  return;
248 
249  if (entry)
250  set_curdir(entry);
251  else if (_root._entry)
252  set_curdir(_root._entry);
253 
254  if (_left_hwnd) {
257  //SetFocus(_left_hwnd);
258  }
259 
260  // store path into history
261  if (info._path && *info._path)
262  _url_history.push(info._path);
263 }
information structure for creation of MDIShellBrowserChild
Definition: filechild.h:44
Definition: pane.h:36
struct _CONTEXT CONTEXT
void set_curdir(Entry *entry)
Definition: filechild.cpp:266
#define _tsplitpath_s
Definition: tchar.h:687
#define ListBox_GetCurSel(hwndCtl)
Definition: windowsx.h:451
NtObj file system directory-entry.
Definition: ntobjfs.h:100
WindowHandle _left_hwnd
Definition: window.h:324
#define GetDriveType
Definition: winbase.h:3626
ENTRY_TYPE _etype
Definition: filechild.h:36
uint8_t entry
Definition: isohybrid.c:63
Definition: pane.h:39
WindowHandle _right_hwnd
Definition: window.h:325
#define ListBox_FindItemData(hwndCtl, indexStart, data)
Definition: windowsx.h:446
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
shell folder entry
Definition: shellfs.h:53
void push(const value_type &__x)
Definition: _stack.h:86
#define _MAX_FNAME
Definition: utility.h:74
#define IDW_TREE_RIGHT
Definition: pane.h:30
#define ListBox_SetCurSel(hwndCtl, index)
Definition: windowsx.h:470
struct _test_info info[]
Definition: SetCursorPos.c:19
#define IDW_TREE_LEFT
Definition: pane.h:29
Definition: pane.h:38
Definition: pane.h:37
#define _MAX_DRIVE
Definition: utility.h:73
LPCTSTR _path
Definition: filechild.h:37
unsigned int idx
Definition: utils.c:41
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
smooth NULL
Definition: ftsmooth.c:416
Definition: pane.h:42
#define DRIVE_UNKNOWN
Definition: winbase.h:253
FAT drive root entry.
Definition: fatfs.h:225
bool _header_wdths_ok
Definition: filechild.h:119
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
HANDLE _hDrive
Definition: fatfs.h:237
ExtContextMenuHandlerT< ChildWindow > super
Definition: filechild.h:90
char TCHAR
Definition: xmlstorage.h:189
child window pane for displaying file lists
Definition: pane.h:66
Definition: pane.h:43
#define SORT_NAME
Definition: xpath.c:441
#define _tsplitpath
Definition: tchar.h:686
#define IDW_HEADER_RIGHT
Definition: pane.h:32
ShellFolder & GetDesktopFolder()
Registry key entry.
Definition: regfs.h:63
static char drive[2]
Definition: batch.c:28
#define GetVolumeInformation
Definition: winbase.h:3667
#define TEXT(s)
Definition: k32.h:26
#define lstrcpy
Definition: winbase.h:3688
Entry * _cur
Definition: pane.h:80
Definition: entries.h:40
#define COUNTOF(x)
Definition: utility.h:93
stack< String > _url_history
Definition: window.h:335
Windows file system directory-entry.
Definition: winfs.h:45
#define wsprintf
Definition: winuser.h:5731
ShellPath _shell_path
Definition: filechild.h:50
#define lstrcat
Definition: winbase.h:3685
base of all file and directory entries
Definition: entries.h:82
#define IDW_HEADER_LEFT
Definition: pane.h:31
Shell folder path of the desktop.
Definition: shellclasses.h:991

Member Function Documentation

◆ activate_entry()

void FileChildWindow::activate_entry ( Pane pane)
protected
Todo:
enable using RETURN key accelerator

Definition at line 577 of file filechild.cpp.

Referenced by Command(), and WndProc().

578 {
579  Entry* entry = pane->_cur;
580 
581  if (!entry)
582  return;
583 
584  WaitCursor wait;
585 
586  if ((entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || // a directory?
587  entry->_down) // a file with NTFS sub-streams?
588  {
589  int scanned_old = entry->_scanned;
590 
591  if (!scanned_old)
592  scan_entry(entry);
593 
594  if (entry->_data.cFileName[0]==TEXT('.') && entry->_data.cFileName[1]==TEXT('\0'))
595  return;
596 
597  if (entry->_data.cFileName[0]==TEXT('.') && entry->_data.cFileName[1]==TEXT('.') && entry->_data.cFileName[2]==TEXT('\0')) {
598  entry = _left->_cur->_up;
599  collapse_entry(_left, entry);
600  goto focus_entry;
601  } else if (entry->_expanded)
602  collapse_entry(pane, _left->_cur);
603  else {
605 
606  if (!pane->_treePane) focus_entry: {
609 
610  set_curdir(entry);
611  }
612  }
613 
614  if (!scanned_old) {
615  pane->calc_widths(false);
616 
617  pane->set_header();
618  }
619  } else {
620  entry->launch_entry(_hwnd);
621  }
622 }
void set_curdir(Entry *entry)
Definition: filechild.cpp:266
#define ListBox_GetCurSel(hwndCtl)
Definition: windowsx.h:451
Entry * _up
Definition: entries.h:94
WIN32_FIND_DATA _data
Definition: entries.h:100
WindowHandle _left_hwnd
Definition: window.h:324
uint8_t entry
Definition: isohybrid.c:63
#define ListBox_FindItemData(hwndCtl, indexStart, data)
Definition: windowsx.h:446
static void collapse_entry(Pane *pane, Entry *dir)
Definition: filechild.cpp:354
#define ListBox_SetCurSel(hwndCtl, index)
Definition: windowsx.h:470
bool _expanded
Definition: entries.h:96
bool calc_widths(bool anyway)
Definition: pane.cpp:178
unsigned int idx
Definition: utils.c:41
bool _treePane
Definition: pane.h:85
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
void set_header()
Definition: pane.cpp:693
void scan_entry(Entry *entry)
Definition: filechild.cpp:625
Entry * _down
Definition: entries.h:93
bool expand_entry(Entry *dir)
Definition: filechild.cpp:310
virtual BOOL launch_entry(HWND hwnd, UINT nCmdShow=SW_SHOWNORMAL)
Definition: entries.cpp:443
#define TEXT(s)
Definition: k32.h:26
bool _scanned
Definition: entries.h:97
Entry * _cur
Definition: pane.h:80
base of all file and directory entries
Definition: entries.h:82

◆ collapse_entry()

void FileChildWindow::collapse_entry ( Pane pane,
Entry dir 
)
staticprotected

Definition at line 354 of file filechild.cpp.

Referenced by activate_entry().

355 {
356  int idx = ListBox_FindItemData(*pane, 0, dir);
357 
358  SendMessage(*pane, WM_SETREDRAW, FALSE, 0); //ShowWindow(*pane, SW_HIDE);
359 
360  // hide sub entries
361  for(;;) {
362  LRESULT res = ListBox_GetItemData(*pane, idx+1);
363  Entry* sub = (Entry*) res;
364 
365  if (res==LB_ERR || !sub || sub->_level<=dir->_level)
366  break;
367 
368  ListBox_DeleteString(*pane, idx+1);
369  }
370 
371  dir->_expanded = false;
372 
373  SendMessage(*pane, WM_SETREDRAW, TRUE, 0); //ShowWindow(*pane, SW_SHOW);
374 }
#define TRUE
Definition: types.h:120
#define ListBox_DeleteString(hwndCtl, index)
Definition: windowsx.h:443
#define WM_SETREDRAW
Definition: winuser.h:1598
#define ListBox_FindItemData(hwndCtl, indexStart, data)
Definition: windowsx.h:446
bool _expanded
Definition: entries.h:96
#define LB_ERR
Definition: winuser.h:2386
unsigned int idx
Definition: utils.c:41
#define ListBox_GetItemData(hwndCtl, index)
Definition: windowsx.h:453
int _level
Definition: entries.h:98
#define SendMessage
Definition: winuser.h:5709
GLuint res
Definition: glext.h:9613
LONG_PTR LRESULT
Definition: windef.h:209
base of all file and directory entries
Definition: entries.h:82

◆ Command()

int FileChildWindow::Command ( int  id,
int  code 
)
protectedvirtual

Reimplemented from Window.

Definition at line 553 of file filechild.cpp.

554 {
555  Pane* pane = GetFocus()==_left_hwnd? _left: _right;
556 
557  switch(code) {
558  case LBN_SELCHANGE: {
559  int idx = ListBox_GetCurSel(*pane);
560  Entry* entry = (Entry*) ListBox_GetItemData(*pane, idx);
561 
562  if (pane == _left)
563  set_curdir(entry);
564  else
565  pane->_cur = entry;
566  break;}
567 
568  case LBN_DBLCLK:
569  activate_entry(pane);
570  break;
571  }
572 
573  return 0;
574 }
void set_curdir(Entry *entry)
Definition: filechild.cpp:266
#define ListBox_GetCurSel(hwndCtl)
Definition: windowsx.h:451
WindowHandle _left_hwnd
Definition: window.h:324
uint8_t entry
Definition: isohybrid.c:63
#define LBN_SELCHANGE
Definition: winuser.h:2036
unsigned int idx
Definition: utils.c:41
#define ListBox_GetItemData(hwndCtl, index)
Definition: windowsx.h:453
child window pane for displaying file lists
Definition: pane.h:66
#define LBN_DBLCLK
Definition: winuser.h:2032
void activate_entry(Pane *pane)
Definition: filechild.cpp:577
HWND WINAPI GetFocus(void)
Definition: window.c:1860
Entry * _cur
Definition: pane.h:80
base of all file and directory entries
Definition: entries.h:82

◆ create()

FileChildWindow * FileChildWindow::create ( const FileChildWndInfo info)
static

Definition at line 377 of file filechild.cpp.

Referenced by MDIMainFrame::Command(), and WndProc().

378 {
379  CONTEXT("FileChildWindow::create()");
380 
382 
384  mcs.szTitle = (LPTSTR)info._path;
386  mcs.x = info._pos.rcNormalPosition.left;
387  mcs.y = info._pos.rcNormalPosition.top;
390  mcs.style = 0;
391  mcs.lParam = 0;
392 
393  FileChildWindow* child = static_cast<FileChildWindow*>(
395 
396  if (!child->_left_hwnd && !child->_right_hwnd) {
397  SendMessage(info._hmdiclient, WM_MDIDESTROY, (WPARAM)child->_hwnd, 0);
398  MessageBox(info._hmdiclient, TEXT("Error opening child window"), TEXT("ROS Explorer"), MB_OK);
399  }
400 
401  return child;
402 }
MDI child window displaying file lists.
Definition: filechild.h:88
struct _CONTEXT CONTEXT
#define CLASSNAME_WINEFILETREE
Definition: explorer.h:76
LONG top
Definition: windef.h:297
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
static HWND child
Definition: cursoricon.c:298
CHAR * LPTSTR
Definition: xmlstorage.h:192
static Window * create_mdi_child(const ChildWndInfo &info, const MDICREATESTRUCT &mcs, CREATORFUNC_INFO creator)
Definition: window.cpp:118
UINT_PTR WPARAM
Definition: windef.h:207
LPCTSTR _path
Definition: filechild.h:37
#define WINDOW_CREATOR_INFO(WND_CLASS, INFO_CLASS)
Definition: window.h:215
HWND _hmdiclient
Definition: window.h:49
HINSTANCE _hInstance
Definition: globals.h:270
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
#define MessageBox
Definition: winuser.h:5688
#define WM_MDIDESTROY
Definition: winuser.h:1789
#define TEXT(s)
Definition: k32.h:26
#define MB_OK
Definition: winuser.h:784
information structure for creation of FileChildWindow
Definition: filechild.h:30
RECT rcNormalPosition
Definition: winuser.h:3237
#define SendMessage
Definition: winuser.h:5709
static struct myctx * mcs
Definition: adnstest.c:53
LONG bottom
Definition: windef.h:299
WINDOWPLACEMENT _pos
Definition: filechild.h:39

◆ expand_entry()

bool FileChildWindow::expand_entry ( Entry dir)
protected

Definition at line 310 of file filechild.cpp.

Referenced by activate_entry(), and refresh().

311 {
312  int idx;
313  Entry* p;
314 
315  if (!dir || dir->_expanded || !dir->_down)
316  return false;
317 
318  p = dir->_down;
319 
320  if (p->_data.cFileName[0]=='.' && p->_data.cFileName[1]=='\0' && p->_next) {
321  p = p->_next;
322 
323  if (p->_data.cFileName[0]=='.' && p->_data.cFileName[1]=='.' &&
324  p->_data.cFileName[2]=='\0' && p->_next)
325  p = p->_next;
326  }
327 
328  // no subdirectories ?
329  if (!(p->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && // not a directory?
330  !p->_down) // not a file with NTFS sub-streams?
331  return FALSE;
332 
333  idx = ListBox_FindItemData(_left_hwnd, 0, dir);
334 
335  dir->_expanded = true;
336 
337  // insert entries in left pane
338  HiddenWindow hide(_left_hwnd);
339 
340  _left->insert_entries(p, idx);
341 
342  if (!_header_wdths_ok) {
343  if (_left->calc_widths(false)) {
344  _left->set_header();
345 
346  _header_wdths_ok = true;
347  }
348  }
349 
350  return true;
351 }
Entry * _next
Definition: entries.h:92
WIN32_FIND_DATA _data
Definition: entries.h:100
WindowHandle _left_hwnd
Definition: window.h:324
int insert_entries(Entry *dir, int idx=-1)
Definition: pane.cpp:658
#define ListBox_FindItemData(hwndCtl, indexStart, data)
Definition: windowsx.h:446
bool _expanded
Definition: entries.h:96
bool calc_widths(bool anyway)
Definition: pane.cpp:178
unsigned int idx
Definition: utils.c:41
bool _header_wdths_ok
Definition: filechild.h:119
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
void set_header()
Definition: pane.cpp:693
Entry * _down
Definition: entries.h:93
GLfloat GLfloat p
Definition: glext.h:8902
base of all file and directory entries
Definition: entries.h:82

◆ get_root()

const Root& FileChildWindow::get_root ( ) const
inline

Definition at line 122 of file filechild.h.

Referenced by MDIMainFrame::activate_child_window(), and MDIMainFrame::activate_drive_window().

122 {return _root;}

◆ jump_to_int()

String FileChildWindow::jump_to_int ( LPCTSTR  url)
protectedvirtual
Todo:
use fname

Implements ChildWindow.

Definition at line 669 of file filechild.cpp.

670 {
671  String dir, fname;
672 
673  if (SplitFileSysURL(url, dir, fname)) {
674  Entry* entry = NULL;
675 
676  // call read_tree() to iterate through the hierarchy and open all folders to reach dir
677  if (_root._entry)
678  switch(_root._entry->_etype) {
679  case ET_SHELL: { //@@ separate into FileChildWindow in ShellChildWindow, WinChildWindow, UnixChildWindow ?
680  ShellPath shell_path(dir);
681  entry = _root.read_tree(&*shell_path);
682  break;}
683 
684 #ifdef __WINE__
685  case ET_UNIX: {
686  LPCTSTR path = dir;
687 
688  if (!_tcsicmp(path, _root._path, _tcslen(_root._path)))
689  path += _tcslen(_root._path);
690 
691  entry = _root.read_tree(path);
692  break;}
693 #endif
694 
695  default: { // ET_NTOBJS, ET_REGISTRY, ET_FAT, ET_WINDOWS
696  LPCTSTR path = dir;
697 
698  if (!_tcsnicmp(path, _root._path, _tcslen(_root._path)))
699  path += _tcslen(_root._path);
700 
701  entry = _root.read_tree(path);
702  break;}
703  }
704 
705  if (entry) {
706  // refresh left pane entries
707  HiddenWindow hide(_left_hwnd);
708 
710 
711  _left->insert_entries(_root._entry);
712 
713  if (!_header_wdths_ok) {
714  if (_left->calc_widths(false)) {
715  _left->set_header();
716 
717  _header_wdths_ok = true;
718  }
719  }
720 
721  set_curdir(entry);
722 
723  if (_left_hwnd) {
724  int idx = ListBox_FindItemData(_left_hwnd, -1, entry);
725 
726  if (idx != -1) { // The item should always be found.
729  }
730  }
731 
733 
734  return dir; //FmtString(TEXT("file://%s"), (LPCTSTR)dir);
735  }
736  }
737 
738  return String();
739 }
void set_curdir(Entry *entry)
Definition: filechild.cpp:266
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define _tcsicmp
Definition: xmlstorage.h:205
WindowHandle _left_hwnd
Definition: window.h:324
uint8_t entry
Definition: isohybrid.c:63
int insert_entries(Entry *dir, int idx=-1)
Definition: pane.cpp:658
#define ListBox_ResetContent(hwndCtl)
Definition: windowsx.h:464
#define ListBox_FindItemData(hwndCtl, indexStart, data)
Definition: windowsx.h:446
HWND WINAPI SetFocus(_In_opt_ HWND)
static WCHAR String[]
Definition: stringtable.c:55
#define ListBox_SetCurSel(hwndCtl, index)
Definition: windowsx.h:470
bool calc_widths(bool anyway)
Definition: pane.cpp:178
#define _tcsnicmp
Definition: xmlstorage.h:207
unsigned int idx
Definition: utils.c:41
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
smooth NULL
Definition: ftsmooth.c:416
unsigned int dir
Definition: maze.c:112
bool _header_wdths_ok
Definition: filechild.h:119
void set_header()
Definition: pane.cpp:693
static const WCHAR url[]
Definition: encode.c:1432
Definition: services.c:325
wrapper class for item ID lists
Definition: shellclasses.h:651
base of all file and directory entries
Definition: entries.h:82
bool SplitFileSysURL(LPCTSTR url, String &dir_out, String &fname_out)
Definition: utility.cpp:504

◆ Notify()

int FileChildWindow::Notify ( int  id,
NMHDR pnmh 
)
protectedvirtual

Reimplemented from Window.

Definition at line 663 of file filechild.cpp.

664 {
665  return (pnmh->idFrom==IDW_HEADER_LEFT? _left: _right)->Notify(id, pnmh);
666 }
UINT_PTR idFrom
Definition: winuser.h:3111
#define IDW_HEADER_LEFT
Definition: pane.h:31

◆ refresh()

void FileChildWindow::refresh ( )
protected

Definition at line 541 of file filechild.cpp.

Referenced by WndProc().

542 {
543  WaitCursor wait;
544  bool expanded = _left->_cur->_expanded;
545 
547 
548  if (expanded)
550 }
bool _expanded
Definition: entries.h:96
void scan_entry(Entry *entry)
Definition: filechild.cpp:625
bool expand_entry(Entry *dir)
Definition: filechild.cpp:310
Entry * _cur
Definition: pane.h:80

◆ resize_children()

void FileChildWindow::resize_children ( int  cx,
int  cy 
)
protectedvirtual

Reimplemented from ChildWindow.

Definition at line 405 of file filechild.cpp.

Referenced by WndProc().

406 {
407  HDWP hdwp = BeginDeferWindowPos(4);
408  RECT rt;
409 
410  rt.left = 0;
411  rt.top = 0;
412  rt.right = cx;
413  rt.bottom = cy;
414 
415  cx = _split_pos + SPLIT_WIDTH/2;
416 
417  if (_left && _right) {
418  WINDOWPOS wp;
419  HD_LAYOUT hdl;
420 
421  hdl.prc = &rt;
422  hdl.pwpos = &wp;
423 
425 
427  wp.x-1, wp.y, _split_pos-SPLIT_WIDTH/2+1, wp.cy, wp.flags);
428 
430  rt.left+cx+1, wp.y, wp.cx-cx+2, wp.cy, wp.flags);
431  }
432 
433  if (_left_hwnd)
435 
436  if (_right_hwnd)
437  hdwp = DeferWindowPos(hdwp, _right_hwnd, 0, rt.left+cx+1, rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
438 
439  EndDeferWindowPos(hdwp);
440 }
HDWP WINAPI BeginDeferWindowPos(_In_ int)
WindowHandle _left_hwnd
Definition: window.h:324
WindowHandle _right_hwnd
Definition: window.h:325
LONG top
Definition: windef.h:297
HWND hwndInsertAfter
Definition: winuser.h:3531
LONG left
Definition: windef.h:296
#define SWP_NOZORDER
Definition: winuser.h:1232
LONG right
Definition: windef.h:298
#define SPLIT_WIDTH
Definition: eventvwr.c:62
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
UINT flags
Definition: winuser.h:3536
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOACTIVATE
Definition: winuser.h:1227
WindowHandle _hwndHeader
Definition: pane.h:77
#define Header_Layout(hwndHD, playout)
Definition: commctrl.h:753
#define HD_LAYOUT
Definition: commctrl.h:745
int _split_pos
Definition: window.h:328
_Out_opt_ int * cx
Definition: commctrl.h:570
LONG bottom
Definition: windef.h:299

◆ scan_entry()

void FileChildWindow::scan_entry ( Entry entry)
protected
Todo:
use modifyable sort order instead of fixed file system default

Definition at line 625 of file filechild.cpp.

Referenced by activate_entry(), refresh(), and set_curdir().

626 {
627  CONTEXT("FileChildWindow::scan_entry()");
628 
630 
631  // delete sub entries in left pane
632  for(;;) {
634  Entry* sub = (Entry*) res;
635 
636  if (res==LB_ERR || !sub || sub->_level<=entry->_level)
637  break;
638 
640  }
641 
642  // empty right pane
644 
645  // release memory
646  entry->free_subentries();
647  entry->_expanded = false;
648 
649  // read contents from disk
650  entry->read_directory_base(_root._sort_order);
651 
652  // insert found entries in right pane
653  HiddenWindow hide(_right_hwnd);
654  _right->insert_entries(entry->_down);
655 
656  _right->calc_widths(false);
657  _right->set_header();
658 
659  _header_wdths_ok = false;
660 }
struct _CONTEXT CONTEXT
#define ListBox_GetCurSel(hwndCtl)
Definition: windowsx.h:451
void read_directory_base(SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0)
Definition: entries.cpp:143
WindowHandle _left_hwnd
Definition: window.h:324
#define ListBox_DeleteString(hwndCtl, index)
Definition: windowsx.h:443
int insert_entries(Entry *dir, int idx=-1)
Definition: pane.cpp:658
WindowHandle _right_hwnd
Definition: window.h:325
#define ListBox_ResetContent(hwndCtl)
Definition: windowsx.h:464
bool _expanded
Definition: entries.h:96
bool calc_widths(bool anyway)
Definition: pane.cpp:178
#define LB_ERR
Definition: winuser.h:2386
unsigned int idx
Definition: utils.c:41
bool _header_wdths_ok
Definition: filechild.h:119
void set_header()
Definition: pane.cpp:693
#define ListBox_GetItemData(hwndCtl, index)
Definition: windowsx.h:453
Entry * _down
Definition: entries.h:93
int _level
Definition: entries.h:98
void free_subentries()
Definition: entries.cpp:743
GLuint res
Definition: glext.h:9613
LONG_PTR LRESULT
Definition: windef.h:209
base of all file and directory entries
Definition: entries.h:82

◆ set_curdir()

void FileChildWindow::set_curdir ( Entry entry)
protected
Todo:
make configurable (This call takes really very long compared to all other processing!)

Definition at line 266 of file filechild.cpp.

Referenced by activate_entry(), Command(), FileChildWindow(), and jump_to_int().

267 {
268  CONTEXT("FileChildWindow::set_curdir()");
269 
270  _path[0] = TEXT('\0');
271 
272  _left->_cur = entry;
273  _right->_root = entry&&entry->_down? entry->_down: entry;
274  _right->_cur = entry;
275 
276  if (entry) {
277  WaitCursor wait;
278 
279  if (!entry->_scanned)
280  scan_entry(entry);
281  else {
282  HiddenWindow hide(_right_hwnd);
283 
285  _right->insert_entries(entry->_down);
286 
287  _right->calc_widths(false);
288 
289  _right->set_header();
290  }
291 
292  entry->get_path(_path, COUNTOF(_path));
293  }
294 
295  if (_hwnd) // only change window title if the window already exists
296  SetWindowText(_hwnd, _path);
297 
298  if (_path[0])
299  {
301  set_url(_path); //set_url(FmtString(TEXT("file://%s"), _path));
302  else
303  _path[0] = TEXT('\0');
304  }
305 }
Entry * _root
Definition: pane.h:79
struct _CONTEXT CONTEXT
uint8_t entry
Definition: isohybrid.c:63
int insert_entries(Entry *dir, int idx=-1)
Definition: pane.cpp:658
WindowHandle _right_hwnd
Definition: window.h:325
#define ListBox_ResetContent(hwndCtl)
Definition: windowsx.h:464
virtual bool get_path(PTSTR path, size_t path_count) const =0
bool calc_widths(bool anyway)
Definition: pane.cpp:178
void set_header()
Definition: pane.cpp:693
void scan_entry(Entry *entry)
Definition: filechild.cpp:625
Entry * _down
Definition: entries.h:93
void set_url(LPCTSTR url)
Definition: window.cpp:567
#define TEXT(s)
Definition: k32.h:26
#define SetWindowText
Definition: winuser.h:5723
bool _scanned
Definition: entries.h:97
Entry * _cur
Definition: pane.h:80
#define COUNTOF(x)
Definition: utility.h:93
#define SetCurrentDirectory
Definition: winbase.h:3717
TCHAR _path[MAX_PATH]
Definition: filechild.h:118

◆ set_focus_pane()

void FileChildWindow::set_focus_pane ( Pane pane)
inline

Definition at line 124 of file filechild.h.

Referenced by Pane::WndProc().

125  {_focus_pane = pane==_right? 1: 0;}
int _focus_pane
Definition: window.h:326

◆ switch_focus_pane()

void FileChildWindow::switch_focus_pane ( )
inline

Definition at line 127 of file filechild.h.

Referenced by Pane::WndProc().

int _focus_pane
Definition: window.h:326
HWND WINAPI SetFocus(_In_opt_ HWND)

◆ WndProc()

LRESULT FileChildWindow::WndProc ( UINT  nmsg,
WPARAM  wparam,
LPARAM  lparam 
)
protectedvirtual

Reimplemented from Window.

Definition at line 443 of file filechild.cpp.

444 {
445  switch(nmsg) {
446  case WM_DRAWITEM: {
448  Entry* entry = (Entry*) dis->itemData;
449 
450  if (dis->CtlID == IDW_TREE_LEFT) {
451  _left->draw_item(dis, entry);
452  return TRUE;
453  } else if (dis->CtlID == IDW_TREE_RIGHT) {
454  _right->draw_item(dis, entry);
455  return TRUE;
456  }
457 
458  goto def;}
459 
460  case WM_SIZE:
461  if (wparam != SIZE_MINIMIZED)
463  return DefMDIChildProc(_hwnd, nmsg, wparam, lparam);
464 
465  case PM_GET_FILEWND_PTR:
466  return (LRESULT)this;
467 
468  case WM_SETFOCUS: {
470 
471  if (_left && _left->_cur) {
472  _left->_cur->get_path(path, COUNTOF(path));
473  SetCurrentDirectory(path);
474  }
475 
477  goto def;}
478 
479  case PM_DISPATCH_COMMAND: {
480  Pane* pane = GetFocus()==_left_hwnd? _left: _right;
481 
482  switch(LOWORD(wparam)) {
483  case ID_WINDOW_NEW: {CONTEXT("FileChildWindow PM_DISPATCH_COMMAND ID_WINDOW_NEW");
484  if (_root._entry->_etype == ET_SHELL)
486  else
487  FileChildWindow::create(FileChildWndInfo(GetParent(_hwnd)/*_hmdiclient*/, _path));
488  break;}
489 
490  case ID_REFRESH: {CONTEXT("ID_REFRESH");
491  refresh();
492  break;}
493 
494  case ID_ACTIVATE: {CONTEXT("ID_ACTIVATE");
495  activate_entry(pane);
496  break;}
497 
498  default:
499  if (pane->command(LOWORD(wparam)))
500  return TRUE;
501  else
502  return super::WndProc(nmsg, wparam, lparam);
503  }
504 
505  return TRUE;}
506 
507  case WM_CONTEXTMENU: {
508  // first select the current item in the listbox
509  HWND hpanel = (HWND) wparam;
510  POINT pt;
511  pt.x = LOWORD(lparam);
512  pt.y = HIWORD(lparam);
513  POINT pt_screen = pt;
514  ScreenToClient(hpanel, &pt);
515  SendMessage(hpanel, WM_LBUTTONDOWN, 0, MAKELONG(pt.x, pt.y));
516  SendMessage(hpanel, WM_LBUTTONUP, 0, MAKELONG(pt.x, pt.y));
517 
518  // now create the popup menu using shell namespace and IContextMenu
519  Pane* pane = GetFocus()==_left_hwnd? _left: _right;
520  int idx = ListBox_GetCurSel(*pane);
521  if (idx != -1) {
522  Entry* entry = (Entry*) ListBox_GetItemData(*pane, idx);
523 
524  HRESULT hr = entry->do_context_menu(_hwnd, pt_screen, _cm_ifs);
525 
526  if (SUCCEEDED(hr))
527  refresh();
528  else
529  CHECKERROR(hr);
530  }
531  break;}
532 
533  default: def:
534  return super::WndProc(nmsg, wparam, lparam);
535  }
536 
537  return 0;
538 }
information structure for creation of MDIShellBrowserChild
Definition: filechild.h:44
struct _CONTEXT CONTEXT
#define TRUE
Definition: types.h:120
#define ID_REFRESH
Definition: resource.h:18
#define ListBox_GetCurSel(hwndCtl)
Definition: windowsx.h:451
#define PM_GET_FILEWND_PTR
Definition: explorer.h:61
long y
Definition: polytest.cpp:48
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define WM_LBUTTONDOWN
Definition: winuser.h:1752
long x
Definition: polytest.cpp:48
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
WindowHandle _left_hwnd
Definition: window.h:324
#define pt(x, y)
Definition: drawing.c:79
BOOL command(UINT cmd)
Definition: pane.cpp:942
int _focus_pane
Definition: window.h:326
uint8_t entry
Definition: isohybrid.c:63
WindowHandle _right_hwnd
Definition: window.h:325
ULONG_PTR itemData
Definition: winuser.h:3046
HANDLE HWND
Definition: compat.h:13
HWND WINAPI SetFocus(_In_opt_ HWND)
virtual bool get_path(PTSTR path, size_t path_count) const =0
virtual HRESULT do_context_menu(HWND hwnd, const POINT &pos, CtxMenuInterfaces &cm_ifs)
Definition: entries.cpp:519
#define IDW_TREE_RIGHT
Definition: pane.h:30
#define IDW_TREE_LEFT
Definition: pane.h:29
unsigned int idx
Definition: utils.c:41
#define MAKELONG(a, b)
Definition: typedefs.h:248
#define CHECKERROR(hr)
Definition: shellclasses.h:162
#define DefMDIChildProc
Definition: ros2win.h:33
#define ListBox_GetItemData(hwndCtl, index)
Definition: windowsx.h:453
char TCHAR
Definition: xmlstorage.h:189
#define ID_WINDOW_NEW
Definition: resource.h:227
if(!(yy_init))
Definition: macro.lex.yy.c:717
#define WM_SIZE
Definition: winuser.h:1593
LONG HRESULT
Definition: typedefs.h:77
child window pane for displaying file lists
Definition: pane.h:66
void draw_item(LPDRAWITEMSTRUCT dis, Entry *entry, int calcWidthCol=-1)
Definition: pane.cpp:298
#define MAX_PATH
Definition: compat.h:26
virtual void resize_children(int cx, int cy)
Definition: filechild.cpp:405
#define ID_ACTIVATE
Definition: resource.h:60
#define SIZE_MINIMIZED
Definition: winuser.h:2460
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
UINT WPARAM LPARAM lparam
Definition: msvc.h:92
HWND WINAPI GetParent(_In_ HWND)
#define WM_LBUTTONUP
Definition: winuser.h:1753
Definition: services.c:325
void activate_entry(Pane *pane)
Definition: filechild.cpp:577
information structure for creation of FileChildWindow
Definition: filechild.h:30
#define WM_DRAWITEM
Definition: winuser.h:1627
HWND WINAPI GetFocus(void)
Definition: window.c:1860
Entry * _cur
Definition: pane.h:80
#define SendMessage
Definition: winuser.h:5709
#define HIWORD(l)
Definition: typedefs.h:246
#define COUNTOF(x)
Definition: utility.h:93
static FileChildWindow * create(const FileChildWndInfo &info)
Definition: filechild.cpp:377
#define WM_SETFOCUS
Definition: winuser.h:1595
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
LONG_PTR LRESULT
Definition: windef.h:209
#define PM_DISPATCH_COMMAND
Definition: window.h:265
#define LOWORD(l)
Definition: pedump.c:82
base of all file and directory entries
Definition: entries.h:82
#define SetCurrentDirectory
Definition: winbase.h:3717
#define SUCCEEDED(hr)
Definition: intsafe.h:57
TCHAR _path[MAX_PATH]
Definition: filechild.h:118
UINT WPARAM wparam
Definition: msvc.h:92
Shell folder path of the desktop.
Definition: shellclasses.h:991

Member Data Documentation

◆ _header_wdths_ok

bool FileChildWindow::_header_wdths_ok
protected

Definition at line 119 of file filechild.h.

Referenced by expand_entry(), FileChildWindow(), jump_to_int(), and scan_entry().

◆ _left

Pane* FileChildWindow::_left
protected

◆ _path

TCHAR FileChildWindow::_path[MAX_PATH]
protected

Definition at line 118 of file filechild.h.

Referenced by set_curdir(), and WndProc().

◆ _right

Pane* FileChildWindow::_right
protected

◆ _root

Root FileChildWindow::_root
protected

Definition at line 115 of file filechild.h.


The documentation for this struct was generated from the following files: