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 The 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, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef STD_BITMAP_BUTTON_H
22#define STD_BITMAP_BUTTON_H
23
24#include <kicommon.h>
25#include <wx/bmpbndl.h>
26#include <wx/panel.h>
27
28class wxButton;
29
40
41class KICOMMON_API STD_BITMAP_BUTTON : public wxPanel
42{
43public:
44 // For use with wxFormBuilder on a sub-classed wxBitmapButton
45 STD_BITMAP_BUTTON( wxWindow* aParent, wxWindowID aId, const wxBitmap& aDummyBitmap,
46 const wxPoint& aPos = wxDefaultPosition, const wxSize& aSize = wxDefaultSize,
47 int aStyle = 0 );
48
50
51 void SetBitmap( const wxBitmapBundle& aBmp );
52 bool Enable( bool aEnable = true ) override;
53
54protected:
55 void OnKillFocus( wxFocusEvent& aEvent );
56 void OnMouseLeave( wxMouseEvent& aEvent );
57 void OnMouseEnter( wxMouseEvent& aEvent );
58 void OnLeftButtonUp( wxMouseEvent& aEvent );
59 void OnLeftButtonDown( wxMouseEvent& aEvent );
60 void OnPaint( wxPaintEvent& WXUNUSED( aEvent ) );
61 void onThemeChanged( wxSysColourChangedEvent &aEvent );
62
63private:
65 bool m_bIsEnable = true;
66 wxBitmapBundle m_bitmap;
67};
68
69#endif /*STD_BITMAP_BUTTON_H*/
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)
STD_BITMAP_BUTTON(wxWindow *aParent, wxWindowID aId, const wxBitmap &aDummyBitmap, const wxPoint &aPos=wxDefaultPosition, const wxSize &aSize=wxDefaultSize, int aStyle=0)
void OnLeftButtonUp(wxMouseEvent &aEvent)
void OnMouseLeave(wxMouseEvent &aEvent)
#define KICOMMON_API
Definition kicommon.h:27