KiCad PCB EDA Suite
Loading...
Searching...
No Matches
WIDGET_SAVE_RESTORE Class Reference

#include <widget_save_restore.h>

Classes

union  CONTROL
 
union  DATA
 
struct  WIDGET_CTRL_T
 Struct that represents a single bound control. More...
 

Public Member Functions

 WIDGET_SAVE_RESTORE (const EDA_IU_SCALE &aIuScale, bool &aValidFlag)
 
void Add (wxRadioBox &ctrl, long &dest)
 Bind a radiobox to a choice.
 
void Add (wxRadioButton &ctrl, bool &dest)
 Bind a radio button to a binary choice.
 
void Add (wxCheckBox &ctrl, bool &dest)
 Bind a check box to a binary choice.
 
void Add (wxTextCtrl &ctrl, wxString &dest)
 Bind a text ctrl to a string: the control value is stored directly into the string.
 
void Add (wxTextCtrl &ctrl, long &dest)
 Bind a text ctrl to a integer: the control value is converted to and from integer on save/restore.
 
void Add (wxTextCtrl &ctrl, double &dest)
 Bind a text ctrl to a double: the control value is converted to and from double on save/restore.
 
void Add (UNIT_BINDER &ctrl, long &dest)
 Bind a control managed by a UNIT_BINDER into a integer.
 
void Add (UNIT_BINDER &ctrl, EDA_ANGLE &dest)
 Bind a control managed by a UNIT_BINDER into an angle.
 
void Add (wxChoice &ctrl, long &dest)
 Bind a choice control into a choice (agnostic to the actual meaning of the choice)
 
void Add (wxNotebook &ctrl, long &dest)
 Bind a notebook tab choice to an integer.
 
void ReadConfigFromControls ()
 Read values of all bound controls into the internally-stored references to the underlying data.
 
void RestoreConfigToControls ()
 Restore the values from the internally-stored references to the underlying data to each bound control.
 

Private Types

enum class  WIDGET_CTRL_TYPE_T {
  TEXT , TEXT_INTEGER , TEXT_DOUBLE , UNIT_BINDER ,
  UNIT_BINDER_ANGLE , CHECKBOX , RADIOBUTTON , RADIOBOX ,
  CHOICE , TAB
}
 Recognised parameters types (encodes an implicit widget type, data type and appropriate conversion). More...
 

Private Attributes

std::vector< WIDGET_CTRL_Tm_ctrls
 
bool & m_valid
 

Detailed Description

Definition at line 41 of file widget_save_restore.h.

Member Enumeration Documentation

◆ WIDGET_CTRL_TYPE_T

enum class WIDGET_SAVE_RESTORE::WIDGET_CTRL_TYPE_T
strongprivate

Recognised parameters types (encodes an implicit widget type, data type and appropriate conversion).

Enumerator
TEXT 
TEXT_INTEGER 
TEXT_DOUBLE 
UNIT_BINDER 
UNIT_BINDER_ANGLE 
CHECKBOX 
RADIOBUTTON 
RADIOBOX 
CHOICE 
TAB 

Definition at line 120 of file widget_save_restore.h.

Constructor & Destructor Documentation

◆ WIDGET_SAVE_RESTORE()

WIDGET_SAVE_RESTORE::WIDGET_SAVE_RESTORE ( const EDA_IU_SCALE aIuScale,
bool &  aValidFlag 
)
inline

Definition at line 44 of file widget_save_restore.h.

Member Function Documentation

◆ Add() [1/10]

void WIDGET_SAVE_RESTORE::Add ( UNIT_BINDER ctrl,
EDA_ANGLE dest 
)

Bind a control managed by a UNIT_BINDER into an angle.

Definition at line 78 of file widget_save_restore.cpp.

References m_ctrls, and UNIT_BINDER_ANGLE.

◆ Add() [2/10]

void WIDGET_SAVE_RESTORE::Add ( UNIT_BINDER ctrl,
long &  dest 
)

Bind a control managed by a UNIT_BINDER into a integer.

Definition at line 72 of file widget_save_restore.cpp.

References m_ctrls, and UNIT_BINDER.

◆ Add() [3/10]

void WIDGET_SAVE_RESTORE::Add ( wxCheckBox &  ctrl,
bool &  dest 
)

Bind a check box to a binary choice.

Definition at line 48 of file widget_save_restore.cpp.

References CHECKBOX, and m_ctrls.

◆ Add() [4/10]

void WIDGET_SAVE_RESTORE::Add ( wxChoice &  ctrl,
long &  dest 
)

Bind a choice control into a choice (agnostic to the actual meaning of the choice)

Definition at line 83 of file widget_save_restore.cpp.

References CHOICE, and m_ctrls.

◆ Add() [5/10]

void WIDGET_SAVE_RESTORE::Add ( wxNotebook &  ctrl,
long &  dest 
)

Bind a notebook tab choice to an integer.

Definition at line 89 of file widget_save_restore.cpp.

References m_ctrls, and TAB.

◆ Add() [6/10]

void WIDGET_SAVE_RESTORE::Add ( wxRadioBox &  ctrl,
long &  dest 
)

Bind a radiobox to a choice.

Definition at line 36 of file widget_save_restore.cpp.

References m_ctrls, and RADIOBOX.

Referenced by DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY().

◆ Add() [7/10]

void WIDGET_SAVE_RESTORE::Add ( wxRadioButton &  ctrl,
bool &  dest 
)

Bind a radio button to a binary choice.

Definition at line 42 of file widget_save_restore.cpp.

References m_ctrls, and RADIOBUTTON.

◆ Add() [8/10]

void WIDGET_SAVE_RESTORE::Add ( wxTextCtrl &  ctrl,
double &  dest 
)

Bind a text ctrl to a double: the control value is converted to and from double on save/restore.

Definition at line 66 of file widget_save_restore.cpp.

References m_ctrls, and TEXT_DOUBLE.

◆ Add() [9/10]

void WIDGET_SAVE_RESTORE::Add ( wxTextCtrl &  ctrl,
long &  dest 
)

Bind a text ctrl to a integer: the control value is converted to and from integer on save/restore.

Definition at line 60 of file widget_save_restore.cpp.

References m_ctrls, and TEXT_INTEGER.

◆ Add() [10/10]

void WIDGET_SAVE_RESTORE::Add ( wxTextCtrl &  ctrl,
wxString &  dest 
)

Bind a text ctrl to a string: the control value is stored directly into the string.

Definition at line 54 of file widget_save_restore.cpp.

References m_ctrls, and TEXT.

◆ ReadConfigFromControls()

void WIDGET_SAVE_RESTORE::ReadConfigFromControls ( )

Read values of all bound controls into the internally-stored references to the underlying data.

Definition at line 95 of file widget_save_restore.cpp.

References CHECKBOX, CHOICE, m_ctrls, m_valid, RADIOBOX, RADIOBUTTON, TAB, TEXT, TEXT_DOUBLE, TEXT_INTEGER, UNIT_BINDER, and UNIT_BINDER_ANGLE.

Referenced by DIALOG_CREATE_ARRAY::TransferDataFromWindow().

◆ RestoreConfigToControls()

void WIDGET_SAVE_RESTORE::RestoreConfigToControls ( )

Restore the values from the internally-stored references to the underlying data to each bound control.

Definition at line 147 of file widget_save_restore.cpp.

References CHECKBOX, CHOICE, m_ctrls, m_valid, RADIOBOX, RADIOBUTTON, TAB, TEXT, TEXT_DOUBLE, TEXT_INTEGER, UNIT_BINDER, and UNIT_BINDER_ANGLE.

Referenced by DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY().

Member Data Documentation

◆ m_ctrls

std::vector<WIDGET_CTRL_T> WIDGET_SAVE_RESTORE::m_ctrls
private

Definition at line 230 of file widget_save_restore.h.

Referenced by Add(), ReadConfigFromControls(), and RestoreConfigToControls().

◆ m_valid

bool& WIDGET_SAVE_RESTORE::m_valid
private

Definition at line 231 of file widget_save_restore.h.

Referenced by ReadConfigFromControls(), and RestoreConfigToControls().


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