src/widget/widget_resizebox.cpp
branchcpp_gui
changeset 6282 c5b92f2d924f
parent 6281 2ae707873e23
child 6289 be3d8bd9fb02
equal deleted inserted replaced
6281:2ae707873e23 6282:c5b92f2d924f
    29 void ResizeBox::OnCaptureSizing(EvtMouseOver &e)
    29 void ResizeBox::OnCaptureSizing(EvtMouseOver &e)
    30 {
    30 {
    31 	if (!_left_button_down) {
    31 	if (!_left_button_down) {
    32 		m_ticket_sizing.Release();
    32 		m_ticket_sizing.Release();
    33 
    33 
    34 		EvtClick ev(Point(0, 0));
    34 		EvtLeftClick ev(Point(0, 0));
    35 		ev.m_widget = this;
    35 		ev.m_widget = this;
    36 		CallHandlers(ev);
    36 		CallHandlers(ev);
    37 		return;
    37 		return;
    38 	}
    38 	}
    39 	BaseWindow *w = GetWindow();
    39 	BaseWindow *w = GetWindow();
    50 	SetBottomRight(m_container->BottomRight());
    50 	SetBottomRight(m_container->BottomRight());
    51 
    51 
    52 	m_tooltips = STR_RESIZE_BUTTON;
    52 	m_tooltips = STR_RESIZE_BUTTON;
    53 
    53 
    54 	SetAnchors(PIN_RIGHT | PIN_BOTTOM);
    54 	SetAnchors(PIN_RIGHT | PIN_BOTTOM);
       
    55 	super::OnCreate(ev);
    55 }
    56 }
    56 
    57 
    57 /*virtual*/ void ResizeBox::OnPaint(EvtPaint &ev)
    58 /*virtual*/ void ResizeBox::OnPaint(EvtPaint &ev)
    58 {
    59 {
    59 	assert(Size() == Point16(11, 11));
    60 	assert(Size() == Point16(DEFAULT_WIDTH, DEFAULT_HEIGHT));
    60 
    61 
    61 	DrawBackground(ev);
    62 	DrawBackground(ev);
    62 	bool sizing = m_ticket_sizing.IsActive();
    63 	bool sizing = m_ticket_sizing.IsActive();
    63 	DrawSprite(SPR_WINDOW_RESIZE, PAL_NONE, Left() + 3 + sizing, Top() + 3 + sizing);
    64 	DrawSprite(SPR_WINDOW_RESIZE, PAL_NONE, Left() + 3 + sizing, Top() + 3 + sizing);
    64 	ev.SetHandled();
    65 	ev.SetHandled();
    65 }
    66 }
    66 
    67 
    67 /*virtual*/ void ResizeBox::OnLeftClick(EvtClick &ev)
    68 /*virtual*/ void ResizeBox::OnLeftButtonDown(EvtLeftButtonDown &ev)
    68 {
    69 {
    69 	BaseWindow *w = GetWindow();
    70 	BaseWindow *w = GetWindow();
    70 	m_sizing_offset = w->Size() - ev.m_pt;
    71 	m_sizing_offset = w->Size() - ev.m_pt;
    71 	m_ticket_sizing = CaptureEventsT(this, &ResizeBox::OnCaptureSizing);
    72 	m_ticket_sizing = CaptureEventsT(this, &ResizeBox::OnCaptureSizing);
    72 	Invalidate();
    73 	Invalidate();