Exemplo n.º 1
0
//[-------------------------------------------------------]
//[ Protected virtual PLGui::WidgetFunctions functions    ]
//[-------------------------------------------------------]
void ThemeTestWidget::OnDraw(Graphics &cGraphics)
{
    // Fill with a background as "empty space"
    Color4 cColorEmpty = Color4(0.9f, 0.9f, 0.9f, 1.0f);
    cGraphics.DrawBox(cColorEmpty, Vector2i::Zero, GetSize() - Vector2i(1, 1));

    // Draw a window
    Vector2i vPos = Vector2i(32, 32);
    Vector2i vSize = GetSize() - Vector2i(64, 64);
    m_pTheme->DrawWindow(cGraphics, vPos, vPos + vSize - Vector2i(1, 1), true, WidgetActive, GetTitle(), GetIcon());

    // Draw a panel inside
    vPos = Vector2i(64, 64);
    vSize = vSize - Vector2i(64, 64);
    m_pTheme->DrawPanel(cGraphics, vPos, vPos + vSize - Vector2i(1, 1), SunkenBorder);

    // Draw some rectangles
    /*
    m_pTheme->DrawRect(cGraphics, Vector2i(100, 100), Vector2i(150, 150), DashedLine, Color4::Red,   1);
    m_pTheme->DrawRect(cGraphics, Vector2i(200, 100), Vector2i(250, 150), DottedLine, Color4::Green, 1);
    m_pTheme->DrawRect(cGraphics, Vector2i(300, 100), Vector2i(350, 150), SolidLine,  Color4::Blue,  1);
    m_pTheme->DrawRect(cGraphics, Vector2i(100, 200), Vector2i(150, 250), DashedLine, Color4::Red,   2);
    m_pTheme->DrawRect(cGraphics, Vector2i(200, 200), Vector2i(250, 250), DottedLine, Color4::Green, 2);
    m_pTheme->DrawRect(cGraphics, Vector2i(300, 200), Vector2i(350, 250), SolidLine,  Color4::Blue,  2);
    m_pTheme->DrawRect(cGraphics, Vector2i(100, 300), Vector2i(150, 350), DashedLine, Color4::Red,   3);
    m_pTheme->DrawRect(cGraphics, Vector2i(200, 300), Vector2i(250, 350), DottedLine, Color4::Green, 3);
    m_pTheme->DrawRect(cGraphics, Vector2i(300, 300), Vector2i(350, 350), SolidLine,  Color4::Blue,  3);
    */

    // Draw a button
    Image cImage(*GetGui());
    m_pTheme->DrawButton(cGraphics, Vector2i(100, 100), Vector2i(200, 125), "Press Me", cImage, WidgetEnabled);
}
Exemplo n.º 2
0
/**
*  @brief
*    Draw widget background
*/
void Widget::DrawBackground(Graphics &cGraphics)
{
	// Draw background color
	if (!m_cBackgroundColor.IsTransparent()) {
		cGraphics.DrawBox(m_cBackgroundColor, Vector2i(0, 0), GetSize(), 0, 0);
	}

	// Call signal and virtual function
	SignalDrawBackground(cGraphics);
	OnDrawBackground(cGraphics);
}