KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_calculator_frame.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KICAD, a free EDA CAD application.
3 *
4 * Copyright (C) 1992-2021 Kicad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 3
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef PCB_CALCULATOR_FRAME_H_
21#define PCB_CALCULATOR_FRAME_H_
22
24#include <kiway_player.h>
25
26class wxTreebook;
27class wxTreebookEvent;
28class wxBoxSizer;
29
31class KIWAY;
32class PANEL_TRANSLINE;
33
34
39{
40public:
41 PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent );
43
44 // Pcb calculator doesn't host a tool framework
45 wxWindow* GetToolCanvas() const override
46 {
47 return nullptr;
48 }
49
50 /*
51 * Return the panel of given type or nullptr if there is no such panel exists.
52 */
53 template<typename T>
55 {
56 std::map<std::size_t, CALCULATOR_PANEL*>::iterator panel = m_panelTypes.find( typeid( T ).hash_code() );
57
58 if( panel != m_panelTypes.end() )
59 return static_cast<T*>( panel->second );
60
61 return nullptr;
62 }
63
64 void AddCalculator( CALCULATOR_PANEL *aPanel, const wxString& panelUIName );
65
66 void ShowChangedLanguage() override;
67
68 // Config read-write, virtual from EDA_BASE_FRAME
69 void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
70 void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
71
75 void OnExit( wxCommandEvent& aEvent );
76
77protected:
78 void doReCreateMenuBar() override;
79
81
82private:
83 // Event handlers
84 void OnClosePcbCalc( wxCloseEvent& event );
85
86 void OnUpdateUI( wxUpdateUIEvent& event );
87
88 void onThemeChanged( wxSysColourChangedEvent& aEvent );
89
90 void loadPages();
91
92private:
93 wxBoxSizer* m_mainSizer;
94 wxTreebook* m_treebook;
95
97
98 std::vector<CALCULATOR_PANEL*> m_panels;
99 std::map<std::size_t, CALCULATOR_PANEL*> m_panelTypes;
100
101 void OnPageChanged ( wxTreebookEvent& aEvent );
102};
103
104
105extern const wxString DataFileNameExt;
106
107#endif // PCB_CALCULATOR_H
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:67
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:279
PCB calculator the main frame.
void doReCreateMenuBar() override
void OnPageChanged(wxTreebookEvent &aEvent)
wxWindow * GetToolCanvas() const override
Canvas access.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
std::vector< CALCULATOR_PANEL * > m_panels
void OnUpdateUI(wxUpdateUIEvent &event)
void onThemeChanged(wxSysColourChangedEvent &aEvent)
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void OnExit(wxCommandEvent &aEvent)
Event handler for the wxID_EXIT and wxID_CLOSE events.
void OnClosePcbCalc(wxCloseEvent &event)
void AddCalculator(CALCULATOR_PANEL *aPanel, const wxString &panelUIName)
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
std::map< std::size_t, CALCULATOR_PANEL * > m_panelTypes
const wxString DataFileNameExt