Example #1
0
void TBEditField::OnPaintChildren(const PaintProps &paint_props)
{
	TBWidget::OnPaintChildren(paint_props);

	// Draw fadeout skin at the needed edges.
	DrawEdgeFadeout(GetVisibleRect(),
		TBIDC("TBEditField.fadeout_x"),
		TBIDC("TBEditField.fadeout_y"),
		m_scrollbar_x.GetValue(),
		m_scrollbar_y.GetValue(),
		(int)(m_scrollbar_x.GetMaxValue() - m_scrollbar_x.GetValueDouble()),
		(int)(m_scrollbar_y.GetMaxValue() - m_scrollbar_y.GetValueDouble()));
}
Example #2
0
void TBLayout::OnPaintChildren(const PaintProps &paint_props)
{
	TBRect padding_rect = GetPaddingRect();
	if (padding_rect.IsEmpty())
		return;

	// If we overflow the layout, apply clipping when painting children
	TBRect old_clip_rect;
	if (m_overflow)
	{
		// We only want clipping in one axis (the overflowing one) so we
		// don't damage any expanded skins on the other axis. Add some fluff.
		TBRect clip_rect = padding_rect;
		const int fluff = 100;

		if (m_axis == AXIS_X)
			clip_rect = clip_rect.Expand(m_overflow_scroll == 0 ? fluff : 0, fluff,
										m_overflow_scroll == m_overflow ? fluff : 0, fluff);
		else
			clip_rect = clip_rect.Expand(fluff, m_overflow_scroll == 0 ? fluff : 0,
										fluff, m_overflow_scroll == m_overflow ? fluff : 0);

		old_clip_rect = g_renderer->SetClipRect(clip_rect, true);

		TB_IF_DEBUG_SETTING(LAYOUT_CLIPPING, g_renderer->DrawRect(clip_rect, TBColor(255, 0, 0, 200)));
	}

	// Paint children
	TBWidget::OnPaintChildren(paint_props);

	// Paint fadeout image over the overflowed edges
	// to the indicate to used that it's overflowed.
	if (m_overflow && m_packed.paint_overflow_fadeout)
	{
		TBID skin_x, skin_y;
		if (m_axis == AXIS_X)
			skin_x = TBIDC("TBLayout.fadeout_x");
		else
			skin_y = TBIDC("TBLayout.fadeout_y");

		DrawEdgeFadeout(padding_rect, skin_x, skin_y,
			m_overflow_scroll,
			m_overflow_scroll,
			m_overflow - m_overflow_scroll,
			m_overflow - m_overflow_scroll);
	}

	// Restore clipping
	if (m_overflow)
		g_renderer->SetClipRect(old_clip_rect, false);
}