src/widget/widget_caption.cpp
branchcpp_gui
changeset 6275 bd57b30a8b81
parent 6273 d8a2c6844650
child 6276 e5f0198ec570
equal deleted inserted replaced
6274:35a9b459de19 6275:bd57b30a8b81
    49 	DrawBackground(ev);
    49 	DrawBackground(ev);
    50 	DrawStringCenteredTruncated(Left() + 2, Right() - 2, Top() + 2, m_text, m_text_color);
    50 	DrawStringCenteredTruncated(Left() + 2, Right() - 2, Top() + 2, m_text, m_text_color);
    51 	ev.SetHandled();
    51 	ev.SetHandled();
    52 }
    52 }
    53 
    53 
       
    54 /*virtual*/ void CaptionBar::OnLeftClick(EvtClick &ev)
       
    55 {
       
    56 	m_moving_offset = ev.m_pt/* - GetWindow()->TopLeft()*/;
       
    57 	ev.SetHandled();
       
    58 	m_ticket_moving = CaptureEventsT(this, &CaptionBar::OnCapturePressed);
       
    59 	Invalidate();
       
    60 }
       
    61 
       
    62 void CaptionBar::OnCapturePressed(EvtMouseOver &e)
       
    63 {
       
    64 	if (!_left_button_down) {
       
    65 		m_ticket_moving.Release();
       
    66 
       
    67 		EvtClick ev(Point(0, 0));
       
    68 		ev.m_widget = this;
       
    69 		CallHandlers(ev);
       
    70 		return;
       
    71 	}
       
    72 	GetWindow()->SetTopLeft(e.m_pt - m_moving_offset);
       
    73 	e.SetHandled();
       
    74 	Invalidate();
       
    75 }
       
    76 
       
    77 
    54 }; // namespace gui
    78 }; // namespace gui