13#ifndef __AUDACITY_SLIDER__
14#define __AUDACITY_SLIDER__
39#define PERCENT_SLIDER 6
45#define SPEED_MIN 0.001f
46#define SPEED_MAX 3.000f
54#define STEP_CONTINUOUS 0.0f
66 friend class ASliderAx;
83 bool alwayshidetip=
false,
84 bool heavyweight=
false,
86 int orientation = wxHORIZONTAL);
97 bool alwayshidetip=
false,
98 bool heavyweight=
false,
100 int orientation = wxHORIZONTAL);
102 void Init(wxWindow * parent,
118 int orientation = wxHORIZONTAL);
123 void SetId(wxWindowID
id);
127 void SetDefaultValue(
float value);
128 void SetDefaultShortcut(
bool value);
130 void GetScroll(
float & line,
float & page);
131 void SetScroll(
float line,
float page);
133 void ShowTip(
bool show);
136 float Get(
bool convert =
true);
137 void Set(
float value);
139 void Increase(
float steps);
140 void Decrease(
float steps);
144 void SetSpeed(
float speed);
146 void Move(
const wxPoint &newpos);
148 void AdjustSize(
const wxSize & sz);
150 void OnPaint(wxDC &dc,
bool highlighted);
151 void OnSize(wxSizeEvent & event);
152 void OnMouseEvent(wxMouseEvent & event);
153 void OnKeyDown(wxKeyEvent & event);
158 bool ShowDialog(wxPoint pos);
160 void SetEnabled(
bool enabled);
161 bool GetEnabled()
const;
163 float GetMinValue()
const;
164 float GetMaxValue()
const;
166 void SetParent(wxWindow *parent);
167 void SendUpdate(
float newValue);
169 wxString GetStringValue()
const;
178 void SetPopWinPosition();
180 void DrawToBitmap(wxDC & dc);
182 bool DoShowDialog(wxPoint pos);
185 int ValueToPosition(
float val);
186 float DragPositionToValue(
int fromPos,
bool shiftDown);
187 float ClickPositionToValue(
int fromPos,
bool shiftDown);
252 std::unique_ptr<wxBitmap>
mBitmap, mThumbBitmap, mThumbBitmapHilited;
259class AUDACITY_DLL_API
ASlider :
public wxPanel
261 friend class ASliderAx;
268 wxOrientation orientation{ wxHORIZONTAL };
269 bool showLabels{
true };
270 bool drawTicks{
true };
271 bool drawTrack{
true };
272 bool alwaysHideTip{
false };
274 bool canUseShift{
true };
282 { orientation = o;
return *
this; }
300 const Options &options = Options{});
306 void SetFocusFromKbd()
override;
308 bool SetBackgroundColour(
const wxColour& colour)
override;
310 void GetScroll(
float & line,
float & page);
311 void SetScroll(
float line,
float page);
315 float Get(
bool convert =
true );
316 void Set(
float value);
318 void Increase(
float steps);
319 void Decrease(
float steps);
320 bool ShowDialog(wxPoint pos = wxPoint(-1, -1));
322 void SetSpeed(
float speed);
324 void OnErase(wxEraseEvent & event);
325 void OnPaint(wxPaintEvent & event);
326 void OnSize(wxSizeEvent & event);
327 void OnMouseEvent(wxMouseEvent & event);
328 void OnCaptureLost(wxMouseCaptureLostEvent & event);
329 void OnKeyDown(wxKeyEvent &event);
330 void OnSlider(wxCommandEvent &event);
331 void OnSetFocus(wxFocusEvent & event);
332 void OnKillFocus(wxFocusEvent & event);
333 void OnTimer(wxTimerEvent & event);
336 bool Enable(
bool enable =
true)
override;
337 bool IsEnabled()
const;
341 struct Resetter {
void operator () (
bool *p)
const {
if(p) *p =
false; } };
356 DECLARE_EVENT_TABLE()
361#define SLIDER_DIALOG_TEXTCTRL 100
387 void OnSlider(wxCommandEvent &event);
397 DECLARE_EVENT_TABLE()
std::vector< TranslatableString > TranslatableStrings
static void OnSize(wxSizeEvent &evt)
ASlider is a custom slider, allowing for a slicker look and feel.
bool AcceptsFocusFromKeyboard() const override
std::unique_ptr< LWSlider > mLWSlider
bool AcceptsFocus() const override
std::unique_ptr< bool, Resetter > TempAllowFocus
static bool s_AcceptsFocus
Lightweight version of ASlider. In other words it does not have a window permanently associated with ...
TranslatableString mTipTemplate
std::unique_ptr< wxBitmap > mBitmap
wxWeakRef< TipWindow > mTipPanel
Pop up dialog used with an LWSlider.
bool TransferDataFromWindow() override
void OnSlider(wxCommandEvent &event)
void OnTextChange(wxCommandEvent &event)
SliderDialog(wxWindow *parent, wxWindowID id, const TranslatableString &title, wxPoint position, wxSize size, int style, float value, float line, float page, LWSlider *pSlider=nullptr)
bool TransferDataToWindow() override
A wxPopupWindow used to give the numerical value of an LWSlider or ASlider.
Holds a msgid for the translation catalog; may also bind format arguments.
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Options & Orientation(wxOrientation o)
Options & DrawTrack(bool t)
Options & CanUseShift(bool c)
Options & DrawTicks(bool t)
Options & AlwayHideTip(bool t)
Options & ShowLabels(bool l)
Options & StepValue(float v)