Sowl  1.0
Simple Object Window Library
ControlWindowCreator.h
1 #pragma once
2 #include "../WindowHandleCreator.h"
3 #include "../Window.h"
4 
5 namespace sowl
6 {
7  template<class TControl>
9  {
10  public:
11  ControlWindowCreator(const Window& parentWindow, LPCWSTR className, WORD id, DWORD style)
12  : WindowHandleCreator(parentWindow.GetProcessHandle(), className)
13  {
14  WithParent(parentWindow.GetHandle());
15  WithMenu((HMENU)(uintptr_t)id);
16  WithStyle(style);
17  }
18 
19  inline ControlWindowCreator& WithTitle(LPCWSTR title) { WindowHandleCreator::WithTitle(title); return *this; }
20  inline ControlWindowCreator& AndStyle(DWORD style) { WindowHandleCreator::AndStyle(style); return *this; }
21  inline ControlWindowCreator& WithRect(int x, int y, int width, int height) { WindowHandleCreator::WithRect(x, y, width, height); return *this; }
22  inline ControlWindowCreator& WithParams(LPVOID lpParam) { WindowHandleCreator::WithParams(lpParam); return *this; }
23  inline HWND CreateHandle() const { return WindowHandleCreator::Create(); }
24  inline TControl Create() const { return TControl(WindowHandleCreator::Create()); }
25  };
26 }
HINSTANCE GetProcessHandle() const
Get the process handle (HINSTANCE) where the encapsulated handle window belongs to...
Definition: Window.cpp:72
Encapsulates a window handle.
Definition: Window.h:8
WindowHandleCreator(HINSTANCE processHandle, LPCWSTR className)
Initialize the builder with given parameters and defaults.
Definition: WindowHandleCreator.cpp:9
Builds a call to CreateWindowEx.
Definition: WindowHandleCreator.h:7
Definition: ControlWindowCreator.h:8