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
 
wxTextCtrl * m_FramePosX
 
wxTextCtrl * m_FramePosY
 

Private Attributes

wxStaticText * m_TextX
 
wxStaticText * m_TextY
 

Detailed Description

Definition at line 114 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 34 of file eda_size_ctrl.cpp.

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

36 {
37  m_UserUnit = user_unit;
38 
39  m_TextX = new wxStaticText( parent, -1, title + _( " X:" ) );
40  BoxSizer->Add( m_TextX, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
41 
42  m_FramePosX = new wxTextCtrl( parent, -1, wxEmptyString, wxDefaultPosition );
43  BoxSizer->Add( m_FramePosX, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
44 
45  m_TextY = new wxStaticText( parent, -1, title + _( " Y:" ) );
46  BoxSizer->Add( m_TextY, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
47 
48  m_FramePosY = new wxTextCtrl( parent, -1, wxEmptyString );
49  BoxSizer->Add( m_FramePosY, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
50 
51  SetValue( aPos.x, aPos.y );
52 }
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)
EDA_POSITION_CTRL::~EDA_POSITION_CTRL ( )

Definition at line 55 of file eda_size_ctrl.cpp.

References m_FramePosX, m_FramePosY, m_TextX, and m_TextY.

56 {
57  delete m_TextX;
58  delete m_TextY;
59  delete m_FramePosX;
60  delete m_FramePosY;
61 }
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 73 of file eda_size_ctrl.cpp.

References m_FramePosX, and m_FramePosY.

74 {
75  m_FramePosX->Enable( x_win_on );
76  m_FramePosY->Enable( y_win_on );
77 }
wxTextCtrl * m_FramePosX
wxTextCtrl * m_FramePosY
wxPoint EDA_POSITION_CTRL::GetValue ( )

Definition at line 66 of file eda_size_ctrl.cpp.

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

Referenced by EDA_SIZE_CTRL::GetValue().

67 {
68  return wxPoint( ValueFromString( m_UserUnit, m_FramePosX->GetValue() ),
69  ValueFromString( m_UserUnit, m_FramePosY->GetValue() ) );
70 }
int ValueFromString(EDA_UNITS_T aUnits, const wxString &aTextValue, bool aUseMils)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application...
Definition: base_units.cpp:409
EDA_UNITS_T m_UserUnit
wxTextCtrl * m_FramePosX
wxTextCtrl * m_FramePosY
void EDA_POSITION_CTRL::SetValue ( int  x_value,
int  y_value 
)

Definition at line 80 of file eda_size_ctrl.cpp.

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

Referenced by EDA_POSITION_CTRL().

81 {
82  m_FramePosX->SetValue( StringFromValue( m_UserUnit, x_value, true ) );
83  m_FramePosY->SetValue( StringFromValue( m_UserUnit, y_value, true ) );
84 }
EDA_UNITS_T m_UserUnit
wxTextCtrl * m_FramePosX
wxTextCtrl * m_FramePosY
wxString StringFromValue(EDA_UNITS_T aUnits, int aValue, bool aAddUnitSymbol, bool aUseMils)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:210

Member Data Documentation

wxTextCtrl* EDA_POSITION_CTRL::m_FramePosX

Definition at line 119 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 120 of file dialog_helpers.h.

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

wxStaticText* EDA_POSITION_CTRL::m_TextX
private

Definition at line 123 of file dialog_helpers.h.

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

wxStaticText * EDA_POSITION_CTRL::m_TextY
private

Definition at line 123 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 117 of file dialog_helpers.h.

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


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