KiCad PCB EDA Suite
PANEL_COLOR_CODE Class Reference

#include <panel_color_code.h>

Inheritance diagram for PANEL_COLOR_CODE:
PANEL_COLOR_CODE_BASE CALCULATOR_PANEL

Public Member Functions

 PANEL_COLOR_CODE (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
 
 ~PANEL_COLOR_CODE ()
 
void OnToleranceSelection (wxCommandEvent &event) override
 
void ToleranceSelection (int aSelection)
 
void LoadSettings (PCB_CALCULATOR_SETTINGS *aCfg) override
 Load the settings into the panel. More...
 
void SaveSettings (PCB_CALCULATOR_SETTINGS *aCfg) override
 Save the settings from the panel. More...
 
void ThemeChanged () override
 Update UI elements of the panel when the theme changes to ensure the images and fonts/colors are appropriate for the new theme. More...
 

Protected Attributes

wxRadioBox * m_rbToleranceSelection
 
wxStaticText * m_staticTextBand1
 
wxStaticText * m_staticTextBand2
 
wxStaticText * m_staticTextBand3
 
wxStaticText * m_staticTextBand4
 
wxStaticText * m_staticTextBand5
 
wxStaticText * m_staticTextBand6
 
wxStaticBitmap * m_Band1bitmap
 
wxStaticBitmap * m_Band2bitmap
 
wxStaticBitmap * m_Band3bitmap
 
wxStaticBitmap * m_Band4bitmap
 
wxStaticBitmap * m_Band_mult_bitmap
 
wxStaticBitmap * m_Band_tol_bitmap
 

Detailed Description

Definition at line 27 of file panel_color_code.h.

Constructor & Destructor Documentation

◆ PANEL_COLOR_CODE()

PANEL_COLOR_CODE::PANEL_COLOR_CODE ( wxWindow *  parent,
wxWindowID  id = wxID_ANY,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = wxTAB_TRAVERSAL,
const wxString &  name = wxEmptyString 
)

Definition at line 26 of file panel_color_code.cpp.

28 :
29 PANEL_COLOR_CODE_BASE( parent, id, pos, size, style, name )
30{
32
33 // Needed on wxWidgets 3.0 to ensure sizers are correctly set
34 GetSizer()->SetSizeHints( this );
35}
const char * name
Definition: DXF_plotter.cpp:56
PANEL_COLOR_CODE_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(500, 300), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
void ToleranceSelection(int aSelection)

References PANEL_COLOR_CODE_BASE::m_rbToleranceSelection, and ToleranceSelection().

◆ ~PANEL_COLOR_CODE()

PANEL_COLOR_CODE::~PANEL_COLOR_CODE ( )

Definition at line 38 of file panel_color_code.cpp.

39{
40}

Member Function Documentation

◆ LoadSettings()

void PANEL_COLOR_CODE::LoadSettings ( PCB_CALCULATOR_SETTINGS aCfg)
overridevirtual

Load the settings into the panel.

Parameters
aCfgis the settings structure to load from

Implements CALCULATOR_PANEL.

Definition at line 57 of file panel_color_code.cpp.

References PCB_CALCULATOR_SETTINGS::m_ColorCodeTolerance, PANEL_COLOR_CODE_BASE::m_rbToleranceSelection, and ToleranceSelection().

◆ OnToleranceSelection()

void PANEL_COLOR_CODE::OnToleranceSelection ( wxCommandEvent &  event)
overridevirtual

Reimplemented from PANEL_COLOR_CODE_BASE.

Definition at line 70 of file panel_color_code.cpp.

71{
72 ToleranceSelection( event.GetSelection() );
73}

References ToleranceSelection().

◆ SaveSettings()

void PANEL_COLOR_CODE::SaveSettings ( PCB_CALCULATOR_SETTINGS aCfg)
overridevirtual

Save the settings from the panel.

Parameters
aCfgis the settings structure to save to

Implements CALCULATOR_PANEL.

Definition at line 64 of file panel_color_code.cpp.

65{
66 aCfg->m_ColorCodeTolerance = m_rbToleranceSelection->GetSelection();
67}

References PCB_CALCULATOR_SETTINGS::m_ColorCodeTolerance, and PANEL_COLOR_CODE_BASE::m_rbToleranceSelection.

◆ ThemeChanged()

void PANEL_COLOR_CODE::ThemeChanged ( )
overridevirtual

Update UI elements of the panel when the theme changes to ensure the images and fonts/colors are appropriate for the new theme.

Implements CALCULATOR_PANEL.

Definition at line 43 of file panel_color_code.cpp.

44{
45 // Update the bitmaps
52
53 Refresh();
54}
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:105
@ color_code_tolerance
@ color_code_value
@ color_code_multiplier
@ color_code_value_and_name
wxStaticBitmap * m_Band_tol_bitmap
wxStaticBitmap * m_Band2bitmap
wxStaticBitmap * m_Band4bitmap
wxStaticBitmap * m_Band_mult_bitmap
wxStaticBitmap * m_Band1bitmap
wxStaticBitmap * m_Band3bitmap
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...

References color_code_multiplier, color_code_tolerance, color_code_value, color_code_value_and_name, KiBitmap(), PANEL_COLOR_CODE_BASE::m_Band1bitmap, PANEL_COLOR_CODE_BASE::m_Band2bitmap, PANEL_COLOR_CODE_BASE::m_Band3bitmap, PANEL_COLOR_CODE_BASE::m_Band4bitmap, PANEL_COLOR_CODE_BASE::m_Band_mult_bitmap, PANEL_COLOR_CODE_BASE::m_Band_tol_bitmap, and Refresh().

◆ ToleranceSelection()

void PANEL_COLOR_CODE::ToleranceSelection ( int  aSelection)

Definition at line 76 of file panel_color_code.cpp.

77{
78 /* For tolerance = 5 or 10 %, there are 3 bands for the value
79 * but for tolerance < 5 %, there are 4 bands
80 */
81 bool show4thBand = aSelection != 0;
82
83 m_Band4bitmap->Show(show4thBand);
84 m_staticTextBand4->Show(show4thBand);
85
86 // m_Band4Label visibility has changed:
87 // The new size must be taken in account
88 GetSizer()->Layout();
89
90 // All this shouldn't be necessary but if you want the bitmaps to show up on OSX it is.
97
98 Refresh();
99}
wxStaticText * m_staticTextBand4

References color_code_multiplier, color_code_tolerance, color_code_value, color_code_value_and_name, KiBitmap(), PANEL_COLOR_CODE_BASE::m_Band1bitmap, PANEL_COLOR_CODE_BASE::m_Band2bitmap, PANEL_COLOR_CODE_BASE::m_Band3bitmap, PANEL_COLOR_CODE_BASE::m_Band4bitmap, PANEL_COLOR_CODE_BASE::m_Band_mult_bitmap, PANEL_COLOR_CODE_BASE::m_Band_tol_bitmap, PANEL_COLOR_CODE_BASE::m_staticTextBand4, and Refresh().

Referenced by LoadSettings(), OnToleranceSelection(), and PANEL_COLOR_CODE().

Member Data Documentation

◆ m_Band1bitmap

wxStaticBitmap* PANEL_COLOR_CODE_BASE::m_Band1bitmap
protectedinherited

◆ m_Band2bitmap

wxStaticBitmap* PANEL_COLOR_CODE_BASE::m_Band2bitmap
protectedinherited

◆ m_Band3bitmap

wxStaticBitmap* PANEL_COLOR_CODE_BASE::m_Band3bitmap
protectedinherited

◆ m_Band4bitmap

wxStaticBitmap* PANEL_COLOR_CODE_BASE::m_Band4bitmap
protectedinherited

◆ m_Band_mult_bitmap

wxStaticBitmap* PANEL_COLOR_CODE_BASE::m_Band_mult_bitmap
protectedinherited

◆ m_Band_tol_bitmap

wxStaticBitmap* PANEL_COLOR_CODE_BASE::m_Band_tol_bitmap
protectedinherited

◆ m_rbToleranceSelection

wxRadioBox* PANEL_COLOR_CODE_BASE::m_rbToleranceSelection
protectedinherited

◆ m_staticTextBand1

wxStaticText* PANEL_COLOR_CODE_BASE::m_staticTextBand1
protectedinherited

◆ m_staticTextBand2

wxStaticText* PANEL_COLOR_CODE_BASE::m_staticTextBand2
protectedinherited

◆ m_staticTextBand3

wxStaticText* PANEL_COLOR_CODE_BASE::m_staticTextBand3
protectedinherited

◆ m_staticTextBand4

wxStaticText* PANEL_COLOR_CODE_BASE::m_staticTextBand4
protectedinherited

◆ m_staticTextBand5

wxStaticText* PANEL_COLOR_CODE_BASE::m_staticTextBand5
protectedinherited

◆ m_staticTextBand6

wxStaticText* PANEL_COLOR_CODE_BASE::m_staticTextBand6
protectedinherited

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