1998-06-28 11:34:42 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2008-03-15 16:53:06 +00:00
|
|
|
// Name: wx/msw/slider.h
|
|
|
|
// Purpose: wxSlider class implementation using trackbar control
|
1998-06-28 11:34:42 +00:00
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 23:52:45 +00:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-06-28 11:34:42 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-03-15 16:53:06 +00:00
|
|
|
#ifndef _WX_SLIDER_H_
|
|
|
|
#define _WX_SLIDER_H_
|
1998-06-28 11:34:42 +00:00
|
|
|
|
2007-07-09 10:09:52 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxSubwindows;
|
2004-12-11 23:35:41 +00:00
|
|
|
|
1998-06-28 11:34:42 +00:00
|
|
|
// Slider
|
2008-03-26 15:06:00 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxSlider : public wxSliderBase
|
1998-06-28 11:34:42 +00:00
|
|
|
{
|
|
|
|
public:
|
2005-03-08 10:44:38 +00:00
|
|
|
wxSlider() { Init(); }
|
|
|
|
|
|
|
|
wxSlider(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)
|
1999-02-22 11:01:13 +00:00
|
|
|
{
|
2004-12-11 23:35:41 +00:00
|
|
|
Init();
|
|
|
|
|
|
|
|
(void)Create(parent, id, value, minValue, maxValue,
|
|
|
|
pos, size, style, validator, name);
|
1999-02-22 11:01:13 +00:00
|
|
|
}
|
|
|
|
|
2004-12-11 23:35:41 +00:00
|
|
|
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);
|
1999-02-22 11:01:13 +00:00
|
|
|
|
2005-03-08 10:44:38 +00:00
|
|
|
virtual ~wxSlider();
|
1999-02-22 11:01:13 +00:00
|
|
|
|
2004-12-11 23:35:41 +00:00
|
|
|
// slider methods
|
2002-06-20 12:52:06 +00:00
|
|
|
virtual int GetValue() const;
|
1999-02-22 11:01:13 +00:00
|
|
|
virtual void SetValue(int);
|
|
|
|
|
|
|
|
void SetRange(int minValue, int maxValue);
|
|
|
|
|
|
|
|
int GetMin() const { return m_rangeMin; }
|
|
|
|
int GetMax() const { return m_rangeMax; }
|
|
|
|
|
2004-12-11 23:35:41 +00:00
|
|
|
// Win32-specific slider methods
|
1999-02-22 11:01:13 +00:00
|
|
|
void SetTickFreq(int n, int pos);
|
|
|
|
int GetTickFreq() const { return m_tickFreq; }
|
|
|
|
void SetPageSize(int pageSize);
|
2002-06-20 12:52:06 +00:00
|
|
|
int GetPageSize() const;
|
|
|
|
void ClearSel();
|
|
|
|
void ClearTicks();
|
1999-02-22 11:01:13 +00:00
|
|
|
void SetLineSize(int lineSize);
|
2002-06-20 12:52:06 +00:00
|
|
|
int GetLineSize() const;
|
|
|
|
int GetSelEnd() const;
|
|
|
|
int GetSelStart() const;
|
1999-02-22 11:01:13 +00:00
|
|
|
void SetSelection(int minPos, int maxPos);
|
2002-06-20 12:52:06 +00:00
|
|
|
void SetThumbLength(int len);
|
|
|
|
int GetThumbLength() const;
|
|
|
|
void SetTick(int tickPos);
|
1999-02-22 11:01:13 +00:00
|
|
|
|
2004-12-11 23:35:41 +00:00
|
|
|
// implementation only from now on
|
|
|
|
WXHWND GetStaticMin() const;
|
|
|
|
WXHWND GetStaticMax() const;
|
|
|
|
WXHWND GetEditValue() const;
|
1999-02-22 11:01:13 +00:00
|
|
|
virtual bool ContainsHWND(WXHWND hWnd) const;
|
|
|
|
|
2005-04-10 18:33:03 +00:00
|
|
|
// we should let background show through the slider (and its labels)
|
|
|
|
virtual bool HasTransparentBackground() { return true; }
|
|
|
|
|
2007-08-07 19:22:43 +00:00
|
|
|
// returns true if the platform should explicitly apply a theme border
|
|
|
|
virtual bool CanApplyThemeBorder() const { return false; }
|
2005-04-10 18:33:03 +00:00
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
void Command(wxCommandEvent& event);
|
1999-05-13 21:21:04 +00:00
|
|
|
virtual bool MSWOnScroll(int orientation, WXWORD wParam,
|
|
|
|
WXWORD pos, WXHWND control);
|
1999-02-22 11:01:13 +00:00
|
|
|
|
2004-12-12 21:51:11 +00:00
|
|
|
virtual bool Show(bool show = true);
|
|
|
|
virtual bool Enable(bool show = true);
|
|
|
|
virtual bool SetFont(const wxFont& font);
|
2004-12-11 23:35:41 +00:00
|
|
|
|
2006-02-08 21:47:09 +00:00
|
|
|
virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
|
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
protected:
|
2004-12-11 23:35:41 +00:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
|
|
|
// format an integer value as string
|
|
|
|
static wxString Format(int n) { return wxString::Format(_T("%d"), n); }
|
|
|
|
|
|
|
|
// get the boundig box for the slider and possible labels
|
|
|
|
wxRect GetBoundingBox() const;
|
|
|
|
|
|
|
|
// get the height and, if the pointer is not NULL, width of our labels
|
|
|
|
int GetLabelsSize(int *width = NULL) const;
|
|
|
|
|
|
|
|
|
|
|
|
// overridden base class virtuals
|
2004-12-12 21:51:11 +00:00
|
|
|
virtual void DoGetPosition(int *x, int *y) const;
|
2004-12-11 23:35:41 +00:00
|
|
|
virtual void DoGetSize(int *width, int *height) const;
|
|
|
|
virtual void DoMoveWindow(int x, int y, int width, int height);
|
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
|
|
|
// the labels windows, if any
|
2008-01-06 14:38:44 +00:00
|
|
|
wxSubwindows *m_labels;
|
2004-12-11 23:35:41 +00:00
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
int m_rangeMin;
|
|
|
|
int m_rangeMax;
|
|
|
|
int m_pageSize;
|
|
|
|
int m_lineSize;
|
|
|
|
int m_tickFreq;
|
|
|
|
|
2005-05-31 15:33:43 +00:00
|
|
|
// flag needed to detect whether we're getting THUMBRELEASE event because
|
|
|
|
// of dragging the thumb or scrolling the mouse wheel
|
|
|
|
bool m_isDragging;
|
2004-09-04 01:53:42 +00:00
|
|
|
|
2005-03-08 10:44:38 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxSlider)
|
1998-06-28 11:34:42 +00:00
|
|
|
};
|
|
|
|
|
2008-03-15 16:53:06 +00:00
|
|
|
#endif // _WX_SLIDER_H_
|
2004-12-11 23:35:41 +00:00
|
|
|
|