foobar2000 SDK  2015-08-03
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Private Member Functions
CWindowRegisteredT< TClass, TBaseClass >

#include <WTL-PP.h>

+ Inheritance diagram for CWindowRegisteredT< TClass, TBaseClass >:

Public Member Functions

 BEGIN_MSG_MAP_EX (CWindowRegisteredT) END_MSG_MAP() static void Register()
 

Static Public Member Functions

static UINT GetClassStyle ()
 
static HCURSOR GetCursor ()
 

Protected Member Functions

virtual ~CWindowRegisteredT ()
 

Static Private Member Functions

static LRESULT CALLBACK myWindowProc (HWND wnd, UINT msg, WPARAM wp, LPARAM lp)
 

Detailed Description

template<typename TClass, typename TBaseClass = CWindow>
class CWindowRegisteredT< TClass, TBaseClass >

Definition at line 202 of file WTL-PP.h.

Constructor & Destructor Documentation

template<typename TClass, typename TBaseClass = CWindow>
virtual CWindowRegisteredT< TClass, TBaseClass >::~CWindowRegisteredT ( )
inlineprotectedvirtual

Definition at line 230 of file WTL-PP.h.

230 {}

Member Function Documentation

template<typename TClass, typename TBaseClass = CWindow>
CWindowRegisteredT< TClass, TBaseClass >::BEGIN_MSG_MAP_EX ( CWindowRegisteredT< TClass, TBaseClass )
inline

Definition at line 211 of file WTL-PP.h.

215  {
216  static CWindowClassUnregisterScope scope;
217  if (!scope.IsActive()) {
218  WNDCLASS wc = {};
219  wc.style = TClass::GetClassStyle();
220  wc.cbWndExtra = sizeof(void*);
221  wc.lpszClassName = TClass::GetClassName();
222  wc.lpfnWndProc = myWindowProc;
223  wc.hInstance = (HINSTANCE)&__ImageBase;
224  wc.hCursor = TClass::GetCursor();
225  ATLASSERT_SUCCESS( RegisterClass(&wc) != 0 );
226  scope.Set(wc.lpszClassName);
227  }
228  }
static LRESULT CALLBACK myWindowProc(HWND wnd, UINT msg, WPARAM wp, LPARAM lp)
Definition: WTL-PP.h:232
void Set(const TCHAR *n)
Definition: WTL-PP.h:186
bool IsActive() const
Definition: WTL-PP.h:187
template<typename TClass, typename TBaseClass = CWindow>
static UINT CWindowRegisteredT< TClass, TBaseClass >::GetClassStyle ( )
inlinestatic

Definition at line 204 of file WTL-PP.h.

204  {
205  return CS_VREDRAW | CS_HREDRAW;
206  }
template<typename TClass, typename TBaseClass = CWindow>
static HCURSOR CWindowRegisteredT< TClass, TBaseClass >::GetCursor ( )
inlinestatic

Definition at line 207 of file WTL-PP.h.

207  {
208  return ::LoadCursor(NULL, IDC_ARROW);
209  }
template<typename TClass, typename TBaseClass = CWindow>
static LRESULT CALLBACK CWindowRegisteredT< TClass, TBaseClass >::myWindowProc ( HWND  wnd,
UINT  msg,
WPARAM  wp,
LPARAM  lp 
)
inlinestaticprivate

Definition at line 232 of file WTL-PP.h.

232  {
233  TClass * i = NULL;
234  if (msg == WM_NCCREATE) {
235  i = new TClass;
236  i->Attach(wnd);
237  ::SetWindowLongPtr(wnd, 0, reinterpret_cast<LONG_PTR>(i));
238  } else {
239  i = reinterpret_cast<TClass*>( ::GetWindowLongPtr(wnd, 0) );
240  }
241  LRESULT r;
242  if (i == NULL || !i->ProcessWindowMessage(wnd, msg, wp, lp, r)) r = ::DefWindowProc(wnd, msg, wp, lp);
243  if (msg == WM_NCDESTROY) {
244  ::SetWindowLongPtr(wnd, 0, 0);
245  delete i;
246  }
247  return r;
248  }

The documentation for this class was generated from the following file: