Class ChildWindow represents MDI child windows. More...
#include <window.h>
Public Types | |
typedef Window | super |
Public Member Functions | |
ChildWindow (HWND hwnd, const ChildWndInfo &info) | |
bool | go_to (LPCTSTR url) |
Static Public Member Functions | |
static ChildWindow * | create (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 | |
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 |
Class ChildWindow represents MDI child windows.
It is used with class MainFrame.
Definition at line 289 of file window.h.
typedef Window ChildWindow::super |
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.
: super(hwnd), _hwndFrame(GetParent(info._hmdiclient)) { _focus_pane = 0; _split_pos = DEFAULT_SPLIT_POS; _last_split = DEFAULT_SPLIT_POS; }
ChildWindow * ChildWindow::create | ( | const ChildWndInfo & | info, |
const RECT & | rect, | ||
CREATORFUNC_INFO | creator, | ||
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.
{ MDICREATESTRUCT mcs; mcs.szClass = classname; mcs.szTitle = title; mcs.hOwner = g_Globals._hInstance; mcs.x = rect.left, mcs.y = rect.top; mcs.cx = rect.right - rect.left; mcs.cy = rect.bottom - rect.top; mcs.style = style; mcs.lParam = 0; return static_cast<ChildWindow*>(create_mdi_child(info, mcs, creator)); }
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()) { set_url(url_str); _url_history.push(url_str); return true; } else return false; }
Implemented in FileChildWindow, MDIShellBrowserChild, and WebChildWindow.
Referenced by go_to(), and WndProc().
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; rt.top = 0; rt.right = cx; rt.bottom = cy; if (_left_hwnd) { cx = _split_pos + SPLIT_WIDTH/2; 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); } else { _split_pos = 0; cx = 0; } 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); }
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); } }
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.top-1, rt.right, rt.bottom+1); SetRect(&rc, rt.left, rt.top-1, rt.right, rt.bottom+1); DrawEdge(canvas, &rc, EDGE_RAISED, BF_RECT); SelectObject(canvas, lastBrush); break;} case WM_SETCURSOR: if (LOWORD(lparam) == HTCLIENT) { POINT pt; GetCursorPos(&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; case WM_GETMINMAXINFO: 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 break;} 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; SetCapture(_hwnd); } break;} case WM_LBUTTONUP: if (GetCapture() == _hwnd) ReleaseCapture(); break; 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; ReleaseCapture(); SetCursor(LoadCursor(0, IDC_ARROW)); } break; 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); UpdateWindow(_left_hwnd); UpdateWindow(_hwnd); UpdateWindow(_right_hwnd); } } break; case PM_DISPATCH_COMMAND: switch(LOWORD(wparam)) { case ID_GO_BACK: if (!_url_history.empty()) { const String& url = jump_to_int(_url_history.top()); if (jump_to_int(url)) set_url(url); _url_history.pop(); } break; case ID_GO_FORWARD: //@@ break; case ID_GO_UP: ///@todo break; case ID_GO_HOME: //@@ break; default: 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()); } break; case PM_JUMP_TO_URL: return go_to((LPCTSTR)lparam)? TRUE: FALSE; default: def: return DefMDIChildProc(_hwnd, nmsg, wparam, lparam); } return 0; }
int ChildWindow::_focus_pane [protected] |
Definition at line 311 of file window.h.
Referenced by ChildWindow(), FileChildWindow::set_focus_pane(), FileChildWindow::switch_focus_pane(), and FileChildWindow::WndProc().
HWND ChildWindow::_hwndFrame [protected] |
Definition at line 316 of file window.h.
Referenced by set_url(), WebChildWindow::StatusTextChange(), MDIShellBrowserChild::update_shell_browser(), and WndProc().
int ChildWindow::_last_split [protected] |
Definition at line 314 of file window.h.
Referenced by ChildWindow(), and WndProc().
WindowHandle ChildWindow::_left_hwnd [protected] |
Definition at line 309 of file window.h.
Referenced by FileChildWindow::activate_entry(), FileChildWindow::Command(), MDIShellBrowserChild::entry_selected(), FileChildWindow::expand_entry(), FileChildWindow::FileChildWindow(), FileChildWindow::jump_to_int(), resize_children(), FileChildWindow::resize_children(), FileChildWindow::scan_entry(), MDIShellBrowserChild::update_shell_browser(), WndProc(), and FileChildWindow::WndProc().
MenuInfo* ChildWindow::_menu_info [protected] |
WindowHandle ChildWindow::_right_hwnd [protected] |
Definition at line 310 of file window.h.
Referenced by FileChildWindow::FileChildWindow(), resize_children(), FileChildWindow::resize_children(), FileChildWindow::scan_entry(), FileChildWindow::set_curdir(), MDIShellBrowserChild::update_shell_browser(), WndProc(), and FileChildWindow::WndProc().
int ChildWindow::_split_pos [protected] |
Definition at line 313 of file window.h.
Referenced by ChildWindow(), resize_children(), FileChildWindow::resize_children(), MDIShellBrowserChild::update_shell_browser(), and WndProc().
String ChildWindow::_statusText [protected] |
Definition at line 317 of file window.h.
Referenced by WebChildWindow::StatusTextChange(), and WndProc().
String ChildWindow::_url [protected] |
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().
ROS Explorer Source Code Documentation
generated on 02.01.2013 by ![]() |