14#ifndef __AUDACITY_TIME_TEXT_CTRL__
15#define __AUDACITY_TIME_TEXT_CTRL__
24#include <wx/control.h>
37 friend class NumericTextCtrlAx;
43 bool autoPos {
true };
44 bool readOnly {
false };
45 bool menuEnabled {
true };
46 bool hasInvalidValue {
false };
47 double invalidValue { -1.0 };
50 bool hasValue {
false };
59 { hasInvalidValue = has, invalidValue = v;
return *
this; }
62 { formatSymbol = f;
return *
this; }
64 { customFormat = f;
return *
this; }
66 { hasValue = has, value = v;
return *
this; }
75 const wxPoint &pos = wxDefaultPosition,
76 const wxSize &
size = wxDefaultSize);
83 wxSize ComputeSizing(
bool update =
true, wxCoord digitW = 0, wxCoord digitH = 0);
85 bool Layout()
override;
97 void SetFieldFocus(
int );
99 wxSize
GetDimensions() {
return wxSize(mWidth + mButtonWidth, mHeight); }
101 void SetDigitSize(
int width,
int height);
102 void SetReadOnly(
bool readOnly =
true);
103 void EnableMenu(
bool enable =
true);
109 void SetInvalidValue(
double invalidValue);
116 void HandleFormatterChanged();
118 void OnCaptureKey(wxCommandEvent &event);
119 void OnKeyDown(wxKeyEvent &event);
120 void OnKeyUp(wxKeyEvent &event);
121 void OnMouse(wxMouseEvent &event);
122 void OnErase(wxEraseEvent &event);
123 void OnPaint(wxPaintEvent &event);
124 void OnFocus(wxFocusEvent &event);
125 void OnContext(wxContextMenuEvent &event);
134 void UpdateAutoFocus();
136 void Updated(
bool keyup =
false);
149 wxRect GetBox(
size_t ii)
const;
171 int mFocusedDigit { 0 };
183 DECLARE_EVENT_TABLE()
const TranslatableString name
DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_TIMETEXTCTRL_UPDATED, -1)
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
A context in which formatter operates.
An explicitly nonlocalized string, not meant for the user to see.
NumericConverter provides the advanced formatting control used in the selection bar of Audacity.
virtual void ControlsToValue()
virtual void ValueToControls()
bool SetCustomFormat(const TranslatableString &customFormat)
virtual void OnFormatUpdated()
void SetValue(double newValue)
bool SetFormatName(const NumericFormatSymbol &formatName)
bool SetTypeAndFormatName(const NumericConverterType &type, const NumericFormatSymbol &formatName)
std::unique_ptr< wxFont > mDigitFont
std::vector< wxRect > mBoxes
std::unique_ptr< wxBitmap > mBackgroundBitmap
NumericConverterType mType
std::vector< FieldPosition > mFieldPositions
Holds a msgid for the translation catalog; may also bind format arguments.
void OnFocus(wxWindow &window, wxFocusEvent &event)
a function useful to implement a focus event handler The window releases the keyboard if the event is...
CommandManager::Options Options
Options & MenuEnabled(bool enable)
Options & FormatSymbol(const NumericFormatSymbol &f)
Options & Value(bool has, double v)
Options & CustomFormat(const TranslatableString &f)
Options & AutoPos(bool enable)
Options & InvalidValue(bool has, double v=-1.0)
Options & ReadOnly(bool enable)