#include "wx/osx/uma.h"
#else
#include "wx/osx/private.h"
-// bring in themeing
+#if wxOSX_USE_COCOA
+// bring in theming
#include <Carbon/Carbon.h>
#endif
+#endif
#define MAC_SCROLLBAR_SIZE 15
#define MAC_SMALL_SCROLLBAR_SIZE 11
#ifndef __WXUNIVERSAL__
// Don't give scrollbars to wxControls unless they ask for them
- if ( (! IsKindOf(CLASSINFO(wxControl)) && ! IsKindOf(CLASSINFO(wxStatusBar)))
+ if ( (! IsKindOf(CLASSINFO(wxControl))
+#if wxUSE_STATUSBAR
+ && ! IsKindOf(CLASSINFO(wxStatusBar))
+#endif
+ )
|| (IsKindOf(CLASSINFO(wxControl)) && ((style & wxHSCROLL) || (style & wxVSCROLL))))
{
MacCreateScrollBars( style ) ;
void wxWindowMac::MacChildAdded()
{
+#if wxUSE_SCROLLBAR
if ( m_vScrollBar )
m_vScrollBar->Raise() ;
if ( m_hScrollBar )
m_hScrollBar->Raise() ;
+#endif
}
void wxWindowMac::MacPostControlCreate(const wxPoint& WXUNUSED(pos), const wxSize& size)
break ;
default:
- wxFAIL_MSG(_T("unexpected window variant"));
+ wxFAIL_MSG(wxT("unexpected window variant"));
break ;
}
m_peer->SetData<ControlSize>(kControlEntireControl, kControlSizeTag, &size ) ;
break ;
default:
- wxFAIL_MSG(_T("unexpected window variant"));
+ wxFAIL_MSG(wxT("unexpected window variant"));
break ;
}
int left, top;
m_peer->GetContentArea( left, top, ww, hh );
-
+#if wxUSE_SCROLLBAR
if (m_hScrollBar && m_hScrollBar->IsShown() )
hh -= m_hScrollBar->GetSize().y ;
if (m_vScrollBar && m_vScrollBar->IsShown() )
ww -= m_vScrollBar->GetSize().x ;
+#endif
if (x)
*x = ww;
if (y)
r.width =
r.height = 16 ;
- if ( IsKindOf( CLASSINFO( wxScrollBar ) ) )
+ if ( 0 )
+ {
+ }
+#if wxUSE_SCROLLBAR
+ else if ( IsKindOf( CLASSINFO( wxScrollBar ) ) )
{
r.height = 16 ;
}
- #if wxUSE_SPINBTN
+#endif
+#if wxUSE_SPINBTN
else if ( IsKindOf( CLASSINFO( wxSpinButton ) ) )
{
r.height = 24 ;
}
- #endif
+#endif
else
{
// return wxWindowBase::DoGetBestSize() ;
void wxWindowMac::SetLabel(const wxString& title)
{
+ if ( title == m_label )
+ return;
+
m_label = title ;
+ InvalidateBestSize();
+
if ( m_peer && m_peer->IsOk() )
m_peer->SetLabel( wxStripMenuCodes(m_label, wxStrip_Mnemonics), GetFont().GetEncoding() ) ;
int wxWindowMac::GetScrollPos(int orient) const
{
+#if wxUSE_SCROLLBAR
if ( orient == wxHORIZONTAL )
{
if ( m_hScrollBar )
if ( m_vScrollBar )
return m_vScrollBar->GetThumbPosition() ;
}
-
+#endif
return 0;
}
// of positions that we can scroll.
int wxWindowMac::GetScrollRange(int orient) const
{
+#if wxUSE_SCROLLBAR
if ( orient == wxHORIZONTAL )
{
if ( m_hScrollBar )
if ( m_vScrollBar )
return m_vScrollBar->GetRange() ;
}
-
+#endif
return 0;
}
int wxWindowMac::GetScrollThumb(int orient) const
{
+#if wxUSE_SCROLLBAR
if ( orient == wxHORIZONTAL )
{
if ( m_hScrollBar )
if ( m_vScrollBar )
return m_vScrollBar->GetThumbSize() ;
}
-
+#endif
return 0;
}
void wxWindowMac::SetScrollPos(int orient, int pos, bool WXUNUSED(refresh))
{
+#if wxUSE_SCROLLBAR
if ( orient == wxHORIZONTAL )
{
if ( m_hScrollBar )
if ( m_vScrollBar )
m_vScrollBar->SetThumbPosition( pos ) ;
}
+#endif
}
void
if ( IsTopLevel() )
return ;
+#if wxUSE_SCROLLBAR
if ( MacHasScrollBarCorner() )
{
CGContextRef cgContext = (CGContextRef) MacGetCGContextRef() ;
CGContextFillRect( cgContext, cgrect );
CGContextRestoreGState( cgContext );
}
+#endif
}
void wxWindowMac::MacPaintBorders( int WXUNUSED(leftOrigin) , int WXUNUSED(rightOrigin) )
void wxWindowMac::RemoveChild( wxWindowBase *child )
{
+#if wxUSE_SCROLLBAR
if ( child == m_hScrollBar )
m_hScrollBar = NULL ;
if ( child == m_vScrollBar )
m_vScrollBar = NULL ;
-
+#endif
wxWindowBase::RemoveChild( child ) ;
}
void wxWindowMac::DoUpdateScrollbarVisibility()
{
+#if wxUSE_SCROLLBAR
bool triggerSizeEvent = false;
if ( m_hScrollBar )
event.SetEventObject(this);
HandleWindowEvent(event);
}
+#endif
}
// New function that will replace some of the above.
void wxWindowMac::SetScrollbar(int orient, int pos, int thumb,
int range, bool refresh)
{
+#if wxUSE_SCROLLBAR
if ( orient == wxHORIZONTAL && m_hScrollBar )
m_hScrollBar->SetScrollbar(pos, thumb, range, thumb, refresh);
else if ( orient == wxVERTICAL && m_vScrollBar )
m_vScrollBar->SetScrollbar(pos, thumb, range, thumb, refresh);
DoUpdateScrollbarVisibility();
+#endif
}
// Does a physical scroll
child = node->GetData();
if (child == NULL)
continue;
+#if wxUSE_SCROLLBAR
if (child == m_vScrollBar)
continue;
if (child == m_hScrollBar)
continue;
+#endif
if (child->IsTopLevel())
continue;
void wxWindowMac::MacOnScroll( wxScrollEvent &event )
{
+#if wxUSE_SCROLLBAR
if ( event.GetEventObject() == m_vScrollBar || event.GetEventObject() == m_hScrollBar )
{
wxScrollWinEvent wevent;
HandleWindowEvent(wevent);
}
+#endif
}
wxWindow *wxWindowBase::DoFindFocus()
child = node->GetData();
if (child == NULL)
continue;
+#if wxUSE_SCROLLBAR
if (child == m_vScrollBar)
continue;
if (child == m_hScrollBar)
continue;
+#endif
if (child->IsTopLevel())
continue;
if (!child->IsShown())
bool wxWindowMac::MacHasScrollBarCorner() const
{
+#if wxUSE_SCROLLBAR
/* Returns whether the scroll bars in a wxScrolledWindow should be
* shortened. Scroll bars should be shortened if either:
*
// No parent frame found
return false ;
}
+#else
+ return false;
+#endif
}
void wxWindowMac::MacCreateScrollBars( long style )
{
+#if wxUSE_SCROLLBAR
wxASSERT_MSG( m_vScrollBar == NULL && m_hScrollBar == NULL , wxT("attempt to create window twice") ) ;
if ( style & ( wxVSCROLL | wxHSCROLL ) )
// because the create does not take into account the client area origin
// we might have a real position shift
MacRepositionScrollBars() ;
+#endif
}
bool wxWindowMac::MacIsChildOfClientArea( const wxWindow* child ) const
{
- bool result = ((child == NULL) || ((child != m_hScrollBar) && (child != m_vScrollBar)));
+ bool result = ((child == NULL)
+#if wxUSE_SCROLLBAR
+ || ((child != m_hScrollBar) && (child != m_vScrollBar))
+#endif
+ );
return result ;
}
void wxWindowMac::MacRepositionScrollBars()
{
+#if wxUSE_SCROLLBAR
if ( !m_hScrollBar && !m_vScrollBar )
return ;
m_vScrollBar->SetSize( vPoint.x , vPoint.y, vSize.x, vSize.y , wxSIZE_ALLOW_MINUS_ONE );
if ( m_hScrollBar )
m_hScrollBar->SetSize( hPoint.x , hPoint.y, hSize.x, hSize.y, wxSIZE_ALLOW_MINUS_ONE );
+#endif
}
bool wxWindowMac::AcceptsFocus() const