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; }
74 const Options &options = {},
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);
115 void HandleFormatterChanged(
bool resetFocus);
117 void OnCaptureKey(wxCommandEvent &event);
118 void OnKeyDown(wxKeyEvent &event);
119 void OnKeyUp(wxKeyEvent &event);
120 void OnMouse(wxMouseEvent &event);
121 void OnErase(wxEraseEvent &event);
122 void OnPaint(wxPaintEvent &event);
123 void OnFocus(wxFocusEvent &event);
124 void OnContext(wxContextMenuEvent &event);
133 void UpdateAutoFocus();
135 void Updated(
bool keyup =
false);
148 wxRect GetBox(
size_t ii)
const;
168 int mFocusedDigit { 0 };
180 DECLARE_EVENT_TABLE()
DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_TIMETEXTCTRL_UPDATED, -1)
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()
virtual void OnFormatUpdated(bool resetFocus)
bool SetCustomFormat(const TranslatableString &customFormat)
void SetValue(double newValue)
bool SetTypeAndFormatName(const NumericConverterType &type, const NumericFormatID &formatName)
bool SetFormatName(const NumericFormatID &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...
Options & MenuEnabled(bool enable)
Options & Value(bool has, double v)
Options & CustomFormat(const TranslatableString &f)
Options & AutoPos(bool enable)
Options & InvalidValue(bool has, double v=-1.0)
Options & FormatSymbol(const NumericFormatID &f)
Options & ReadOnly(bool enable)