src/widget/widget_caption.cpp
branchcpp_gui
changeset 6273 d8a2c6844650
parent 6264 9fc3b5467396
child 6275 bd57b30a8b81
equal deleted inserted replaced
6272:43637acd46b5 6273:d8a2c6844650
    16 #include "../genworld.h"
    16 #include "../genworld.h"
    17 #include "../helpers.hpp"
    17 #include "../helpers.hpp"
    18 #include "window_events.hpp"
    18 #include "window_events.hpp"
    19 
    19 
    20 
    20 
       
    21 namespace gui {
       
    22 
       
    23 /*virtual*/ void CaptionBar::DrawBackground(EvtPaint &ev)
       
    24 {
       
    25 //	DrawFrameRect(m_color, FR_NONE);
       
    26 
       
    27 	BaseWindow *w = GetWindow();
       
    28 	assert(w != NULL);
       
    29 
       
    30 	byte caption_color = w->caption_color;
       
    31 	assert(Height() == 14); // XXX - to ensure the same sizes are used everywhere!
       
    32 	DrawFrameRect(Left(), Top(), Right(), Bottom(), m_color, FR_BORDERONLY);
       
    33 	DrawFrameRect(Left() + 1, Top() + 1, Right() - 1, Bottom() - 1, m_color, (caption_color == 0xFF) ? FR_LOWERED | FR_DARKENED : FR_LOWERED | FR_DARKENED | FR_BORDERONLY);
       
    34 	if (caption_color != 0xFF) {
       
    35 		GfxFillRect(Left() + 2, Top() + 2, Right() - 2, Bottom() - 2, _colour_gradient[_player_colors[caption_color]][4]);
       
    36 	}
       
    37 
       
    38 	//assert(r.bottom - r.top == 13); // XXX - to ensure the same sizes are used everywhere!
       
    39 	//DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, FR_BORDERONLY);
       
    40 	//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);
       
    41 
       
    42 	//if (caption_color != 0xFF) {
       
    43 	//	GfxFillRect(r.left+2, r.top+2, r.right-2, r.bottom-2, _colour_gradient[_player_colors[caption_color]][4]);
       
    44 	//}
       
    45 }
       
    46 
       
    47 /*virtual*/ void CaptionBar::OnPaint(EvtPaint &ev)
       
    48 {
       
    49 	DrawBackground(ev);
       
    50 	DrawStringCenteredTruncated(Left() + 2, Right() - 2, Top() + 2, m_text, m_text_color);
       
    51 	ev.SetHandled();
       
    52 }
       
    53 
       
    54 }; // namespace gui