ReactOS  0.4.12-dev-75-g00dd17e
ChildWindow Struct Referenceabstract

#include <window.h>

Inheritance diagram for ChildWindow:
Collaboration diagram for ChildWindow:

Public Types

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

 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 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)
 
virtual void resize_children (int cx, int cy)
 
virtual String jump_to_int (LPCTSTR url)=0
 
void set_url (LPCTSTR url)
 
- Protected Member Functions inherited from Window
virtual LRESULT Init (LPCREATESTRUCT pcs)
 
virtual int Command (int id, int code)
 
virtual int Notify (int id, NMHDR *pnmh)
 

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
 

Additional Inherited Members

- Public Attributes inherited from Window
IAccessible IAccessible_iface
 
IOleWindow IOleWindow_iface
 
IEnumVARIANT IEnumVARIANT_iface
 
LONG ref
 
- 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)
 
- 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

Class ChildWindow represents MDI child windows. It is used with class MainFrame.

Definition at line 304 of file window.h.

Member Typedef Documentation

◆ super

Definition at line 306 of file window.h.

Constructor & Destructor Documentation

◆ ChildWindow()

ChildWindow::ChildWindow ( HWND  hwnd,
const ChildWndInfo info 
)

Definition at line 359 of file window.cpp.

360  : super(hwnd),
362 {
363  _focus_pane = 0;
366 }
int _last_split
Definition: window.h:329
HWND _hwndFrame
Definition: window.h:331
int _focus_pane
Definition: window.h:326
#define DEFAULT_SPLIT_POS
Definition: window.h:270
HWND _hmdiclient
Definition: window.h:49
PreTranslateWindow super
Definition: window.h:306
HWND WINAPI GetParent(_In_ HWND)
int _split_pos
Definition: window.h:328

Member Function Documentation

◆ create()

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

Definition at line 369 of file window.cpp.

Referenced by MDIShellBrowserChild::create(), and WebChildWindow::create().

371 {
373 
374  mcs.szClass = classname;
375  mcs.szTitle = title;
377  mcs.x = rect.left,
378  mcs.y = rect.top;
379  mcs.cx = rect.right - rect.left;
380  mcs.cy = rect.bottom - rect.top;
381  mcs.style = style;
382  mcs.lParam = 0;
383 
384  return static_cast<ChildWindow*>(create_mdi_child(info, mcs, creator));
385 }
LONG top
Definition: windef.h:297
WCHAR classname[128]
Definition: startup.c:15
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
static Window * create_mdi_child(const ChildWndInfo &info, const MDICREATESTRUCT &mcs, CREATORFUNC_INFO creator)
Definition: window.cpp:118
HINSTANCE _hInstance
Definition: globals.h:270
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
static struct myctx * mcs
Definition: adnstest.c:53
LONG bottom
Definition: windef.h:299
Arabic default style
Definition: afstyles.h:93
static char title[]
Definition: ps.c:92

◆ go_to()

bool ChildWindow::go_to ( LPCTSTR  url)

Definition at line 553 of file window.cpp.

Referenced by WndProc().

554 {
555  const String& url_str = jump_to_int(url);
556 
557  if (!url_str.empty()) {
558  set_url(url_str);
559 
560  _url_history.push(url_str);
561 
562  return true;
563  } else
564  return false;
565 }
static WCHAR String[]
Definition: stringtable.c:55
void push(const value_type &__x)
Definition: _stack.h:86
static const WCHAR url[]
Definition: encode.c:1432
void set_url(LPCTSTR url)
Definition: window.cpp:567
virtual String jump_to_int(LPCTSTR url)=0
stack< String > _url_history
Definition: window.h:335

◆ jump_to_int()

virtual String ChildWindow::jump_to_int ( LPCTSTR  url)
protectedpure virtual

Implemented in WebChildWindow, MDIShellBrowserChild, and FileChildWindow.

Referenced by go_to(), and WndProc().

◆ resize_children()

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

Reimplemented in FileChildWindow.

Definition at line 527 of file window.cpp.

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

528 {
529  HDWP hdwp = BeginDeferWindowPos(2);
530  RECT rt;
531 
532  rt.left = 0;
533  rt.top = 0;
534  rt.right = cx;
535  rt.bottom = cy;
536 
537  if (_left_hwnd) {
538  cx = _split_pos + SPLIT_WIDTH/2;
539 
541  } else {
542  _split_pos = 0;
543  cx = 0;
544  }
545 
546  if (_right_hwnd)
547  hdwp = DeferWindowPos(hdwp, _right_hwnd, 0, rt.left+cx+1, rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
548 
549  EndDeferWindowPos(hdwp);
550 }
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
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
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
int _split_pos
Definition: window.h:328
_Out_opt_ int * cx
Definition: commctrl.h:570
LONG bottom
Definition: windef.h:299

◆ set_url()

void ChildWindow::set_url ( LPCTSTR  url)
protected

Definition at line 567 of file window.cpp.

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

568 {
569  if (_url != url) {
570  _url = url;
571 
573  }
574 }
HWND _hwndFrame
Definition: window.h:331
#define PM_URL_CHANGED
Definition: window.h:391
LONG_PTR LPARAM
Definition: windef.h:208
static const WCHAR url[]
Definition: encode.c:1432
String _url
Definition: window.h:333
#define SendMessage
Definition: winuser.h:5709

◆ WndProc()

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

Reimplemented from Window.

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

Definition at line 388 of file window.cpp.

389 {
390  switch(nmsg) {
391  case WM_PAINT: {
392  RECT rc;
393  PaintCanvas canvas(_hwnd);
394  ClientRect rt(_hwnd);
395  rt.left = _split_pos-SPLIT_WIDTH/2;
396  rt.right = _split_pos+SPLIT_WIDTH/2+1;
397  HBRUSH lastBrush = SelectBrush(canvas, GetStockBrush(COLOR_SPLITBAR));
398  Rectangle(canvas, rt.left, rt.top-1, rt.right, rt.bottom+1);
399  SetRect(&rc, rt.left, rt.top-1, rt.right, rt.bottom+1);
400  DrawEdge(canvas, &rc, EDGE_RAISED, BF_RECT);
401  SelectObject(canvas, lastBrush);
402  break;}
403 
404  case WM_SETCURSOR:
405  if (LOWORD(lparam) == HTCLIENT) {
406  POINT pt;
407  GetCursorPos(&pt);
408  ScreenToClient(_hwnd, &pt);
409 
410  if (pt.x>=_split_pos-SPLIT_WIDTH/2 && pt.x<_split_pos+SPLIT_WIDTH/2+1) {
412  return TRUE;
413  }
414  }
415  goto def;
416 
417  case WM_SIZE:
418  if (wparam != SIZE_MINIMIZED)
420  goto def;
421 
422  case WM_GETMINMAXINFO:
423  DefMDIChildProc(_hwnd, nmsg, wparam, lparam);
424 
425  {LPMINMAXINFO lpmmi = (LPMINMAXINFO)lparam;
426 
427  lpmmi->ptMaxTrackSize.x <<= 1; // 2*GetSystemMetrics(SM_CXSCREEN) / SM_CXVIRTUALSCREEN
428  lpmmi->ptMaxTrackSize.y <<= 1; // 2*GetSystemMetrics(SM_CYSCREEN) / SM_CYVIRTUALSCREEN
429  break;}
430 
431  case WM_LBUTTONDOWN: {
432  int x = GET_X_LPARAM(lparam);
433 
434  ClientRect rt(_hwnd);
435 
436  if (x>=_split_pos-SPLIT_WIDTH/2 && x<_split_pos+SPLIT_WIDTH/2+1) {
438  SetCapture(_hwnd);
439  }
440 
441  break;}
442 
443  case WM_LBUTTONUP:
444  if (GetCapture() == _hwnd)
445  ReleaseCapture();
446  break;
447 
448  case WM_KEYDOWN:
449  if (wparam == VK_ESCAPE)
450  if (GetCapture() == _hwnd) {
452  ClientRect rt(_hwnd);
453  resize_children(rt.right, rt.bottom);
454  _last_split = -1;
455  ReleaseCapture();
457  }
458  break;
459 
460  case WM_MOUSEMOVE:
461  if (GetCapture() == _hwnd) {
462  int x = GET_X_LPARAM(lparam);
463 
464  ClientRect rt(_hwnd);
465 
466  if (x>=0 && x<rt.right) {
467  _split_pos = x;
468  resize_children(rt.right, rt.bottom);
469  rt.left = x-SPLIT_WIDTH/2;
470  rt.right = x+SPLIT_WIDTH/2+1;
471  InvalidateRect(_hwnd, &rt, FALSE);
473  UpdateWindow(_hwnd);
475  }
476  }
477  break;
478 
479  case PM_DISPATCH_COMMAND:
480  switch(LOWORD(wparam)) {
481  case ID_GO_BACK:
482  if (!_url_history.empty()) {
483  const String& url = jump_to_int(_url_history.top());
484 
485  if (jump_to_int(url))
486  set_url(url);
487 
488  _url_history.pop();
489  }
490  break;
491 
492  case ID_GO_FORWARD:
493  //@@
494  break;
495 
496  case ID_GO_UP:
498  break;
499 
500  case ID_GO_HOME:
501  //@@
502  break;
503 
504  default:
505  return FALSE;
506  }
507  return TRUE;
508 
509  case WM_MDIACTIVATE:
510  if ((HWND)lparam == _hwnd) {
513  }
514  break;
515 
516  case PM_JUMP_TO_URL:
517  return go_to((LPCTSTR)lparam)? TRUE: FALSE;
518 
519  default: def:
520  return DefMDIChildProc(_hwnd, nmsg, wparam, lparam);
521  }
522 
523  return 0;
524 }
#define IDC_SIZEWE
Definition: winuser.h:689
#define TRUE
Definition: types.h:120
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
void pop()
Definition: _stack.h:87
int _last_split
Definition: window.h:329
bool empty() const
Definition: _stack.h:82
long y
Definition: polytest.cpp:48
#define WM_LBUTTONDOWN
Definition: winuser.h:1752
long x
Definition: polytest.cpp:48
HWND _hwndFrame
Definition: window.h:331
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
WindowHandle _left_hwnd
Definition: window.h:324
#define pt(x, y)
Definition: drawing.c:79
BOOL WINAPI UpdateWindow(_In_ HWND)
WindowHandle _right_hwnd
Definition: window.h:325
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define PM_URL_CHANGED
Definition: window.h:391
static WCHAR String[]
Definition: stringtable.c:55
String _statusText
Definition: window.h:332
LONG left
Definition: windef.h:296
#define VK_ESCAPE
Definition: winuser.h:2168
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2635
#define ID_GO_UP
Definition: resource.h:210
#define SPLIT_WIDTH
Definition: eventvwr.c:62
#define BF_RECT
Definition: winuser.h:462
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETCURSOR
Definition: winuser.h:1618
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
HWND WINAPI GetCapture(void)
Definition: message.c:2855
struct tagMINMAXINFO * LPMINMAXINFO
#define WM_KEYDOWN
Definition: winuser.h:1691
#define GET_X_LPARAM(lp)
Definition: precomp.h:67
#define DefMDIChildProc
Definition: ros2win.h:33
#define PM_SETSTATUSTEXT
Definition: window.h:340
#define GetStockBrush(i)
Definition: windowsx.h:282
#define WM_SIZE
Definition: winuser.h:1593
static const WCHAR url[]
Definition: encode.c:1432
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define COLOR_SPLITBAR
Definition: window.h:271
String _url
Definition: window.h:333
#define SIZE_MINIMIZED
Definition: winuser.h:2460
#define WM_PAINT
Definition: winuser.h:1602
void set_url(LPCTSTR url)
Definition: window.cpp:567
#define WM_MDIACTIVATE
Definition: winuser.h:1790
UINT WPARAM LPARAM lparam
Definition: msvc.h:92
#define LoadCursor
Definition: winuser.h:5678
#define EDGE_RAISED
Definition: winuser.h:450
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
HWND WINAPI SetCapture(_In_ HWND hWnd)
reference top()
Definition: _stack.h:84
virtual String jump_to_int(LPCTSTR url)=0
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
INT x
Definition: msvc.h:62
virtual void resize_children(int cx, int cy)
Definition: window.cpp:527
#define ID_GO_HOME
Definition: resource.h:208
#define WM_LBUTTONUP
Definition: winuser.h:1753
int _split_pos
Definition: window.h:328
#define WM_MOUSEMOVE
Definition: winuser.h:1751
bool go_to(LPCTSTR url)
Definition: window.cpp:553
#define IDC_ARROW
Definition: winuser.h:682
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2864
#define SendMessage
Definition: winuser.h:5709
#define ID_GO_FORWARD
Definition: resource.h:207
#define HIWORD(l)
Definition: typedefs.h:246
#define SelectBrush(hdc, hbr)
Definition: windowsx.h:485
stack< String > _url_history
Definition: window.h:335
POINT ptMaxTrackSize
Definition: winuser.h:3573
#define HTCLIENT
Definition: winuser.h:2429
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
#define PM_DISPATCH_COMMAND
Definition: window.h:265
#define WM_GETMINMAXINFO
Definition: winuser.h:1622
#define LOWORD(l)
Definition: pedump.c:82
UINT WPARAM wparam
Definition: msvc.h:92
#define ID_GO_BACK
Definition: resource.h:206
#define PM_JUMP_TO_URL
Definition: window.h:390

Member Data Documentation

◆ _focus_pane

int ChildWindow::_focus_pane
protected

Definition at line 326 of file window.h.

Referenced by ChildWindow(), and FileChildWindow::WndProc().

◆ _hwndFrame

HWND ChildWindow::_hwndFrame
protected

Definition at line 331 of file window.h.

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

◆ _last_split

int ChildWindow::_last_split
protected

Definition at line 329 of file window.h.

Referenced by ChildWindow(), and WndProc().

◆ _left_hwnd

◆ _menu_info

MenuInfo* ChildWindow::_menu_info
protected

Definition at line 322 of file window.h.

◆ _right_hwnd

◆ _split_pos

int ChildWindow::_split_pos
protected

◆ _statusText

String ChildWindow::_statusText
protected

Definition at line 332 of file window.h.

Referenced by WndProc().

◆ _url

String ChildWindow::_url
protected

Definition at line 333 of file window.h.

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

◆ _url_history

stack<String> ChildWindow::_url_history
protected

Definition at line 335 of file window.h.

Referenced by FileChildWindow::FileChildWindow(), go_to(), and WndProc().


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