KiCad PCB EDA Suite
Loading...
Searching...
No Matches
kiway_holder.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 The 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 2
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
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef KIWAY_HOLDER_H_
21#define KIWAY_HOLDER_H_
22
23#include <kicommon.h>
24
25class KIWAY;
26class PROJECT;
27class wxWindow;
28
35{
36public:
38
39 KIWAY_HOLDER( KIWAY* aKiway, HOLDER_TYPE aType ) :
40 m_kiway( aKiway ),
41 m_type( aType )
42 {}
43
44 HOLDER_TYPE GetType() const { return m_type; }
45
51 KIWAY& Kiway() const
52 {
53 wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
54 return *m_kiway;
55 }
56
61 bool HasKiway() const
62 {
63 return m_kiway != nullptr;
64 }
65
69 PROJECT& Prj() const;
70
78 void SetKiway( wxWindow* aDest, KIWAY* aKiway );
79
80private:
81 // private, all setting is done through SetKiway().
82 KIWAY* m_kiway; // no ownership.
84};
85
86
87#endif // KIWAY_HOLDER_H_
KIWAY * m_kiway
KIWAY_HOLDER(KIWAY *aKiway, HOLDER_TYPE aType)
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
bool HasKiway() const
Safety check before asking for the Kiway reference.
HOLDER_TYPE GetType() const
HOLDER_TYPE m_type
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:311
Container for project specific data.
Definition project.h:62
PROJECT & Prj()
Definition kicad.cpp:730
#define KICOMMON_API
Definition kicommon.h:27