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 The 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#include <wx/statline.h>
26
27NET_INSPECTOR_PANEL::NET_INSPECTOR_PANEL( wxWindow* parent, EDA_BASE_FRAME* aFrame, wxWindowID id,
28 const wxPoint& pos, const wxSize& size, long style,
29 const wxString& name ) :
30 wxPanel( parent, id, pos, size, style, name ),
31 m_frame( aFrame )
32{
33 m_sizerOuter = new wxGridBagSizer( 0, 0 );
34 m_sizerOuter->SetFlexibleDirection( wxBOTH );
35 m_sizerOuter->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
36
37 m_searchCtrl = new wxSearchCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, 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 ),
44 wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 2 );
45
46 wxStaticLine* separator = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
47 m_sizerOuter->Add( separator, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 3 );
48
49 m_configureBtn = new BITMAP_BUTTON( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
50 m_configureBtn->SetToolTip( _( "Configure netlist inspector" ) );
52 m_configureBtn->SetPadding( 2 );
53 m_sizerOuter->Add( m_configureBtn, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
54
55 m_netsList = new wxDataViewCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_MULTIPLE );
56 m_netsList->SetFont( KIUI::GetDockedPaneFont( this ) );
57 m_sizerOuter->Add( m_netsList, wxGBPosition( 1, 0 ), wxGBSpan( 1, 3 ), wxEXPAND, 5 );
58
59 m_sizerOuter->AddGrowableCol( 0 );
60 m_sizerOuter->AddGrowableRow( 1 );
61
62 SetFont( KIUI::GetDockedPaneFont( this ) );
63 SetSizer( m_sizerOuter );
64 Layout();
65
66 m_sizerOuter->Fit( this );
67
68 // Connect Events
69 m_frame->Bind( EDA_LANG_CHANGED, &NET_INSPECTOR_PANEL::OnLanguageChanged, this );
70
71 Bind( wxEVT_SET_FOCUS, &NET_INSPECTOR_PANEL::OnSetFocus, this );
72 Bind( wxEVT_SIZE, &NET_INSPECTOR_PANEL::OnSize, this );
73
74 m_searchCtrl->Bind( wxEVT_COMMAND_TEXT_UPDATED, &NET_INSPECTOR_PANEL::OnSearchTextChanged,
75 this );
76 m_netsList->Bind( wxEVT_SET_FOCUS, &NET_INSPECTOR_PANEL::OnSetFocus, this );
77 m_configureBtn->Bind( wxEVT_BUTTON, &NET_INSPECTOR_PANEL::OnConfigButton, this );
78}
79
80
82{
83 // Disconnect Events
84 m_frame->Unbind( EDA_LANG_CHANGED, &NET_INSPECTOR_PANEL::OnLanguageChanged, this );
85
86 Unbind( wxEVT_SET_FOCUS, &NET_INSPECTOR_PANEL::OnSetFocus, this );
87 Unbind( wxEVT_SIZE, &NET_INSPECTOR_PANEL::OnSize, this );
88
89 m_searchCtrl->Unbind( wxEVT_COMMAND_TEXT_UPDATED, &NET_INSPECTOR_PANEL::OnSearchTextChanged,
90 this );
91 m_netsList->Unbind( wxEVT_SET_FOCUS, &NET_INSPECTOR_PANEL::OnSetFocus, this );
92 m_configureBtn->Unbind( wxEVT_BUTTON, &NET_INSPECTOR_PANEL::OnConfigButton, this );
93}
94
95
96void NET_INSPECTOR_PANEL::OnLanguageChanged( wxCommandEvent& event )
97{
98 m_searchCtrl->SetDescriptiveText( _( "Filter" ) );
99 m_configureBtn->SetToolTip( _( "Configure netlist inspector" ) );
100
102
103 event.Skip();
104}
const char * name
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:110
A bitmap button widget that behaves like an AUI toolbar item's button when it is drawn.
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)
Functions to provide common constants and other functions to assist in making a consistent UI.