|
KiCad PCB EDA Suite
|
A bitmap button widget that behaves like an AUI toolbar item's button when it is drawn. More...
#include <bitmap_button.h>
Public Member Functions | |
| BITMAP_BUTTON (wxWindow *aParent, wxWindowID aId, const wxPoint &aPos=wxDefaultPosition, const wxSize &aSize=wxDefaultSize, int aStyles=wxBORDER_NONE|wxTAB_TRAVERSAL) | |
| BITMAP_BUTTON (wxWindow *aParent, wxWindowID aId, const wxBitmap &aDummyBitmap, const wxPoint &aPos=wxDefaultPosition, const wxSize &aSize=wxDefaultSize, int aStyles=wxBORDER_NONE|wxTAB_TRAVERSAL) | |
| ~BITMAP_BUTTON () | |
| void | SetPadding (int aPaddingDIP) |
| Set the amount of padding present on each side of the bitmap. | |
| void | SetBitmap (const wxBitmapBundle &aBmp) |
| Set the bitmap shown when the button is enabled. | |
| void | SetDisabledBitmap (const wxBitmapBundle &aBmp) |
| Set the bitmap shown when the button is disabled. | |
| bool | Enable (bool aEnable=true) override |
| Enable the button. | |
| void | SetIsCheckButton () |
| Setup the control as a two-state button (checked or unchecked). | |
| void | SetIsRadioButton () |
| void | Check (bool aCheck=true) |
| Check the control. | |
| bool | IsChecked () const |
| void | SetIsSeparator () |
| Render button as a toolbar separator. | |
| void | AcceptDragInAsClick (bool aAcceptDragIn=true) |
| Accept mouse-up as click even if mouse-down happened outside of the control. | |
| void | SetShowBadge (bool aShowBadge) |
| void | SetBadgeText (const wxString &aText) |
| void | SetBadgeColors (const wxColor &aBadgeColor, const wxColor &aBadgeTextColor) |
| void | SetBitmapCentered (bool aCentered=true) |
| void | SetIsToolbarButton (bool aIsToolbar=true) |
| bool | IsToolbarButton () const |
Protected Member Functions | |
| void | setupEvents () |
| void | OnMouseLeave (wxEvent &aEvent) |
| void | OnMouseEnter (wxEvent &aEvent) |
| void | OnKillFocus (wxEvent &aEvent) |
| void | OnSetFocus (wxEvent &aEvent) |
| void | OnLeftButtonUp (wxMouseEvent &aEvent) |
| void | OnLeftButtonDown (wxMouseEvent &aEvent) |
| void | OnPaint (wxPaintEvent &aEvent) |
| void | OnDPIChanged (wxDPIChangedEvent &aEvent) |
| virtual wxSize | DoGetBestSize () const override |
| void | setFlag (int aFlag) |
| void | clearFlag (int aFlag) |
| bool | hasFlag (int aFlag) const |
| void | invalidateBestSize () |
Private Attributes | |
| wxBitmapBundle | m_normalBitmap |
| wxBitmapBundle | m_disabledBitmap |
| bool | m_isRadioButton |
| bool | m_showBadge |
| wxString | m_badgeText |
| wxColor | m_badgeColor |
| wxColor | m_badgeTextColor |
| wxFont | m_badgeFont |
| int | m_buttonState |
| int | m_padding |
| wxSize | m_dipSize |
| bool | m_isToolbarButton |
| bool | m_acceptDraggedInClicks |
| Accept mouse-up as click even if mouse-down happened outside of the control. | |
| bool | m_centerBitmap |
| Draw bitmap centered in the control. | |
A bitmap button widget that behaves like an AUI toolbar item's button when it is drawn.
Specifically:
Definition at line 37 of file bitmap_button.h.
| BITMAP_BUTTON::BITMAP_BUTTON | ( | wxWindow * | aParent, |
| wxWindowID | aId, | ||
| const wxPoint & | aPos = wxDefaultPosition, | ||
| const wxSize & | aSize = wxDefaultSize, | ||
| int | aStyles = wxBORDER_NONE | wxTAB_TRAVERSAL ) |
Definition at line 33 of file bitmap_button.cpp.
References m_acceptDraggedInClicks, m_badgeColor, m_badgeFont, m_badgeTextColor, m_buttonState, m_centerBitmap, m_isRadioButton, m_isToolbarButton, m_padding, m_showBadge, and setupEvents().
| BITMAP_BUTTON::BITMAP_BUTTON | ( | wxWindow * | aParent, |
| wxWindowID | aId, | ||
| const wxBitmap & | aDummyBitmap, | ||
| const wxPoint & | aPos = wxDefaultPosition, | ||
| const wxSize & | aSize = wxDefaultSize, | ||
| int | aStyles = wxBORDER_NONE | wxTAB_TRAVERSAL ) |
Definition at line 52 of file bitmap_button.cpp.
References m_acceptDraggedInClicks, m_badgeColor, m_badgeFont, m_badgeTextColor, m_buttonState, m_centerBitmap, m_isRadioButton, m_isToolbarButton, m_padding, m_showBadge, and setupEvents().
| BITMAP_BUTTON::~BITMAP_BUTTON | ( | ) |
Definition at line 84 of file bitmap_button.cpp.
References OnDPIChanged(), OnKillFocus(), OnLeftButtonDown(), OnLeftButtonUp(), OnMouseEnter(), OnMouseLeave(), OnPaint(), and OnSetFocus().
| void BITMAP_BUTTON::AcceptDragInAsClick | ( | bool | aAcceptDragIn = true | ) |
Accept mouse-up as click even if mouse-down happened outside of the control.
| aAcceptDragIn | is true to allow drag in, false to ignore lone mouse-up events |
Definition at line 138 of file bitmap_button.cpp.
References m_acceptDraggedInClicks.
Referenced by ACTION_TOOLBAR_PALETTE::AddAction().
| void BITMAP_BUTTON::Check | ( | bool | aCheck = true | ) |
Check the control.
This is the equivalent to toggling a toolbar button.
Definition at line 403 of file bitmap_button.cpp.
References clearFlag(), hasFlag(), and setFlag().
|
inlineprotected |
Definition at line 142 of file bitmap_button.h.
References m_buttonState.
Referenced by Check(), Enable(), OnKillFocus(), OnLeftButtonDown(), OnLeftButtonUp(), and OnMouseLeave().
|
overrideprotectedvirtual |
Definition at line 97 of file bitmap_button.cpp.
References hasFlag(), m_dipSize, m_padding, and wxCONTROL_SEPARATOR.
|
override |
Enable the button.
Definition at line 358 of file bitmap_button.cpp.
References clearFlag(), hasFlag(), and setFlag().
Referenced by PANEL_KICAD_LAUNCHER::CreateLaunchers().
|
inlineprotected |
Definition at line 147 of file bitmap_button.h.
References m_buttonState.
Referenced by Check(), DoGetBestSize(), Enable(), IsChecked(), OnKillFocus(), OnLeftButtonDown(), OnLeftButtonUp(), OnMouseEnter(), OnMouseLeave(), OnPaint(), and OnSetFocus().
|
protected |
Definition at line 106 of file bitmap_button.cpp.
Referenced by OnDPIChanged(), SetBitmap(), SetIsSeparator(), and SetPadding().
| bool BITMAP_BUTTON::IsChecked | ( | ) | const |
Definition at line 421 of file bitmap_button.cpp.
References hasFlag().
|
inline |
Definition at line 121 of file bitmap_button.h.
References m_isToolbarButton.
|
protected |
Definition at line 259 of file bitmap_button.cpp.
References invalidateBestSize().
Referenced by setupEvents(), and ~BITMAP_BUTTON().
|
protected |
Definition at line 168 of file bitmap_button.cpp.
References clearFlag(), and hasFlag().
Referenced by setupEvents(), and ~BITMAP_BUTTON().
|
protected |
Definition at line 217 of file bitmap_button.cpp.
References clearFlag(), hasFlag(), m_isRadioButton, and setFlag().
Referenced by setupEvents(), and ~BITMAP_BUTTON().
|
protected |
Definition at line 195 of file bitmap_button.cpp.
References clearFlag(), hasFlag(), and m_acceptDraggedInClicks.
Referenced by setupEvents(), and ~BITMAP_BUTTON().
|
protected |
Definition at line 156 of file bitmap_button.cpp.
References hasFlag(), and setFlag().
Referenced by setupEvents(), and ~BITMAP_BUTTON().
|
protected |
Definition at line 144 of file bitmap_button.cpp.
References clearFlag(), and hasFlag().
Referenced by setupEvents(), and ~BITMAP_BUTTON().
|
protected |
Definition at line 266 of file bitmap_button.cpp.
References hasFlag(), KIPLATFORM::UI::IsDarkTheme(), m_badgeColor, m_badgeFont, m_badgeText, m_badgeTextColor, m_centerBitmap, m_dipSize, m_disabledBitmap, m_normalBitmap, m_padding, m_showBadge, and wxCONTROL_SEPARATOR.
Referenced by setupEvents(), and ~BITMAP_BUTTON().
|
protected |
Definition at line 180 of file bitmap_button.cpp.
References hasFlag(), and setFlag().
Referenced by setupEvents(), and ~BITMAP_BUTTON().
|
inline |
Definition at line 109 of file bitmap_button.h.
References m_badgeColor, and m_badgeTextColor.
|
inline |
Definition at line 107 of file bitmap_button.h.
References m_badgeText.
| void BITMAP_BUTTON::SetBitmap | ( | const wxBitmapBundle & | aBmp | ) |
Set the bitmap shown when the button is enabled.
| aBmp | is the enabled bitmap. |
Definition at line 123 of file bitmap_button.cpp.
References invalidateBestSize(), m_dipSize, and m_normalBitmap.
Referenced by ACTION_TOOLBAR_PALETTE::AddAction(), and PANEL_KICAD_LAUNCHER::CreateLaunchers().
|
inline |
Definition at line 115 of file bitmap_button.h.
References m_centerBitmap.
Referenced by ACTION_TOOLBAR_PALETTE::AddAction().
| void BITMAP_BUTTON::SetDisabledBitmap | ( | const wxBitmapBundle & | aBmp | ) |
Set the bitmap shown when the button is disabled.
| aBmp | is the disabled bitmap. |
Definition at line 132 of file bitmap_button.cpp.
References m_disabledBitmap.
Referenced by ACTION_TOOLBAR_PALETTE::AddAction(), and PANEL_KICAD_LAUNCHER::CreateLaunchers().
|
inlineprotected |
Definition at line 137 of file bitmap_button.h.
References m_buttonState.
Referenced by Check(), Enable(), OnLeftButtonDown(), OnMouseEnter(), OnSetFocus(), SetIsCheckButton(), SetIsRadioButton(), and SetIsSeparator().
| void BITMAP_BUTTON::SetIsCheckButton | ( | ) |
Setup the control as a two-state button (checked or unchecked).
Definition at line 382 of file bitmap_button.cpp.
References setFlag().
| void BITMAP_BUTTON::SetIsRadioButton | ( | ) |
Definition at line 388 of file bitmap_button.cpp.
References m_isRadioButton, and setFlag().
| void BITMAP_BUTTON::SetIsSeparator | ( | ) |
Render button as a toolbar separator.
Also disables the button. Bitmap, if set, is ignored.
Definition at line 395 of file bitmap_button.cpp.
References invalidateBestSize(), setFlag(), and wxCONTROL_SEPARATOR.
Referenced by FOOTPRINT_CHOOSER_FRAME::FOOTPRINT_CHOOSER_FRAME().
|
inline |
Definition at line 120 of file bitmap_button.h.
References m_isToolbarButton.
Referenced by ACTION_TOOLBAR_PALETTE::AddAction().
| void BITMAP_BUTTON::SetPadding | ( | int | aPaddingDIP | ) |
Set the amount of padding present on each side of the bitmap.
| aPadding | is the amount in DIP of padding for each side. |
Definition at line 115 of file bitmap_button.cpp.
References invalidateBestSize(), and m_padding.
Referenced by ACTION_TOOLBAR_PALETTE::AddAction(), and PANEL_KICAD_LAUNCHER::CreateLaunchers().
|
inline |
Definition at line 105 of file bitmap_button.h.
References m_showBadge.
|
protected |
Definition at line 71 of file bitmap_button.cpp.
References OnDPIChanged(), OnKillFocus(), OnLeftButtonDown(), OnLeftButtonUp(), OnMouseEnter(), OnMouseLeave(), OnPaint(), and OnSetFocus().
Referenced by BITMAP_BUTTON(), and BITMAP_BUTTON().
|
private |
Accept mouse-up as click even if mouse-down happened outside of the control.
Definition at line 170 of file bitmap_button.h.
Referenced by AcceptDragInAsClick(), BITMAP_BUTTON(), BITMAP_BUTTON(), and OnLeftButtonUp().
|
private |
Definition at line 161 of file bitmap_button.h.
Referenced by BITMAP_BUTTON(), BITMAP_BUTTON(), OnPaint(), and SetBadgeColors().
|
private |
Definition at line 163 of file bitmap_button.h.
Referenced by BITMAP_BUTTON(), BITMAP_BUTTON(), and OnPaint().
|
private |
Definition at line 160 of file bitmap_button.h.
Referenced by OnPaint(), and SetBadgeText().
|
private |
Definition at line 162 of file bitmap_button.h.
Referenced by BITMAP_BUTTON(), BITMAP_BUTTON(), OnPaint(), and SetBadgeColors().
|
private |
Definition at line 164 of file bitmap_button.h.
Referenced by BITMAP_BUTTON(), BITMAP_BUTTON(), clearFlag(), hasFlag(), and setFlag().
|
private |
Draw bitmap centered in the control.
Definition at line 173 of file bitmap_button.h.
Referenced by BITMAP_BUTTON(), BITMAP_BUTTON(), OnPaint(), and SetBitmapCentered().
|
private |
Definition at line 166 of file bitmap_button.h.
Referenced by DoGetBestSize(), OnPaint(), and SetBitmap().
|
private |
Definition at line 156 of file bitmap_button.h.
Referenced by OnPaint(), and SetDisabledBitmap().
|
private |
Definition at line 158 of file bitmap_button.h.
Referenced by BITMAP_BUTTON(), BITMAP_BUTTON(), OnLeftButtonDown(), and SetIsRadioButton().
|
private |
Definition at line 167 of file bitmap_button.h.
Referenced by BITMAP_BUTTON(), BITMAP_BUTTON(), IsToolbarButton(), and SetIsToolbarButton().
|
private |
Definition at line 155 of file bitmap_button.h.
Referenced by OnPaint(), and SetBitmap().
|
private |
Definition at line 165 of file bitmap_button.h.
Referenced by BITMAP_BUTTON(), BITMAP_BUTTON(), DoGetBestSize(), OnPaint(), and SetPadding().
|
private |
Definition at line 159 of file bitmap_button.h.
Referenced by BITMAP_BUTTON(), BITMAP_BUTTON(), OnPaint(), and SetShowBadge().