Added helper functions for setting initial window size:

* inline MakeDefaultNSRect makes an NSRect with position (10.0,10.0) and
  size based on the size passed to Create run through (Width|Height)Default
  This NSRect is to be used with the initWithFrame: initializer.
* SetInitialFrameRect is called after the window has been added to its parent
  and (if applicable) sized to fit.  If -1 is specified for a dimension then
  the fit/default size is kept.  If not, the window is sized to the specified
  size. It will be positioned in wxWindows coordinates (0,0==TL).


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22809 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott
2003-08-13 19:37:45 +00:00
parent 6056c7c6f3
commit d139c3a84b
2 changed files with 30 additions and 2 deletions

View File

@@ -14,6 +14,10 @@
#include "wx/cocoa/NSView.h"
#ifdef __OBJC__
#import <Foundation/NSGeometry.h>
#endif //def __OBJC__
class wxWindowCocoaHider;
// ========================================================================
@@ -83,6 +87,14 @@ protected:
bool m_isInPaint;
static wxWindow *sm_capturedWindow;
virtual void CocoaReplaceView(WX_NSView oldView, WX_NSView newView);
void SetInitialFrameRect(const wxPoint& pos, const wxSize& size);
#ifdef __OBJC__
inline NSRect MakeDefaultNSRect(const wxSize& size)
{
// NOTE: position is 10,10 to make it "obvious" that it's out of place
return NSMakeRect(10.0,10.0,WidthDefault(size.x),HeightDefault(size.y));
}
#endif //def __OBJC__
// ------------------------------------------------------------------------
// Implementation
// ------------------------------------------------------------------------