KiCad PCB EDA Suite
aboutinfo.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) 2014 Rafael Sokolowski <Rafael.Sokolowski@web.de>
5  * Copyright (C) 2014-2017 KiCad Developers, see CHANGELOG.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 ABOUTAPPINFO_H
26 #define ABOUTAPPINFO_H
27 
28 #include <wx/aboutdlg.h>
29 #include <wx/bitmap.h>
30 #include <wx/dynarray.h>
31 
32 #include "bitmap_types.h"
33 
34 class CONTRIBUTOR;
35 
36 WX_DECLARE_OBJARRAY( CONTRIBUTOR, CONTRIBUTORS );
37 
38 
45 {
46 public:
48  virtual ~ABOUT_APP_INFO() {};
49 
50  void AddDeveloper( const CONTRIBUTOR* developer )
51  {
52  if( developer != NULL )
53  developers.Add( developer );
54  }
55 
56  void AddDocWriter( const CONTRIBUTOR* docwriter )
57  {
58  if( docwriter != NULL )
59  docwriters.Add( docwriter );
60  }
61 
62  void AddArtist( const CONTRIBUTOR* artist )
63  {
64  if( artist != NULL )
65  artists.Add( artist );
66  }
67 
68  void AddTranslator( const CONTRIBUTOR* translator )
69  {
70  if( translator != NULL )
71  translators.Add( translator );
72  }
73 
74  void AddPackager( const CONTRIBUTOR* packager )
75  {
76  if( packager != NULL )
77  packagers.Add( packager );
78  }
79 
80  CONTRIBUTORS GetDevelopers() { return developers; }
81  CONTRIBUTORS GetDocWriters() { return docwriters; }
82  CONTRIBUTORS GetArtists() { return artists; }
83  CONTRIBUTORS GetTranslators() { return translators; }
84  CONTRIBUTORS GetPackagers() { return packagers; }
85 
86  void SetDescription( const wxString& text ) { description = text; }
87  wxString& GetDescription() { return description; }
88 
89  void SetLicense( const wxString& text ) { license = text; }
90  wxString& GetLicense() { return license; }
91 
92  void SetCopyright( const wxString& text ) { copyright = text; }
93  wxString GetCopyright() { return copyright; }
94 
95  void SetAppName( const wxString& name ) { appName = name; }
96  wxString& GetAppName() { return appName; }
97 
98  void SetBuildVersion( const wxString& version ) { buildVersion = version; }
99  wxString& GetBuildVersion() { return buildVersion; }
100 
101  void SetLibVersion( const wxString& version ) { libVersion = version; }
102  wxString& GetLibVersion() { return libVersion; }
103 
104  void SetAppIcon( const wxIcon& aIcon ) { m_appIcon = aIcon; }
105  wxIcon& GetAppIcon() { return m_appIcon; }
106 
108  wxBitmap* CreateKiBitmap( BITMAP_DEF aBitmap )
109  {
110  m_bitmaps.emplace_back( KiBitmapNew( aBitmap ) );
111  return m_bitmaps.back().get();
112  }
113 
114 private:
115  CONTRIBUTORS developers;
116  CONTRIBUTORS docwriters;
117  CONTRIBUTORS artists;
118  CONTRIBUTORS translators;
119  CONTRIBUTORS packagers;
120 
121  wxString description;
122  wxString license;
123 
124  wxString copyright;
125  wxString appName;
126  wxString buildVersion;
127  wxString libVersion;
128 
129  wxIcon m_appIcon;
130 
132  std::vector<std::unique_ptr<wxBitmap>> m_bitmaps;
133 };
134 
135 
149 {
150 public:
151  CONTRIBUTOR( const wxString& aName,
152  const wxString& aEmail = wxEmptyString,
153  const wxString& aUrl = wxEmptyString,
154  const wxString& aCategory = wxEmptyString,
155  wxBitmap* aIcon = NULL )
156  {
157  m_checked = false;
158  m_name = aName;
159  m_url = aUrl,
160  m_email = aEmail;
161  m_category = aCategory;
162  m_icon = aIcon;
163  }
164 
165  virtual ~CONTRIBUTOR() {}
166 
167  wxString& GetName() { return m_name; }
168  wxString& GetEMail() { return m_email; }
169  wxString& GetUrl() { return m_url; }
170  wxString& GetCategory() { return m_category; }
171  wxBitmap* GetIcon() { return m_icon; }
172  void SetChecked( bool status ) { m_checked = status; }
173  bool IsChecked() { return m_checked; }
174 
175 private:
176  wxString m_name;
177  wxString m_email;
178  wxString m_url;
179  wxString m_category;
180  wxBitmap* m_icon;
181  bool m_checked;
182 };
183 
184 #endif // ABOUTAPPINFO_H
wxString copyright
Definition: aboutinfo.h:124
void SetCopyright(const wxString &text)
Definition: aboutinfo.h:92
wxString & GetUrl()
Definition: aboutinfo.h:169
CONTRIBUTORS GetTranslators()
Definition: aboutinfo.h:83
CONTRIBUTORS docwriters
Definition: aboutinfo.h:116
PNG memory record (file in memory).
Definition: bitmap_types.h:41
virtual ~ABOUT_APP_INFO()
Definition: aboutinfo.h:48
wxString & GetLibVersion()
Definition: aboutinfo.h:102
void AddTranslator(const CONTRIBUTOR *translator)
Definition: aboutinfo.h:68
void SetChecked(bool status)
Definition: aboutinfo.h:172
wxString & GetCategory()
Definition: aboutinfo.h:170
wxIcon m_appIcon
Definition: aboutinfo.h:129
void AddDocWriter(const CONTRIBUTOR *docwriter)
Definition: aboutinfo.h:56
wxString & GetName()
Definition: aboutinfo.h:167
wxString & GetBuildVersion()
Definition: aboutinfo.h:99
wxIcon & GetAppIcon()
Definition: aboutinfo.h:105
void SetAppIcon(const wxIcon &aIcon)
Definition: aboutinfo.h:104
An object of this class is meant to be used to store application specific information like who has co...
Definition: aboutinfo.h:44
wxString license
Definition: aboutinfo.h:122
wxString libVersion
Definition: aboutinfo.h:127
wxString & GetLicense()
Definition: aboutinfo.h:90
wxString description
Definition: aboutinfo.h:121
wxBitmap * CreateKiBitmap(BITMAP_DEF aBitmap)
Wrapper to manage memory allocation for bitmaps
Definition: aboutinfo.h:108
wxString m_category
Definition: aboutinfo.h:179
wxBitmap * KiBitmapNew(BITMAP_DEF aBitmap)
Function KiBitmapNew allocates a wxBitmap on heap from a memory record, held in a BITMAP_DEF...
Definition: bitmap.cpp:164
wxString appName
Definition: aboutinfo.h:125
wxString m_email
Definition: aboutinfo.h:177
CONTRIBUTORS GetDocWriters()
Definition: aboutinfo.h:81
CONTRIBUTOR(const wxString &aName, const wxString &aEmail=wxEmptyString, const wxString &aUrl=wxEmptyString, const wxString &aCategory=wxEmptyString, wxBitmap *aIcon=NULL)
Definition: aboutinfo.h:151
void SetBuildVersion(const wxString &version)
Definition: aboutinfo.h:98
wxString buildVersion
Definition: aboutinfo.h:126
void SetDescription(const wxString &text)
Definition: aboutinfo.h:86
wxString & GetAppName()
Definition: aboutinfo.h:96
CONTRIBUTORS GetArtists()
Definition: aboutinfo.h:82
void SetLibVersion(const wxString &version)
Definition: aboutinfo.h:101
std::vector< std::unique_ptr< wxBitmap > > m_bitmaps
Bitmaps to be freed when the dialog is closed
Definition: aboutinfo.h:132
bool m_checked
Definition: aboutinfo.h:181
wxString GetCopyright()
Definition: aboutinfo.h:93
CONTRIBUTORS translators
Definition: aboutinfo.h:118
wxBitmap * m_icon
Definition: aboutinfo.h:180
wxString m_name
Definition: aboutinfo.h:176
wxString m_url
Definition: aboutinfo.h:178
wxString & GetEMail()
Definition: aboutinfo.h:168
void AddArtist(const CONTRIBUTOR *artist)
Definition: aboutinfo.h:62
void SetLicense(const wxString &text)
Definition: aboutinfo.h:89
CONTRIBUTORS GetPackagers()
Definition: aboutinfo.h:84
wxBitmap * GetIcon()
Definition: aboutinfo.h:171
const char * name
Definition: DXF_plotter.cpp:61
CONTRIBUTORS GetDevelopers()
Definition: aboutinfo.h:80
A contributor, a person which was involved in the development of the application or which has contrib...
Definition: aboutinfo.h:148
void AddPackager(const CONTRIBUTOR *packager)
Definition: aboutinfo.h:74
CONTRIBUTORS developers
Definition: aboutinfo.h:115
CONTRIBUTORS packagers
Definition: aboutinfo.h:119
void AddDeveloper(const CONTRIBUTOR *developer)
Definition: aboutinfo.h:50
wxString & GetDescription()
Definition: aboutinfo.h:87
CONTRIBUTORS artists
Definition: aboutinfo.h:117
virtual ~CONTRIBUTOR()
Definition: aboutinfo.h:165
bool IsChecked()
Definition: aboutinfo.h:173
void SetAppName(const wxString &name)
Definition: aboutinfo.h:95
WX_DECLARE_OBJARRAY(CONTRIBUTOR, CONTRIBUTORS)