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

MDIMainFrame Struct Reference

#include <mainframe.h>

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

List of all members.

Public Types

typedef MainFrameBase super

Public Member Functions

 MDIMainFrame (HWND hwnd)
ChildWindowCreateChild (LPCTSTR path=NULL, int mode=OWM_EXPLORE|OWM_DETAILS)
ChildWindowCreateChild (LPCITEMIDLIST pidl, int mode=OWM_EXPLORE|OWM_DETAILS|OWM_PIDL)

Static Public Member Functions

static HWND Create ()
static HWND Create (LPCTSTR path, int mode=OWM_EXPLORE|OWM_DETAILS)
static HWND Create (LPCITEMIDLIST pidl, int mode=OWM_EXPLORE|OWM_DETAILS|OWM_PIDL)

Protected Member Functions

LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
int Command (int id, int code)
virtual BOOL TranslateMsg (MSG *pmsg)
bool activate_drive_window (LPCTSTR path)
bool activate_child_window (LPCTSTR filesys)
virtual void resize_frame (int cx, int cy)
virtual void frame_get_clientspace (PRECT prect)
virtual bool go_to (LPCTSTR url, bool new_window)

Protected Attributes

HWND _hmdiclient
WindowHandle _hextrabar
WindowHandle _hdrivebar
TCHAR _drives [BUFFER_LEN]

Detailed Description

Definition at line 98 of file mainframe.h.


Member Typedef Documentation

Reimplemented from MainFrameBase.

Definition at line 100 of file mainframe.h.


Constructor & Destructor Documentation

MDIMainFrame::MDIMainFrame ( HWND  hwnd )

Definition at line 717 of file mainframe.cpp.

References _drives, _hdrivebar, _hextrabar, ExplorerGlobals::_hInstance, _hmdiclient, MenuInfo::_hMenuView, MainFrameBase::_hMenuWindow, MainFrameBase::_htoolbar, MainFrameBase::_hwndrebar, MainFrameBase::_menu_info, BUFFER_LEN, g_Globals, ID_DRIVE_DESKTOP, ID_DRIVE_FAT, ID_DRIVE_FIRST, ID_DRIVE_NTOBJ_NS, ID_DRIVE_REGISTRY, ID_DRIVE_SHELL_NS, ID_DRIVE_UNIX_FS, ID_VIEW_DRIVE_BAR, ID_VIEW_EXTRA_BAR, ID_WEB_WINDOW, ID_WINDOW_CASCADE, ID_WINDOW_NEW, ID_WINDOW_TILE_HORZ, ID_WINDOW_TILE_VERT, IDB_DRIVEBAR, IDW_DRIVEBAR, IDW_EXTRABAR, IDW_FIRST_CHILD, RBBS_HIDETITLE, TEXT, and W_VER_NT.

 :  super(hwnd)
{
    TBBUTTON mdiBtns[] = {
        {0, 0, 0, BTNS_SEP, {0, 0}, 0, 0},
        {0, ID_WINDOW_NEW, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
        {1, ID_WINDOW_CASCADE, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
        {2, ID_WINDOW_TILE_HORZ, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
        {3, ID_WINDOW_TILE_VERT, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0}
    };

    SendMessage(_htoolbar, TB_ADDBUTTONS, sizeof(mdiBtns)/sizeof(TBBUTTON), (LPARAM)&mdiBtns);

    CLIENTCREATESTRUCT ccs;

    ccs.hWindowMenu = _hMenuWindow;
    ccs.idFirstChild = IDW_FIRST_CHILD;

    _hmdiclient = CreateWindowEx(WS_EX_CLIENTEDGE|WS_EX_NOPARENTNOTIFY, TEXT("MDICLIENT"), NULL,
                    WS_CHILD|WS_CLIPCHILDREN|WS_VSCROLL|WS_HSCROLL|WS_VISIBLE|WS_BORDER,
                    0, 0, 0, 0,
                    hwnd, 0, g_Globals._hInstance, &ccs);

    TBBUTTON extraBtns = {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0};

#ifndef _NO_REBAR
    _hextrabar = CreateToolbarEx(hwnd,
                CCS_NOPARENTALIGN|CCS_NORESIZE|CCS_NODIVIDER|
                WS_CHILD|TBSTYLE_FLAT|WS_VISIBLE|CCS_NOMOVEY|TBSTYLE_LIST,
                IDW_EXTRABAR, 2, g_Globals._hInstance, IDB_DRIVEBAR, NULL, 0,
                16, 15, 16, 15, sizeof(TBBUTTON));
#else
    _hextrabar = CreateToolbarEx(hwnd,
                WS_CHILD|WS_VISIBLE|CCS_NOMOVEY|TBSTYLE_LIST,CCS_NODIVIDER|
                IDW_EXTRABAR, 2, g_Globals._hInstance, IDB_DRIVEBAR, &extraBtns, 1,
                16, 13, 16, 13, sizeof(TBBUTTON));
#endif

    CheckMenuItem(_menu_info._hMenuView, ID_VIEW_EXTRA_BAR, MF_BYCOMMAND|MF_CHECKED);


    extraBtns.fsStyle = BTNS_BUTTON;

#ifdef __WINE__
     // insert unix file system button
    extraBtns.iString = SendMessage(_hextrabar, TB_ADDSTRING, 0, (LPARAM)TEXT("/\0"));
    extraBtns.idCommand = ID_DRIVE_UNIX_FS;
    SendMessage(_hextrabar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&extraBtns);
#endif

     // insert explorer window button
    extraBtns.iString = SendMessage(_hextrabar, TB_ADDSTRING, 0, (LPARAM)TEXT("Explore\0"));
    extraBtns.idCommand = ID_DRIVE_DESKTOP;
    SendMessage(_hextrabar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&extraBtns);

     // insert shell namespace button
    extraBtns.iString = SendMessage(_hextrabar, TB_ADDSTRING, 0, (LPARAM)TEXT("Shell\0"));
    extraBtns.idCommand = ID_DRIVE_SHELL_NS;
    extraBtns.iBitmap = 6;
    SendMessage(_hextrabar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&extraBtns);

     // insert web control button
    extraBtns.iString = SendMessage(_hextrabar, TB_ADDSTRING, 0, (LPARAM)TEXT("Web\0"));
    extraBtns.idCommand = ID_WEB_WINDOW;
    extraBtns.iBitmap = 7;
    SendMessage(_hextrabar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&extraBtns);

    if ((HIWORD(GetVersion())>>14) == W_VER_NT) {
         // insert NT object namespace button
        extraBtns.iString = SendMessage(_hextrabar, TB_ADDSTRING, 0, (LPARAM)TEXT("NT Obj\0"));
        extraBtns.idCommand = ID_DRIVE_NTOBJ_NS;
        extraBtns.iBitmap = 8;
        SendMessage(_hextrabar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&extraBtns);
    }
#ifndef __REACTOS__ // don't insert reg button for ROS. Regedit should be used.
     // insert Registry button
    extraBtns.iString = SendMessage(_hextrabar, TB_ADDSTRING, 0, (LPARAM)TEXT("Reg.\0"));
    extraBtns.idCommand = ID_DRIVE_REGISTRY;
    extraBtns.iBitmap = 9;
    SendMessage(_hextrabar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&extraBtns);
#endif

#ifdef _DEBUG
     // insert FAT direct file system access button
    extraBtns.iString = SendMessage(_hextrabar, TB_ADDSTRING, 0, (LPARAM)TEXT("FAT\0"));
    extraBtns.idCommand = ID_DRIVE_FAT;
    extraBtns.iBitmap = 10;
    SendMessage(_hextrabar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&extraBtns);
#endif


    TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0};
#ifndef _NO_WIN_FS
    PTSTR p;

#ifndef _NO_REBAR
    _hdrivebar = CreateToolbarEx(hwnd,
                CCS_NOPARENTALIGN|CCS_NORESIZE|CCS_NODIVIDER|
                WS_CHILD|WS_VISIBLE|TBSTYLE_FLAT|CCS_NOMOVEY|TBSTYLE_LIST,
                IDW_DRIVEBAR, 2, g_Globals._hInstance, IDB_DRIVEBAR, NULL, 0,
                16, 15, 16, 15, sizeof(TBBUTTON));
#else
    _hdrivebar = CreateToolbarEx(hwnd,
                WS_CHILD|WS_VISIBLE|CCS_NOMOVEY|TBSTYLE_LIST|CCS_NODIVIDER,
                IDW_DRIVEBAR, 2, g_Globals._hInstance, IDB_DRIVEBAR, &drivebarBtn, 1,
                16, 13, 16, 13, sizeof(TBBUTTON));
#endif
#endif

    CheckMenuItem(_menu_info._hMenuView, ID_VIEW_DRIVE_BAR, MF_BYCOMMAND|MF_CHECKED);


#ifndef _NO_WIN_FS
    GetLogicalDriveStrings(BUFFER_LEN, _drives);

     // register windows drive root strings
    SendMessage(_hdrivebar, TB_ADDSTRING, 0, (LPARAM)_drives);

    drivebarBtn.fsStyle = BTNS_BUTTON;
    drivebarBtn.idCommand = ID_DRIVE_FIRST;

    for(p=_drives; *p; ) {
        switch(GetDriveType(p)) {
            case DRIVE_REMOVABLE:   drivebarBtn.iBitmap = 1;    break;
            case DRIVE_CDROM:       drivebarBtn.iBitmap = 3;    break;
            case DRIVE_REMOTE:      drivebarBtn.iBitmap = 4;    break;
            case DRIVE_RAMDISK:     drivebarBtn.iBitmap = 5;    break;
            default:/*DRIVE_FIXED*/ drivebarBtn.iBitmap = 2;
        }

        SendMessage(_hdrivebar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&drivebarBtn);
        ++drivebarBtn.idCommand;
        ++drivebarBtn.iString;

        while(*p++);
    }
#endif


#ifndef _NO_REBAR
    int btn_hgt = HIWORD(SendMessage(_htoolbar, TB_GETBUTTONSIZE, 0, 0));

    REBARBANDINFO rbBand;

    rbBand.cbSize = sizeof(REBARBANDINFO);
    rbBand.fMask  = RBBIM_TEXT|RBBIM_STYLE|RBBIM_CHILD|RBBIM_CHILDSIZE|RBBIM_SIZE;
#ifndef RBBS_HIDETITLE // missing in MinGW headers as of 25.02.2004
#define RBBS_HIDETITLE  0x400
#endif
    rbBand.fStyle = RBBS_CHILDEDGE|RBBS_GRIPPERALWAYS|RBBS_HIDETITLE;

    TCHAR ExtrasBand[] = _T("Extras");
    rbBand.lpText = ExtrasBand;
    rbBand.hwndChild = _hextrabar;
    rbBand.cxMinChild = 0;
    rbBand.cyMinChild = btn_hgt;
    rbBand.cx = 284;
    SendMessage(_hwndrebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);

#ifndef _NO_WIN_FS
    rbBand.fStyle |= RBBS_BREAK;
    TCHAR DrivesBand[] = _T("Drives");
    rbBand.lpText = DrivesBand;
    rbBand.hwndChild = _hdrivebar;
    rbBand.cxMinChild = 0;
    rbBand.cyMinChild = btn_hgt;
    rbBand.cx = 400;
    SendMessage(_hwndrebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);
#endif
#endif
}

Member Function Documentation

bool MDIMainFrame::activate_child_window ( LPCTSTR  filesys ) [protected]

Definition at line 1310 of file mainframe.cpp.

References Root::_fs, _hmdiclient, ShellBrowser::get_root(), FileChildWindow::get_root(), HWND, PM_GET_FILEWND_PTR, and PM_GET_SHELLBROWSER_PTR.

Referenced by Command().

{
    HWND child_wnd;

     // search for a already open window of the given file system name
    for(child_wnd=GetNextWindow(_hmdiclient,GW_CHILD); child_wnd; child_wnd=GetNextWindow(child_wnd, GW_HWNDNEXT)) {
        FileChildWindow* child = (FileChildWindow*) SendMessage(child_wnd, PM_GET_FILEWND_PTR, 0, 0);

        if (child) {
            if (!lstrcmpi(child->get_root()._fs, filesys)) {
                SendMessage(_hmdiclient, WM_MDIACTIVATE, (WPARAM)child_wnd, 0);

                if (IsMinimized(child_wnd))
                    ShowWindow(child_wnd, SW_SHOWNORMAL);

                return true;
            }
        } else {
            ShellBrowser* shell_child = (ShellBrowser*) SendMessage(child_wnd, PM_GET_SHELLBROWSER_PTR, 0, 0);

            if (shell_child) {
                if (!lstrcmpi(shell_child->get_root()._fs, filesys)) {
                    SendMessage(_hmdiclient, WM_MDIACTIVATE, (WPARAM)child_wnd, 0);

                    if (IsMinimized(child_wnd))
                        ShowWindow(child_wnd, SW_SHOWNORMAL);

                    return true;
                }
            }
        }
    }

    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool MDIMainFrame::activate_drive_window ( LPCTSTR  path ) [protected]

Definition at line 1282 of file mainframe.cpp.

References _hmdiclient, _MAX_DRIVE, Root::_path, _tsplitpath_s, COUNTOF, FileChildWindow::get_root(), HWND, and PM_GET_FILEWND_PTR.

Referenced by Command().

{
    TCHAR drv1[_MAX_DRIVE], drv2[_MAX_DRIVE];
    HWND child_wnd;

    _tsplitpath_s(path, drv1, COUNTOF(drv1), NULL, 0, NULL, 0, NULL, 0);

     // search for a already open window for the same drive
    for(child_wnd=GetNextWindow(_hmdiclient,GW_CHILD); child_wnd; child_wnd=GetNextWindow(child_wnd, GW_HWNDNEXT)) {
        FileChildWindow* child = (FileChildWindow*) SendMessage(child_wnd, PM_GET_FILEWND_PTR, 0, 0);

        if (child) {
            _tsplitpath_s(child->get_root()._path, drv2, COUNTOF(drv2), NULL, 0, NULL, 0, NULL, 0);

            if (!lstrcmpi(drv2, drv1)) {
                SendMessage(_hmdiclient, WM_MDIACTIVATE, (WPARAM)child_wnd, 0);

                if (IsMinimized(child_wnd))
                    ShowWindow(child_wnd, SW_SHOWNORMAL);

                return true;
            }
        }
    }

    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Todo:
store last directory per drive
Todo:
prompt for image file
Todo:
There are even more menu items!

Reimplemented from MainFrameBase.

Definition at line 1028 of file mainframe.cpp.

References _drives, MainFrameBase::_haddressedit, _hdrivebar, _hextrabar, _hmdiclient, WindowHandle::_hwnd, _MAX_DRIVE, _tsplitpath_s, activate_child_window(), activate_drive_window(), BUFFER_LEN, MainFrameBase::Command(), CONTEXT, COUNTOF, Create(), MDIShellBrowserChild::create(), FileChildWindow::create(), create_webchildwindow(), display_error(), MainFrameBase::ExecuteCommandbar(), HWND, ID_DRIVE_DESKTOP, ID_DRIVE_FAT, ID_DRIVE_FIRST, ID_DRIVE_NTOBJ_NS, ID_DRIVE_REGISTRY, ID_DRIVE_SHELL_NS, ID_DRIVE_UNIX_FS, ID_EXPLORER_FAQ, ID_VIEW_DRIVE_BAR, ID_VIEW_EXTRA_BAR, ID_VIEW_SDI, ID_WEB_WINDOW, ID_WINDOW_ARRANGE, ID_WINDOW_CASCADE, ID_WINDOW_NEW, ID_WINDOW_TILE_HORZ, ID_WINDOW_TILE_VERT, IDW_COMMANDBAR, PM_DISPATCH_COMMAND, TEXT, and MainFrameBase::toggle_child().

{
    CONTEXT("MDIMainFrame::Command()");

    HWND hwndClient = (HWND) SendMessage(_hmdiclient, WM_MDIGETACTIVE, 0, 0);

    if (hwndClient)
        if (SendMessage(hwndClient, PM_DISPATCH_COMMAND, MAKELONG(id,code), 0))
            return 0;

#ifndef _NO_WIN_FS
    if (id>=ID_DRIVE_FIRST && id<=ID_DRIVE_FIRST+0xFF) {
        TCHAR drv[_MAX_DRIVE], path[MAX_PATH];
        LPCTSTR root = _drives;

        for(int i=id-ID_DRIVE_FIRST; i--; root++)
            while(*root)
                ++root;

        if (activate_drive_window(root))
            return 0;

        _tsplitpath_s(root, drv, COUNTOF(drv), NULL, 0, NULL, 0, NULL, 0);

        if (!SetCurrentDirectory(drv)) {
            display_error(_hwnd, GetLastError());
            return 0;
        }

        GetCurrentDirectory(MAX_PATH, path); ///@todo store last directory per drive

        FileChildWindow::create(FileChildWndInfo(_hmdiclient, path));

        return 1;
    }
#endif

    switch(id) {
      case ID_WINDOW_NEW: {
        TCHAR path[MAX_PATH];

        GetCurrentDirectory(MAX_PATH, path);

        FileChildWindow::create(FileChildWndInfo(_hmdiclient, path));
        break;}

      case ID_WINDOW_CASCADE:
        SendMessage(_hmdiclient, WM_MDICASCADE, 0, 0);
        break;

      case ID_WINDOW_TILE_HORZ:
        SendMessage(_hmdiclient, WM_MDITILE, MDITILE_HORIZONTAL, 0);
        break;

      case ID_WINDOW_TILE_VERT:
        SendMessage(_hmdiclient, WM_MDITILE, MDITILE_VERTICAL, 0);
        break;

      case ID_WINDOW_ARRANGE:
        SendMessage(_hmdiclient, WM_MDIICONARRANGE, 0, 0);
        break;

      case ID_VIEW_EXTRA_BAR:
        toggle_child(_hwnd, id, _hextrabar, 1);
        break;

#ifndef _NO_WIN_FS
      case ID_VIEW_DRIVE_BAR:
        toggle_child(_hwnd, id, _hdrivebar, 2);
        break;
#endif

#ifdef __WINE__
      case ID_DRIVE_UNIX_FS: {
        TCHAR path[MAX_PATH];
        FileChildWindow* child;

        getcwd(path, COUNTOF(path));

        if (activate_child_window(TEXT("unixfs")))
            break;

        FileChildWindow::create(_hmdiclient, FileChildWndInfo(path));
        break;}
#endif

      case ID_DRIVE_DESKTOP: {
        TCHAR path[MAX_PATH];

        if (activate_child_window(TEXT("Desktop")))
            break;

        GetCurrentDirectory(MAX_PATH, path);

        MDIShellBrowserChild::create(ShellChildWndInfo(_hmdiclient, path, DesktopFolderPath()));
        break;}

      case ID_DRIVE_SHELL_NS: {
        TCHAR path[MAX_PATH];
        GetCurrentDirectory(MAX_PATH, path);

        if (activate_child_window(TEXT("Shell")))
            break;

        FileChildWindow::create(ShellChildWndInfo(_hmdiclient, path, DesktopFolderPath()));
        break;}

      case ID_DRIVE_NTOBJ_NS: {
        if (activate_child_window(TEXT("NTOBJ")))
            break;

        FileChildWindow::create(NtObjChildWndInfo(_hmdiclient, TEXT("\\")));
      break;}

      case ID_DRIVE_REGISTRY: {
        if (activate_child_window(TEXT("Registry")))
            break;

        FileChildWindow::create(RegistryChildWndInfo(_hmdiclient, TEXT("\\")));
      break;}

      case ID_DRIVE_FAT: {

        ///@todo prompt for image file

        if (activate_child_window(TEXT("FAT")))
            break;

        FileChildWindow::create(FATChildWndInfo(_hmdiclient, TEXT("FAT Image")));   //@@
      break;}

      case ID_WEB_WINDOW:
#ifdef _DEBUG
        create_webchildwindow(WebChildWndInfo(_hmdiclient, TEXT("http://localhost")));
#else
        create_webchildwindow(WebChildWndInfo(_hmdiclient, TEXT("http://www.reactos.org")));
#endif
        break;

      case ID_EXPLORER_FAQ:
        create_webchildwindow(WebChildWndInfo(_hmdiclient, TEXT("http://www.foxplanet.de/explorer/")));
        break;

      case ID_VIEW_SDI:
        MainFrameBase::Create(ExplorerCmd());
        break;

      case IDW_COMMANDBAR:
        if (code == 1) {
            TCHAR url[BUFFER_LEN];
            LPCTSTR dir;

            if (GetWindowText(_haddressedit, url, BUFFER_LEN))
                dir = url;
            else
                dir = NULL;

            ExecuteCommandbar(dir);
        }
        break;

    ///@todo There are even more menu items!

      default:
        if (super::Command(id, code) == 0)
            return 0;
        else
            return DefFrameProc(_hwnd, _hmdiclient, WM_COMMAND, MAKELONG(id,code), 0);
    }

    return 0;
}

Here is the call graph for this function:

HWND MDIMainFrame::Create ( LPCTSTR  path,
int  mode = OWM_EXPLORE|OWM_DETAILS 
) [static]

Definition at line 900 of file mainframe.cpp.

References Create(), CreateChild(), GET_WINDOW, and HWND.

{
    HWND hFrame = Create();
    if (!hFrame)
        return 0;

    ShowWindow(hFrame, SW_SHOW);

    MDIMainFrame* pMainFrame = GET_WINDOW(MDIMainFrame, hFrame);

    if (pMainFrame)
        pMainFrame->CreateChild(path, mode);

    return hFrame;
}

Here is the call graph for this function:

HWND MDIMainFrame::Create (  ) [static]

Definition at line 890 of file mainframe.cpp.

References ExplorerGlobals::_hframeClass, ExplorerGlobals::_hInstance, g_Globals, IDM_MDIFRAME, IDS_TITLE, and WINDOW_CREATOR.

Referenced by Command(), and Create().

{
    HMENU hMenuFrame = LoadMenu(g_Globals._hInstance, MAKEINTRESOURCE(IDM_MDIFRAME));

    return Window::Create(WINDOW_CREATOR(MDIMainFrame), 0,
                (LPCTSTR)(int)g_Globals._hframeClass, ResString(IDS_TITLE), WS_OVERLAPPEDWINDOW,
                CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
                0/*hwndDesktop*/, hMenuFrame);
}

Here is the caller graph for this function:

HWND MDIMainFrame::Create ( LPCITEMIDLIST  pidl,
int  mode = OWM_EXPLORE|OWM_DETAILS|OWM_PIDL 
) [static]

Definition at line 916 of file mainframe.cpp.

References Create(), CreateChild(), GET_WINDOW, and HWND.

{
    HWND hFrame = Create();
    if (!hFrame)
        return 0;

    ShowWindow(hFrame, SW_SHOW);

    MDIMainFrame* pMainFrame = GET_WINDOW(MDIMainFrame, hFrame);

    if (pMainFrame)
        pMainFrame->CreateChild(pidl, mode);

    return hFrame;
}

Here is the call graph for this function:

ChildWindow * MDIMainFrame::CreateChild ( LPCTSTR  path = NULL,
int  mode = OWM_EXPLORE|OWM_DETAILS 
)

Definition at line 933 of file mainframe.cpp.

References WindowHandle::_hwnd, and PM_OPEN_WINDOW.

Referenced by SDIMainFrame::Create(), Create(), and go_to().

{
    return reinterpret_cast<ChildWindow*>(SendMessage(_hwnd, PM_OPEN_WINDOW, mode, (LPARAM)path));
}

Here is the caller graph for this function:

ChildWindow * MDIMainFrame::CreateChild ( LPCITEMIDLIST  pidl,
int  mode = OWM_EXPLORE|OWM_DETAILS|OWM_PIDL 
)

Definition at line 938 of file mainframe.cpp.

References WindowHandle::_hwnd, OWM_PIDL, and PM_OPEN_WINDOW.

{
    return reinterpret_cast<ChildWindow*>(SendMessage(_hwnd, PM_OPEN_WINDOW, mode|OWM_PIDL, (LPARAM)pidl));
}
void MDIMainFrame::frame_get_clientspace ( PRECT  prect ) [protected, virtual]

Reimplemented from MainFrameBase.

Definition at line 1202 of file mainframe.cpp.

References _hdrivebar, and MainFrameBase::frame_get_clientspace().

{
    super::frame_get_clientspace(prect);

#ifndef _NO_WIN_FS
    if (IsWindowVisible(_hdrivebar)) {
        ClientRect rt(_hdrivebar);
        prect->top += rt.bottom+2;
    }
#endif
}

Here is the call graph for this function:

bool MDIMainFrame::go_to ( LPCTSTR  url,
bool  new_window 
) [protected, virtual]

Reimplemented from MainFrameBase.

Definition at line 1346 of file mainframe.cpp.

References _hmdiclient, CreateChild(), MainFrameBase::go_to(), HWND, and PM_JUMP_TO_URL.

{
    if (!new_window) {
        HWND hwndClient = (HWND) SendMessage(_hmdiclient, WM_MDIGETACTIVE, 0, 0);

        if (hwndClient)
            if (SendMessage(hwndClient, PM_JUMP_TO_URL, 0, (LPARAM)url))
                return true;
    }

    if (CreateChild(url))
        return true;

    return super::go_to(url, new_window);
}

Here is the call graph for this function:

void MDIMainFrame::resize_frame ( int  cx,
int  cy 
) [protected, virtual]

Todo:
use split bar

Reimplemented from MainFrameBase.

Definition at line 1214 of file mainframe.cpp.

References MainFrameBase::_haddressedit, MainFrameBase::_hcommandedit, _hdrivebar, _hextrabar, _hmdiclient, MainFrameBase::_hsidebar, MainFrameBase::_hstatusbar, MainFrameBase::_htoolbar, and MainFrameBase::_hwndrebar.

{
    if (cy <= 0)
        return; // avoid resizing children when receiving RBN_AUTOSIZE while getting minimized

    RECT rect = {0, 0, cx, cy};

    if (_hwndrebar) {
        int height = SendMessage(_hwndrebar, RB_GETBARHEIGHT, 0, 0);
        rect.top += height;
        rect.top += 5;
    } else {
        if (IsWindowVisible(_htoolbar)) {
            SendMessage(_htoolbar, WM_SIZE, 0, 0);
            WindowRect rt(_htoolbar);
            rect.top = rt.bottom;
        //  rect.bottom -= rt.bottom;
        }

        if (IsWindowVisible(_hextrabar)) {
            SendMessage(_hextrabar, WM_SIZE, 0, 0);
            WindowRect rt(_hextrabar);
            int new_top = --rect.top + rt.bottom;
            MoveWindow(_hextrabar, 0, rect.top, rt.right, new_top, TRUE);
            rect.top = new_top;
        //  rect.bottom -= rt.bottom;
        }

#ifndef _NO_WIN_FS
        if (IsWindowVisible(_hdrivebar)) {
            SendMessage(_hdrivebar, WM_SIZE, 0, 0);
            WindowRect rt(_hdrivebar);
            int new_top = --rect.top + rt.bottom;
            MoveWindow(_hdrivebar, 0, rect.top, rt.right, new_top, TRUE);
            rect.top = new_top;
        //  rect.bottom -= rt.bottom;
        }
#endif
    }

    if (IsWindowVisible(_hstatusbar)) {
        int parts[] = {300, 500};

        SendMessage(_hstatusbar, WM_SIZE, 0, 0);
        SendMessage(_hstatusbar, SB_SETPARTS, 2, (LPARAM)&parts);
        ClientRect rt(_hstatusbar);
        rect.bottom -= rt.bottom;
    }

    if (IsWindowVisible(_haddressedit) || IsWindowVisible(_hcommandedit)) {
        ClientRect rt(_haddressedit);
        rect.bottom -= rt.bottom;

        int mid = (rect.right-rect.left) / 2;   ///@todo use split bar
        SetWindowPos(_haddressedit, 0, 0, rect.bottom, mid, rt.bottom, SWP_NOACTIVATE|SWP_NOZORDER);
        SetWindowPos(_hcommandedit, 0, mid+1, rect.bottom, rect.right-(mid+1), rt.bottom, SWP_NOACTIVATE|SWP_NOZORDER);
    }

    if (IsWindowVisible(_hsidebar)) {
        WindowRect rt(_hsidebar);
        rect.left += rt.right-rt.left;

        SetWindowPos(_hsidebar, 0, -1, rect.top-1, rt.right-rt.left, rect.bottom-rect.top+1, SWP_NOACTIVATE|SWP_NOZORDER);
    }

    MoveWindow(_hmdiclient, rect.left-1, rect.top-1, rect.right-rect.left+1, rect.bottom-rect.top+1, TRUE);
}
BOOL MDIMainFrame::TranslateMsg ( MSG *  pmsg ) [protected, virtual]

Reimplemented from MainFrameBase.

Definition at line 944 of file mainframe.cpp.

References _hmdiclient, and MainFrameBase::TranslateMsg().

{
    if (_hmdiclient && TranslateMDISysAccel(_hmdiclient, pmsg))
        return TRUE;

    return super::TranslateMsg(pmsg);
}

Here is the call graph for this function:

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

Todo:
read paths and window placements from registry

Reimplemented from MainFrameBase.

Definition at line 952 of file mainframe.cpp.

References _hmdiclient, WindowHandle::_hwnd, FileChildWndInfo::_open_mode, FileChildWndInfo::_pos, ShellChildWndInfo::_root_shell_path, _tcsstr, ShellPath::assign(), CONTEXT, MDIShellBrowserChild::create(), create_webchildwindow(), GET_WINDOW, LOG, OBJ_CONTEXT, OWM_PIDL, OWM_ROOTED, OWM_SEPARATE, PM_OPEN_WINDOW, MainFrameBase::ProcessMessage(), and TEXT.

{
    switch(nmsg) {
      case PM_OPEN_WINDOW: {
        CONTEXT("MDIMainFrame PM_OPEN_WINDOW");

        TCHAR buffer[MAX_PATH];
        LPCTSTR path;
        ShellPath shell_path = DesktopFolderPath();

        if (lparam) {
            if (wparam & OWM_PIDL) {
                 // take over PIDL from lparam
                shell_path.assign((LPCITEMIDLIST)lparam);   // create as "rooted" window
                FileSysShellPath fsp(shell_path);
                path = fsp;

                if (path) {
                    LOG(FmtString(TEXT("MDIMainFrame PM_OPEN_WINDOW: path=%s"), path));
                    lstrcpy(buffer, path);
                    path = buffer;
                }
            } else {
                 // take over path from lparam
                path = (LPCTSTR)lparam;
                shell_path = path;  // create as "rooted" window
            }
        } else {
            ///@todo read paths and window placements from registry
            if (!GetCurrentDirectory(MAX_PATH, buffer))
                *buffer = '\0';

            path = buffer;
        }

        if (path && _tcsstr(path, TEXT("://"))) {   // "http://...", "ftp://", ...
            OBJ_CONTEXT("create WebChild window", path);

            return (LRESULT)GET_WINDOW(ChildWindow, create_webchildwindow(WebChildWndInfo(_hmdiclient, path)));
        } else {
            OBJ_CONTEXT("create ShellChildWndInfo", path);

             // Shell Namespace as default view
            ShellChildWndInfo create_info(_hmdiclient, path, shell_path);

            if (wparam & OWM_ROOTED)
                create_info._root_shell_path = shell_path;
            else
                create_info._root_shell_path = DesktopFolderPath(); //SpecialFolderPath(CSIDL_DRIVES, _hwnd);

            create_info._pos.showCmd = wparam&OWM_SEPARATE? SW_SHOWNORMAL: SW_SHOWMAXIMIZED;
            create_info._pos.rcNormalPosition.left = CW_USEDEFAULT;
            create_info._pos.rcNormalPosition.top = CW_USEDEFAULT;
            create_info._pos.rcNormalPosition.right = CW_USEDEFAULT;
            create_info._pos.rcNormalPosition.bottom = CW_USEDEFAULT;

            create_info._open_mode = wparam;

        //  FileChildWindow::create(_hmdiclient, create_info);
            return (LRESULT)MDIShellBrowserChild::create(create_info);
        }
        return TRUE;}   // success

      default: {
        LRESULT res;

        if (super::ProcessMessage(nmsg, wparam, lparam, &res))
            return res;
        else
            return DefFrameProc(_hwnd, _hmdiclient, nmsg, wparam, lparam);
      }
    }

    return 0;
}

Here is the call graph for this function:


Member Data Documentation

TCHAR MDIMainFrame::_drives[BUFFER_LEN] [protected]

Definition at line 134 of file mainframe.h.

Referenced by Command(), and MDIMainFrame().

Definition at line 116 of file mainframe.h.

Referenced by Command(), frame_get_clientspace(), MDIMainFrame(), and resize_frame().

Definition at line 114 of file mainframe.h.

Referenced by Command(), MDIMainFrame(), and resize_frame().


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