KiCad PCB EDA Suite
wx_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) 2018-2021 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 3
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#include <widgets/wx_panel.h>
25#include <wx/dcclient.h>
26#include <wx/settings.h>
27
28WX_PANEL::WX_PANEL( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
29 long style, const wxString& name ) :
30 wxPanel( parent, id, pos, size, style, name ),
31 m_leftBorder( false ),
32 m_rightBorder( false ),
33 m_topBorder( false ),
34 m_bottomBorder( false )
35{
36 this->Connect( wxEVT_PAINT, wxPaintEventHandler( WX_PANEL::OnPaint ) );
37}
38
39
41{
42 this->Disconnect( wxEVT_PAINT, wxPaintEventHandler( WX_PANEL::OnPaint ) );
43}
44
45
46void WX_PANEL::OnPaint( wxPaintEvent& event )
47{
48 wxRect rect( wxPoint( 0, 0 ), GetClientSize() );
49 wxPaintDC dc( this );
50
51 dc.SetBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_FRAMEBK ) );
52 dc.SetPen( wxPen( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ), 1 ) );
53
54 if( m_leftBorder )
55 dc.DrawLine( rect.GetLeft(), rect.GetTop(), rect.GetLeft(), rect.GetBottom() );
56
57 if( m_rightBorder )
58 dc.DrawLine( rect.GetRight(), rect.GetTop(), rect.GetRight(), rect.GetBottom() );
59
60 if( m_topBorder )
61 dc.DrawLine( rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetTop() );
62
63 if( m_bottomBorder )
64 dc.DrawLine( rect.GetLeft(), rect.GetBottom(), rect.GetRight(), rect.GetBottom() );
65}
66
67
const char * name
Definition: DXF_plotter.cpp:56
bool m_topBorder
Definition: wx_panel.h:52
bool m_rightBorder
Definition: wx_panel.h:51
~WX_PANEL()
Definition: wx_panel.cpp:40
bool m_leftBorder
Definition: wx_panel.h:50
bool m_bottomBorder
Definition: wx_panel.h:53
WX_PANEL(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
Definition: wx_panel.cpp:28
void OnPaint(wxPaintEvent &event)
Definition: wx_panel.cpp:46