Ejemplo n.º 1
0
void Panel::calcSize()
{
	int width = 0;
	int height = 0;

	// sucht die width/height indem alle Komponenten durchlaufen werden und die am weitesten rechts und unten gespeichert werden
	for (unsigned int i = 0; i < getComponents().size(); i++)
	{
		width = std::max(width, getComponents()[i]->getRelativeRect().getRight() + getPadding().x);
		height = std::max(height, getComponents()[i]->getRelativeRect().getBot() + getPadding().y);
	}

	if (width != getRelativeRect().getSize().x)
	{
		setRelativeRect(PixelRect(
			getRelativeRect().getPosition().x,
			getRelativeRect().getPosition().y,
			width,
			getRelativeRect().getSize().y));
	}

	if (height != getRelativeRect().getSize().y)
	{
		setRelativeRect(PixelRect(
			getRelativeRect().getPosition().x,
			getRelativeRect().getPosition().y,
			getRelativeRect().getSize().x,
			height));
	}
}
Ejemplo n.º 2
0
void
RawBitmap::StretchTo(unsigned width, unsigned height,
                     Canvas &dest_canvas,
                     unsigned dest_width, unsigned dest_height,
                     gcc_unused bool transparent_white) const
{
  GLTexture &texture = BindAndGetTexture();

  OpenGL::texture_shader->Use();

  texture.Draw(PixelRect(0, 0, dest_width, dest_height),
               PixelRect(0, 0, width, height));
}
Ejemplo n.º 3
0
void
TopWindow::Create(const TCHAR *cls, const TCHAR *text, PixelSize size,
                  TopWindowStyle style)
{
  hSavedFocus = nullptr;

  const RasterPoint position(CW_USEDEFAULT, CW_USEDEFAULT);
  Window::Create(nullptr, cls, text, PixelRect(position, size), style);
}
Ejemplo n.º 4
0
  gcc_pure
  const PixelRect GetClientRect() const
  {
    assert(IsDefined());

#ifndef USE_GDI
    return PixelRect(size);
#else
    PixelRect rc;
    ::GetClientRect(hWnd, &rc);
    return rc;
#endif
  }
Ejemplo n.º 5
0
gcc_pure
static PixelRect
GetShowMenuButtonRect(const PixelRect rc)
{
  const unsigned padding = Layout::GetTextPadding();
  const unsigned size = Layout::GetMaximumControlHeight();
  const int right = rc.right - padding;
  const int left = right - size;
  const int top = rc.top + padding;
  const int bottom = top + size;

  return PixelRect(left, top, right, bottom);
}
Ejemplo n.º 6
0
LRESULT
ContainerWindow::OnMessage(HWND hWnd, UINT message,
                            WPARAM wParam, LPARAM lParam)
{
  switch (message) {
  case WM_CTLCOLORSTATIC:
  case WM_CTLCOLORBTN:
    {
      Window *window = Window::GetChecked((HWND)lParam);
      if (window == nullptr)
        break;

      Canvas canvas((HDC)wParam, {1, 1});
      const Brush *brush = OnChildColor(*window, canvas);
      if (brush == nullptr)
        break;

      return (LRESULT)brush->Native();
    }

  case WM_DRAWITEM:
    /* forward WM_DRAWITEM to the child window who sent this
       message */
    {
      const DRAWITEMSTRUCT *di = (const DRAWITEMSTRUCT *)lParam;

      Window *window = Window::GetChecked(di->hwndItem);
      if (window == nullptr)
        break;

      Canvas canvas(di->hDC, PixelRect(di->rcItem).GetSize());
      window->OnPaint(canvas);
      return TRUE;
    }
  };

  return PaintWindow::OnMessage(hWnd, message, wParam, lParam);
}
Ejemplo n.º 7
0
void
TopWindow::Create(const TCHAR *cls, const TCHAR *text, PixelSize size,
                  TopWindowStyle style)
{
  hSavedFocus = nullptr;

#ifdef _WIN32_WCE
  task_bar = NULL;
#endif

#ifdef HAVE_AYGSHELL_DLL
  memset(&s_sai, 0, sizeof(s_sai));
  s_sai.cbSize = sizeof(s_sai);
#endif

#ifdef _WIN32_WCE
  /* full-screen on Windows CE */
  const RasterPoint position(0, 0);
#else
  const RasterPoint position(CW_USEDEFAULT, CW_USEDEFAULT);
#endif

  Window::Create(NULL, cls, text, PixelRect(position, size), style);
}
Ejemplo n.º 8
0
 gcc_pure
 PixelRect GetRect() const {
   return PixelRect(GetSize());
 }
Ejemplo n.º 9
0
QuitButton::QuitButton(ComponentContainer* parent, const PixelVector& v) : Button(parent, PixelRect(v, PixelVector(100, 30)), "Quit")
{}
Ejemplo n.º 10
0
 gcc_pure
 PixelRect GetRect() const {
   return PixelRect(size);
 }
Ejemplo n.º 11
0
 void Draw(PixelPoint dest) const {
   Draw(PixelRect(dest, GetSize()), GetRect());
 }