Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes

FileChildWindow Struct Reference

MDI child window displaying file lists. More...

#include <filechild.h>

Inheritance diagram for FileChildWindow:
Inheritance graph
[legend]
Collaboration diagram for FileChildWindow:
Collaboration graph
[legend]

List of all members.

Public Types

typedef ExtContextMenuHandlerT
< ChildWindow
super

Public Member Functions

 FileChildWindow (HWND hwnd, const FileChildWndInfo &info)
const Rootget_root () const
void set_focus_pane (Pane *pane)
void switch_focus_pane ()

Static Public Member Functions

static FileChildWindowcreate (const FileChildWndInfo &info)

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 ()

Static Protected Member Functions

static void collapse_entry (Pane *pane, Entry *dir)

Protected Attributes

Root _root
Pane_left
Pane_right
TCHAR _path [MAX_PATH]
bool _header_wdths_ok

Detailed Description

MDI child window displaying file lists.

Definition at line 88 of file filechild.h.


Member Typedef Documentation

Reimplemented from ExtContextMenuHandlerT< ChildWindow >.

Definition at line 90 of file filechild.h.


Constructor & Destructor Documentation

FileChildWindow::FileChildWindow ( HWND  hwnd,
const FileChildWndInfo info 
)

Todo:
use OWM_ROOTED flag
Todo:
Is not-explore-mode for FileChildWindow completely implemented?

Definition at line 127 of file filechild.cpp.

References Pane::_cur, Entry::_data, Root::_drive_type, Root::_entry, FileChildWndInfo::_etype, Root::_fs, Root::_fs_flags, FATDrive::_hDrive, _header_wdths_ok, WindowHandle::_hwnd, _left, ChildWindow::_left_hwnd, _MAX_DRIVE, _MAX_FNAME, FileChildWndInfo::_open_mode, Root::_path, FileChildWndInfo::_path, _right, ChildWindow::_right_hwnd, _root, ShellChildWndInfo::_shell_path, Root::_sort_order, _tcslen, _tsplitpath_s, ChildWindow::_url_history, Root::_volname, COL_ATTRIBUTES, COL_CONTENT, COL_DATE, COL_INDEX, COL_LINKS, COL_SIZE, COL_TIME, COL_TYPE, CONTEXT, COUNTOF, ET_FAT, ET_NTOBJS, ET_REGISTRY, ET_SHELL, GetDesktopFolder(), IDW_HEADER_LEFT, IDW_HEADER_RIGHT, IDW_TREE_LEFT, IDW_TREE_RIGHT, OWM_EXPLORE, Root::read_tree(), set_curdir(), SORT_NAME, SORT_NONE, and TEXT.

 :  super(hwnd, info)
{
    CONTEXT("FileChildWindow::FileChildWindow()");

    TCHAR drv[_MAX_DRIVE+1];
    Entry* entry = NULL;

    _left = NULL;
    _right = NULL;

    switch(info._etype) {
#ifdef __WINE__
      case ET_UNIX:
        _root._drive_type = GetDriveType(info._path);
        _root._sort_order = SORT_NAME;

        _tsplitpath(info._path, drv, NULL, NULL, NULL);
        lstrcat(drv, TEXT("/"));
        lstrcpy(_root._volname, TEXT("root fs"));
        _root._fs_flags = 0;
        lstrcpy(_root._fs, TEXT("unixfs"));
        lstrcpy(_root._path, TEXT("/"));
        _root._entry = new UnixDirectory(_root._path);
        entry = _root.read_tree(info._path+_tcslen(_root._path));
        break;
#endif

      case ET_NTOBJS:
        _root._drive_type = DRIVE_UNKNOWN;
        _root._sort_order = SORT_NAME;

        _tsplitpath_s(info._path, drv, COUNTOF(drv), NULL, 0, NULL, 0, NULL, 0);
        lstrcat(drv, TEXT("\\"));
        lstrcpy(_root._volname, TEXT("NT Object Namespace"));
        lstrcpy(_root._fs, TEXT("NTOBJ"));
        lstrcpy(_root._path, drv);
        _root._entry = new NtObjDirectory(_root._path);
        entry = _root.read_tree(info._path+_tcslen(_root._path));
        break;

      case ET_REGISTRY:
        _root._drive_type = DRIVE_UNKNOWN;
        _root._sort_order = SORT_NONE;

        _tsplitpath_s(info._path, drv, COUNTOF(drv), NULL, 0, NULL, 0, NULL, 0);
        lstrcat(drv, TEXT("\\"));
        lstrcpy(_root._volname, TEXT("Registry"));
        lstrcpy(_root._fs, TEXT("Registry"));
        lstrcpy(_root._path, drv);
        _root._entry = new RegistryRoot();
        entry = _root.read_tree(info._path+_tcslen(_root._path));
        break;

      case ET_FAT: {
        _root._drive_type = DRIVE_UNKNOWN;
        _root._sort_order = SORT_NONE;

        _tsplitpath_s(info._path, drv, COUNTOF(drv), NULL, 0, NULL, 0, NULL, 0);
        lstrcat(drv, TEXT("\\"));
        lstrcpy(_root._volname, TEXT("FAT XXX"));   //@@
        lstrcpy(_root._fs, TEXT("FAT"));
        lstrcpy(_root._path, drv);
        FATDrive* drive = new FATDrive(TEXT("c:/reactos-emu/c.img"));   //TEXT("\\\\.\\F:"));   //@@

        if (drive->_hDrive != INVALID_HANDLE_VALUE) {
            _root._entry = drive;
            entry = _root.read_tree(info._path+_tcslen(_root._path));
        }
        break;}

#ifndef _NO_WIN_FS
      default:  // ET_WINDOWS
        _root._drive_type = GetDriveType(info._path);
        _root._sort_order = SORT_NAME;

        _tsplitpath_s(info._path, drv, COUNTOF(drv), NULL, 0, NULL, 0, NULL, 0);
        lstrcat(drv, TEXT("\\"));
        GetVolumeInformation(drv, _root._volname, _MAX_FNAME, 0, 0, &_root._fs_flags, _root._fs, COUNTOF(_root._fs));
        lstrcpy(_root._path, drv);
        _root._entry = new WinDirectory(_root._path);
        entry = _root.read_tree(info._path+_tcslen(_root._path));
        break;
#else
    default:
#endif

      case ET_SHELL: {  //@@ separate FileChildWindow into ShellChildWindow, WinChildWindow, UnixChildWindow ?
        _root._drive_type = DRIVE_UNKNOWN;
        _root._sort_order = SORT_NAME;

        lstrcpy(drv, TEXT("\\"));
        lstrcpy(_root._volname, TEXT("Desktop"));
        _root._fs_flags = 0;
        lstrcpy(_root._fs, TEXT("Shell"));

        _root._entry = new ShellDirectory(GetDesktopFolder(), DesktopFolderPath(), hwnd);
        const ShellChildWndInfo& shell_info = static_cast<const ShellChildWndInfo&>(info);
        entry = _root.read_tree(&*shell_info._shell_path);
        break;}
    }

    if (_root._entry) {
        if (info._etype != ET_SHELL)
            wsprintf(_root._entry->_data.cFileName, TEXT("%s - %s"), drv, _root._fs);
    /*@@else
            lstrcpy(_root._entry->_data.cFileName, TEXT("GetDesktopFolder"));*/

        _root._entry->_data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;


        ///@todo use OWM_ROOTED flag

        if (info._open_mode & OWM_EXPLORE)  ///@todo Is not-explore-mode for FileChildWindow completely implemented?
            _left_hwnd = *(_left=new Pane(_hwnd, IDW_TREE_LEFT, IDW_HEADER_LEFT, _root._entry, true, COL_CONTENT));

        _right_hwnd = *(_right=new Pane(_hwnd, IDW_TREE_RIGHT, IDW_HEADER_RIGHT, NULL, false,
                                        COL_TYPE|COL_SIZE|COL_DATE|COL_TIME|COL_ATTRIBUTES|COL_INDEX|COL_LINKS|COL_CONTENT));
    }

    _header_wdths_ok = false;

    if (!_left_hwnd && !_right_hwnd)
        return;

    if (entry)
        set_curdir(entry);
    else if (_root._entry)
        set_curdir(_root._entry);

    if (_left_hwnd) {
        int idx = ListBox_FindItemData(_left_hwnd, ListBox_GetCurSel(_left_hwnd), _left->_cur);
        ListBox_SetCurSel(_left_hwnd, idx);
        //SetFocus(_left_hwnd);
    }

     // store path into history
    if (info._path && *info._path)
        _url_history.push(info._path);
}

Here is the call graph for this function:


Member Function Documentation

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

Definition at line 580 of file filechild.cpp.

References Pane::_cur, Entry::_data, Entry::_down, Entry::_expanded, WindowHandle::_hwnd, _left, ChildWindow::_left_hwnd, Entry::_scanned, Pane::_treePane, Entry::_up, Pane::calc_widths(), collapse_entry(), expand_entry(), Entry::launch_entry(), scan_entry(), set_curdir(), Pane::set_header(), and TEXT.

Referenced by Command(), and WndProc().

{
    Entry* entry = pane->_cur;

    if (!entry)
        return;

    WaitCursor wait;

    if ((entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ||   // a directory?
        entry->_down)   // a file with NTFS sub-streams?
    {
        int scanned_old = entry->_scanned;

        if (!scanned_old)
            scan_entry(entry);

        if (entry->_data.cFileName[0]==TEXT('.') && entry->_data.cFileName[1]==TEXT('\0'))
            return;

        if (entry->_data.cFileName[0]==TEXT('.') && entry->_data.cFileName[1]==TEXT('.') && entry->_data.cFileName[2]==TEXT('\0')) {
            entry = _left->_cur->_up;
            collapse_entry(_left, entry);
            goto focus_entry;
        } else if (entry->_expanded)
            collapse_entry(pane, _left->_cur);
        else {
            expand_entry(_left->_cur);

            if (!pane->_treePane) focus_entry: {
                int idx = ListBox_FindItemData(_left_hwnd, ListBox_GetCurSel(_left_hwnd), entry);
                ListBox_SetCurSel(_left_hwnd, idx);

                set_curdir(entry);
            }
        }

        if (!scanned_old) {
            pane->calc_widths(false);

            pane->set_header();
        }
    } else {
        entry->launch_entry(_hwnd);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FileChildWindow::collapse_entry ( Pane pane,
Entry dir 
) [static, protected]

Definition at line 357 of file filechild.cpp.

References Entry::_expanded, and Entry::_level.

Referenced by activate_entry().

{
    int idx = ListBox_FindItemData(*pane, 0, dir);

    SendMessage(*pane, WM_SETREDRAW, FALSE, 0); //ShowWindow(*pane, SW_HIDE);

     // hide sub entries
    for(;;) {
        LRESULT res = ListBox_GetItemData(*pane, idx+1);
        Entry* sub = (Entry*) res;

        if (res==LB_ERR || !sub || sub->_level<=dir->_level)
            break;

        ListBox_DeleteString(*pane, idx+1);
    }

    dir->_expanded = false;

    SendMessage(*pane, WM_SETREDRAW, TRUE, 0);  //ShowWindow(*pane, SW_SHOW);
}

Here is the caller graph for this function:

int FileChildWindow::Command ( int  id,
int  code 
) [protected, virtual]

Reimplemented from Window.

Definition at line 556 of file filechild.cpp.

References Pane::_cur, _left, ChildWindow::_left_hwnd, _right, activate_entry(), and set_curdir().

{
    Pane* pane = GetFocus()==_left_hwnd? _left: _right;

    switch(code) {
      case LBN_SELCHANGE: {
        int idx = ListBox_GetCurSel(*pane);
        Entry* entry = (Entry*) ListBox_GetItemData(*pane, idx);

        if (pane == _left)
            set_curdir(entry);
        else
            pane->_cur = entry;
        break;}

      case LBN_DBLCLK:
        activate_entry(pane);
        break;
    }

    return 0;
}

Here is the call graph for this function:

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

Definition at line 380 of file filechild.cpp.

References ExplorerGlobals::_hInstance, ChildWndInfo::_hmdiclient, FileChildWndInfo::_path, FileChildWndInfo::_pos, CLASSNAME_WINEFILETREE, CONTEXT, Window::create_mdi_child(), g_Globals, TEXT, and WINDOW_CREATOR_INFO.

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

{
    CONTEXT("FileChildWindow::create()");

    MDICREATESTRUCT mcs;

    mcs.szClass = CLASSNAME_WINEFILETREE;
    mcs.szTitle = (LPTSTR)info._path;
    mcs.hOwner  = g_Globals._hInstance;
    mcs.x       = info._pos.rcNormalPosition.left;
    mcs.y       = info._pos.rcNormalPosition.top;
    mcs.cx      = info._pos.rcNormalPosition.right - info._pos.rcNormalPosition.left;
    mcs.cy      = info._pos.rcNormalPosition.bottom - info._pos.rcNormalPosition.top;
    mcs.style   = 0;
    mcs.lParam  = 0;

    FileChildWindow* child = static_cast<FileChildWindow*>(
        create_mdi_child(info, mcs, WINDOW_CREATOR_INFO(FileChildWindow,FileChildWndInfo)));

    if (!child->_left_hwnd && !child->_right_hwnd) {
        SendMessage(info._hmdiclient, WM_MDIDESTROY, (WPARAM)child->_hwnd, 0);
        MessageBox(info._hmdiclient, TEXT("Error opening child window"), TEXT("ROS Explorer"), MB_OK);
    }

    return child;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool FileChildWindow::expand_entry ( Entry dir ) [protected]

Definition at line 313 of file filechild.cpp.

References Entry::_data, Entry::_down, Entry::_expanded, _header_wdths_ok, _left, ChildWindow::_left_hwnd, Entry::_next, Pane::calc_widths(), Pane::insert_entries(), and Pane::set_header().

Referenced by activate_entry(), and refresh().

{
    int idx;
    Entry* p;

    if (!dir || dir->_expanded || !dir->_down)
        return false;

    p = dir->_down;

    if (p->_data.cFileName[0]=='.' && p->_data.cFileName[1]=='\0' && p->_next) {
        p = p->_next;

        if (p->_data.cFileName[0]=='.' && p->_data.cFileName[1]=='.' &&
                p->_data.cFileName[2]=='\0' && p->_next)
            p = p->_next;
    }

     // no subdirectories ?
    if (!(p->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&  // not a directory?
        !p->_down)  // not a file with NTFS sub-streams?
        return FALSE;

    idx = ListBox_FindItemData(_left_hwnd, 0, dir);

    dir->_expanded = true;

     // insert entries in left pane
    HiddenWindow hide(_left_hwnd);

    _left->insert_entries(p, idx);

    if (!_header_wdths_ok) {
        if (_left->calc_widths(false)) {
            _left->set_header();

            _header_wdths_ok = true;
        }
    }

    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

const Root& FileChildWindow::get_root (  ) const [inline]

Definition at line 122 of file filechild.h.

References _root.

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

{return _root;}

Here is the caller graph for this function:

String FileChildWindow::jump_to_int ( LPCTSTR  url ) [protected, virtual]

Todo:
use fname

Implements ChildWindow.

Definition at line 672 of file filechild.cpp.

References Root::_entry, Entry::_etype, _header_wdths_ok, _left, ChildWindow::_left_hwnd, Root::_path, _root, _tcsicmp, _tcslen, _tcsnicmp, Pane::calc_widths(), ET_SHELL, Pane::insert_entries(), Root::read_tree(), set_curdir(), Pane::set_header(), and SplitFileSysURL().

{
    String dir, fname;

    if (SplitFileSysURL(url, dir, fname)) {
        Entry* entry = NULL;

         // call read_tree() to iterate through the hierarchy and open all folders to reach dir
        if (_root._entry)
            switch(_root._entry->_etype) {
              case ET_SHELL: {  //@@ separate into FileChildWindow in ShellChildWindow, WinChildWindow, UnixChildWindow ?
                ShellPath shell_path(dir);
                entry = _root.read_tree(&*shell_path);
                break;}

#ifdef __WINE__
              case ET_UNIX: {
                LPCTSTR path = dir;

                if (!_tcsicmp(path, _root._path, _tcslen(_root._path)))
                    path += _tcslen(_root._path);

                entry = _root.read_tree(path);
                break;}
#endif

              default: { // ET_NTOBJS, ET_REGISTRY, ET_FAT, ET_WINDOWS
                LPCTSTR path = dir;

                if (!_tcsnicmp(path, _root._path, _tcslen(_root._path)))
                    path += _tcslen(_root._path);

                entry = _root.read_tree(path);
                break;}
            }

            if (entry) {
                 // refresh left pane entries
                HiddenWindow hide(_left_hwnd);

                ListBox_ResetContent(_left_hwnd);

                _left->insert_entries(_root._entry);

                if (!_header_wdths_ok) {
                    if (_left->calc_widths(false)) {
                        _left->set_header();

                        _header_wdths_ok = true;
                    }
                }

                set_curdir(entry);

                if (_left_hwnd) {
                    int idx = ListBox_FindItemData(_left_hwnd, -1, entry);

                    if (idx != -1) { // The item should always be found.
                        ListBox_SetCurSel(_left_hwnd, idx);
                        SetFocus(_left_hwnd);
                    }
                }

                ///@todo use fname

                return dir; //FmtString(TEXT("file://%s"), (LPCTSTR)dir);
            }
    }

    return String();
}

Here is the call graph for this function:

int FileChildWindow::Notify ( int  id,
NMHDR *  pnmh 
) [protected, virtual]

Reimplemented from Window.

Definition at line 666 of file filechild.cpp.

References _left, _right, and IDW_HEADER_LEFT.

{
    return (pnmh->idFrom==IDW_HEADER_LEFT? _left: _right)->Notify(id, pnmh);
}
void FileChildWindow::refresh (  ) [protected]

Definition at line 544 of file filechild.cpp.

References Pane::_cur, Entry::_expanded, _left, expand_entry(), and scan_entry().

Referenced by WndProc().

{
    WaitCursor wait;
    bool expanded = _left->_cur->_expanded;

    scan_entry(_left->_cur);

    if (expanded)
        expand_entry(_left->_cur);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FileChildWindow::resize_children ( int  cx,
int  cy 
) [protected, virtual]

Reimplemented from ChildWindow.

Definition at line 408 of file filechild.cpp.

References Pane::_hwndHeader, _left, ChildWindow::_left_hwnd, _right, ChildWindow::_right_hwnd, ChildWindow::_split_pos, and SPLIT_WIDTH.

Referenced by WndProc().

{
    HDWP hdwp = BeginDeferWindowPos(4);
    RECT rt;

    rt.left   = 0;
    rt.top    = 0;
    rt.right  = cx;
    rt.bottom = cy;

    cx = _split_pos + SPLIT_WIDTH/2;

    if (_left && _right) {
        WINDOWPOS wp;
        HD_LAYOUT hdl;

        hdl.prc   = &rt;
        hdl.pwpos = &wp;

        Header_Layout(_left->_hwndHeader, &hdl);

        hdwp = DeferWindowPos(hdwp, _left->_hwndHeader, wp.hwndInsertAfter,
                            wp.x-1, wp.y, _split_pos-SPLIT_WIDTH/2+1, wp.cy, wp.flags);

        hdwp = DeferWindowPos(hdwp, _right->_hwndHeader, wp.hwndInsertAfter,
                                rt.left+cx+1, wp.y, wp.cx-cx+2, wp.cy, wp.flags);
    }

    if (_left_hwnd)
        hdwp = DeferWindowPos(hdwp, _left_hwnd, 0, rt.left, rt.top, _split_pos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);

    if (_right_hwnd)
        hdwp = DeferWindowPos(hdwp, _right_hwnd, 0, rt.left+cx+1, rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);

    EndDeferWindowPos(hdwp);
}

Here is the caller graph for this function:

void FileChildWindow::scan_entry ( Entry entry ) [protected]

Todo:
use modifyable sort order instead of fixed file system default

Definition at line 628 of file filechild.cpp.

References Entry::_down, Entry::_expanded, _header_wdths_ok, ChildWindow::_left_hwnd, Entry::_level, _right, ChildWindow::_right_hwnd, _root, Root::_sort_order, Pane::calc_widths(), CONTEXT, Entry::free_subentries(), Pane::insert_entries(), Entry::read_directory_base(), and Pane::set_header().

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

{
    CONTEXT("FileChildWindow::scan_entry()");

    int idx = ListBox_GetCurSel(_left_hwnd);

     // delete sub entries in left pane
    for(;;) {
        LRESULT res = ListBox_GetItemData(_left_hwnd, idx+1);
        Entry* sub = (Entry*) res;

        if (res==LB_ERR || !sub || sub->_level<=entry->_level)
            break;

        ListBox_DeleteString(_left_hwnd, idx+1);
    }

     // empty right pane
    ListBox_ResetContent(_right_hwnd);

     // release memory
    entry->free_subentries();
    entry->_expanded = false;

     // read contents from disk
    entry->read_directory_base(_root._sort_order);  ///@todo use modifyable sort order instead of fixed file system default

     // insert found entries in right pane
    HiddenWindow hide(_right_hwnd);
    _right->insert_entries(entry->_down);

    _right->calc_widths(false);
    _right->set_header();

    _header_wdths_ok = false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FileChildWindow::set_curdir ( Entry entry ) [protected]

Todo:
make configurable (This call takes really _very_ long compared to all other processing!)

Definition at line 269 of file filechild.cpp.

References Pane::_cur, Entry::_down, WindowHandle::_hwnd, _left, _path, _right, ChildWindow::_right_hwnd, Pane::_root, Entry::_scanned, Pane::calc_widths(), CONTEXT, COUNTOF, Entry::get_path(), Pane::insert_entries(), scan_entry(), Pane::set_header(), ChildWindow::set_url(), and TEXT.

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

{
    CONTEXT("FileChildWindow::set_curdir()");

    _path[0] = TEXT('\0');

    _left->_cur = entry;
    _right->_root = entry&&entry->_down? entry->_down: entry;
    _right->_cur = entry;

    if (entry) {
        WaitCursor wait;

        if (!entry->_scanned)
            scan_entry(entry);
        else {
            HiddenWindow hide(_right_hwnd);

            ListBox_ResetContent(_right_hwnd);
            _right->insert_entries(entry->_down);

            _right->calc_widths(false); ///@todo make configurable (This call takes really _very_ long compared to all other processing!)

            _right->set_header();
        }

        entry->get_path(_path, COUNTOF(_path));
    }

    if (_hwnd)  // only change window title if the window already exists
        SetWindowText(_hwnd, _path);

    if (_path[0])
    {
        if (SetCurrentDirectory(_path))
            set_url(_path); //set_url(FmtString(TEXT("file://%s"), _path));
        else
            _path[0] = TEXT('\0');
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FileChildWindow::set_focus_pane ( Pane pane ) [inline]

Definition at line 124 of file filechild.h.

References ChildWindow::_focus_pane, and _right.

Referenced by Pane::WndProc().

        {_focus_pane = pane==_right? 1: 0;}

Here is the caller graph for this function:

void FileChildWindow::switch_focus_pane (  ) [inline]

Definition at line 127 of file filechild.h.

References ChildWindow::_focus_pane, _left, and _right.

Referenced by Pane::WndProc().

        {SetFocus(_focus_pane? *_left: *_right);}

Here is the caller graph for this function:

LRESULT FileChildWindow::WndProc ( UINT  nmsg,
WPARAM  wparam,
LPARAM  lparam 
) [protected, virtual]

Reimplemented from ExtContextMenuHandlerT< ChildWindow >.

Definition at line 446 of file filechild.cpp.

References ExtContextMenuHandlerT< ChildWindow >::_cm_ifs, Pane::_cur, Root::_entry, Entry::_etype, ChildWindow::_focus_pane, WindowHandle::_hwnd, _left, ChildWindow::_left_hwnd, _path, _right, ChildWindow::_right_hwnd, _root, activate_entry(), CHECKERROR, Pane::command(), CONTEXT, COUNTOF, create(), Entry::do_context_menu(), Pane::draw_item(), ET_SHELL, Entry::get_path(), HWND, ID_ACTIVATE, ID_REFRESH, ID_WINDOW_NEW, IDW_TREE_LEFT, IDW_TREE_RIGHT, PM_DISPATCH_COMMAND, PM_GET_FILEWND_PTR, refresh(), resize_children(), ScreenToClient(), and ExtContextMenuHandlerT< ChildWindow >::WndProc().

{
    switch(nmsg) {
        case WM_DRAWITEM: {
            LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lparam;
            Entry* entry = (Entry*) dis->itemData;

            if (dis->CtlID == IDW_TREE_LEFT) {
                _left->draw_item(dis, entry);
                return TRUE;
            } else if (dis->CtlID == IDW_TREE_RIGHT) {
                _right->draw_item(dis, entry);
                return TRUE;
            }

            goto def;}

        case WM_SIZE:
            if (wparam != SIZE_MINIMIZED)
                resize_children(LOWORD(lparam), HIWORD(lparam));
            return DefMDIChildProc(_hwnd, nmsg, wparam, lparam);

        case PM_GET_FILEWND_PTR:
            return (LRESULT)this;

        case WM_SETFOCUS: {
            TCHAR path[MAX_PATH];

            if (_left && _left->_cur) {
                _left->_cur->get_path(path, COUNTOF(path));
                SetCurrentDirectory(path);
            }

            SetFocus(_focus_pane? _right_hwnd: _left_hwnd);
            goto def;}

        case PM_DISPATCH_COMMAND: {
            Pane* pane = GetFocus()==_left_hwnd? _left: _right;

            switch(LOWORD(wparam)) {
              case ID_WINDOW_NEW: {CONTEXT("FileChildWindow PM_DISPATCH_COMMAND ID_WINDOW_NEW");
                if (_root._entry->_etype == ET_SHELL)
                    FileChildWindow::create(ShellChildWndInfo(GetParent(_hwnd)/*_hmdiclient*/, _path, DesktopFolderPath()));
                else
                    FileChildWindow::create(FileChildWndInfo(GetParent(_hwnd)/*_hmdiclient*/, _path));
                break;}

              case ID_REFRESH: {CONTEXT("ID_REFRESH");
                refresh();
                break;}

              case ID_ACTIVATE: {CONTEXT("ID_ACTIVATE");
                activate_entry(pane);
                break;}

              default:
                if (pane->command(LOWORD(wparam)))
                    return TRUE;
                else
                    return super::WndProc(nmsg, wparam, lparam);
            }

            return TRUE;}

        case WM_CONTEXTMENU: {
             // first select the current item in the listbox
            HWND hpanel = (HWND) wparam;
            POINT pt;
            pt.x = LOWORD(lparam);
            pt.y = HIWORD(lparam);
            POINT pt_screen = pt;
            ScreenToClient(hpanel, &pt);
            SendMessage(hpanel, WM_LBUTTONDOWN, 0, MAKELONG(pt.x, pt.y));
            SendMessage(hpanel, WM_LBUTTONUP, 0, MAKELONG(pt.x, pt.y));

             // now create the popup menu using shell namespace and IContextMenu
            Pane* pane = GetFocus()==_left_hwnd? _left: _right;
            int idx = ListBox_GetCurSel(*pane);
            if (idx != -1) {
                Entry* entry = (Entry*) ListBox_GetItemData(*pane, idx);

                HRESULT hr = entry->do_context_menu(_hwnd, pt_screen, _cm_ifs);

                if (SUCCEEDED(hr))
                    refresh();
                else
                    CHECKERROR(hr);
            }
            break;}

        default: def:
            return super::WndProc(nmsg, wparam, lparam);
    }

    return 0;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 119 of file filechild.h.

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

TCHAR FileChildWindow::_path[MAX_PATH] [protected]

Definition at line 118 of file filechild.h.

Referenced by set_curdir(), and WndProc().

Definition at line 115 of file filechild.h.

Referenced by FileChildWindow(), get_root(), jump_to_int(), scan_entry(), and WndProc().


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

ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage