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.

27 :
28 PANEL_COLOR_CODE_BASE( parent, id, pos, size, style, name )
29{
31
32 // Needed on wxWidgets 3.0 to ensure sizers are correctly set
33 GetSizer()->SetSizeHints( this );
34}
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 37 of file panel_color_code.cpp.

38{
39}

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 56 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 69 of file panel_color_code.cpp.

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

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 63 of file panel_color_code.cpp.

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

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 42 of file panel_color_code.cpp.

43{
44 // Update the bitmaps
51
52 Refresh();
53}
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:106
@ 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 75 of file panel_color_code.cpp.

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