diff --git a/interface/window.h b/interface/window.h
index 79235c42ca..1c5857c2ff 100644
--- a/interface/window.h
+++ b/interface/window.h
@@ -927,10 +927,10 @@ public:
/**
Returns the minimum size of the window, an indication to the sizer layout
- mechanism
- that this is the minimum required size. It normally just returns the value set
- by SetMinSize(), but it can be overridden to do the
- calculation on demand.
+ mechanism that this is the minimum required size.
+
+ This method normally just returns the value set by SetMinSize(), but it
+ can be overridden to do the calculation on demand.
@see GetMinClientSize()
*/
@@ -2122,18 +2122,30 @@ public:
/**
Sets the minimum client size of the window, to indicate to the sizer
layout mechanism that this is the minimum required size of window's client
- area. You may need to call this if you change the window size after
+ area.
+
+ You may need to call this if you change the window size after
construction and before adding to its parent sizer.
+ Note, that just as with SetMinSize(), calling this method doesn't
+ prevent the program from explicitly making the window smaller than the
+ specified size.
+
@see SetMinSize()
*/
void SetMinClientSize(const wxSize& size);
/**
- Sets the minimum size of the window, to indicate to the sizer layout mechanism
- that this is the minimum required size. You may need to call this
- if you change the window size after construction and before adding
- to its parent sizer.
+ Sets the minimum size of the window, to indicate to the sizer layout
+ mechanism that this is the minimum required size.
+
+ You may need to call this if you change the window size after
+ construction and before adding to its parent sizer.
+
+ Notice that calling this method doesn't prevent the program from making
+ the window explicitly smaller than the specified size by calling
+ SetSize(), it just ensures that it won't become smaller than this size
+ during the automatic layout.
@see SetMinClientSize()
*/
diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp
index f7c7bf4e24..5634ab6e2b 100644
--- a/src/gtk/window.cpp
+++ b/src/gtk/window.cpp
@@ -2419,8 +2419,6 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags
if (height != -1)
m_height = height;
- ConstrainSize();
-
if (m_parent->m_wxwindow)
{
wxPizza* pizza = WX_PIZZA(m_parent->m_wxwindow);
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 48b14a96e7..cdc0b755f1 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -118,7 +118,8 @@ TEST_GUI_OBJECTS = \
test_gui_config.o \
test_gui_textctrltest.o \
test_gui_selstoretest.o \
- test_gui_clientsize.o
+ test_gui_clientsize.o \
+ test_gui_setsize.o
TEST_GUI_ODEP = $(___pch_testprec_test_gui_testprec_h_gch___depname)
PRINTFBENCH_CXXFLAGS = $(__printfbench_PCH_INC) -D__WX$(TOOLKIT)__ \
$(__WXUNIV_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
@@ -510,6 +511,9 @@ test_gui_selstoretest.o: $(srcdir)/misc/selstoretest.cpp $(TEST_GUI_ODEP)
test_gui_clientsize.o: $(srcdir)/window/clientsize.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/window/clientsize.cpp
+test_gui_setsize.o: $(srcdir)/window/setsize.cpp $(TEST_GUI_ODEP)
+ $(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/window/setsize.cpp
+
printfbench_printfbench.o: $(srcdir)/benchmarks/printfbench.cpp $(PRINTFBENCH_ODEP)
$(CXXC) -c -o $@ $(PRINTFBENCH_CXXFLAGS) $(srcdir)/benchmarks/printfbench.cpp
diff --git a/tests/makefile.bcc b/tests/makefile.bcc
index 2edcdf71d9..232de88194 100644
--- a/tests/makefile.bcc
+++ b/tests/makefile.bcc
@@ -105,7 +105,8 @@ TEST_GUI_OBJECTS = \
$(OBJS)\test_gui_config.obj \
$(OBJS)\test_gui_textctrltest.obj \
$(OBJS)\test_gui_selstoretest.obj \
- $(OBJS)\test_gui_clientsize.obj
+ $(OBJS)\test_gui_clientsize.obj \
+ $(OBJS)\test_gui_setsize.obj
PRINTFBENCH_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \
$(__OPTIMIZEFLAG) $(__THREADSFLAG_1) -D__WXMSW__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
@@ -545,6 +546,9 @@ $(OBJS)\test_gui_selstoretest.obj: .\misc\selstoretest.cpp
$(OBJS)\test_gui_clientsize.obj: .\window\clientsize.cpp
$(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\window\clientsize.cpp
+$(OBJS)\test_gui_setsize.obj: .\window\setsize.cpp
+ $(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\window\setsize.cpp
+
$(OBJS)\printfbench_dummy.obj: .\dummy.cpp
$(CXX) -q -c -P -o$@ $(PRINTFBENCH_CXXFLAGS) -H .\dummy.cpp
diff --git a/tests/makefile.gcc b/tests/makefile.gcc
index 7bf1140190..0d9e1d3186 100644
--- a/tests/makefile.gcc
+++ b/tests/makefile.gcc
@@ -98,7 +98,8 @@ TEST_GUI_OBJECTS = \
$(OBJS)\test_gui_config.o \
$(OBJS)\test_gui_textctrltest.o \
$(OBJS)\test_gui_selstoretest.o \
- $(OBJS)\test_gui_clientsize.o
+ $(OBJS)\test_gui_clientsize.o \
+ $(OBJS)\test_gui_setsize.o
PRINTFBENCH_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) \
$(GCCFLAGS) -DHAVE_W32API_H -D__WXMSW__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
@@ -523,6 +524,9 @@ $(OBJS)\test_gui_selstoretest.o: ./misc/selstoretest.cpp
$(OBJS)\test_gui_clientsize.o: ./window/clientsize.cpp
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
+$(OBJS)\test_gui_setsize.o: ./window/setsize.cpp
+ $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\printfbench_dummy.o: ./dummy.cpp
$(CXX) -c -o $@ $(PRINTFBENCH_CXXFLAGS) $(CPPDEPS) $<
diff --git a/tests/makefile.vc b/tests/makefile.vc
index 4a238a3295..08d5e1ede0 100644
--- a/tests/makefile.vc
+++ b/tests/makefile.vc
@@ -101,7 +101,8 @@ TEST_GUI_OBJECTS = \
$(OBJS)\test_gui_config.obj \
$(OBJS)\test_gui_textctrltest.obj \
$(OBJS)\test_gui_selstoretest.obj \
- $(OBJS)\test_gui_clientsize.obj
+ $(OBJS)\test_gui_clientsize.obj \
+ $(OBJS)\test_gui_setsize.obj
PRINTFBENCH_CXXFLAGS = /M$(__RUNTIME_LIBS_38)$(__DEBUGRUNTIME) /DWIN32 \
$(__DEBUGINFO) /Fd$(OBJS)\printfbench.pdb $(____DEBUGRUNTIME) \
$(__OPTIMIZEFLAG) $(__NO_VC_CRTDBG_p) /D__WXMSW__ $(__WXUNIV_DEFINE_p) \
@@ -630,6 +631,9 @@ $(OBJS)\test_gui_selstoretest.obj: .\misc\selstoretest.cpp
$(OBJS)\test_gui_clientsize.obj: .\window\clientsize.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\window\clientsize.cpp
+$(OBJS)\test_gui_setsize.obj: .\window\setsize.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\window\setsize.cpp
+
$(OBJS)\printfbench_dummy.obj: .\dummy.cpp
$(CXX) /c /nologo /TP /Fo$@ $(PRINTFBENCH_CXXFLAGS) /Yctestprec.h .\dummy.cpp
diff --git a/tests/makefile.wat b/tests/makefile.wat
index 4da93dc9fc..ec777b57b1 100644
--- a/tests/makefile.wat
+++ b/tests/makefile.wat
@@ -310,7 +310,8 @@ TEST_GUI_OBJECTS = &
$(OBJS)\test_gui_config.obj &
$(OBJS)\test_gui_textctrltest.obj &
$(OBJS)\test_gui_selstoretest.obj &
- $(OBJS)\test_gui_clientsize.obj
+ $(OBJS)\test_gui_clientsize.obj &
+ $(OBJS)\test_gui_setsize.obj
PRINTFBENCH_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) &
$(__RUNTIME_LIBS) -d__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) &
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) &
@@ -576,6 +577,9 @@ $(OBJS)\test_gui_selstoretest.obj : .AUTODEPEND .\misc\selstoretest.cpp
$(OBJS)\test_gui_clientsize.obj : .AUTODEPEND .\window\clientsize.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<
+$(OBJS)\test_gui_setsize.obj : .AUTODEPEND .\window\setsize.cpp
+ $(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<
+
$(OBJS)\printfbench_dummy.obj : .AUTODEPEND .\dummy.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(PRINTFBENCH_CXXFLAGS) $<
diff --git a/tests/test.bkl b/tests/test.bkl
index b8b0475dc9..292779bcac 100644
--- a/tests/test.bkl
+++ b/tests/test.bkl
@@ -98,6 +98,7 @@
controls/textctrltest.cpp
misc/selstoretest.cpp
window/clientsize.cpp
+ window/setsize.cpp
core
base
diff --git a/tests/test_test_gui.dsp b/tests/test_test_gui.dsp
index ee5b74aea4..55dd1d27d1 100644
--- a/tests/test_test_gui.dsp
+++ b/tests/test_test_gui.dsp
@@ -265,6 +265,10 @@ SOURCE=.\misc\selstoretest.cpp
# End Source File
# Begin Source File
+SOURCE=.\window\setsize.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\geometry\size.cpp
# End Source File
# Begin Source File
diff --git a/tests/test_vc7_test_gui.vcproj b/tests/test_vc7_test_gui.vcproj
index 2a750e3879..99c8d2cd07 100644
--- a/tests/test_vc7_test_gui.vcproj
+++ b/tests/test_vc7_test_gui.vcproj
@@ -710,6 +710,8 @@
RelativePath=".\geometry\rect.cpp"/>
+
+
diff --git a/tests/window/setsize.cpp b/tests/window/setsize.cpp
new file mode 100644
index 0000000000..122cb0749a
--- /dev/null
+++ b/tests/window/setsize.cpp
@@ -0,0 +1,96 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name: tests/window/setsize.cpp
+// Purpose: Tests for SetSize() and related wxWindow methods
+// Author: Vadim Zeitlin
+// Created: 2008-05-25
+// RCS-ID: $Id$
+// Copyright: (c) 2008 Vadim Zeitlin
+///////////////////////////////////////////////////////////////////////////////
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "testprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/app.h"
+ #include "wx/window.h"
+#endif // WX_PRECOMP
+
+inline std::ostream& operator<<(std::ostream& o, const wxSize& s)
+{
+ return o << s.x << 'x' << s.y;
+}
+
+// ----------------------------------------------------------------------------
+// test class
+// ----------------------------------------------------------------------------
+
+class SetSizeTestCase : public CppUnit::TestCase
+{
+public:
+ SetSizeTestCase() { }
+
+ virtual void setUp();
+ virtual void tearDown();
+
+private:
+ CPPUNIT_TEST_SUITE( SetSizeTestCase );
+ CPPUNIT_TEST( SetSize );
+ CPPUNIT_TEST( SetSizeLessThanMinSize );
+ CPPUNIT_TEST_SUITE_END();
+
+ void SetSize();
+ void SetSizeLessThanMinSize();
+
+ wxWindow *m_win;
+
+ DECLARE_NO_COPY_CLASS(SetSizeTestCase)
+};
+
+// register in the unnamed registry so that these tests are run by default
+CPPUNIT_TEST_SUITE_REGISTRATION( SetSizeTestCase );
+
+// also include in it's own registry so that these tests can be run alone
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( SetSizeTestCase, "SetSizeTestCase" );
+
+// ----------------------------------------------------------------------------
+// test initialization
+// ----------------------------------------------------------------------------
+
+void SetSizeTestCase::setUp()
+{
+ m_win = new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY);
+}
+
+void SetSizeTestCase::tearDown()
+{
+ delete m_win;
+ m_win = NULL;
+}
+
+// ----------------------------------------------------------------------------
+// tests themselves
+// ----------------------------------------------------------------------------
+
+void SetSizeTestCase::SetSize()
+{
+ const wxSize size(127, 35);
+ m_win->SetSize(size);
+ CPPUNIT_ASSERT_EQUAL( size, m_win->GetSize() );
+}
+
+void SetSizeTestCase::SetSizeLessThanMinSize()
+{
+ m_win->SetMinSize(wxSize(100, 100));
+
+ const wxSize size(200, 50);
+ m_win->SetSize(size);
+ CPPUNIT_ASSERT_EQUAL( size, m_win->GetSize() );
+}
+