13#ifndef __AUDACITY_SLIDER__
14#define __AUDACITY_SLIDER__
43#define SPEED_MIN 0.01f
52#define STEP_CONTINUOUS 0.0f
64 friend class ASliderAx;
78 bool heavyweight=
false,
80 int orientation = wxHORIZONTAL);
88 bool heavyweight=
false,
90 int orientation = wxHORIZONTAL);
92 void Init(wxWindow * parent,
104 int orientation = wxHORIZONTAL);
109 void SetId(wxWindowID
id);
111 void SetDefaultValue(
float value);
112 void SetDefaultShortcut(
bool value);
114 void GetScroll(
float & line,
float & page);
115 void SetScroll(
float line,
float page);
117 void ShowTip(
bool show);
120 float Get(
bool convert =
true);
121 void Set(
float value);
123 void Increase(
float steps);
124 void Decrease(
float steps);
128 void SetSpeed(
float speed);
130 void Move(
const wxPoint &newpos);
132 void AdjustSize(
const wxSize & sz);
134 void OnPaint(wxDC &dc,
bool highlighted);
135 void OnSize(wxSizeEvent & event);
136 void OnMouseEvent(wxMouseEvent & event);
137 void OnKeyDown(wxKeyEvent & event);
142 bool ShowDialog(wxPoint pos);
144 void SetEnabled(
bool enabled);
145 bool GetEnabled()
const;
147 float GetMinValue()
const;
148 float GetMaxValue()
const;
151 void SendUpdate(
float newValue);
158 void SetPopWinPosition();
160 void DrawToBitmap(wxDC & dc);
162 bool DoShowDialog(wxPoint pos);
165 int ValueToPosition(
float val);
166 float DragPositionToValue(
int fromPos,
bool shiftDown);
167 float ClickPositionToValue(
int fromPos,
bool shiftDown);
226 std::unique_ptr<wxBitmap>
mBitmap, mThumbBitmap, mThumbBitmapHilited;
233class AUDACITY_DLL_API
ASlider :
public wxPanel
235 friend class ASliderAx;
242 wxOrientation orientation{ wxHORIZONTAL };
244 bool canUseShift{
true };
252 { orientation = o;
return *
this; }
272 void SetFocusFromKbd()
override;
274 bool SetBackgroundColour(
const wxColour& colour)
override;
276 void GetScroll(
float & line,
float & page);
277 void SetScroll(
float line,
float page);
281 float Get(
bool convert =
true );
282 void Set(
float value);
284 void Increase(
float steps);
285 void Decrease(
float steps);
286 bool ShowDialog(wxPoint pos = wxPoint(-1, -1));
288 void SetSpeed(
float speed);
290 void OnErase(wxEraseEvent & event);
291 void OnPaint(wxPaintEvent & event);
292 void OnSize(wxSizeEvent & event);
293 void OnMouseEvent(wxMouseEvent & event);
294 void OnCaptureLost(wxMouseCaptureLostEvent & event);
295 void OnKeyDown(wxKeyEvent &event);
296 void OnSlider(wxCommandEvent &event);
297 void OnSetFocus(wxFocusEvent & event);
298 void OnKillFocus(wxFocusEvent & event);
299 void OnTimer(wxTimerEvent & event);
302 bool Enable(
bool enable =
true)
override;
303 bool IsEnabled()
const;
307 struct Resetter {
void operator () (
bool *p)
const {
if(p) *p =
false; } };
322 DECLARE_EVENT_TABLE()
327#define SLIDER_DIALOG_TEXTCTRL 100
353 void OnSlider(wxCommandEvent &event);
363 DECLARE_EVENT_TABLE()
const TranslatableString name
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< TipWindow > mTipPanel
std::unique_ptr< wxBitmap > mBitmap
void SetParent(wxWindow *parent)
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 & CanUseShift(bool c)
Options & StepValue(float v)