KiCad PCB EDA Suite
Loading...
Searching...
No Matches
drc_re_condition_row_panel.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) 2024 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, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#pragma once
25
26#include <wx/panel.h>
27#include <functional>
28
29class BOARD;
30class NET_SELECTOR;
32class AREA_SELECTOR;
33class wxChoice;
34class wxBitmapButton;
35class wxStyledTextCtrl;
36class wxBoxSizer;
37
47class DRC_RE_CONDITION_ROW_PANEL : public wxPanel
48{
49public:
50 enum class OBJECT_TARGET
51 {
54 };
55
64
65 DRC_RE_CONDITION_ROW_PANEL( wxWindow* aParent, BOARD* aBoard, bool aShowObjectSelector );
66
67 void SetObjectTarget( OBJECT_TARGET aTarget );
69
70 void SetConditionType( CONDITION_TYPE aType );
72
73 void SetValue( const wxString& aValue );
74 wxString GetValue() const;
75
82 bool ParseExpression( const wxString& aExpr );
83
89 wxString BuildExpression() const;
90
91 void SetDeleteCallback( std::function<void()> aCallback ) { m_deleteCallback = aCallback; }
92 void SetChangeCallback( std::function<void()> aCallback ) { m_changeCallback = aCallback; }
93
94 void ShowDeleteButton( bool aShow );
95 bool HasCustomQuerySelected() const;
96
97private:
98 void onObjectChoice( wxCommandEvent& aEvent );
99 void onConditionChoice( wxCommandEvent& aEvent );
100 void onDeleteClicked( wxCommandEvent& aEvent );
101 void updateVisibility();
102
104
105 wxChoice* m_objectChoice;
110 wxStyledTextCtrl* m_customQueryCtrl;
111 wxBitmapButton* m_deleteBtn;
112 wxBoxSizer* m_mainSizer;
113 wxBoxSizer* m_contentSizer;
114 wxBoxSizer* m_rowSizer;
115
116 std::function<void()> m_deleteCallback;
117 std::function<void()> m_changeCallback;
118};
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:322
void SetDeleteCallback(std::function< void()> aCallback)
void SetValue(const wxString &aValue)
DRC_RE_CONDITION_ROW_PANEL(wxWindow *aParent, BOARD *aBoard, bool aShowObjectSelector)
wxString BuildExpression() const
Build a condition expression from the row's current state.
void SetConditionType(CONDITION_TYPE aType)
bool ParseExpression(const wxString &aExpr)
Parse a condition expression and set the row's state.
void onConditionChoice(wxCommandEvent &aEvent)
void SetChangeCallback(std::function< void()> aCallback)
void onObjectChoice(wxCommandEvent &aEvent)
void onDeleteClicked(wxCommandEvent &aEvent)
void SetObjectTarget(OBJECT_TARGET aTarget)