KiCad PCB EDA Suite
Loading...
Searching...
No Matches
net_inspector_panel.cpp
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 modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
21
22#include <eda_base_frame.h>
23
24#include <widgets/ui_common.h>
25
26NET_INSPECTOR_PANEL::NET_INSPECTOR_PANEL( wxWindow* parent, EDA_BASE_FRAME* aFrame, wxWindowID id,
27 const wxPoint& pos, const wxSize& size, long style,
28 const wxString& name ) :
29 wxPanel( parent, id, pos, size, style, name ),
30 m_frame( aFrame )
31{
32 m_sizerOuter = new wxGridBagSizer( 0, 0 );
33 m_sizerOuter->SetFlexibleDirection( wxBOTH );
34 m_sizerOuter->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
35
36 m_searchCtrl = new wxSearchCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition,
37 wxDefaultSize, 0 );
38#ifndef __WXMAC__
39 m_searchCtrl->ShowSearchButton( true );
40#endif
41 m_searchCtrl->ShowCancelButton( false );
42 m_searchCtrl->SetDescriptiveText( _( "Filter" ) );
43 m_sizerOuter->Add( m_searchCtrl, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
44
45 m_configureBtn = new BITMAP_BUTTON( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
46 m_configureBtn->SetToolTip( _( "Configure netlist inspector" ) );
47 m_configureBtn->SetBitmap( KiBitmapBundle( BITMAPS::options_generic_16 ) );
49 m_sizerOuter->Add( m_configureBtn, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), 0, 5 );
50
51 m_netsList = new wxDataViewCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
52 wxDV_MULTIPLE );
53 m_netsList->SetFont( KIUI::GetDockedPaneFont( this ) );
54 m_sizerOuter->Add( m_netsList, wxGBPosition( 1, 0 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
55
56 m_sizerOuter->AddGrowableCol( 0 );
57 m_sizerOuter->AddGrowableRow( 1 );
58
59 SetFont( KIUI::GetDockedPaneFont( this ) );
60 SetSizer( m_sizerOuter );
61 Layout();
62
63 m_sizerOuter->Fit( this );
64
65 // Connect Events
66 m_frame->Bind( EDA_LANG_CHANGED, &NET_INSPECTOR_PANEL::OnLanguageChanged, this );
67
68 Bind( wxEVT_SET_FOCUS, &NET_INSPECTOR_PANEL::OnSetFocus, this );
69 Bind( wxEVT_SIZE, &NET_INSPECTOR_PANEL::OnSize, this );
70
71 m_searchCtrl->Bind( wxEVT_COMMAND_TEXT_UPDATED, &NET_INSPECTOR_PANEL::OnSearchTextChanged,
72 this );
73 m_netsList->Bind( wxEVT_SET_FOCUS, &NET_INSPECTOR_PANEL::OnSetFocus, this );
74 m_configureBtn->Bind( wxEVT_BUTTON, &NET_INSPECTOR_PANEL::OnConfigButton, this );
75}
76
77
79{
80 // Disconnect Events
81 m_frame->Unbind( EDA_LANG_CHANGED, &NET_INSPECTOR_PANEL::OnLanguageChanged, this );
82
83 Unbind( wxEVT_SET_FOCUS, &NET_INSPECTOR_PANEL::OnSetFocus, this );
84 Unbind( wxEVT_SIZE, &NET_INSPECTOR_PANEL::OnSize, this );
85
86 m_searchCtrl->Unbind( wxEVT_COMMAND_TEXT_UPDATED, &NET_INSPECTOR_PANEL::OnSearchTextChanged,
87 this );
88 m_netsList->Unbind( wxEVT_SET_FOCUS, &NET_INSPECTOR_PANEL::OnSetFocus, this );
89 m_configureBtn->Unbind( wxEVT_BUTTON, &NET_INSPECTOR_PANEL::OnConfigButton, this );
90}
91
92
93void NET_INSPECTOR_PANEL::OnLanguageChanged( wxCommandEvent& event )
94{
95 m_searchCtrl->SetDescriptiveText( _( "Filter" ) );
96 m_configureBtn->SetToolTip( _( "Configure netlist inspector" ) );
97
99
100 event.Skip();
101}
const char * name
Definition: DXF_plotter.cpp:57
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Definition: bitmap.cpp:110
A bitmap button widget that behaves like an AUI toolbar item's button when it is drawn.
Definition: bitmap_button.h:42
void SetBitmap(const wxBitmapBundle &aBmp)
Set the bitmap shown when the button is enabled.
void SetPadding(int aPadding)
Set the amount of padding present on each side of the bitmap.
The base frame for deriving all KiCad main window classes.
virtual void OnSearchTextChanged(wxCommandEvent &event)
NET_INSPECTOR_PANEL(wxWindow *parent, EDA_BASE_FRAME *aFrame, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1, -1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
virtual void OnLanguageChanged(wxCommandEvent &event)
virtual void OnSize(wxSizeEvent &event)
virtual void OnLanguageChangedImpl()
Implementation-specific implementation of language update handling.
wxDataViewCtrl * m_netsList
wxSearchCtrl * m_searchCtrl
virtual void OnSetFocus(wxFocusEvent &event)
wxGridBagSizer * m_sizerOuter
EDA_BASE_FRAME * m_frame
BITMAP_BUTTON * m_configureBtn
virtual void OnConfigButton(wxCommandEvent &event)
#define _(s)
Base window classes and related definitions.
KICOMMON_API wxFont GetDockedPaneFont(wxWindow *aWindow)
Definition: ui_common.cpp:142
Functions to provide common constants and other functions to assist in making a consistent UI.