KiCad PCB EDA Suite
Loading...
Searching...
No Matches
std_bitmap_button.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) 2020-2022 Kicad Developers, see AUTHORS.txt for contributors.
5 * Copyright (C) 2016 Anil8735(https://stackoverflow.com/users/3659387/anil8753) from https://stackoverflow.com/a/37274011
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#ifndef STD_BITMAP_BUTTON_H
26#define STD_BITMAP_BUTTON_H
27
28#include <kicommon.h>
29#include <wx/bmpbndl.h>
30#include <wx/panel.h>
31
32class wxButton;
33
45class KICOMMON_API STD_BITMAP_BUTTON : public wxPanel
46{
47public:
48 // For use with wxFormBuilder on a sub-classed wxBitmapButton
49 STD_BITMAP_BUTTON( wxWindow* aParent, wxWindowID aId, const wxBitmap& aDummyBitmap,
50 const wxPoint& aPos = wxDefaultPosition, const wxSize& aSize = wxDefaultSize,
51 int aStyle = 0 );
52
54
55 void SetBitmap( const wxBitmapBundle& aBmp );
56 bool Enable( bool aEnable = true ) override;
57
58protected:
59 void OnKillFocus( wxFocusEvent& aEvent );
60 void OnMouseLeave( wxMouseEvent& aEvent );
61 void OnMouseEnter( wxMouseEvent& aEvent );
62 void OnLeftButtonUp( wxMouseEvent& aEvent );
63 void OnLeftButtonDown( wxMouseEvent& aEvent );
64 void OnPaint( wxPaintEvent& WXUNUSED( aEvent ) );
65 void onThemeChanged( wxSysColourChangedEvent &aEvent );
66
67private:
68 int m_stateButton = 0;
69 bool m_bIsEnable = true;
70 wxBitmapBundle m_bitmap;
71};
72
73#endif /*STD_BITMAP_BUTTON_H*/
A bitmap button widget that behaves like a standard dialog button except with an icon.
wxBitmapBundle m_bitmap
#define KICOMMON_API
Definition: kicommon.h:28