KiCad PCB EDA Suite
PANEL_SYM_COLOR_SETTINGS Class Reference

#include <panel_sym_color_settings.h>

Inheritance diagram for PANEL_SYM_COLOR_SETTINGS:
PANEL_SYM_COLOR_SETTINGS_BASE

Public Member Functions

 PANEL_SYM_COLOR_SETTINGS (wxWindow *aWindow)
 

Protected Member Functions

void OnThemeChanged (wxCommandEvent &event) override
 

Protected Attributes

wxRadioButton * m_eeschemaRB
 
wxRadioButton * m_themeRB
 
wxChoice * m_themes
 

Private Member Functions

bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
void _wxFB_OnThemeChanged (wxCommandEvent &event)
 

Detailed Description

Definition at line 30 of file panel_sym_color_settings.h.

Constructor & Destructor Documentation

◆ PANEL_SYM_COLOR_SETTINGS()

PANEL_SYM_COLOR_SETTINGS::PANEL_SYM_COLOR_SETTINGS ( wxWindow *  aWindow)

Definition at line 30 of file panel_sym_color_settings.cpp.

30 :
32{
33}
PANEL_SYM_COLOR_SETTINGS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)

Member Function Documentation

◆ _wxFB_OnThemeChanged()

void PANEL_SYM_COLOR_SETTINGS_BASE::_wxFB_OnThemeChanged ( wxCommandEvent &  event)
inlineprivateinherited

Definition at line 36 of file panel_sym_color_settings_base.h.

36{ OnThemeChanged( event ); }
virtual void OnThemeChanged(wxCommandEvent &event)

References PANEL_SYM_COLOR_SETTINGS_BASE::OnThemeChanged().

◆ OnThemeChanged()

void PANEL_SYM_COLOR_SETTINGS::OnThemeChanged ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from PANEL_SYM_COLOR_SETTINGS_BASE.

Definition at line 92 of file panel_sym_color_settings.cpp.

93{
94 m_themeRB->SetValue( true );
95}

References PANEL_SYM_COLOR_SETTINGS_BASE::m_themeRB.

◆ TransferDataFromWindow()

bool PANEL_SYM_COLOR_SETTINGS::TransferDataFromWindow ( )
overrideprivate

Definition at line 73 of file panel_sym_color_settings.cpp.

74{
75 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
77
79
81 {
82 int sel = m_themes->GetSelection();
83 COLOR_SETTINGS* colors = static_cast<COLOR_SETTINGS*>( m_themes->GetClientData( sel ) );
84
85 cfg->m_ColorTheme = colors->GetFilename();
86 }
87
88 return true;
89}
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:187
Color settings are a bit different than most of the settings objects in that there can be more than o...
wxString GetFilename() const
Definition: json_settings.h:73
T * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111

References SETTINGS_MANAGER::GetAppSettings(), JSON_SETTINGS::GetFilename(), APP_SETTINGS_BASE::m_ColorTheme, PANEL_SYM_COLOR_SETTINGS_BASE::m_eeschemaRB, PANEL_SYM_COLOR_SETTINGS_BASE::m_themes, SYMBOL_EDITOR_SETTINGS::m_UseEeschemaColorSettings, and Pgm().

◆ TransferDataToWindow()

bool PANEL_SYM_COLOR_SETTINGS::TransferDataToWindow ( )
overrideprivate

Definition at line 36 of file panel_sym_color_settings.cpp.

37{
38 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
40
42 m_eeschemaRB->SetValue( true );
43 else
44 m_themeRB->SetValue( true );
45
46 COLOR_SETTINGS* current = mgr.GetColorSettings( cfg->m_ColorTheme );
47
48 int width = 0;
49 int height = 0;
50 int minwidth = width;
51
52 m_themes->Clear();
53
54 for( COLOR_SETTINGS* settings : mgr.GetColorSettingsList() )
55 {
56 int pos = m_themes->Append( settings->GetName(), static_cast<void*>( settings ) );
57
58 if( settings == current )
59 m_themes->SetSelection( pos );
60
61 m_themes->GetTextExtent( settings->GetName(), &width, &height );
62 minwidth = std::max( minwidth, width );
63 }
64
65 m_themes->SetMinSize( wxSize( minwidth + 50, -1 ) );
66
67 Fit();
68
69 return true;
70}
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
std::vector< COLOR_SETTINGS * > GetColorSettingsList()

References SETTINGS_MANAGER::GetAppSettings(), SETTINGS_MANAGER::GetColorSettings(), SETTINGS_MANAGER::GetColorSettingsList(), APP_SETTINGS_BASE::m_ColorTheme, PANEL_SYM_COLOR_SETTINGS_BASE::m_eeschemaRB, PANEL_SYM_COLOR_SETTINGS_BASE::m_themeRB, PANEL_SYM_COLOR_SETTINGS_BASE::m_themes, SYMBOL_EDITOR_SETTINGS::m_UseEeschemaColorSettings, and Pgm().

Member Data Documentation

◆ m_eeschemaRB

wxRadioButton* PANEL_SYM_COLOR_SETTINGS_BASE::m_eeschemaRB
protectedinherited

Definition at line 40 of file panel_sym_color_settings_base.h.

Referenced by TransferDataFromWindow(), and TransferDataToWindow().

◆ m_themeRB

wxRadioButton* PANEL_SYM_COLOR_SETTINGS_BASE::m_themeRB
protectedinherited

Definition at line 41 of file panel_sym_color_settings_base.h.

Referenced by OnThemeChanged(), and TransferDataToWindow().

◆ m_themes

wxChoice* PANEL_SYM_COLOR_SETTINGS_BASE::m_themes
protectedinherited

Definition at line 42 of file panel_sym_color_settings_base.h.

Referenced by TransferDataFromWindow(), and TransferDataToWindow().


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