scrollbar handling simplification
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39178 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -100,47 +100,6 @@ private:
|
||||
DECLARE_NO_COPY_CLASS(wxGtkString)
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// GTK+ scroll types -> wxEventType
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// translate a GTK+ scroll type to a wxEventType
|
||||
inline wxEventType GtkScrollTypeToWx(guint scrollType)
|
||||
{
|
||||
wxEventType command;
|
||||
switch ( scrollType )
|
||||
{
|
||||
case GTK_SCROLL_STEP_BACKWARD:
|
||||
command = wxEVT_SCROLL_LINEUP;
|
||||
break;
|
||||
|
||||
case GTK_SCROLL_STEP_FORWARD:
|
||||
command = wxEVT_SCROLL_LINEDOWN;
|
||||
break;
|
||||
|
||||
case GTK_SCROLL_PAGE_BACKWARD:
|
||||
command = wxEVT_SCROLL_PAGEUP;
|
||||
break;
|
||||
|
||||
case GTK_SCROLL_PAGE_FORWARD:
|
||||
command = wxEVT_SCROLL_PAGEDOWN;
|
||||
break;
|
||||
|
||||
default:
|
||||
command = wxEVT_SCROLL_THUMBTRACK;
|
||||
}
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
inline wxEventType GtkScrollWinTypeToWx(guint scrollType)
|
||||
{
|
||||
// GtkScrollTypeToWx() returns SCROLL_XXX, not SCROLLWIN_XXX as we need
|
||||
return GtkScrollTypeToWx(scrollType) +
|
||||
wxEVT_SCROLLWIN_TOP - wxEVT_SCROLL_TOP;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Misc. functions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@@ -25,8 +25,7 @@ class WXDLLIMPEXP_CORE wxScrollBar;
|
||||
class WXDLLIMPEXP_CORE wxScrollBar: public wxScrollBarBase
|
||||
{
|
||||
public:
|
||||
wxScrollBar()
|
||||
{ m_adjust = (GtkAdjustment *) NULL; m_oldPos = 0.0; }
|
||||
wxScrollBar();
|
||||
inline wxScrollBar( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
@@ -49,19 +48,11 @@ public:
|
||||
int GetRange() const;
|
||||
virtual void SetThumbPosition( int viewStart );
|
||||
virtual void SetScrollbar( int position, int thumbSize, int range, int pageSize,
|
||||
bool refresh = TRUE );
|
||||
bool refresh = true );
|
||||
|
||||
// Backward compatibility
|
||||
// ----------------------
|
||||
|
||||
int GetValue(void) const;
|
||||
void SetValue( int viewStart );
|
||||
void GetValues( int *viewStart, int *viewLength, int *objectLength, int *pageLength) const;
|
||||
int GetViewLength() const;
|
||||
int GetObjectLength() const;
|
||||
void SetThumbSize(int thumbSize);
|
||||
void SetPageSize( int pageLength );
|
||||
void SetObjectLength( int objectLength );
|
||||
void SetViewLength( int viewLength );
|
||||
void SetRange(int range);
|
||||
|
||||
static wxVisualAttributes
|
||||
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
||||
@@ -71,12 +62,6 @@ public:
|
||||
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
|
||||
GtkAdjustment *m_adjust;
|
||||
float m_oldPos;
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxScrollBar)
|
||||
};
|
||||
|
@@ -31,17 +31,15 @@ public:
|
||||
|
||||
protected:
|
||||
// this does (each) half of AdjustScrollbars() work
|
||||
void DoAdjustScrollbar(GtkAdjustment *adj,
|
||||
void DoAdjustScrollbar(GtkRange* range,
|
||||
int pixelsPerLine,
|
||||
int winSize,
|
||||
int virtSize,
|
||||
int *pos,
|
||||
int *lines,
|
||||
int *linesPerPage);
|
||||
|
||||
// and this does the same for Scroll()
|
||||
void DoScroll(int orient,
|
||||
GtkAdjustment *adj,
|
||||
int pos,
|
||||
int pixelsPerLine,
|
||||
int *posOld);
|
||||
|
@@ -172,10 +172,6 @@ public:
|
||||
virtual void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
// Call after modifing the value of m_hAdjust or m_vAdjust to bring the
|
||||
// scrolbar in sync (this does not generate any wx events)
|
||||
void GtkUpdateScrollbar(int orient);
|
||||
|
||||
// Called from GTK signal handlers. it indicates that
|
||||
// the layouting functions have to be called later on
|
||||
// (i.e. in idle time, implemented in OnInternalIdle() ).
|
||||
@@ -192,6 +188,9 @@ public:
|
||||
// is this a radiobutton (used by radiobutton code itself only)?
|
||||
virtual bool IsRadioButton() const { return false; }
|
||||
|
||||
// Common scroll event handling code for wxWindow and wxScrollBar
|
||||
wxEventType GetScrollEventType(GtkRange* range);
|
||||
|
||||
// position and size of the window
|
||||
int m_x, m_y;
|
||||
int m_width, m_height;
|
||||
@@ -206,10 +205,10 @@ public:
|
||||
|
||||
wxGtkIMData *m_imData;
|
||||
|
||||
// scrolling stuff
|
||||
GtkAdjustment *m_hAdjust,*m_vAdjust;
|
||||
float m_oldHorizontalPos;
|
||||
float m_oldVerticalPos;
|
||||
// horizontal/vertical scroll bar
|
||||
GtkRange* m_scrollBar[2];
|
||||
// horizontal/vertical scroll position
|
||||
double m_scrollPos[2];
|
||||
|
||||
// extra (wxGTK-specific) flags
|
||||
bool m_needParent:1; // ! wxFrame, wxDialog, wxNotebookPage ?
|
||||
@@ -227,6 +226,8 @@ public:
|
||||
// chain needs update
|
||||
bool m_needsStyleChange:1; // May not be able to change
|
||||
// background style until OnIdle
|
||||
bool m_mouseButtonDown:1;
|
||||
bool m_blockScrollEvent:1;
|
||||
|
||||
// C++ has no virtual methods in the constrcutor of any class but we need
|
||||
// different methods of inserting a child window into a wxFrame,
|
||||
@@ -282,9 +283,8 @@ protected:
|
||||
// sets the border of a given GtkScrolledWindow from a wx style
|
||||
static void GtkScrolledWindowSetBorder(GtkWidget* w, int style);
|
||||
|
||||
protected:
|
||||
// GtkAdjustment to be used by Scroll{Lines,Pages}
|
||||
void SetVScrollAdjustment(GtkAdjustment* adj);
|
||||
void BlockScrollEvent();
|
||||
void UnblockScrollEvent();
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxWindowGTK)
|
||||
|
Reference in New Issue
Block a user