2011-03-20 18:05:19 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/osx/slider.h
|
|
|
|
// Purpose: wxSlider class
|
|
|
|
// Author: Stefan Csomor
|
|
|
|
// Modified by:
|
|
|
|
// Created: 1998-01-01
|
|
|
|
// Copyright: (c) Stefan Csomor
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_SLIDER_H_
|
|
|
|
#define _WX_SLIDER_H_
|
|
|
|
|
2016-06-26 05:25:29 +00:00
|
|
|
#include "wx/compositewin.h"
|
2011-03-20 18:05:19 +00:00
|
|
|
#include "wx/stattext.h"
|
|
|
|
|
|
|
|
// Slider
|
2016-06-26 05:25:29 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxSlider: public wxCompositeWindow<wxSliderBase>
|
2011-03-20 18:05:19 +00:00
|
|
|
{
|
2016-06-26 05:25:29 +00:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxSlider);
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
wxSlider();
|
|
|
|
|
2016-06-26 05:25:29 +00:00
|
|
|
wxSlider(wxWindow *parent, wxWindowID id,
|
2011-03-20 18:05:19 +00:00
|
|
|
int value, int minValue, int maxValue,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxSL_HORIZONTAL,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxSliderNameStr)
|
|
|
|
{
|
|
|
|
Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~wxSlider();
|
|
|
|
|
|
|
|
bool Create(wxWindow *parent, wxWindowID id,
|
|
|
|
int value, int minValue, int maxValue,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxSL_HORIZONTAL,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxSliderNameStr);
|
|
|
|
|
2016-06-26 05:25:29 +00:00
|
|
|
virtual int GetValue() const wxOVERRIDE;
|
|
|
|
virtual void SetValue(int) wxOVERRIDE;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2016-06-26 05:25:29 +00:00
|
|
|
void SetRange(int minValue, int maxValue) wxOVERRIDE;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2016-06-26 05:25:29 +00:00
|
|
|
int GetMin() const wxOVERRIDE { return m_rangeMin; }
|
|
|
|
int GetMax() const wxOVERRIDE { return m_rangeMax; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
void SetMin(int minValue) { SetRange(minValue, m_rangeMax); }
|
|
|
|
void SetMax(int maxValue) { SetRange(m_rangeMin, maxValue); }
|
|
|
|
|
|
|
|
// For trackbars only
|
2016-06-26 05:25:29 +00:00
|
|
|
int GetTickFreq() const wxOVERRIDE { return m_tickFreq; }
|
|
|
|
void SetPageSize(int pageSize) wxOVERRIDE;
|
|
|
|
int GetPageSize() const wxOVERRIDE;
|
|
|
|
void ClearSel() wxOVERRIDE;
|
|
|
|
void ClearTicks() wxOVERRIDE;
|
|
|
|
void SetLineSize(int lineSize) wxOVERRIDE;
|
|
|
|
int GetLineSize() const wxOVERRIDE;
|
|
|
|
int GetSelEnd() const wxOVERRIDE;
|
|
|
|
int GetSelStart() const wxOVERRIDE;
|
|
|
|
void SetSelection(int minPos, int maxPos) wxOVERRIDE;
|
|
|
|
void SetThumbLength(int len) wxOVERRIDE;
|
|
|
|
int GetThumbLength() const wxOVERRIDE;
|
|
|
|
void SetTick(int tickPos) wxOVERRIDE;
|
|
|
|
|
|
|
|
void Command(wxCommandEvent& event) wxOVERRIDE;
|
2011-03-20 18:05:19 +00:00
|
|
|
// osx specific event handling common for all osx-ports
|
|
|
|
|
2016-06-26 05:25:29 +00:00
|
|
|
virtual bool OSXHandleClicked( double timestampsec ) wxOVERRIDE;
|
|
|
|
virtual void TriggerScrollEvent( wxEventType scrollEvent ) wxOVERRIDE;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// Platform-specific implementation of SetTickFreq
|
2016-06-26 05:25:29 +00:00
|
|
|
virtual void DoSetTickFreq(int freq) wxOVERRIDE;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2016-06-26 05:25:29 +00:00
|
|
|
virtual wxSize DoGetBestSize() const wxOVERRIDE;
|
|
|
|
virtual void DoSetSize(int x, int y, int w, int h, int sizeFlags) wxOVERRIDE;
|
|
|
|
virtual void DoMoveWindow(int x, int y, int w, int h) wxOVERRIDE;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
// set min/max size of the slider
|
|
|
|
virtual void DoSetSizeHints( int minW, int minH,
|
|
|
|
int maxW, int maxH,
|
2016-06-26 05:25:29 +00:00
|
|
|
int incW, int incH) wxOVERRIDE;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
// Common processing to invert slider values based on wxSL_INVERSE
|
2016-06-26 05:25:29 +00:00
|
|
|
virtual int ValueInvertOrNot(int value) const wxOVERRIDE;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
wxStaticText* m_macMinimumStatic ;
|
|
|
|
wxStaticText* m_macMaximumStatic ;
|
|
|
|
wxStaticText* m_macValueStatic ;
|
|
|
|
|
|
|
|
int m_rangeMin;
|
|
|
|
int m_rangeMax;
|
|
|
|
int m_pageSize;
|
|
|
|
int m_lineSize;
|
|
|
|
int m_tickFreq;
|
|
|
|
private :
|
2016-06-26 05:25:29 +00:00
|
|
|
virtual wxWindowList GetCompositeWindowParts() const wxOVERRIDE
|
|
|
|
{
|
|
|
|
wxWindowList parts;
|
|
|
|
parts.push_back(m_macMinimumStatic);
|
|
|
|
parts.push_back(m_macMaximumStatic);
|
|
|
|
parts.push_back(m_macValueStatic);
|
|
|
|
return parts;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxDECLARE_EVENT_TABLE();
|
2011-03-20 18:05:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_SLIDER_H_
|