src/widget/widget_caption.cpp
branchcpp_gui
changeset 6276 e5f0198ec570
parent 6275 bd57b30a8b81
child 6277 732cf765e2d7
equal deleted inserted replaced
6275:bd57b30a8b81 6276:e5f0198ec570
    20 
    20 
    21 namespace gui {
    21 namespace gui {
    22 
    22 
    23 /*virtual*/ void CaptionBar::DrawBackground(EvtPaint &ev)
    23 /*virtual*/ void CaptionBar::DrawBackground(EvtPaint &ev)
    24 {
    24 {
    25 //	DrawFrameRect(m_color, FR_NONE);
       
    26 
       
    27 	BaseWindow *w = GetWindow();
    25 	BaseWindow *w = GetWindow();
    28 	assert(w != NULL);
    26 	assert(w != NULL);
    29 
    27 
    30 	byte caption_color = w->caption_color;
    28 	byte caption_color = w->caption_color;
    31 	assert(Height() == 14); // XXX - to ensure the same sizes are used everywhere!
    29 	assert(Height() == 14); // XXX - to ensure the same sizes are used everywhere!
    32 	DrawFrameRect(Left(), Top(), Right(), Bottom(), m_color, FR_BORDERONLY);
    30 	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);
    31 	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) {
    32 	if (caption_color != 0xFF) {
    35 		GfxFillRect(Left() + 2, Top() + 2, Right() - 2, Bottom() - 2, _colour_gradient[_player_colors[caption_color]][4]);
    33 		GfxFillRect(Left() + 2, Top() + 2, Right() - 2, Bottom() - 2, _colour_gradient[_player_colors[caption_color]][4]);
    36 	}
    34 	}
    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 }
    35 }
    46 
    36 
    47 /*virtual*/ void CaptionBar::OnPaint(EvtPaint &ev)
    37 /*virtual*/ void CaptionBar::OnPaint(EvtPaint &ev)
    48 {
    38 {
    49 	DrawBackground(ev);
    39 	DrawBackground(ev);
    51 	ev.SetHandled();
    41 	ev.SetHandled();
    52 }
    42 }
    53 
    43 
    54 /*virtual*/ void CaptionBar::OnLeftClick(EvtClick &ev)
    44 /*virtual*/ void CaptionBar::OnLeftClick(EvtClick &ev)
    55 {
    45 {
    56 	m_moving_offset = ev.m_pt/* - GetWindow()->TopLeft()*/;
    46 	m_moving_offset = ev.m_pt;
    57 	ev.SetHandled();
    47 	ev.SetHandled();
    58 	m_ticket_moving = CaptureEventsT(this, &CaptionBar::OnCapturePressed);
    48 	m_ticket_moving = CaptureEventsT(this, &CaptionBar::OnCapturePressed);
    59 	Invalidate();
    49 	Invalidate();
    60 }
    50 }
    61 
    51