Renamed the wxWindowCocoaScroller class to wxWindowCocoaScrollView because
it was confusing. Scroller is the Cocoa term for a scroll bar. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31312 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
25b0e7c897
commit
f298b203b5
@ -19,7 +19,7 @@
|
|||||||
#endif //def __OBJC__
|
#endif //def __OBJC__
|
||||||
|
|
||||||
class wxWindowCocoaHider;
|
class wxWindowCocoaHider;
|
||||||
class wxWindowCocoaScroller;
|
class wxWindowCocoaScrollView;
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// wxWindowCocoa
|
// wxWindowCocoa
|
||||||
@ -30,7 +30,7 @@ class WXDLLEXPORT wxWindowCocoa: public wxWindowBase, protected wxCocoaNSView
|
|||||||
DECLARE_NO_COPY_CLASS(wxWindowCocoa)
|
DECLARE_NO_COPY_CLASS(wxWindowCocoa)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
friend wxWindow *wxWindowBase::GetCapture();
|
friend wxWindow *wxWindowBase::GetCapture();
|
||||||
friend class wxWindowCocoaScroller;
|
friend class wxWindowCocoaScrollView;
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
// initialization
|
// initialization
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
@ -100,7 +100,7 @@ protected:
|
|||||||
void SetNSView(WX_NSView cocoaNSView);
|
void SetNSView(WX_NSView cocoaNSView);
|
||||||
WX_NSView m_cocoaNSView;
|
WX_NSView m_cocoaNSView;
|
||||||
wxWindowCocoaHider *m_cocoaHider;
|
wxWindowCocoaHider *m_cocoaHider;
|
||||||
wxWindowCocoaScroller *m_cocoaScroller;
|
wxWindowCocoaScrollView *m_wxCocoaScrollView;
|
||||||
bool m_isInPaint;
|
bool m_isInPaint;
|
||||||
static wxWindow *sm_capturedWindow;
|
static wxWindow *sm_capturedWindow;
|
||||||
virtual void CocoaReplaceView(WX_NSView oldView, WX_NSView newView);
|
virtual void CocoaReplaceView(WX_NSView oldView, WX_NSView newView);
|
||||||
|
@ -60,14 +60,14 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// wxWindowCocoaScroller
|
// wxWindowCocoaScrollView
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
class wxWindowCocoaScroller: protected wxCocoaNSView
|
class wxWindowCocoaScrollView: protected wxCocoaNSView
|
||||||
{
|
{
|
||||||
DECLARE_NO_COPY_CLASS(wxWindowCocoaScroller)
|
DECLARE_NO_COPY_CLASS(wxWindowCocoaScrollView)
|
||||||
public:
|
public:
|
||||||
wxWindowCocoaScroller(wxWindow *owner);
|
wxWindowCocoaScrollView(wxWindow *owner);
|
||||||
virtual ~wxWindowCocoaScroller();
|
virtual ~wxWindowCocoaScrollView();
|
||||||
inline WX_NSScrollView GetNSScrollView() { return m_cocoaNSScrollView; }
|
inline WX_NSScrollView GetNSScrollView() { return m_cocoaNSScrollView; }
|
||||||
void ClientSizeToSize(int &width, int &height);
|
void ClientSizeToSize(int &width, int &height);
|
||||||
void DoGetClientSize(int *x, int *y) const;
|
void DoGetClientSize(int *x, int *y) const;
|
||||||
@ -78,7 +78,7 @@ protected:
|
|||||||
WX_NSScrollView m_cocoaNSScrollView;
|
WX_NSScrollView m_cocoaNSScrollView;
|
||||||
virtual void Cocoa_FrameChanged(void);
|
virtual void Cocoa_FrameChanged(void);
|
||||||
private:
|
private:
|
||||||
wxWindowCocoaScroller();
|
wxWindowCocoaScrollView();
|
||||||
};
|
};
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
@ -151,9 +151,9 @@ bool wxWindowCocoaHider::Cocoa_drawRect(const NSRect& rect)
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// wxWindowCocoaScroller
|
// wxWindowCocoaScrollView
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
wxWindowCocoaScroller::wxWindowCocoaScroller(wxWindow *owner)
|
wxWindowCocoaScrollView::wxWindowCocoaScrollView(wxWindow *owner)
|
||||||
: m_owner(owner)
|
: m_owner(owner)
|
||||||
{
|
{
|
||||||
wxAutoNSAutoreleasePool pool;
|
wxAutoNSAutoreleasePool pool;
|
||||||
@ -176,7 +176,7 @@ wxWindowCocoaScroller::wxWindowCocoaScroller(wxWindow *owner)
|
|||||||
Encapsulate();
|
Encapsulate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowCocoaScroller::Encapsulate()
|
void wxWindowCocoaScrollView::Encapsulate()
|
||||||
{
|
{
|
||||||
// Set the scroll view autoresizingMask to match the current NSView
|
// Set the scroll view autoresizingMask to match the current NSView
|
||||||
[m_cocoaNSScrollView setAutoresizingMask: [m_owner->GetNSView() autoresizingMask]];
|
[m_cocoaNSScrollView setAutoresizingMask: [m_owner->GetNSView() autoresizingMask]];
|
||||||
@ -190,7 +190,7 @@ void wxWindowCocoaScroller::Encapsulate()
|
|||||||
// Now it's also retained by the NSScrollView
|
// Now it's also retained by the NSScrollView
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowCocoaScroller::Unencapsulate()
|
void wxWindowCocoaScrollView::Unencapsulate()
|
||||||
{
|
{
|
||||||
[m_cocoaNSScrollView setDocumentView: nil];
|
[m_cocoaNSScrollView setDocumentView: nil];
|
||||||
m_owner->CocoaReplaceView(m_cocoaNSScrollView, m_owner->GetNSView());
|
m_owner->CocoaReplaceView(m_cocoaNSScrollView, m_owner->GetNSView());
|
||||||
@ -198,13 +198,13 @@ void wxWindowCocoaScroller::Unencapsulate()
|
|||||||
[m_owner->GetNSView() setAutoresizingMask: NSViewMinYMargin];
|
[m_owner->GetNSView() setAutoresizingMask: NSViewMinYMargin];
|
||||||
}
|
}
|
||||||
|
|
||||||
wxWindowCocoaScroller::~wxWindowCocoaScroller()
|
wxWindowCocoaScrollView::~wxWindowCocoaScrollView()
|
||||||
{
|
{
|
||||||
DisassociateNSView(m_cocoaNSScrollView);
|
DisassociateNSView(m_cocoaNSScrollView);
|
||||||
[m_cocoaNSScrollView release];
|
[m_cocoaNSScrollView release];
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowCocoaScroller::ClientSizeToSize(int &width, int &height)
|
void wxWindowCocoaScrollView::ClientSizeToSize(int &width, int &height)
|
||||||
{
|
{
|
||||||
NSSize frameSize = [NSScrollView
|
NSSize frameSize = [NSScrollView
|
||||||
frameSizeForContentSize: NSMakeSize(width,height)
|
frameSizeForContentSize: NSMakeSize(width,height)
|
||||||
@ -215,7 +215,7 @@ void wxWindowCocoaScroller::ClientSizeToSize(int &width, int &height)
|
|||||||
height = (int)frameSize.height;
|
height = (int)frameSize.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowCocoaScroller::DoGetClientSize(int *x, int *y) const
|
void wxWindowCocoaScrollView::DoGetClientSize(int *x, int *y) const
|
||||||
{
|
{
|
||||||
NSSize nssize = [m_cocoaNSScrollView contentSize];
|
NSSize nssize = [m_cocoaNSScrollView contentSize];
|
||||||
if(x)
|
if(x)
|
||||||
@ -224,7 +224,7 @@ void wxWindowCocoaScroller::DoGetClientSize(int *x, int *y) const
|
|||||||
*y = (int)nssize.height;
|
*y = (int)nssize.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowCocoaScroller::Cocoa_FrameChanged(void)
|
void wxWindowCocoaScrollView::Cocoa_FrameChanged(void)
|
||||||
{
|
{
|
||||||
wxLogTrace(wxTRACE_COCOA,wxT("Cocoa_FrameChanged"));
|
wxLogTrace(wxTRACE_COCOA,wxT("Cocoa_FrameChanged"));
|
||||||
wxSizeEvent event(m_owner->GetSize(), m_owner->GetId());
|
wxSizeEvent event(m_owner->GetSize(), m_owner->GetId());
|
||||||
@ -252,7 +252,7 @@ void wxWindowCocoa::Init()
|
|||||||
{
|
{
|
||||||
m_cocoaNSView = NULL;
|
m_cocoaNSView = NULL;
|
||||||
m_cocoaHider = NULL;
|
m_cocoaHider = NULL;
|
||||||
m_cocoaScroller = NULL;
|
m_wxCocoaScrollView = NULL;
|
||||||
m_isBeingDeleted = FALSE;
|
m_isBeingDeleted = FALSE;
|
||||||
m_isInPaint = FALSE;
|
m_isInPaint = FALSE;
|
||||||
m_shouldBeEnabled = true;
|
m_shouldBeEnabled = true;
|
||||||
@ -294,7 +294,7 @@ wxWindow::~wxWindow()
|
|||||||
if(m_parent && m_parent->GetNSView()==[GetNSViewForSuperview() superview])
|
if(m_parent && m_parent->GetNSView()==[GetNSViewForSuperview() superview])
|
||||||
CocoaRemoveFromParent();
|
CocoaRemoveFromParent();
|
||||||
delete m_cocoaHider;
|
delete m_cocoaHider;
|
||||||
delete m_cocoaScroller;
|
delete m_wxCocoaScrollView;
|
||||||
if(m_cocoaNSView)
|
if(m_cocoaNSView)
|
||||||
SendDestroyEvent();
|
SendDestroyEvent();
|
||||||
SetNSView(NULL);
|
SetNSView(NULL);
|
||||||
@ -330,15 +330,15 @@ WX_NSView wxWindowCocoa::GetNSViewForSuperview() const
|
|||||||
{
|
{
|
||||||
return m_cocoaHider
|
return m_cocoaHider
|
||||||
? m_cocoaHider->GetNSView()
|
? m_cocoaHider->GetNSView()
|
||||||
: m_cocoaScroller
|
: m_wxCocoaScrollView
|
||||||
? m_cocoaScroller->GetNSScrollView()
|
? m_wxCocoaScrollView->GetNSScrollView()
|
||||||
: m_cocoaNSView;
|
: m_cocoaNSView;
|
||||||
}
|
}
|
||||||
|
|
||||||
WX_NSView wxWindowCocoa::GetNSViewForHiding() const
|
WX_NSView wxWindowCocoa::GetNSViewForHiding() const
|
||||||
{
|
{
|
||||||
return m_cocoaScroller
|
return m_wxCocoaScrollView
|
||||||
? m_cocoaScroller->GetNSScrollView()
|
? m_wxCocoaScrollView->GetNSScrollView()
|
||||||
: m_cocoaNSView;
|
: m_cocoaNSView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -742,8 +742,8 @@ void wxWindow::DoClientToScreen(int *x, int *y) const
|
|||||||
void wxWindow::DoGetClientSize(int *x, int *y) const
|
void wxWindow::DoGetClientSize(int *x, int *y) const
|
||||||
{
|
{
|
||||||
wxLogTrace(wxTRACE_COCOA,wxT("DoGetClientSize:"));
|
wxLogTrace(wxTRACE_COCOA,wxT("DoGetClientSize:"));
|
||||||
if(m_cocoaScroller)
|
if(m_wxCocoaScrollView)
|
||||||
m_cocoaScroller->DoGetClientSize(x,y);
|
m_wxCocoaScrollView->DoGetClientSize(x,y);
|
||||||
else
|
else
|
||||||
wxWindowCocoa::DoGetSize(x,y);
|
wxWindowCocoa::DoGetSize(x,y);
|
||||||
}
|
}
|
||||||
@ -751,8 +751,8 @@ void wxWindow::DoGetClientSize(int *x, int *y) const
|
|||||||
void wxWindow::DoSetClientSize(int width, int height)
|
void wxWindow::DoSetClientSize(int width, int height)
|
||||||
{
|
{
|
||||||
wxLogTrace(wxTRACE_COCOA_Window_Size,wxT("DoSetClientSize=(%d,%d)"),width,height);
|
wxLogTrace(wxTRACE_COCOA_Window_Size,wxT("DoSetClientSize=(%d,%d)"),width,height);
|
||||||
if(m_cocoaScroller)
|
if(m_wxCocoaScrollView)
|
||||||
m_cocoaScroller->ClientSizeToSize(width,height);
|
m_wxCocoaScrollView->ClientSizeToSize(width,height);
|
||||||
CocoaSetWxWindowSize(width,height);
|
CocoaSetWxWindowSize(width,height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -812,9 +812,9 @@ void wxWindow::SetScrollPos(int orient, int pos, bool refresh)
|
|||||||
|
|
||||||
void wxWindow::CocoaCreateNSScrollView()
|
void wxWindow::CocoaCreateNSScrollView()
|
||||||
{
|
{
|
||||||
if(!m_cocoaScroller)
|
if(!m_wxCocoaScrollView)
|
||||||
{
|
{
|
||||||
m_cocoaScroller = new wxWindowCocoaScroller(this);
|
m_wxCocoaScrollView = new wxWindowCocoaScrollView(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user