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 <wx/bmpbndl.h>
29#include <wx/panel.h>
30
31class wxButton;
32
44class STD_BITMAP_BUTTON : public wxPanel
45{
46public:
47 // For use with wxFormBuilder on a sub-classed wxBitmapButton
48 STD_BITMAP_BUTTON( wxWindow* aParent, wxWindowID aId, const wxBitmap& aDummyBitmap,
49 const wxPoint& aPos = wxDefaultPosition, const wxSize& aSize = wxDefaultSize,
50 int aStyle = 0 );
51
53
54 void SetBitmap( const wxBitmapBundle& aBmp );
55 bool Enable( bool aEnable = true ) override;
56
57protected:
58 void OnKillFocus( wxFocusEvent& aEvent );
59 void OnMouseLeave( wxMouseEvent& aEvent );
60 void OnMouseEnter( wxMouseEvent& aEvent );
61 void OnLeftButtonUp( wxMouseEvent& aEvent );
62 void OnLeftButtonDown( wxMouseEvent& aEvent );
63 void OnPaint( wxPaintEvent& WXUNUSED( aEvent ) );
64 void onThemeChanged( wxSysColourChangedEvent &aEvent );
65
66private:
68 bool m_bIsEnable = true;
69 wxBitmapBundle m_bitmap;
70};
71
72#endif /*STD_BITMAP_BUTTON_H*/
A bitmap button widget that behaves like a standard dialog button except with an icon.
void OnPaint(wxPaintEvent &WXUNUSED(aEvent))
void OnKillFocus(wxFocusEvent &aEvent)
void OnLeftButtonDown(wxMouseEvent &aEvent)
wxBitmapBundle m_bitmap
bool Enable(bool aEnable=true) override
void OnMouseEnter(wxMouseEvent &aEvent)
void SetBitmap(const wxBitmapBundle &aBmp)
void onThemeChanged(wxSysColourChangedEvent &aEvent)
void OnLeftButtonUp(wxMouseEvent &aEvent)
void OnMouseLeave(wxMouseEvent &aEvent)