KiCad PCB EDA Suite
EDA_POSITION_CTRL Class Reference

Object to edit/enter a coordinate (pair of values) ( INCHES or MM ) in dialog boxes. More...

#include <dialog_helpers.h>

Inheritance diagram for EDA_POSITION_CTRL:
EDA_SIZE_CTRL

Public Member Functions

 EDA_POSITION_CTRL (wxWindow *parent, const wxString &title, const wxPoint &pos_to_edit, EDA_UNITS user_unit, wxBoxSizer *BoxSizer)
 
 ~EDA_POSITION_CTRL ()
 
void Enable (bool x_win_on, bool y_win_on)
 
void SetValue (int x_value, int y_value)
 
wxPoint GetValue () const
 

Public Attributes

EDA_UNITS m_UserUnit
 
wxTextCtrl * m_FramePosX
 
wxTextCtrl * m_FramePosY
 

Private Attributes

wxStaticText * m_TextX
 
wxStaticText * m_TextY
 

Detailed Description

Object to edit/enter a coordinate (pair of values) ( INCHES or MM ) in dialog boxes.

Definition at line 94 of file dialog_helpers.h.

Constructor & Destructor Documentation

◆ EDA_POSITION_CTRL()

EDA_POSITION_CTRL::EDA_POSITION_CTRL ( wxWindow *  parent,
const wxString &  title,
const wxPoint &  pos_to_edit,
EDA_UNITS  user_unit,
wxBoxSizer *  BoxSizer 
)

Definition at line 33 of file eda_size_ctrl.cpp.

35 {
36  m_UserUnit = user_unit;
37 
38  m_TextX = new wxStaticText( parent, -1, title + wxS( " " ) + _( "X:" ) );
39  BoxSizer->Add( m_TextX, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
40 
41  m_FramePosX = new wxTextCtrl( parent, -1, wxEmptyString, wxDefaultPosition );
42  BoxSizer->Add( m_FramePosX, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
43 
44  m_TextY = new wxStaticText( parent, -1, title + wxS( " " ) + _( "Y:" ) );
45  BoxSizer->Add( m_TextY, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
46 
47  m_FramePosY = new wxTextCtrl( parent, -1, wxEmptyString );
48  BoxSizer->Add( m_FramePosY, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
49 
50  SetValue( aPos.x, aPos.y );
51 }
wxTextCtrl * m_FramePosX
#define _(s)
Definition: 3d_actions.cpp:33
wxTextCtrl * m_FramePosY
wxStaticText * m_TextX
void SetValue(int x_value, int y_value)
wxStaticText * m_TextY

References _, m_FramePosX, m_FramePosY, m_TextX, m_TextY, m_UserUnit, and SetValue().

◆ ~EDA_POSITION_CTRL()

EDA_POSITION_CTRL::~EDA_POSITION_CTRL ( )

Definition at line 54 of file eda_size_ctrl.cpp.

55 {
56  delete m_TextX;
57  delete m_TextY;
58  delete m_FramePosX;
59  delete m_FramePosY;
60 }
wxTextCtrl * m_FramePosX
wxTextCtrl * m_FramePosY
wxStaticText * m_TextX
wxStaticText * m_TextY

References m_FramePosX, m_FramePosY, m_TextX, and m_TextY.

Member Function Documentation

◆ Enable()

void EDA_POSITION_CTRL::Enable ( bool  x_win_on,
bool  y_win_on 
)

Definition at line 72 of file eda_size_ctrl.cpp.

73 {
74  m_FramePosX->Enable( x_win_on );
75  m_FramePosY->Enable( y_win_on );
76 }
wxTextCtrl * m_FramePosX
wxTextCtrl * m_FramePosY

References m_FramePosX, and m_FramePosY.

◆ GetValue()

wxPoint EDA_POSITION_CTRL::GetValue ( ) const

Definition at line 65 of file eda_size_ctrl.cpp.

66 {
67  return wxPoint( ValueFromString( m_UserUnit, m_FramePosX->GetValue() ),
68  ValueFromString( m_UserUnit, m_FramePosY->GetValue() ) );
69 }
long long int ValueFromString(EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application.
Definition: base_units.cpp:402
wxTextCtrl * m_FramePosX
wxTextCtrl * m_FramePosY

References m_FramePosX, m_FramePosY, m_UserUnit, and ValueFromString().

Referenced by EDA_SIZE_CTRL::GetValue().

◆ SetValue()

void EDA_POSITION_CTRL::SetValue ( int  x_value,
int  y_value 
)

Definition at line 79 of file eda_size_ctrl.cpp.

80 {
81  m_FramePosX->SetValue( StringFromValue( m_UserUnit, x_value ) );
82  m_FramePosY->SetValue( StringFromValue( m_UserUnit, y_value ) );
83 }
wxTextCtrl * m_FramePosX
wxTextCtrl * m_FramePosY
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:190

References m_FramePosX, m_FramePosY, m_UserUnit, and StringFromValue().

Referenced by EDA_POSITION_CTRL(), and MWAVE_POLYGONAL_SHAPE_DLG::ReadDataShapeDescr().

Member Data Documentation

◆ m_FramePosX

wxTextCtrl* EDA_POSITION_CTRL::m_FramePosX

Definition at line 108 of file dialog_helpers.h.

Referenced by EDA_POSITION_CTRL(), Enable(), GetValue(), SetValue(), and ~EDA_POSITION_CTRL().

◆ m_FramePosY

wxTextCtrl* EDA_POSITION_CTRL::m_FramePosY

Definition at line 109 of file dialog_helpers.h.

Referenced by EDA_POSITION_CTRL(), Enable(), GetValue(), SetValue(), and ~EDA_POSITION_CTRL().

◆ m_TextX

wxStaticText* EDA_POSITION_CTRL::m_TextX
private

Definition at line 112 of file dialog_helpers.h.

Referenced by EDA_POSITION_CTRL(), and ~EDA_POSITION_CTRL().

◆ m_TextY

wxStaticText* EDA_POSITION_CTRL::m_TextY
private

Definition at line 113 of file dialog_helpers.h.

Referenced by EDA_POSITION_CTRL(), and ~EDA_POSITION_CTRL().

◆ m_UserUnit

EDA_UNITS EDA_POSITION_CTRL::m_UserUnit

Definition at line 106 of file dialog_helpers.h.

Referenced by EDA_POSITION_CTRL(), GetValue(), and SetValue().


The documentation for this class was generated from the following files: