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, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <memory>
23#include <wx/panel.h>
24#include <functional>
25
26class BOARD;
27class NET_SELECTOR;
29class AREA_SELECTOR;
30class wxChoice;
31class wxBitmapButton;
32class wxStyledTextCtrl;
33class wxStyledTextEvent;
34class wxBoxSizer;
35class SCINTILLA_TRICKS;
36
46class DRC_RE_CONDITION_ROW_PANEL : public wxPanel
47{
48public:
49 enum class OBJECT_TARGET
50 {
53 };
54
63
64 DRC_RE_CONDITION_ROW_PANEL( wxWindow* aParent, BOARD* aBoard, bool aShowObjectSelector );
65
66 void SetObjectTarget( OBJECT_TARGET aTarget );
68
69 void SetConditionType( CONDITION_TYPE aType );
71
72 void SetValue( const wxString& aValue );
73 wxString GetValue() const;
74
81 bool ParseExpression( const wxString& aExpr );
82
88 wxString BuildExpression() const;
89
90 void SetDeleteCallback( std::function<void()> aCallback ) { m_deleteCallback = aCallback; }
91 void SetChangeCallback( std::function<void()> aCallback ) { m_changeCallback = aCallback; }
92
93 void ShowDeleteButton( bool aShow );
94 bool HasCustomQuerySelected() const;
95
96private:
97 void onObjectChoice( wxCommandEvent& aEvent );
98 void onConditionChoice( wxCommandEvent& aEvent );
99 void onDeleteClicked( wxCommandEvent& aEvent );
100 void onValueChanged( wxCommandEvent& aEvent );
101 void onCustomQueryChanged( wxStyledTextEvent& aEvent );
102 void updateVisibility();
103
105
106 wxChoice* m_objectChoice;
111 wxStyledTextCtrl* m_customQueryCtrl;
112 std::unique_ptr<SCINTILLA_TRICKS> m_scintillaTricks;
113 wxBitmapButton* m_deleteBtn;
114 wxBoxSizer* m_mainSizer;
115 wxBoxSizer* m_contentSizer;
116 wxBoxSizer* m_rowSizer;
117
118 std::function<void()> m_deleteCallback;
119 std::function<void()> m_changeCallback;
120};
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:372
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.