KiCad PCB EDA Suite
EDA_POSITION_CTRL Class Reference

#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_T 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 ()
 

Public Attributes

EDA_UNITS_T m_UserUnit
 
wxPoint m_Pos_To_Edit
 
wxTextCtrl * m_FramePosX
 
wxTextCtrl * m_FramePosY
 

Private Attributes

wxStaticText * m_TextX
 
wxStaticText * m_TextY
 

Detailed Description

Definition at line 152 of file dialog_helpers.h.

Constructor & Destructor Documentation

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

Definition at line 155 of file wxwineda.cpp.

References m_FramePosX, m_FramePosY, m_TextX, m_TextY, m_UserUnit, ReturnUnitSymbol(), SetValue(), wxPoint::x, and wxPoint::y.

160 {
161  wxString text;
162 
163  m_UserUnit = user_unit;
164 
165  if( title.IsEmpty() )
166  text = _( "Pos " );
167  else
168  text = title;
169 
170  text += _( "X" ) + ReturnUnitSymbol( m_UserUnit );
171  m_TextX = new wxStaticText( parent, -1, text );
172 
173  BoxSizer->Add( m_TextX, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
174  m_FramePosX = new wxTextCtrl( parent, -1, wxEmptyString, wxDefaultPosition );
175 
176  BoxSizer->Add( m_FramePosX, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
177 
178 
179  if( title.IsEmpty() )
180  text = _( "Pos " );
181  else
182  text = title;
183  text += _( "Y" ) + ReturnUnitSymbol( m_UserUnit );
184 
185  m_TextY = new wxStaticText( parent, -1, text );
186 
187  BoxSizer->Add( m_TextY, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
188 
189  m_FramePosY = new wxTextCtrl( parent, -1, wxEmptyString );
190 
191  BoxSizer->Add( m_FramePosY, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
192 
193  SetValue( pos_to_edit.x, pos_to_edit.y );
194 }
wxString ReturnUnitSymbol(EDA_UNITS_T aUnit, const wxString &formatString)
Returns the units symbol.
Definition: base_units.cpp:420
wxStaticText * m_TextY
EDA_UNITS_T m_UserUnit
wxTextCtrl * m_FramePosX
wxTextCtrl * m_FramePosY
wxStaticText * m_TextX
void SetValue(int x_value, int y_value)
Definition: wxwineda.cpp:226
EDA_POSITION_CTRL::~EDA_POSITION_CTRL ( )

Definition at line 197 of file wxwineda.cpp.

References m_FramePosX, m_FramePosY, m_TextX, and m_TextY.

198 {
199  delete m_TextX;
200  delete m_TextY;
201  delete m_FramePosX;
202  delete m_FramePosY;
203 }
wxStaticText * m_TextY
wxTextCtrl * m_FramePosX
wxTextCtrl * m_FramePosY
wxStaticText * m_TextX

Member Function Documentation

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

Definition at line 219 of file wxwineda.cpp.

References m_FramePosX, and m_FramePosY.

220 {
221  m_FramePosX->Enable( x_win_on );
222  m_FramePosY->Enable( y_win_on );
223 }
wxTextCtrl * m_FramePosX
wxTextCtrl * m_FramePosY
wxPoint EDA_POSITION_CTRL::GetValue ( )

Definition at line 208 of file wxwineda.cpp.

References m_FramePosX, m_FramePosY, m_UserUnit, ValueFromString(), wxPoint::x, and wxPoint::y.

Referenced by EDA_SIZE_CTRL::GetValue().

209 {
210  wxPoint coord;
211 
212  coord.x = ValueFromString( m_UserUnit, m_FramePosX->GetValue() );
213  coord.y = ValueFromString( m_UserUnit, m_FramePosY->GetValue() );
214 
215  return coord;
216 }
EDA_UNITS_T m_UserUnit
int ValueFromString(EDA_UNITS_T aUnits, const wxString &aTextValue)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application...
Definition: base_units.cpp:368
wxTextCtrl * m_FramePosX
wxTextCtrl * m_FramePosY
void EDA_POSITION_CTRL::SetValue ( int  x_value,
int  y_value 
)

Definition at line 226 of file wxwineda.cpp.

References m_FramePosX, m_FramePosY, m_Pos_To_Edit, m_UserUnit, StringFromValue(), wxPoint::x, and wxPoint::y.

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

227 {
228  wxString msg;
229 
230  m_Pos_To_Edit.x = x_value;
231  m_Pos_To_Edit.y = y_value;
232 
234  m_FramePosX->Clear();
235  m_FramePosX->SetValue( msg );
236 
238  m_FramePosY->Clear();
239  m_FramePosY->SetValue( msg );
240 }
wxString StringFromValue(EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:203
EDA_UNITS_T m_UserUnit
wxTextCtrl * m_FramePosX
wxTextCtrl * m_FramePosY

Member Data Documentation

wxTextCtrl* EDA_POSITION_CTRL::m_FramePosX

Definition at line 158 of file dialog_helpers.h.

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

wxTextCtrl* EDA_POSITION_CTRL::m_FramePosY

Definition at line 159 of file dialog_helpers.h.

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

wxPoint EDA_POSITION_CTRL::m_Pos_To_Edit

Definition at line 156 of file dialog_helpers.h.

Referenced by SetValue().

wxStaticText* EDA_POSITION_CTRL::m_TextX
private

Definition at line 161 of file dialog_helpers.h.

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

wxStaticText * EDA_POSITION_CTRL::m_TextY
private

Definition at line 161 of file dialog_helpers.h.

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

EDA_UNITS_T EDA_POSITION_CTRL::m_UserUnit

Definition at line 155 of file dialog_helpers.h.

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


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