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 <memory>
27#include <wx/panel.h>
28#include <functional>
29
30class BOARD;
31class NET_SELECTOR;
33class AREA_SELECTOR;
34class wxChoice;
35class wxBitmapButton;
36class wxStyledTextCtrl;
37class wxStyledTextEvent;
38class wxBoxSizer;
39class SCINTILLA_TRICKS;
40
50class DRC_RE_CONDITION_ROW_PANEL : public wxPanel
51{
52public:
53 enum class OBJECT_TARGET
54 {
57 };
58
67
68 DRC_RE_CONDITION_ROW_PANEL( wxWindow* aParent, BOARD* aBoard, bool aShowObjectSelector );
69
70 void SetObjectTarget( OBJECT_TARGET aTarget );
72
73 void SetConditionType( CONDITION_TYPE aType );
75
76 void SetValue( const wxString& aValue );
77 wxString GetValue() const;
78
85 bool ParseExpression( const wxString& aExpr );
86
92 wxString BuildExpression() const;
93
94 void SetDeleteCallback( std::function<void()> aCallback ) { m_deleteCallback = aCallback; }
95 void SetChangeCallback( std::function<void()> aCallback ) { m_changeCallback = aCallback; }
96
97 void ShowDeleteButton( bool aShow );
98 bool HasCustomQuerySelected() const;
99
100private:
101 void onObjectChoice( wxCommandEvent& aEvent );
102 void onConditionChoice( wxCommandEvent& aEvent );
103 void onDeleteClicked( wxCommandEvent& aEvent );
104 void onValueChanged( wxCommandEvent& aEvent );
105 void onCustomQueryChanged( wxStyledTextEvent& aEvent );
106 void updateVisibility();
107
109
110 wxChoice* m_objectChoice;
115 wxStyledTextCtrl* m_customQueryCtrl;
116 std::unique_ptr<SCINTILLA_TRICKS> m_scintillaTricks;
117 wxBitmapButton* m_deleteBtn;
118 wxBoxSizer* m_mainSizer;
119 wxBoxSizer* m_contentSizer;
120 wxBoxSizer* m_rowSizer;
121
122 std::function<void()> m_deleteCallback;
123 std::function<void()> m_changeCallback;
124};
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)
std::unique_ptr< SCINTILLA_TRICKS > m_scintillaTricks
bool ParseExpression(const wxString &aExpr)
Parse a condition expression and set the row's state.
void onCustomQueryChanged(wxStyledTextEvent &aEvent)
void onConditionChoice(wxCommandEvent &aEvent)
void SetChangeCallback(std::function< void()> aCallback)
void onObjectChoice(wxCommandEvent &aEvent)
void onValueChanged(wxCommandEvent &aEvent)
void onDeleteClicked(wxCommandEvent &aEvent)
void SetObjectTarget(OBJECT_TARGET aTarget)
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.