/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-2021 Kicad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see .
*/
#ifndef PCB_CALCULATOR_FRAME_H_
#define PCB_CALCULATOR_FRAME_H_
#include
#include
class wxMenuBar;
class wxNotebook;
class wxBoxSizer;
class APP_SETTINGS_BASE;
class KIWAY;
class PANEL_TRANSLINE;
/**
* PCB calculator the main frame.
*/
class PCB_CALCULATOR_FRAME : public KIWAY_PLAYER
{
public:
PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent );
~PCB_CALCULATOR_FRAME();
// Pcb calculator doesn't host a tool framework
wxWindow* GetToolCanvas() const override
{
return nullptr;
}
/*
* Return the panel of given type or nullptr if there is no such panel exists.
*/
template
T* GetCalculator()
{
std::map::iterator panel = m_panelTypes.find( typeid( T ).hash_code() );
if( panel != m_panelTypes.end() )
return static_cast( panel->second );
return nullptr;
}
void AddCalculator( CALCULATOR_PANEL *aPanel, const wxString& panelUIName );
private:
// Event handlers
void OnClosePcbCalc( wxCloseEvent& event );
void OnUpdateUI( wxUpdateUIEvent& event );
void onThemeChanged( wxSysColourChangedEvent& aEvent );
// Config read-write, virtual from EDA_BASE_FRAME
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
private:
wxMenuBar* m_menubar;
wxNotebook* m_notebook;
wxBoxSizer* m_mainSizer;
int m_lastNotebookPage;
bool m_macHack;
std::vector m_panels;
std::map m_panelTypes;
};
extern const wxString DataFileNameExt;
#endif // PCB_CALCULATOR_H