Handle setting of client size for all types of windows

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22983 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott
2003-08-17 23:23:26 +00:00
parent b7aec135d7
commit e08efb8dd9
6 changed files with 36 additions and 17 deletions

View File

@@ -91,21 +91,13 @@ wxPoint wxFrame::GetClientAreaOrigin() const
return wxPoint(0,0);
}
void wxFrame::DoGetClientSize(int *width, int *height) const
void wxFrame::CocoaSetWxWindowSize(int width, int height)
{
wxFrameBase::DoGetClientSize(width,height);
if(height)
{
if(m_frameStatusBar && m_frameStatusBar->IsShown())
*height -= m_frameStatusBar->GetSize().y;
}
}
void wxFrame::DoSetClientSize(int width, int height)
{
if(m_frameStatusBar && m_frameStatusBar->IsShown())
if(m_frameStatusBar)
height += m_frameStatusBar->GetSize().y;
wxFrameBase::DoSetClientSize(width,height);
if(m_frameToolBar)
height += m_frameToolBar->GetSize().y;
wxTopLevelWindow::CocoaSetWxWindowSize(width,height);
}
void wxFrame::CocoaReplaceView(WX_NSView oldView, WX_NSView newView)

View File

@@ -221,6 +221,22 @@ bool wxTopLevelWindowCocoa::IsFullScreen() const
return FALSE;
}
void wxTopLevelWindowCocoa::CocoaSetWxWindowSize(int width, int height)
{
// Set the NSView size by setting the frame size to enclose it
unsigned int styleMask = [m_cocoaNSWindow styleMask];
NSRect frameRect = [m_cocoaNSWindow frame];
NSRect contentRect = [NSWindow
contentRectForFrameRect: frameRect
styleMask: styleMask];
contentRect.size.width = width;
contentRect.size.height = height;
frameRect = [NSWindow
frameRectForContentRect: contentRect
styleMask: styleMask];
[m_cocoaNSWindow setFrame: frameRect display: NO];
}
void wxTopLevelWindowCocoa::DoMoveWindow(int x, int y, int width, int height)
{
wxLogDebug("wxTopLevelWindow=%p::DoMoveWindow(%d,%d,%d,%d)",this,x,y,width,height);

View File

@@ -600,7 +600,14 @@ void wxWindow::DoGetClientSize(int *x, int *y) const
void wxWindow::DoSetClientSize(int width, int height)
{
wxLogDebug("DoSetClientSize=(%d,%d)",width,height);
// TODO
if(m_cocoaScroller)
m_cocoaScroller->ClientSizeToSize(width,height);
CocoaSetWxWindowSize(width,height);
}
void wxWindow::CocoaSetWxWindowSize(int width, int height)
{
wxWindowCocoa::DoSetSize(-1,-1,width,height,wxSIZE_USE_EXISTING);
}
int wxWindow::GetCharHeight() const
@@ -664,6 +671,7 @@ void wxWindow::CocoaCreateNSScrollView()
void wxWindow::SetScrollbar(int orient, int pos, int thumbVisible,
int range, bool refresh)
{
CocoaCreateNSScrollView();
// TODO
}