+ // sets the size to be size but take width and/or height from
+ // DoGetBestSize() if width/height of size is -1
+ //
+ // NB: when calling this function from the ctor, the DoGetBestSize() of
+ // the class with the same name as the ctor, not the real (most
+ // derived) one - but this is what we usually want
+ void SetSizeOrDefault(const wxSize& size = wxDefaultSize)
+ {
+ if ( size.x == -1 || size.y == -1 )
+ {
+ wxSize sizeDef = GetBestSize();
+ SetSize( size.x == -1 ? sizeDef.x : size.x,
+ size.y == -1 ? sizeDef.y : size.y);
+ }
+ else
+ {
+ SetSize(size);
+ }
+ }
+