src/widget/widget_resizebox.cpp
branchcpp_gui
changeset 6301 e0251f797d59
parent 6295 a88d8c2cff6e
--- a/src/widget/widget_resizebox.cpp	Mon Mar 26 20:50:18 2007 +0000
+++ b/src/widget/widget_resizebox.cpp	Mon Mar 26 21:00:16 2007 +0000
@@ -23,7 +23,7 @@
 /*virtual*/ void ResizeBox::DrawBackground(EvtPaint &ev)
 {
 	bool sizing = m_ticket_sizing.IsActive();
-	DrawFrameRect(m_color, sizing ? FR_LOWERED : FR_NONE);
+	DrawFrameRect(GetBkColor(), sizing ? FR_LOWERED : FR_NONE);
 }
 
 void ResizeBox::OnCaptureSizing(EvtMouseOver &e)
@@ -39,8 +39,8 @@
 	BaseWindow *w = GetWindow();
 	w->SetDirty();
 	Point16 size = e.m_pt - w->TopLeft() + m_sizing_offset;
-	size.x = max(size.x, DEFAULT_WIDTH);
-	size.y = max(size.y, DEFAULT_HEIGHT);
+	size.x = max(size.x, w->m_min_size.x);
+	size.y = max(size.y, w->m_min_size.y);
 	w->SetSize(size);
 	e.SetHandled();
 	w->SetDirty();
@@ -58,7 +58,7 @@
 
 /*virtual*/ void ResizeBox::OnPaint(EvtPaint &ev)
 {
-	assert(Size() == Point16(DEFAULT_WIDTH, DEFAULT_HEIGHT));
+//	assert(GetSize() == Point16(DEFAULT_WIDTH, DEFAULT_HEIGHT));
 
 	DrawBackground(ev);
 	bool sizing = m_ticket_sizing.IsActive();
@@ -69,7 +69,7 @@
 /*virtual*/ void ResizeBox::OnLeftButtonDown(EvtLeftButtonDown &ev)
 {
 	BaseWindow *w = GetWindow();
-	m_sizing_offset = w->Size() - ev.m_pt;
+	m_sizing_offset = w->GetSize() - (GetTopLeftInWindow() + ev.m_pt);
 	m_ticket_sizing = CaptureEventsT(this, &ResizeBox::OnCaptureSizing);
 	Invalidate();
 	ev.SetHandled();