ReactOS  0.4.12-dev-75-g00dd17e
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 29 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 }
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:5698
#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.

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

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
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
INT INT y
Definition: msvc.h:62
#define CreateWindowEx
Definition: winuser.h:5621
smooth NULL
Definition: ftsmooth.c:416
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
INT x
Definition: msvc.h:62

◆ 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
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
struct _test_info info[]
Definition: SetCursorPos.c:19
INT INT y
Definition: msvc.h:62
#define CreateWindowEx
Definition: winuser.h:5621
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
INT x
Definition: msvc.h:62
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.

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

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

◆ 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.

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

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 
128 
129  // end hook in case it's not already done
130  if (s_hcbtHook)
132 
133  Window* child = get_window(hwnd);
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:29
static LRESULT CALLBACK MDICBTHookProc(int code, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:142
LONG_PTR LPARAM
Definition: windef.h:208
smooth NULL
Definition: ftsmooth.c:416
#define WH_CBT
Definition: winuser.h:35
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:421
static HHOOK s_hcbtHook
Definition: window.h:133
#define SetWindowsHookEx
Definition: winuser.h:5722
HWND _hmdiclient
Definition: window.h:49
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:1788
#define SendMessage
Definition: winuser.h:5709
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

◆ DialogProc()

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

Definition at line 725 of file window.cpp.

Referenced by Dialog::DoModal().

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 }
#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:29
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:1716
UINT WPARAM LPARAM lparam
Definition: msvc.h:92
#define HIWORD(l)
Definition: typedefs.h:246
virtual int Command(int id, int code)
Definition: window.cpp:285
#define WM_INITDIALOG
Definition: winuser.h:1715
#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
UINT WPARAM wparam
Definition: msvc.h:92

◆ dispatch_dialog_msg()

BOOL Window::dispatch_dialog_msg ( LPMSG  pmsg)
static

Definition at line 619 of file window.cpp.

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

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:5675
static clock_t begin
Definition: xmllint.c:466
iterator end()
Definition: _set.h:152
_Rep_type::const_iterator const_iterator
Definition: _set.h:74

◆ 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.

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

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 }
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

◆ get_window() [2/2]

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

Definition at line 87 of file window.h.

Referenced by get_window().

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

◆ GetStaticWindowData()

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

Definition at line 63 of file window.cpp.

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

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

◆ Init()

◆ MDICBTHookProc()

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

Definition at line 142 of file window.cpp.

Referenced by create_mdi_child().

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
151  Window* child = get_window(hwnd);
152 
153  if (!child)
154  child = create_controller(hwnd);
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:29
static HHOOK s_hcbtHook
Definition: window.h:133
UINT WPARAM LPARAM lparam
Definition: msvc.h:92
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
UINT WPARAM wparam
Definition: msvc.h:92

◆ MessageLoop()

int Window::MessageLoop ( )
static

Definition at line 629 of file window.cpp.

Referenced by explorer_main(), and Desktops::init().

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 
641  TranslateMessage(&msg);
642 
643  try {
644  DispatchMessage(&msg);
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:5631
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:5656
#define msg(x)
Definition: auth_time.c:54
static BOOL dispatch_dialog_msg(LPMSG pmsg)
Definition: window.cpp:619

◆ Notify()

◆ PostParent()

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

Definition at line 667 of file window.cpp.

Referenced by StartMenuButton::WndProc().

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

◆ pretranslate_msg()

BOOL Window::pretranslate_msg ( LPMSG  pmsg)
static

Definition at line 589 of file window.cpp.

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

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:1693
#define PM_TRANSLATE_MSG
Definition: window.h:266
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SYSCHAR
Definition: winuser.h:1697
static WindowSet s_pretranslate_windows
Definition: window.h:137
#define WM_KEYDOWN
Definition: winuser.h:1691
static clock_t begin
Definition: xmllint.c:466
#define SendMessage
Definition: winuser.h:5709
#define WM_SYSKEYDOWN
Definition: winuser.h:1695
iterator end()
Definition: _set.h:152
_Rep_type::const_iterator const_iterator
Definition: _set.h:74
UINT message
Definition: winuser.h:3068

◆ 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
191  Window* child = get_window(hwnd);
192 
193  if (!child)
194  child = create_controller(hwnd);
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:29
static HHOOK s_hcbtHook
Definition: window.h:133
UINT WPARAM LPARAM lparam
Definition: msvc.h:92
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
UINT WPARAM wparam
Definition: msvc.h:92

◆ register_dialog()

void Window::register_dialog ( HWND  hwnd)
static

Definition at line 609 of file window.cpp.

Referenced by Dialog::Dialog().

610 {
611  s_dialogs.insert(hwnd);
612 }
static WindowSet s_dialogs
Definition: window.h:138
pair< iterator, bool > insert(const value_type &__x)
Definition: _set.h:168

◆ register_pretranslate()

void Window::register_pretranslate ( HWND  hwnd)
static

Definition at line 579 of file window.cpp.

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

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

◆ SendParent()

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

Definition at line 657 of file window.cpp.

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

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

◆ unregister_dialog()

void Window::unregister_dialog ( HWND  hwnd)
static

Definition at line 614 of file window.cpp.

Referenced by Dialog::~Dialog().

615 {
616  s_dialogs.erase(hwnd);
617 }
static WindowSet s_dialogs
Definition: window.h:138
void erase(iterator __pos)
Definition: _set.h:182

◆ unregister_pretranslate()

void Window::unregister_pretranslate ( HWND  hwnd)
static

Definition at line 584 of file window.cpp.

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

585 {
587 }
void erase(iterator __pos)
Definition: _set.h:182
static WindowSet s_pretranslate_windows
Definition: window.h:137

◆ 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 }
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:29
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:1716
UINT WPARAM LPARAM lparam
Definition: msvc.h:92
#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
UINT WPARAM wparam
Definition: msvc.h:92

◆ WndProc()

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

Member Data Documentation

◆ IAccessible_iface

◆ IEnumVARIANT_iface

IEnumVARIANT Window::IEnumVARIANT_iface

Definition at line 32 of file window.c.

Referenced by create_window_object(), and Window_QueryInterface().

◆ IOleWindow_iface

IOleWindow Window::IOleWindow_iface

Definition at line 31 of file window.c.

Referenced by create_window_object(), and Window_QueryInterface().

◆ ref

LONG Window::ref

Definition at line 34 of file window.c.

Referenced by create_window_object(), Window_AddRef(), and Window_Release().

◆ s_dialogs

WindowSet Window::s_dialogs
staticprotected

◆ s_hcbtHook

HHOOK Window::s_hcbtHook = 0
staticprotected

◆ s_new_info

const void * Window::s_new_info = NULL
staticprotected

◆ s_pretranslate_windows

WindowSet Window::s_pretranslate_windows
staticprotected

◆ s_window_creator

Window::CREATORFUNC Window::s_window_creator = NULL
staticprotected

◆ s_wnd_map

Window::WindowMap Window::s_wnd_map
staticprotected

Definition at line 117 of file window.h.

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


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