src/widget/widget_caption.cpp
branchcpp_gui
changeset 6273 d8a2c6844650
parent 6264 9fc3b5467396
child 6275 bd57b30a8b81
--- a/src/widget/widget_caption.cpp	Thu Mar 01 23:34:28 2007 +0000
+++ b/src/widget/widget_caption.cpp	Fri Mar 02 21:21:41 2007 +0000
@@ -18,3 +18,37 @@
 #include "window_events.hpp"
 
 
+namespace gui {
+
+/*virtual*/ void CaptionBar::DrawBackground(EvtPaint &ev)
+{
+//	DrawFrameRect(m_color, FR_NONE);
+
+	BaseWindow *w = GetWindow();
+	assert(w != NULL);
+
+	byte caption_color = w->caption_color;
+	assert(Height() == 14); // XXX - to ensure the same sizes are used everywhere!
+	DrawFrameRect(Left(), Top(), Right(), Bottom(), m_color, FR_BORDERONLY);
+	DrawFrameRect(Left() + 1, Top() + 1, Right() - 1, Bottom() - 1, m_color, (caption_color == 0xFF) ? FR_LOWERED | FR_DARKENED : FR_LOWERED | FR_DARKENED | FR_BORDERONLY);
+	if (caption_color != 0xFF) {
+		GfxFillRect(Left() + 2, Top() + 2, Right() - 2, Bottom() - 2, _colour_gradient[_player_colors[caption_color]][4]);
+	}
+
+	//assert(r.bottom - r.top == 13); // XXX - to ensure the same sizes are used everywhere!
+	//DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, FR_BORDERONLY);
+	//DrawFrameRect(r.left+1, r.top+1, r.right-1, r.bottom-1, wi->color, (caption_color == 0xFF) ? FR_LOWERED | FR_DARKENED : FR_LOWERED | FR_DARKENED | FR_BORDERONLY);
+
+	//if (caption_color != 0xFF) {
+	//	GfxFillRect(r.left+2, r.top+2, r.right-2, r.bottom-2, _colour_gradient[_player_colors[caption_color]][4]);
+	//}
+}
+
+/*virtual*/ void CaptionBar::OnPaint(EvtPaint &ev)
+{
+	DrawBackground(ev);
+	DrawStringCenteredTruncated(Left() + 2, Right() - 2, Top() + 2, m_text, m_text_color);
+	ev.SetHandled();
+}
+
+}; // namespace gui