ReactOS  0.4.14-dev-556-g4c5b21f
Window Struct Reference

#include <window.h>

Inheritance diagram for Window:
Collaboration diagram for Window:

Classes

struct  StaticWindowData
 structure for managing critical sections as static class information in struct Window More...
 

Public Types

typedef map< HWND, Window * > WindowMap
 
typedef Window *(* CREATORFUNC) (HWND)
 
typedef Window *(* CREATORFUNC_INFO) (HWND, const void *)
 

Public Member Functions

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

Public Attributes

IAccessible IAccessible_iface
 
IOleWindow IOleWindow_iface
 
IEnumVARIANT IEnumVARIANT_iface
 
LONG ref
 

Protected Member Functions

virtual LRESULT Init (LPCREATESTRUCT pcs)
 
virtual LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
 
virtual int Command (int id, int code)
 
virtual int Notify (int id, NMHDR *pnmh)
 

Static Protected Member Functions

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

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 Window is the base class for several C++ window wrapper classes. Window objects are allocated from the heap. They are automatically freed when the window gets destroyed.

Definition at line 28 of file window.c.

Member Typedef Documentation

◆ CREATORFUNC

typedef Window*(* Window::CREATORFUNC) (HWND)

Definition at line 66 of file window.h.

◆ CREATORFUNC_INFO

typedef Window*(* Window::CREATORFUNC_INFO) (HWND, const void *)

Definition at line 67 of file window.h.

◆ WindowMap

typedef map<HWND,Window*> Window::WindowMap

Definition at line 64 of file window.h.

Constructor & Destructor Documentation

◆ Window()

Window::Window ( HWND  hwnd)

Definition at line 71 of file window.cpp.

72  : WindowHandle(hwnd)
73 {
74  Lock lock(GetStaticWindowData()._map_crit_sect); // protect access to s_wnd_map
75 
76  s_wnd_map[_hwnd] = this;
77 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
rwlock_t lock
Definition: tcpcore.h:1163
static StaticWindowData & GetStaticWindowData()
Definition: window.cpp:63
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
static WindowMap s_wnd_map
Definition: window.h:117

◆ ~Window()

Window::~Window ( )
virtual

Definition at line 79 of file window.cpp.

80 {
81  Lock lock(GetStaticWindowData()._map_crit_sect); // protect access to s_wnd_map
82 
83  s_wnd_map.erase(_hwnd);
84 }
rwlock_t lock
Definition: tcpcore.h:1163
static StaticWindowData & GetStaticWindowData()
Definition: window.cpp:63
void erase(iterator __pos)
Definition: _map.h:203
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
static WindowMap s_wnd_map
Definition: window.h:117

Member Function Documentation

◆ CancelModes()

void Window::CancelModes ( )
static

Definition at line 295 of file window.cpp.

296 {
298 }
#define PostMessage
Definition: winuser.h:5807
#define WM_CANCELMODE
Definition: winuser.h:1617
#define HWND_BROADCAST
Definition: winuser.h:1190

◆ Command()

◆ Create() [1/2]

HWND Window::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

Definition at line 87 of file window.cpp.

91 {
92  Lock lock(GetStaticWindowData()._create_crit_sect); // protect access to s_window_creator and s_new_info
93 
94  s_window_creator = creator;
95  s_new_info = NULL;
96 
97  return CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle,
98  x, y, w, h,
99  hwndParent, hMenu, g_Globals._hInstance, 0/*lpParam*/);
100 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
rwlock_t lock
Definition: tcpcore.h:1163
static StaticWindowData & GetStaticWindowData()
Definition: window.cpp:63
static CREATORFUNC s_window_creator
Definition: window.h:120
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define CreateWindowEx
Definition: winuser.h:5730
smooth NULL
Definition: ftsmooth.c:416
static HWND hwndParent
Definition: cryptui.c:300
HINSTANCE _hInstance
Definition: globals.h:270
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
static const void * s_new_info
Definition: window.h:119
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by DesktopWindow::Create(), TaskBar::Create(), DesktopBar::Create(), MDIMainFrame::Create(), NotifyArea::Create(), SDIMainFrame::Create(), StartMenu::Create(), ClockWindow::Create(), and StartMenuRoot::Create().

◆ Create() [2/2]

HWND Window::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

Definition at line 102 of file window.cpp.

106 {
107  Lock lock(GetStaticWindowData()._create_crit_sect); // protect access to s_window_creator and s_new_info
108 
109  s_window_creator = (CREATORFUNC) creator;
110  s_new_info = info;
111 
112  return CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle,
113  x, y, w, h,
114  hwndParent, hMenu, g_Globals._hInstance, 0/*lpParam*/);
115 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
rwlock_t lock
Definition: tcpcore.h:1163
static StaticWindowData & GetStaticWindowData()
Definition: window.cpp:63
static CREATORFUNC s_window_creator
Definition: window.h:120
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
struct _test_info info[]
Definition: SetCursorPos.c:19
#define CreateWindowEx
Definition: winuser.h:5730
static HWND hwndParent
Definition: cryptui.c:300
HINSTANCE _hInstance
Definition: globals.h:270
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
static const void * s_new_info
Definition: window.h:119
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
Window *(* CREATORFUNC)(HWND)
Definition: window.h:66

◆ create_controller()

Window * Window::create_controller ( HWND  hwnd)
staticprotected

create controller for a new window

Definition at line 220 of file window.cpp.

221 {
222  if (s_window_creator) { // protect for recursion and create the window object only for the first window
223  Lock lock(GetStaticWindowData()._create_crit_sect); // protect access to s_window_creator and s_new_info
224 
225  const void* info = s_new_info;
226  s_new_info = NULL;
227 
228  CREATORFUNC window_creator = s_window_creator;
230 
231  if (info)
232  return CREATORFUNC_INFO(window_creator)(hwnd, info);
233  else
234  return CREATORFUNC(window_creator)(hwnd);
235  }
236 
237  return NULL;
238 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
rwlock_t lock
Definition: tcpcore.h:1163
static StaticWindowData & GetStaticWindowData()
Definition: window.cpp:63
static CREATORFUNC s_window_creator
Definition: window.h:120
struct _test_info info[]
Definition: SetCursorPos.c:19
smooth NULL
Definition: ftsmooth.c:416
Window *(* CREATORFUNC_INFO)(HWND, const void *)
Definition: window.h:67
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
static const void * s_new_info
Definition: window.h:119
Window *(* CREATORFUNC)(HWND)
Definition: window.h:66

Referenced by DialogProc(), MDICBTHookProc(), PropSheetCBTHookProc(), and WindowWndProc().

◆ create_mdi_child()

Window * Window::create_mdi_child ( const ChildWndInfo info,
const MDICREATESTRUCT mcs,
CREATORFUNC_INFO  creator 
)
static

Definition at line 118 of file window.cpp.

119 {
120  Lock lock(GetStaticWindowData()._create_crit_sect); // protect access to s_window_creator and s_new_info
121 
122  s_window_creator = (CREATORFUNC) creator;
123  s_new_info = &info;
124 
126 
127  HWND hwnd = (HWND) SendMessage(info._hmdiclient, WM_MDICREATE, 0, (LPARAM)&mcs);
128 
129  // end hook in case it's not already done
130  if (s_hcbtHook)
132 
134  s_new_info = NULL;
135 
136  if (child && (!hwnd || !child->_hwnd))
137  child = NULL;
138 
139  return child;
140 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
rwlock_t lock
Definition: tcpcore.h:1163
static StaticWindowData & GetStaticWindowData()
Definition: window.cpp:63
static CREATORFUNC s_window_creator
Definition: window.h:120
HANDLE HWND
Definition: compat.h:13
static HWND child
Definition: cursoricon.c:298
struct _test_info info[]
Definition: SetCursorPos.c:19
Definition: window.c:28
static LRESULT CALLBACK MDICBTHookProc(int code, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:142
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define WH_CBT
Definition: winuser.h:35
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
static HHOOK s_hcbtHook
Definition: window.h:133
#define SetWindowsHookEx
Definition: winuser.h:5831
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
static const void * s_new_info
Definition: window.h:119
#define WM_MDICREATE
Definition: winuser.h:1794
#define SendMessage
Definition: winuser.h:5818
Window *(* CREATORFUNC)(HWND)
Definition: window.h:66
static struct myctx * mcs
Definition: adnstest.c:53
static Window * get_window(HWND hwnd)
get window controller from window handle
Definition: window.cpp:203

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

◆ DialogProc()

INT_PTR CALLBACK Window::DialogProc ( HWND  hwnd,
UINT  nmsg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 725 of file window.cpp.

726 {
727  Window* pThis = get_window(hwnd);
728 
729  if (pThis) {
730  switch(nmsg) {
731  case WM_COMMAND:
732  pThis->Command(LOWORD(wparam), HIWORD(wparam));
733  return TRUE; // message has been processed
734 
735  case WM_NOTIFY:
736  pThis->Notify(wparam, (NMHDR*)lparam);
737  return TRUE; // message has been processed
738 
739  case WM_NOTIFYFORMAT:
740  SetWindowLongPtr(hwnd, DWLP_MSGRESULT, NFR_CURRENT); // set return value NFR_CURRENT
741  return TRUE; // message has been processed
742 
743  case WM_NCDESTROY:
744  delete pThis;
745  return TRUE; // message has been processed
746 
747  default:
748  return pThis->WndProc(nmsg, wparam, lparam);
749  }
750  } else if (nmsg == WM_INITDIALOG) {
751  pThis = create_controller(hwnd);
752 
753  if (pThis)
754  return pThis->Init(NULL);
755  }
756 
757  return FALSE; // message has not been processed
758 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
virtual LRESULT Init(LPCREATESTRUCT pcs)
Definition: window.cpp:241
static Window * create_controller(HWND hwnd)
create controller for a new window
Definition: window.cpp:220
#define SetWindowLongPtr
Definition: treelist.c:70
#define DWLP_MSGRESULT
Definition: winuser.h:864
Definition: window.c:28
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
smooth NULL
Definition: ftsmooth.c:416
virtual int Notify(int id, NMHDR *pnmh)
Definition: window.cpp:290
#define NFR_CURRENT
Definition: window.h:144
#define WM_NCDESTROY
Definition: winuser.h:1666
virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:280
#define WM_COMMAND
Definition: winuser.h:1722
#define HIWORD(l)
Definition: typedefs.h:246
virtual int Command(int id, int code)
Definition: window.cpp:285
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82
static Window * get_window(HWND hwnd)
get window controller from window handle
Definition: window.cpp:203
#define WM_NOTIFY
Definition: richedit.h:61
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by Dialog::DoModal().

◆ dispatch_dialog_msg()

BOOL Window::dispatch_dialog_msg ( LPMSG  pmsg)
static

Definition at line 619 of file window.cpp.

620 {
622  if (IsDialogMessage(*it, pmsg))
623  return TRUE;
624 
625  return FALSE;
626 }
#define TRUE
Definition: types.h:120
static WindowSet s_dialogs
Definition: window.h:138
#define IsDialogMessage
Definition: winuser.h:5784
static clock_t begin
Definition: xmllint.c:466
iterator end()
Definition: _set.h:152
_Rep_type::const_iterator const_iterator
Definition: _set.h:74

Referenced by PropertySheetDialog::DoModal(), MessageLoop(), and StartMenuRoot::TrackStartmenu().

◆ get_window() [1/2]

Window * Window::get_window ( HWND  hwnd)
static

get window controller from window handle

Definition at line 203 of file window.cpp.

204 {
205  {
206  Lock lock(GetStaticWindowData()._map_crit_sect); // protect access to s_wnd_map
207 
208  WindowMap::const_iterator found = s_wnd_map.find(hwnd);
209 
210  if (found!=s_wnd_map.end())
211  return found->second;
212  }
213 
214  return NULL;
215 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
rwlock_t lock
Definition: tcpcore.h:1163
static StaticWindowData & GetStaticWindowData()
Definition: window.cpp:63
smooth NULL
Definition: ftsmooth.c:416
_STLP_TEMPLATE_FOR_CONT_EXT iterator find(const _KT &__x)
Definition: _map.h:210
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
static WindowMap s_wnd_map
Definition: window.h:117
iterator end()
Definition: _map.h:165

Referenced by create_mdi_child(), DialogProc(), MDICBTHookProc(), PropSheetCBTHookProc(), and WindowWndProc().

◆ get_window() [2/2]

template<typename CLASS >
static CLASS* Window::get_window ( HWND  hwnd)
inlinestatic

Definition at line 87 of file window.h.

87 {return static_cast<CLASS*>(get_window(hwnd));}
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static Window * get_window(HWND hwnd)
get window controller from window handle
Definition: window.cpp:203

Referenced by get_window().

◆ GetStaticWindowData()

Window::StaticWindowData & Window::GetStaticWindowData ( )
staticprotected

Definition at line 63 of file window.cpp.

64 {
65  static StaticWindowData s_initialized_data;
66 
67  return s_initialized_data;
68 }

Referenced by Create(), create_controller(), create_mdi_child(), Dialog::DoModal(), get_window(), Window(), and ~Window().

◆ Init()

◆ MDICBTHookProc()

LRESULT CALLBACK Window::MDICBTHookProc ( int  code,
WPARAM  wparam,
LPARAM  lparam 
)
staticprotected

Definition at line 142 of file window.cpp.

143 {
144  if (code == HCBT_CREATEWND) {
145  UnhookWindowsHookEx(s_hcbtHook); // use the hook only for the first created window
146  s_hcbtHook = 0;
147 
148  HWND hwnd = (HWND)wparam;
149 
150  // create Window controller and associate it with the window handle
152 
153  if (!child)
155  }
156 
158 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define HCBT_CREATEWND
Definition: winuser.h:58
HANDLE HWND
Definition: compat.h:13
static Window * create_controller(HWND hwnd)
create controller for a new window
Definition: window.cpp:220
static HWND child
Definition: cursoricon.c:298
Definition: window.c:28
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
static HHOOK s_hcbtHook
Definition: window.h:133
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
static Window * get_window(HWND hwnd)
get window controller from window handle
Definition: window.cpp:203
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by create_mdi_child().

◆ MessageLoop()

int Window::MessageLoop ( )
static

Definition at line 629 of file window.cpp.

630 {
631  MSG msg;
632 
633  while(GetMessage(&msg, 0, 0, 0)) {
634  try {
635  if (pretranslate_msg(&msg))
636  continue;
637 
638  if (dispatch_dialog_msg(&msg))
639  continue;
640 
642 
643  try {
645  } catch(COMException& e) {
646  HandleException(e, 0);
647  }
648  } catch(COMException& e) {
649  HandleException(e, 0);
650  }
651  }
652 
653  return msg.wParam;
654 }
#define DispatchMessage
Definition: winuser.h:5740
BOOL WINAPI TranslateMessage(_In_ const MSG *)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
Exception with context information.
Definition: shellclasses.h:113
#define e
Definition: ke_i.h:82
void HandleException(COMException &e, HWND hwnd)
Exception Handler for COM exceptions.
static BOOL pretranslate_msg(LPMSG pmsg)
Definition: window.cpp:589
#define GetMessage
Definition: winuser.h:5765
#define msg(x)
Definition: auth_time.c:54
static BOOL dispatch_dialog_msg(LPMSG pmsg)
Definition: window.cpp:619

Referenced by explorer_main().

◆ Notify()

◆ PostParent()

LRESULT Window::PostParent ( UINT  nmsg,
WPARAM  wparam = 0,
LPARAM  lparam = 0 
)

Definition at line 667 of file window.cpp.

668 {
669  HWND parent = GetParent(_hwnd);
670 
671  if (!parent)
672  return 0;
673 
674  return PostMessage(parent, nmsg, wparam, lparam);
675 }
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define PostMessage
Definition: winuser.h:5807
r parent
Definition: btrfs.c:2869
HWND WINAPI GetParent(_In_ HWND)
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by StartMenuButton::WndProc().

◆ pretranslate_msg()

BOOL Window::pretranslate_msg ( LPMSG  pmsg)
static

Definition at line 589 of file window.cpp.

590 {
591  if ((pmsg->message != WM_KEYDOWN) &&
592  (pmsg->message != WM_SYSKEYDOWN) &&
593  (pmsg->message != WM_SYSCHAR) &&
594  (pmsg->message != WM_CHAR))
595  {
596  return FALSE;
597  }
598 
600  if (SendMessage(*it, PM_TRANSLATE_MSG, 0, (LPARAM)pmsg))
601  return TRUE;
602 
603  return FALSE;
604 }
#define TRUE
Definition: types.h:120
#define WM_CHAR
Definition: winuser.h:1699
#define PM_TRANSLATE_MSG
Definition: window.h:266
#define WM_SYSCHAR
Definition: winuser.h:1703
static WindowSet s_pretranslate_windows
Definition: window.h:137
#define WM_KEYDOWN
Definition: winuser.h:1697
LONG_PTR LPARAM
Definition: windef.h:208
static clock_t begin
Definition: xmllint.c:466
#define SendMessage
Definition: winuser.h:5818
#define WM_SYSKEYDOWN
Definition: winuser.h:1701
iterator end()
Definition: _set.h:152
_Rep_type::const_iterator const_iterator
Definition: _set.h:74
UINT message
Definition: winuser.h:3090

Referenced by PropertySheetDialog::DoModal(), MessageLoop(), and StartMenuRoot::TrackStartmenu().

◆ PropSheetCBTHookProc()

LRESULT CALLBACK Window::PropSheetCBTHookProc ( int  code,
WPARAM  wparam,
LPARAM  lparam 
)
staticprotected

Definition at line 185 of file window.cpp.

186 {
187  if (code == HCBT_CREATEWND) {
188  HWND hwnd = (HWND)wparam;
189 
190  // create Window controller and associate it with the window handle
192 
193  if (!child)
195  }
196 
198 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define HCBT_CREATEWND
Definition: winuser.h:58
HANDLE HWND
Definition: compat.h:13
static Window * create_controller(HWND hwnd)
create controller for a new window
Definition: window.cpp:220
static HWND child
Definition: cursoricon.c:298
Definition: window.c:28
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
static HHOOK s_hcbtHook
Definition: window.h:133
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
static Window * get_window(HWND hwnd)
get window controller from window handle
Definition: window.cpp:203
static UINT WPARAM wparam
Definition: combo.c:716

◆ register_dialog()

void Window::register_dialog ( HWND  hwnd)
static

Definition at line 609 of file window.cpp.

610 {
612 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static WindowSet s_dialogs
Definition: window.h:138
pair< iterator, bool > insert(const value_type &__x)
Definition: _set.h:168

Referenced by Dialog::Dialog(), and DialogWindow::DialogWindow().

◆ register_pretranslate()

void Window::register_pretranslate ( HWND  hwnd)
static

Definition at line 579 of file window.cpp.

580 {
582 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static WindowSet s_pretranslate_windows
Definition: window.h:137
pair< iterator, bool > insert(const value_type &__x)
Definition: _set.h:168

Referenced by FindProgramDlg::FindProgramDlg(), PreTranslateWindow::PreTranslateWindow(), and TrayNotifyDlg::TrayNotifyDlg().

◆ SendParent()

LRESULT Window::SendParent ( UINT  nmsg,
WPARAM  wparam = 0,
LPARAM  lparam = 0 
)

Definition at line 657 of file window.cpp.

658 {
659  HWND parent = GetParent(_hwnd);
660 
661  if (!parent)
662  return 0;
663 
664  return SendMessage(parent, nmsg, wparam, lparam);
665 }
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
r parent
Definition: btrfs.c:2869
HWND WINAPI GetParent(_In_ HWND)
#define SendMessage
Definition: winuser.h:5818
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by StartMenu::CloseStartMenu(), NotifyArea::Command(), StartMenuButton::WndProc(), StartMenu::WndProc(), EditController::WndProc(), and StartMenu::~StartMenu().

◆ unregister_dialog()

void Window::unregister_dialog ( HWND  hwnd)
static

Definition at line 614 of file window.cpp.

615 {
617 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static WindowSet s_dialogs
Definition: window.h:138
void erase(iterator __pos)
Definition: _set.h:182

Referenced by Dialog::~Dialog(), and DialogWindow::~DialogWindow().

◆ unregister_pretranslate()

void Window::unregister_pretranslate ( HWND  hwnd)
static

Definition at line 584 of file window.cpp.

585 {
587 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
void erase(iterator __pos)
Definition: _set.h:182
static WindowSet s_pretranslate_windows
Definition: window.h:137

Referenced by FindProgramDlg::~FindProgramDlg(), PreTranslateWindow::~PreTranslateWindow(), and TrayNotifyDlg::~TrayNotifyDlg().

◆ WindowWndProc()

LRESULT CALLBACK Window::WindowWndProc ( HWND  hwnd,
UINT  nmsg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 247 of file window.cpp.

248 {
249  Window* pThis = get_window(hwnd);
250 
251  if (!pThis)
252  pThis = create_controller(hwnd);
253 
254  if (pThis) {
255  switch(nmsg) {
256  case WM_COMMAND:
257  return pThis->Command(LOWORD(wparam), HIWORD(wparam));
258 
259  case WM_NOTIFY:
260  return pThis->Notify(wparam, (NMHDR*)lparam);
261 
262  case WM_NOTIFYFORMAT:
263  return NFR_CURRENT;
264 
265  case WM_CREATE:
266  return pThis->Init((LPCREATESTRUCT)lparam);
267 
268  case WM_NCDESTROY:
269  delete pThis;
270  return 0;
271 
272  default:
273  return pThis->WndProc(nmsg, wparam, lparam);
274  }
275  }
276  else
277  return DefWindowProc(hwnd, nmsg, wparam, lparam);
278 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
virtual LRESULT Init(LPCREATESTRUCT pcs)
Definition: window.cpp:241
static Window * create_controller(HWND hwnd)
create controller for a new window
Definition: window.cpp:220
Definition: window.c:28
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
virtual int Notify(int id, NMHDR *pnmh)
Definition: window.cpp:290
#define NFR_CURRENT
Definition: window.h:144
#define DefWindowProc
Definition: ros2win.h:31
#define WM_NCDESTROY
Definition: winuser.h:1666
virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:280
#define WM_COMMAND
Definition: winuser.h:1722
#define WM_CREATE
Definition: winuser.h:1590
#define HIWORD(l)
Definition: typedefs.h:246
virtual int Command(int id, int code)
Definition: window.cpp:285
#define LOWORD(l)
Definition: pedump.c:82
static Window * get_window(HWND hwnd)
get window controller from window handle
Definition: window.cpp:203
#define WM_NOTIFY
Definition: richedit.h:61
static UINT WPARAM wparam
Definition: combo.c:716

◆ WndProc()

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

Reimplemented in ExtContextMenuHandlerT< ShellBrowserChildT< MainFrameBase > >, ExtContextMenuHandlerT< ChildWindow >, ExtContextMenuHandlerT< OwnerDrawParent< DialogWindow > >, ExtContextMenuHandlerT< SubclassedWindow >, ExtContextMenuHandlerT< ShellBrowserChildT< ChildWindow > >, EditController, WebChildWindow, ExplorerAboutDlg, HyperlinkCtrl, ColorStatic, FlatButton, OwnerdrawnButton, OwnerDrawParent< PropSheetPageDlg >, OwnerDrawParent< Window >, OwnerDrawParent< DialogWindow >, OwnerDrawParent< Dialog >, CtlColorParent< OwnerDrawParent< Dialog > >, ResizeController< Dialog >, Dialog, StartMenuRoot, IPCtrlWindow< ChildWindow, SIfacePtr< IWebBrowser2 > >, ChildWindow, MDIShellBrowserChild, ClockWindow, TrayNotifyDlg, StartMenu, ShellBrowserChildT< ChildWindow >, ShellBrowserChildT< MainFrameBase >, SubclassedWindow, DesktopShellView, SDIMainFrame, NotifyArea, StartButton, MDIMainFrame, Pane, DesktopBar, StartMenuButton, FindProgramDlg, FileChildWindow, TaskBar, DesktopWindow, MainFrameBase, QuickLaunchBar, and BackgroundWindow.

Definition at line 280 of file window.cpp.

281 {
282  return DefWindowProc(_hwnd, nmsg, wparam, lparam);
283 }
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define DefWindowProc
Definition: ros2win.h:31
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by DialogProc(), WindowWndProc(), MainFrameBase::WndProc(), DesktopWindow::WndProc(), TaskBar::WndProc(), NotifyArea::WndProc(), and ClockWindow::WndProc().

Member Data Documentation

◆ IAccessible_iface

IAccessible Window::IAccessible_iface

Definition at line 29 of file window.c.

◆ IEnumVARIANT_iface

IEnumVARIANT Window::IEnumVARIANT_iface

Definition at line 31 of file window.c.

◆ IOleWindow_iface

IOleWindow Window::IOleWindow_iface

Definition at line 30 of file window.c.

◆ ref

LONG Window::ref

Definition at line 33 of file window.c.

◆ s_dialogs

WindowSet Window::s_dialogs
staticprotected

Definition at line 138 of file window.h.

Referenced by dispatch_dialog_msg(), register_dialog(), and unregister_dialog().

◆ s_hcbtHook

HHOOK Window::s_hcbtHook = 0
staticprotected

Definition at line 133 of file window.h.

Referenced by create_mdi_child(), MDICBTHookProc(), and PropSheetCBTHookProc().

◆ s_new_info

const void * Window::s_new_info = NULL
staticprotected

Definition at line 119 of file window.h.

Referenced by Create(), create_controller(), create_mdi_child(), and Dialog::DoModal().

◆ s_pretranslate_windows

WindowSet Window::s_pretranslate_windows
staticprotected

Definition at line 137 of file window.h.

Referenced by pretranslate_msg(), register_pretranslate(), and unregister_pretranslate().

◆ s_window_creator

Window::CREATORFUNC Window::s_window_creator = NULL
staticprotected

Definition at line 120 of file window.h.

Referenced by Create(), create_controller(), create_mdi_child(), and Dialog::DoModal().

◆ s_wnd_map

Window::WindowMap Window::s_wnd_map
staticprotected

Definition at line 117 of file window.h.

Referenced by get_window(), Window(), and ~Window().


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