Implement wxSlider ticks support in wxGTK

Tick marks were not available for wxSlider under GTK+ 2 or GTK+ 3
implementations of wxWidgets. However, tick marks have been available
for the GtkScale widget since GTK+ 2 version 2.16.

This change adds similar functionality in relation to tick marks
as was already available in wxMSW builds.

Closes https://github.com/wxWidgets/wxWidgets/pull/1355
This commit is contained in:
iwbnwif
2019-06-30 21:45:25 +01:00
committed by Vadim Zeitlin
parent e8991252ec
commit a7fe78eda8
3 changed files with 105 additions and 20 deletions

View File

@@ -56,6 +56,10 @@ public:
virtual void SetThumbLength(int lenPixels) wxOVERRIDE;
virtual int GetThumbLength() const wxOVERRIDE;
virtual void ClearTicks() wxOVERRIDE;
virtual void SetTick(int tickPos) wxOVERRIDE;
int GetTickFreq() const wxOVERRIDE;
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
@@ -73,11 +77,20 @@ protected:
GtkWidget *m_minLabel,*m_maxLabel;
bool m_blockScrollEvent;
// Note the following member is not used in GTK+2 < 2.16.
int m_tickFreq;
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE;
// set the slider value unconditionally
void GTKSetValue(int value);
// Platform-specific implementation of SetTickFreq
virtual void DoSetTickFreq(int freq) wxOVERRIDE;
private:
void Init();
wxDECLARE_DYNAMIC_CLASS(wxSlider);
};