File: slider.h

package info (click to toggle)
wxpython4.0 4.2.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 221,752 kB
  • sloc: cpp: 962,555; python: 230,573; ansic: 170,731; makefile: 51,756; sh: 9,342; perl: 1,564; javascript: 584; php: 326; xml: 200
file content (116 lines) | stat: -rw-r--r-- 4,011 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/////////////////////////////////////////////////////////////////////////////
// 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_

#include "wx/compositewin.h"
#include "wx/stattext.h"

// Slider
class WXDLLIMPEXP_CORE wxSlider: public wxCompositeWindow<wxSliderBase>
{
    wxDECLARE_DYNAMIC_CLASS(wxSlider);

public:
    wxSlider();

    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 = wxASCII_STR(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 = wxASCII_STR(wxSliderNameStr));

    virtual int GetValue() const wxOVERRIDE;
    virtual void SetValue(int) wxOVERRIDE;

    void SetRange(int minValue, int maxValue) wxOVERRIDE;

    int GetMin() const wxOVERRIDE { return m_rangeMin; }
    int GetMax() const wxOVERRIDE { return m_rangeMax; }

    void SetMin(int minValue) { SetRange(minValue, m_rangeMax); }
    void SetMax(int maxValue) { SetRange(m_rangeMin, maxValue); }

    // For trackbars only
    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;
    // osx specific event handling common for all osx-ports

    virtual bool OSXHandleClicked( double timestampsec ) wxOVERRIDE;
    virtual void TriggerScrollEvent( wxEventType scrollEvent ) wxOVERRIDE;

protected:
    // Platform-specific implementation of SetTickFreq
    virtual void DoSetTickFreq(int freq) wxOVERRIDE;

    virtual wxSize DoGetBestSize() const wxOVERRIDE;
    virtual void   DoSetSize(int x, int y, int w, int h, int sizeFlags) wxOVERRIDE;

    // set min/max size of the slider
    virtual void DoSetSizeHints( int minW, int minH,
                                 int maxW, int maxH,
                                 int incW, int incH) wxOVERRIDE;

    // Common processing to invert slider values based on wxSL_INVERSE
    virtual int ValueInvertOrNot(int value) const wxOVERRIDE;

    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 :
    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();
};

#endif
    // _WX_SLIDER_H_