26 #ifndef __UNIT_BINDER_H_ 27 #define __UNIT_BINDER_H_ 56 wxStaticText* aLabel, wxWindow* aValueCtrl, wxStaticText* aUnitLabel,
57 bool aAllowEval =
true );
87 virtual void SetValue(
long long int aValue );
89 void SetValue(
const wxString& aValue );
149 void SetLabel(
const wxString& aLabel );
154 void Enable(
bool aEnable );
162 void Show(
bool aShow,
bool aResize =
false );
209 double setPrecision(
double aValue,
bool aValueUsesUserUnits );
wxString GetOriginalText() const
Return the pre-evaluated text (or the current text if evaluation is not supported).
ORIGIN_TRANSFORMS::COORD_TYPES_T m_coordType
Type of coordinate for display origin transforms.
EDA_DRAW_FRAME * m_frame
The bound widgets.
virtual void SetNegativeZero()
UNIT_BINDER(EDA_DRAW_FRAME *aParent, wxStaticText *aLabel, wxWindow *aValueCtrl, wxStaticText *aUnitLabel, bool aAllowEval=true)
void delayedFocusHandler(wxCommandEvent &aEvent)
Implementation of conversion functions that require both schematic and board internal units.
EDA_DATA_TYPE
The type of unit.
ORIGIN_TRANSFORMS & m_originTransforms
A reference to an ORIGIN_TRANSFORMS object.
virtual void ChangeDoubleValue(double aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion WITHOUT trigger...
void SetDataType(EDA_DATA_TYPE aDataType)
Used to override the datatype of the displayed property (default is DISTANCE)
bool IsIndeterminate() const
Return true if the control holds the indeterminate value (for instance, if it represents a multiple s...
The base class for create windows for drawing purpose.
virtual void SetPrecision(int aLength)
Normally not needed, but can be used to set the precision when using internal units that are floats (...
void Show(bool aShow, bool aResize=false)
Show/hide the label, widget and units label.
wxStaticText * m_unitLabel
Can be nullptr.
bool m_negativeZero
Indicates "-0" should be displayed for 0.
ORIGIN_TRANSFORMS::COORD_TYPES_T GetCoordType() const
Get the origin transforms coordinate type.
virtual void SetUnits(EDA_UNITS aUnits)
Normally not needed (as the UNIT_BINDER inherits from the parent frame), but can be used to set to DE...
void onKillFocus(wxFocusEvent &aEvent)
virtual bool Validate(double aMin, double aMax, EDA_UNITS aUnits=EDA_UNITS::UNSCALED)
Validate the control against the given range, informing the user of any errors found.
void onSetFocus(wxFocusEvent &aEvent)
void SetLabel(const wxString &aLabel)
void onUnitsChanged(wxCommandEvent &aEvent)
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
virtual long long int GetValue()
Return the current value in Internal Units.
long m_selStart
Selection start and end of the original text.
void SetCoordType(ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType)
Set the current origin transform mode.
void RequireEval()
Force the binder to evaluate the text.
virtual void SetDoubleValue(double aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
virtual double GetDoubleValue()
Return the current value in Internal Units.
double setPrecision(double aValue, bool aValueUsesUserUnits)
When m_precision > 0 truncate the value aValue to show only m_precision digits in mantissa.
void Enable(bool aEnable)
Enable/disable the label, widget and units label.
virtual void ChangeValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion WITHOUT trigger...