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

ChildWindow Struct Reference

Class ChildWindow represents MDI child windows. More...

#include <window.h>

Inheritance diagram for ChildWindow:
Inheritance graph
Collaboration diagram for ChildWindow:
Collaboration graph

List of all members.

Public Types

typedef Window super

Public Member Functions

 ChildWindow (HWND hwnd, const ChildWndInfo &info)
bool go_to (LPCTSTR url)

Static Public Member Functions

static ChildWindowcreate (const ChildWndInfo &info, const RECT &rect, CREATORFUNC_INFO creator, LPCTSTR classname, LPCTSTR title=NULL, DWORD style=0)

Protected Member Functions

LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
virtual void resize_children (int cx, int cy)
virtual String jump_to_int (LPCTSTR url)=0
void set_url (LPCTSTR url)

Protected Attributes

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

Detailed Description

Class ChildWindow represents MDI child windows.

It is used with class MainFrame.

Definition at line 289 of file window.h.

Member Typedef Documentation

Constructor & Destructor Documentation

ChildWindow::ChildWindow ( HWND  hwnd,
const ChildWndInfo info 

Definition at line 362 of file window.cpp.

References _focus_pane, _last_split, _split_pos, and DEFAULT_SPLIT_POS.

Member Function Documentation

ChildWindow * ChildWindow::create ( const ChildWndInfo info,
const RECT &  rect,
LPCTSTR  classname,
LPCTSTR  title = NULL,
DWORD  style = 0 
) [static]

Definition at line 372 of file window.cpp.

References ExplorerGlobals::_hInstance, Window::create_mdi_child(), and g_Globals.


    mcs.szClass = classname;
    mcs.szTitle = title;
    mcs.hOwner  = g_Globals._hInstance;
    mcs.x       = rect.left,
    mcs.y       =;      = rect.right - rect.left;      = rect.bottom -;   = style;
    mcs.lParam  = 0;

    return static_cast<ChildWindow*>(create_mdi_child(info, mcs, creator));

Here is the call graph for this function:

bool ChildWindow::go_to ( LPCTSTR  url )

Definition at line 556 of file window.cpp.

References _url_history, jump_to_int(), and set_url().

Referenced by WndProc().

    const String& url_str = jump_to_int(url);

    if (!url_str.empty()) {


        return true;
    } else
        return false;

Here is the call graph for this function:

Here is the caller graph for this function:

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

Implemented in FileChildWindow, MDIShellBrowserChild, and WebChildWindow.

Referenced by go_to(), and WndProc().

Here is the caller graph for this function:

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

Reimplemented in FileChildWindow.

Definition at line 530 of file window.cpp.

References _left_hwnd, _right_hwnd, _split_pos, and SPLIT_WIDTH.

Referenced by MDIShellBrowserChild::entry_selected(), and WndProc().

    HDWP hdwp = BeginDeferWindowPos(2);
    RECT rt;

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

    if (_left_hwnd) {
        cx = _split_pos + SPLIT_WIDTH/2;

        hdwp = DeferWindowPos(hdwp, _left_hwnd, 0, rt.left,, _split_pos-SPLIT_WIDTH/2-rt.left,, SWP_NOZORDER|SWP_NOACTIVATE);
    } else {
        _split_pos = 0;
        cx = 0;

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


Here is the caller graph for this function:

void ChildWindow::set_url ( LPCTSTR  url ) [protected]

Definition at line 570 of file window.cpp.

References _hwndFrame, _url, and PM_URL_CHANGED.

Referenced by MDIShellBrowserChild::entry_selected(), go_to(), WebChildWindow::NavigateComplete2(), FileChildWindow::set_curdir(), and WndProc().

    if (_url != url) {
        _url = url;

        SendMessage(_hwndFrame, PM_URL_CHANGED, 0, (LPARAM)url);

Here is the caller graph for this function:

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


Reimplemented from Window.

Reimplemented in FileChildWindow, MDIShellBrowserChild, WebChildWindow, ShellBrowserChildT< ChildWindow >, IPCtrlWindow< ChildWindow, SIfacePtr< IWebBrowser2 > >, ExtContextMenuHandlerT< ChildWindow >, and ExtContextMenuHandlerT< ShellBrowserChildT< ChildWindow > >.

Definition at line 391 of file window.cpp.

References WindowHandle::_hwnd, _hwndFrame, _last_split, _left_hwnd, _right_hwnd, _split_pos, _statusText, _url, _url_history, COLOR_SPLITBAR, go_to(), HWND, ID_GO_BACK, ID_GO_FORWARD, ID_GO_HOME, ID_GO_UP, jump_to_int(), PM_DISPATCH_COMMAND, PM_JUMP_TO_URL, PM_SETSTATUSTEXT, PM_URL_CHANGED, resize_children(), ScreenToClient(), set_url(), and SPLIT_WIDTH.

    switch(nmsg) {
      case WM_PAINT: {
        RECT rc;
        PaintCanvas canvas(_hwnd);
        ClientRect rt(_hwnd);
        rt.left = _split_pos-SPLIT_WIDTH/2;
        rt.right = _split_pos+SPLIT_WIDTH/2+1;
        HBRUSH lastBrush = SelectBrush(canvas, GetStockBrush(COLOR_SPLITBAR));
        Rectangle(canvas, rt.left,, rt.right, rt.bottom+1);
        SetRect(&rc, rt.left,, rt.right, rt.bottom+1);
        DrawEdge(canvas, &rc, EDGE_RAISED, BF_RECT);
        SelectObject(canvas, lastBrush);

      case WM_SETCURSOR:
        if (LOWORD(lparam) == HTCLIENT) {
            POINT pt;
            ScreenToClient(_hwnd, &pt);

            if (pt.x>=_split_pos-SPLIT_WIDTH/2 && pt.x<_split_pos+SPLIT_WIDTH/2+1) {
                SetCursor(LoadCursor(0, IDC_SIZEWE));
                return TRUE;
        goto def;

      case WM_SIZE:
        if (wparam != SIZE_MINIMIZED)
            resize_children(LOWORD(lparam), HIWORD(lparam));
        goto def;

        DefMDIChildProc(_hwnd, nmsg, wparam, lparam);

        {LPMINMAXINFO lpmmi = (LPMINMAXINFO)lparam;

        lpmmi->ptMaxTrackSize.x <<= 1;  // 2*GetSystemMetrics(SM_CXSCREEN) / SM_CXVIRTUALSCREEN
        lpmmi->ptMaxTrackSize.y <<= 1;  // 2*GetSystemMetrics(SM_CYSCREEN) / SM_CYVIRTUALSCREEN

      case WM_LBUTTONDOWN: {
        int x = GET_X_LPARAM(lparam);

        ClientRect rt(_hwnd);

        if (x>=_split_pos-SPLIT_WIDTH/2 && x<_split_pos+SPLIT_WIDTH/2+1) {
            _last_split = _split_pos;


      case WM_LBUTTONUP:
        if (GetCapture() == _hwnd)

      case WM_KEYDOWN:
        if (wparam == VK_ESCAPE)
            if (GetCapture() == _hwnd) {
                _split_pos = _last_split;
                ClientRect rt(_hwnd);
                resize_children(rt.right, rt.bottom);
                _last_split = -1;
                SetCursor(LoadCursor(0, IDC_ARROW));

      case WM_MOUSEMOVE:
        if (GetCapture() == _hwnd) {
            int x = GET_X_LPARAM(lparam);

            ClientRect rt(_hwnd);

            if (x>=0 && x<rt.right) {
                _split_pos = x;
                resize_children(rt.right, rt.bottom);
                rt.left = x-SPLIT_WIDTH/2;
                rt.right = x+SPLIT_WIDTH/2+1;
                InvalidateRect(_hwnd, &rt, FALSE);

        switch(LOWORD(wparam)) {
          case ID_GO_BACK:
            if (!_url_history.empty()) {
                const String& url = jump_to_int(;

                if (jump_to_int(url))


          case ID_GO_FORWARD:

          case ID_GO_UP:

          case ID_GO_HOME:

            return FALSE;
        return TRUE;

      case WM_MDIACTIVATE:
        if ((HWND)lparam == _hwnd) {
            SendMessage(_hwndFrame, PM_SETSTATUSTEXT, 0, (LPARAM)_statusText.c_str());
            SendMessage(_hwndFrame, PM_URL_CHANGED, 0, (LPARAM)_url.c_str());

      case PM_JUMP_TO_URL:
        return go_to((LPCTSTR)lparam)? TRUE: FALSE;

      default: def:
        return DefMDIChildProc(_hwnd, nmsg, wparam, lparam);

    return 0;

Here is the call graph for this function:

Member Data Documentation

int ChildWindow::_focus_pane [protected]
int ChildWindow::_last_split [protected]

Definition at line 314 of file window.h.

Referenced by ChildWindow(), and WndProc().

Definition at line 307 of file window.h.

int ChildWindow::_split_pos [protected]

Definition at line 317 of file window.h.

Referenced by WebChildWindow::StatusTextChange(), and WndProc().

Definition at line 318 of file window.h.

Referenced by set_url(), WndProc(), and MDIShellBrowserChild::WndProc().

stack<String> ChildWindow::_url_history [protected]

Definition at line 320 of file window.h.

Referenced by FileChildWindow::FileChildWindow(), go_to(), 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