Esempio n. 1
0
void
Window::Create(ContainerWindow *parent, const TCHAR *cls, const TCHAR *text,
               PixelRect rc, const WindowStyle window_style)
{
  assert(IsScreenInitialized());
  assert(rc.left <= rc.right);
  assert(rc.right - rc.left < 0x1000000);
  assert(rc.top <= rc.bottom);
  assert(rc.bottom - rc.top < 0x1000000);

  double_clicks = window_style.double_clicks;

  DWORD style = window_style.style, ex_style = window_style.ex_style;

  if (window_style.custom_painting)
    EnableCustomPainting();

  hWnd = ::CreateWindowEx(ex_style, cls, text, style,
                          rc.left, rc.top,
                          rc.right - rc.left, rc.bottom - rc.top,
                          parent != NULL ? parent->hWnd : NULL,
                          NULL, NULL, this);

  /* this isn't good error handling, but this only happens if
     out-of-memory (we can't do anything useful) or if we passed wrong
     arguments - which is a bug */
  assert(hWnd != NULL);
}
Esempio n. 2
0
void
Window::set(ContainerWindow *parent, const TCHAR *cls, const TCHAR *text,
            PixelScalar left, PixelScalar top,
            UPixelScalar width, UPixelScalar height,
            const WindowStyle window_style)
{
  assert(IsScreenInitialized());
  assert(width > 0);
  assert(width < 0x1000000);
  assert(height > 0);
  assert(height < 0x1000000);

  double_clicks = window_style.double_clicks;

  DWORD style = window_style.style, ex_style = window_style.ex_style;

  if (window_style.custom_painting)
    EnableCustomPainting();

  hWnd = ::CreateWindowEx(ex_style, cls, text, style,
                          left, top, width, height,
                          parent != NULL ? parent->hWnd : NULL,
                          NULL, NULL, this);

  /* this isn't good error handling, but this only happens if
     out-of-memory (we can't do anything useful) or if we passed wrong
     arguments - which is a bug */
  assert(hWnd != NULL);
}