added wxWindow::AlwaysShowScrollbars() and its wxMac implementation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49611 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -190,6 +190,7 @@ All (GUI):
|
|||||||
- Added support for drop down toolbar buttons (Tim Kosse).
|
- Added support for drop down toolbar buttons (Tim Kosse).
|
||||||
- Added support for labels for toolbar controls (Vince Harron).
|
- Added support for labels for toolbar controls (Vince Harron).
|
||||||
- Added wxMessageDialog::SetMessage() and SetExtendedMessage().
|
- Added wxMessageDialog::SetMessage() and SetExtendedMessage().
|
||||||
|
- Added wxWindow::AlwaysShowScrollbars() (Julian Scheid)
|
||||||
- Added wxMouseEvent::GetClickCount() (Julian Scheid)
|
- Added wxMouseEvent::GetClickCount() (Julian Scheid)
|
||||||
- Added wxBG_STYLE_TRANSPARENT background style (Julian Scheid)
|
- Added wxBG_STYLE_TRANSPARENT background style (Julian Scheid)
|
||||||
- Added XRCSIZERITEM() macro for obtaining sizers from XRC (Brian Vanderburg II)
|
- Added XRCSIZERITEM() macro for obtaining sizers from XRC (Brian Vanderburg II)
|
||||||
|
@@ -219,6 +219,26 @@ called by the user code.
|
|||||||
\docparam{child}{Child window to add.}
|
\docparam{child}{Child window to add.}
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxWindow::AlwaysShowScrollbars}\label{wxwindowalwaysshowscrollbars}
|
||||||
|
|
||||||
|
\func{void}{AlwaysShowScrollbars}{\param{bool}{ hflag}, \param{bool}{ vflag}}
|
||||||
|
|
||||||
|
Call this function to force one or both scrollbars to be always shown, even if
|
||||||
|
the window is big enough to show its entire contents without scrolling.
|
||||||
|
|
||||||
|
\newsince{2.9.0}
|
||||||
|
|
||||||
|
\wxheading{Parameters}
|
||||||
|
|
||||||
|
\docparam{hflag}{Whether the horizontal scroll bar should always be visible.}
|
||||||
|
|
||||||
|
\docparam{vflag}{Whether the vertical scroll bar should always be visible.}
|
||||||
|
|
||||||
|
\wxheading{Remarks}
|
||||||
|
|
||||||
|
This function is currently only implemented under Mac/Carbon.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxWindow::CacheBestSize}\label{wxwindowcachebestsize}
|
\membersection{wxWindow::CacheBestSize}\label{wxwindowcachebestsize}
|
||||||
|
|
||||||
\constfunc{void}{CacheBestSize}{\param{const wxSize\& }{size}}
|
\constfunc{void}{CacheBestSize}{\param{const wxSize\& }{size}}
|
||||||
@@ -1686,6 +1706,21 @@ Returns {\tt true} if the window is retained, {\tt false} otherwise.
|
|||||||
Retained windows are only available on X platforms.
|
Retained windows are only available on X platforms.
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxWindow::IsScrollbarAlwaysShown}\label{wxwindowisscrollbaralwaysshown}
|
||||||
|
|
||||||
|
\func{bool}{IsScrollbarAlwaysShown}{\param{int}{ orient}}
|
||||||
|
|
||||||
|
Return whether a scrollbar is always shown.
|
||||||
|
|
||||||
|
\wxheading{Parameters}
|
||||||
|
|
||||||
|
\docparam{orient}{Orientation to check, either {\tt wxHORIZONTAL} or {\tt wxVERTICAL}.}
|
||||||
|
|
||||||
|
\wxheading{See also}
|
||||||
|
|
||||||
|
\helpref{wxWindow::AlwaysShowScrollbars}{wxwindowalwaysshowscrollbars}
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxWindow::IsShown}\label{wxwindowisshown}
|
\membersection{wxWindow::IsShown}\label{wxwindowisshown}
|
||||||
|
|
||||||
\constfunc{virtual bool}{IsShown}{\void}
|
\constfunc{virtual bool}{IsShown}{\void}
|
||||||
|
@@ -65,7 +65,7 @@ public:
|
|||||||
virtual void Freeze();
|
virtual void Freeze();
|
||||||
virtual void Thaw();
|
virtual void Thaw();
|
||||||
virtual bool IsFrozen() const;
|
virtual bool IsFrozen() const;
|
||||||
|
|
||||||
virtual void Update() ;
|
virtual void Update() ;
|
||||||
virtual void ClearBackground();
|
virtual void ClearBackground();
|
||||||
|
|
||||||
@@ -86,6 +86,7 @@ protected:
|
|||||||
virtual void DoEnable( bool enable );
|
virtual void DoEnable( bool enable );
|
||||||
virtual void OnEnabled( bool enabled );
|
virtual void OnEnabled( bool enabled );
|
||||||
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
|
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
||||||
int range, bool refresh = true );
|
int range, bool refresh = true );
|
||||||
@@ -95,6 +96,13 @@ public:
|
|||||||
virtual int GetScrollRange( int orient ) const;
|
virtual int GetScrollRange( int orient ) const;
|
||||||
virtual void ScrollWindow( int dx, int dy,
|
virtual void ScrollWindow( int dx, int dy,
|
||||||
const wxRect* rect = (wxRect *) NULL );
|
const wxRect* rect = (wxRect *) NULL );
|
||||||
|
virtual void AlwaysShowScrollbars(bool horz = true, bool vert = true);
|
||||||
|
virtual bool IsScrollbarAlwaysShown(int orient) const
|
||||||
|
{
|
||||||
|
return orient == wxHORIZONTAL ? m_hScrollBarAlwaysShown
|
||||||
|
: m_vScrollBarAlwaysShown;
|
||||||
|
}
|
||||||
|
|
||||||
virtual bool Reparent( wxWindowBase *newParent );
|
virtual bool Reparent( wxWindowBase *newParent );
|
||||||
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
@@ -126,7 +134,7 @@ public:
|
|||||||
virtual bool SetTransparent(wxByte alpha);
|
virtual bool SetTransparent(wxByte alpha);
|
||||||
virtual bool CanSetTransparent();
|
virtual bool CanSetTransparent();
|
||||||
virtual wxByte GetTransparent() const ;
|
virtual wxByte GetTransparent() const ;
|
||||||
|
|
||||||
// event handlers
|
// event handlers
|
||||||
// --------------
|
// --------------
|
||||||
void OnSetFocus( wxFocusEvent& event );
|
void OnSetFocus( wxFocusEvent& event );
|
||||||
@@ -302,6 +310,8 @@ protected:
|
|||||||
|
|
||||||
wxScrollBar* m_hScrollBar ;
|
wxScrollBar* m_hScrollBar ;
|
||||||
wxScrollBar* m_vScrollBar ;
|
wxScrollBar* m_vScrollBar ;
|
||||||
|
bool m_hScrollBarAlwaysShown;
|
||||||
|
bool m_vScrollBarAlwaysShown;
|
||||||
wxString m_label ;
|
wxString m_label ;
|
||||||
|
|
||||||
// set to true if we do a sharp clip at the content area of this window
|
// set to true if we do a sharp clip at the content area of this window
|
||||||
@@ -349,6 +359,11 @@ private:
|
|||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
// show/hide scrollbars as needed, common part of SetScrollbar() and
|
||||||
|
// AlwaysShowScrollbars()
|
||||||
|
void DoUpdateScrollbarVisibility();
|
||||||
|
|
||||||
|
|
||||||
WXEVENTHANDLERREF m_macControlEventHandler ;
|
WXEVENTHANDLERREF m_macControlEventHandler ;
|
||||||
|
|
||||||
DECLARE_NO_COPY_CLASS(wxWindowMac)
|
DECLARE_NO_COPY_CLASS(wxWindowMac)
|
||||||
|
@@ -52,6 +52,9 @@ public:
|
|||||||
int range, int pageSize,
|
int range, int pageSize,
|
||||||
bool refresh = true) = 0;
|
bool refresh = true) = 0;
|
||||||
|
|
||||||
|
// implementation-only
|
||||||
|
bool IsNeeded() const { return GetRange() > GetThumbSize(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_NO_COPY_CLASS(wxScrollBarBase)
|
DECLARE_NO_COPY_CLASS(wxScrollBarBase)
|
||||||
};
|
};
|
||||||
|
@@ -1044,6 +1044,20 @@ public:
|
|||||||
bool PageUp() { return ScrollPages(-1); }
|
bool PageUp() { return ScrollPages(-1); }
|
||||||
bool PageDown() { return ScrollPages(1); }
|
bool PageDown() { return ScrollPages(1); }
|
||||||
|
|
||||||
|
// call this to always show one or both scrollbars, even if the window
|
||||||
|
// is big enough to not require them
|
||||||
|
virtual void AlwaysShowScrollbars(bool WXUNUSED(horz) = true,
|
||||||
|
bool WXUNUSED(vert) = true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// return true if AlwaysShowScrollbars() had been called before for the
|
||||||
|
// corresponding orientation
|
||||||
|
virtual bool IsScrollbarAlwaysShown(int WXUNUSED(orient)) const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// context-sensitive help
|
// context-sensitive help
|
||||||
// ----------------------
|
// ----------------------
|
||||||
|
|
||||||
@@ -1249,7 +1263,6 @@ protected:
|
|||||||
// implementation of Navigate() and NavigateIn()
|
// implementation of Navigate() and NavigateIn()
|
||||||
virtual bool DoNavigateIn(int flags);
|
virtual bool DoNavigateIn(int flags);
|
||||||
|
|
||||||
|
|
||||||
#if wxUSE_CONSTRAINTS
|
#if wxUSE_CONSTRAINTS
|
||||||
// satisfy the constraints for the windows but don't set the window sizes
|
// satisfy the constraints for the windows but don't set the window sizes
|
||||||
void SatisfyConstraints();
|
void SatisfyConstraints();
|
||||||
|
@@ -980,6 +980,9 @@ void wxWindowMac::Init()
|
|||||||
|
|
||||||
m_hScrollBar = NULL ;
|
m_hScrollBar = NULL ;
|
||||||
m_vScrollBar = NULL ;
|
m_vScrollBar = NULL ;
|
||||||
|
m_hScrollBarAlwaysShown = false;
|
||||||
|
m_vScrollBarAlwaysShown = false;
|
||||||
|
|
||||||
m_macBackgroundBrush = wxNullBrush ;
|
m_macBackgroundBrush = wxNullBrush ;
|
||||||
|
|
||||||
m_macIsUserPane = true;
|
m_macIsUserPane = true;
|
||||||
@@ -2453,6 +2456,26 @@ void wxWindowMac::SetScrollPos(int orient, int pos, bool refresh)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wxWindowMac::AlwaysShowScrollbars(bool hflag, bool vflag)
|
||||||
|
{
|
||||||
|
bool needVisibilityUpdate = false;
|
||||||
|
|
||||||
|
if ( m_hScrollBarAlwaysShown != hflag )
|
||||||
|
{
|
||||||
|
m_hScrollBarAlwaysShown = hflag;
|
||||||
|
needVisibilityUpdate = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_vScrollBarAlwaysShown != vflag )
|
||||||
|
{
|
||||||
|
m_vScrollBarAlwaysShown = vflag;
|
||||||
|
needVisibilityUpdate = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( needVisibilityUpdate )
|
||||||
|
DoUpdateScrollbarVisibility();
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// we draw borders and grow boxes, are already set up and clipped in the current port / cgContextRef
|
// we draw borders and grow boxes, are already set up and clipped in the current port / cgContextRef
|
||||||
// our own window origin is at leftOrigin/rightOrigin
|
// our own window origin is at leftOrigin/rightOrigin
|
||||||
@@ -2555,39 +2578,29 @@ void wxWindowMac::RemoveChild( wxWindowBase *child )
|
|||||||
wxWindowBase::RemoveChild( child ) ;
|
wxWindowBase::RemoveChild( child ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// New function that will replace some of the above.
|
void wxWindowMac::DoUpdateScrollbarVisibility()
|
||||||
void wxWindowMac::SetScrollbar(int orient, int pos, int thumbVisible,
|
|
||||||
int range, bool refresh)
|
|
||||||
{
|
{
|
||||||
bool showScroller;
|
|
||||||
bool triggerSizeEvent = false;
|
bool triggerSizeEvent = false;
|
||||||
|
|
||||||
if ( orient == wxHORIZONTAL )
|
if ( m_hScrollBar )
|
||||||
{
|
{
|
||||||
if ( m_hScrollBar )
|
bool showHScrollBar = m_hScrollBarAlwaysShown || m_hScrollBar->IsNeeded();
|
||||||
{
|
|
||||||
showScroller = ((range != 0) && (range > thumbVisible));
|
|
||||||
if ( m_hScrollBar->IsShown() != showScroller )
|
|
||||||
{
|
|
||||||
m_hScrollBar->Show( showScroller );
|
|
||||||
triggerSizeEvent = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_hScrollBar->SetScrollbar( pos , thumbVisible , range , thumbVisible , refresh ) ;
|
if ( m_hScrollBar->IsShown() != showHScrollBar )
|
||||||
|
{
|
||||||
|
m_hScrollBar->Show( showHScrollBar );
|
||||||
|
triggerSizeEvent = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( m_vScrollBar )
|
|
||||||
{
|
|
||||||
showScroller = ((range != 0) && (range > thumbVisible));
|
|
||||||
if ( m_vScrollBar->IsShown() != showScroller )
|
|
||||||
{
|
|
||||||
m_vScrollBar->Show( showScroller ) ;
|
|
||||||
triggerSizeEvent = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_vScrollBar->SetScrollbar( pos , thumbVisible , range , thumbVisible , refresh ) ;
|
if ( m_vScrollBar)
|
||||||
|
{
|
||||||
|
bool showVScrollBar = m_vScrollBarAlwaysShown || m_vScrollBar->IsNeeded();
|
||||||
|
|
||||||
|
if ( m_vScrollBar->IsShown() != showVScrollBar )
|
||||||
|
{
|
||||||
|
m_vScrollBar->Show( showVScrollBar ) ;
|
||||||
|
triggerSizeEvent = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2600,6 +2613,18 @@ void wxWindowMac::SetScrollbar(int orient, int pos, int thumbVisible,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// New function that will replace some of the above.
|
||||||
|
void wxWindowMac::SetScrollbar(int orient, int pos, int thumb,
|
||||||
|
int range, bool refresh)
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
// Does a physical scroll
|
// Does a physical scroll
|
||||||
void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
|
void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user