KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_template_selector.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) 2012 Brian Sidebotham <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#ifndef PROJECT_TEMPLATE_SELECTOR_H
26#define PROJECT_TEMPLATE_SELECTOR_H
27
29#include "project_template.h"
30
31#include <map>
32
34
36{
37public:
38 TEMPLATE_WIDGET( wxWindow* aParent, DIALOG_TEMPLATE_SELECTOR* aDialog );
39
44 void SetTemplate(PROJECT_TEMPLATE* aTemplate);
45
47
48 void Select();
49 void Unselect();
50
51protected:
52 void OnKillFocus( wxFocusEvent& event );
53 void OnMouse( wxMouseEvent& event );
54
55private:
56 bool IsSelected() { return m_selected; }
57
58protected:
60 wxWindow* m_parent;
61 wxPanel* m_panel;
63
65};
66
67
69{
70public:
75 TEMPLATE_SELECTION_PANEL( wxNotebookPage* aParent, const wxString& aPath );
76
77 const wxString& GetPath() { return m_templatesPath; }
78
79 void AddTemplateWidget( TEMPLATE_WIDGET* aTemplateWidget );
80
81protected:
82 wxNotebookPage* m_parent;
83 wxString m_templatesPath;
85};
86
87
89{
90public:
91 DIALOG_TEMPLATE_SELECTOR( wxWindow* aParent, const wxPoint& aPos, const wxSize& aSize,
92 std::map<wxString, wxFileName> aTitleDirMap );
93
98
99 void SetWidget( TEMPLATE_WIDGET* aWidget );
100
101protected:
102 void AddTemplate( int aPage, PROJECT_TEMPLATE* aTemplate );
103
104private:
105 void SetHtml( const wxFileName& aFilename )
106 {
107 m_htmlWin->LoadPage( aFilename.GetFullPath() );
108 }
109
110private:
111 void buildPageContent( const wxString& aPath, int aPage );
112 void replaceCurrentPage();
113
114 void OnPageChange( wxNotebookEvent& event ) override;
115 void onDirectoryBrowseClicked( wxCommandEvent& event ) override;
116 void onReload( wxCommandEvent& event ) override;
117 void OnHtmlLinkActivated( wxHtmlLinkEvent& event ) override;
118
119protected:
120 std::vector<TEMPLATE_SELECTION_PANEL*> m_panels;
122};
123
124#endif
Class DIALOG_TEMPLATE_SELECTOR_BASE.
void AddTemplate(int aPage, PROJECT_TEMPLATE *aTemplate)
void OnPageChange(wxNotebookEvent &event) override
void onReload(wxCommandEvent &event) override
void SetHtml(const wxFileName &aFilename)
void onDirectoryBrowseClicked(wxCommandEvent &event) override
PROJECT_TEMPLATE * GetSelectedTemplate()
void SetWidget(TEMPLATE_WIDGET *aWidget)
void buildPageContent(const wxString &aPath, int aPage)
void OnHtmlLinkActivated(wxHtmlLinkEvent &event) override
std::vector< TEMPLATE_SELECTION_PANEL * > m_panels
A class which provides project template functionality.
Class TEMPLATE_SELECTION_PANEL_BASE.
wxString m_templatesPath
the path to access to the folder containing the templates (which are also folders)
void AddTemplateWidget(TEMPLATE_WIDGET *aTemplateWidget)
Class TEMPLATE_WIDGET_BASE.
PROJECT_TEMPLATE * GetTemplate()
void OnMouse(wxMouseEvent &event)
void SetTemplate(PROJECT_TEMPLATE *aTemplate)
Set the project template for this widget, which will determine the icon and title associated with thi...
DIALOG_TEMPLATE_SELECTOR * m_dialog
void OnKillFocus(wxFocusEvent &event)
PROJECT_TEMPLATE * m_currTemplate