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 aPadding) |
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_unadjustedMinSize |
bool | m_isToolbarButton |
Accept mouse-up as click even if mouse-down happened outside of the control. | |
bool | m_acceptDraggedInClicks |
Draws bitmap centered in the control. | |
bool | m_centerBitmap |
A bitmap button widget that behaves like an AUI toolbar item's button when it is drawn.
Specifically:
Definition at line 41 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 37 of file bitmap_button.cpp.
References m_badgeFont, 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 56 of file bitmap_button.cpp.
References m_badgeFont, and setupEvents().
BITMAP_BUTTON::~BITMAP_BUTTON | ( | ) |
Definition at line 88 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 156 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 439 of file bitmap_button.cpp.
References clearFlag(), hasFlag(), Refresh(), and setFlag().
Referenced by PROPERTIES_FRAME::CopyPrmsFromItemToPanel(), DIALOG_FOOTPRINT_CHOOSER::DIALOG_FOOTPRINT_CHOOSER(), FOOTPRINT_CHOOSER_FRAME::FOOTPRINT_CHOOSER_FRAME(), DIALOG_FOOTPRINT_CHOOSER::on3DviewReq(), FOOTPRINT_CHOOSER_FRAME::on3DviewReq(), DIALOG_DIMENSION_PROPERTIES::onFontSelected(), DIALOG_TEXT_PROPERTIES::onFontSelected(), DIALOG_TEXTBOX_PROPERTIES::onFontSelected(), DIALOG_FOOTPRINT_CHOOSER::onFpViewReq(), FOOTPRINT_CHOOSER_FRAME::onFpViewReq(), DIALOG_DIMENSION_PROPERTIES::onThickness(), DIALOG_TEXT_PROPERTIES::onThickness(), DIALOG_TEXTBOX_PROPERTIES::onThickness(), DIALOG_FIELD_PROPERTIES::TransferDataToWindow(), DIALOG_LABEL_PROPERTIES::TransferDataToWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataToWindow(), DIALOG_TABLECELL_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), and DIALOG_TEXTBOX_PROPERTIES::TransferDataToWindow().
|
inlineprotected |
Definition at line 146 of file bitmap_button.h.
Referenced by Check(), Enable(), OnKillFocus(), OnLeftButtonDown(), OnLeftButtonUp(), and OnMouseLeave().
|
overrideprotectedvirtual |
Definition at line 101 of file bitmap_button.cpp.
References hasFlag(), m_padding, m_unadjustedMinSize, and wxCONTROL_SEPARATOR.
|
override |
Enable the button.
Definition at line 394 of file bitmap_button.cpp.
References clearFlag(), hasFlag(), Refresh(), and setFlag().
Referenced by PANEL_KICAD_LAUNCHER::CreateLaunchers(), DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE(), DIALOG_FIELD_PROPERTIES_BASE::DIALOG_FIELD_PROPERTIES_BASE(), DIALOG_LABEL_PROPERTIES_BASE::DIALOG_LABEL_PROPERTIES_BASE(), DIALOG_LIB_EDIT_PIN_TABLE_BASE::DIALOG_LIB_EDIT_PIN_TABLE_BASE(), DIALOG_SHEET_PIN_PROPERTIES_BASE::DIALOG_SHEET_PIN_PROPERTIES_BASE(), DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE(), DIALOG_TEXTBOX_PROPERTIES_BASE::DIALOG_TEXTBOX_PROPERTIES_BASE(), and PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE().
|
inlineprotected |
Definition at line 151 of file bitmap_button.h.
Referenced by Check(), DoGetBestSize(), Enable(), IsChecked(), OnKillFocus(), OnLeftButtonDown(), OnLeftButtonUp(), OnMouseEnter(), OnMouseLeave(), OnPaint(), and OnSetFocus().
|
protected |
Definition at line 110 of file bitmap_button.cpp.
Referenced by OnDPIChanged(), SetBitmap(), SetIsSeparator(), and SetPadding().
bool BITMAP_BUTTON::IsChecked | ( | ) | const |
Definition at line 457 of file bitmap_button.cpp.
References hasFlag().
Referenced by PROPERTIES_FRAME::CopyPrmsFromPanelToItem(), FOOTPRINT_CHOOSER_FRAME::onExternalViewer3DEnable(), DIALOG_FIELD_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow(), DIALOG_TABLECELL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog(), DIALOG_TEXT_PROPERTIES::updateTextThickness(), and TUNER_SLIDER::updateValueText().
|
inline |
Definition at line 125 of file bitmap_button.h.
|
protected |
Definition at line 277 of file bitmap_button.cpp.
References invalidateBestSize(), m_normalBitmap, and m_unadjustedMinSize.
Referenced by setupEvents(), and ~BITMAP_BUTTON().
|
protected |
Definition at line 186 of file bitmap_button.cpp.
References clearFlag(), hasFlag(), and Refresh().
Referenced by setupEvents(), and ~BITMAP_BUTTON().
|
protected |
Definition at line 235 of file bitmap_button.cpp.
References clearFlag(), hasFlag(), m_isRadioButton, Refresh(), and setFlag().
Referenced by setupEvents(), and ~BITMAP_BUTTON().
|
protected |
Definition at line 213 of file bitmap_button.cpp.
References clearFlag(), hasFlag(), m_acceptDraggedInClicks, and Refresh().
Referenced by setupEvents(), and ~BITMAP_BUTTON().
|
protected |
Definition at line 174 of file bitmap_button.cpp.
References hasFlag(), Refresh(), and setFlag().
Referenced by setupEvents(), and ~BITMAP_BUTTON().
|
protected |
Definition at line 162 of file bitmap_button.cpp.
References clearFlag(), hasFlag(), and Refresh().
Referenced by setupEvents(), and ~BITMAP_BUTTON().
|
protected |
Definition at line 291 of file bitmap_button.cpp.
References PGM_BASE::GetCommonSettings(), KIPLATFORM::UI::GetPixelScaleFactor(), hasFlag(), KIPLATFORM::UI::IsDarkTheme(), COMMON_SETTINGS::m_Appearance, m_badgeColor, m_badgeFont, m_badgeText, m_badgeTextColor, m_centerBitmap, m_disabledBitmap, m_isToolbarButton, m_normalBitmap, m_padding, m_showBadge, m_unadjustedMinSize, Pgm(), scale, COMMON_SETTINGS::APPEARANCE::toolbar_icon_size, and wxCONTROL_SEPARATOR.
Referenced by setupEvents(), and ~BITMAP_BUTTON().
|
protected |
Definition at line 198 of file bitmap_button.cpp.
References hasFlag(), Refresh(), and setFlag().
Referenced by setupEvents(), and ~BITMAP_BUTTON().
|
inline |
Definition at line 113 of file bitmap_button.h.
|
inline |
Definition at line 111 of file bitmap_button.h.
Referenced by KISTATUSBAR::SetNotificationCount(), and KICAD_MANAGER_FRAME::updatePcmButtonBadge().
void BITMAP_BUTTON::SetBitmap | ( | const wxBitmapBundle & | aBmp | ) |
Set the bitmap shown when the button is enabled.
aBmp | is the enabled bitmap. |
Definition at line 127 of file bitmap_button.cpp.
References invalidateBestSize(), m_isToolbarButton, m_normalBitmap, and m_unadjustedMinSize.
Referenced by ACTION_TOOLBAR_PALETTE::AddAction(), APPEARANCE_CONTROLS::APPEARANCE_CONTROLS(), PANEL_KICAD_LAUNCHER::CreateLaunchers(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), DIALOG_FOOTPRINT_CHOOSER::DIALOG_FOOTPRINT_CHOOSER(), DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES(), DIALOG_SHEET_PIN_PROPERTIES::DIALOG_SHEET_PIN_PROPERTIES(), DIALOG_TABLECELL_PROPERTIES::DIALOG_TABLECELL_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES(), FOOTPRINT_CHOOSER_FRAME::FOOTPRINT_CHOOSER_FRAME(), KISTATUSBAR::KISTATUSBAR(), NET_INSPECTOR_PANEL::NET_INSPECTOR_PANEL(), PROPERTIES_FRAME::PROPERTIES_FRAME(), and TUNER_SLIDER::TUNER_SLIDER().
|
inline |
Definition at line 119 of file bitmap_button.h.
Referenced by ACTION_TOOLBAR_PALETTE::AddAction(), and KISTATUSBAR::KISTATUSBAR().
void BITMAP_BUTTON::SetDisabledBitmap | ( | const wxBitmapBundle & | aBmp | ) |
Set the bitmap shown when the button is disabled.
aBmp | is the disabled bitmap. |
Definition at line 150 of file bitmap_button.cpp.
References m_disabledBitmap.
Referenced by ACTION_TOOLBAR_PALETTE::AddAction(), and PANEL_KICAD_LAUNCHER::CreateLaunchers().
|
inlineprotected |
Definition at line 141 of file bitmap_button.h.
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 418 of file bitmap_button.cpp.
References setFlag().
Referenced by DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES(), DIALOG_SHEET_PIN_PROPERTIES::DIALOG_SHEET_PIN_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES(), PROPERTIES_FRAME::PROPERTIES_FRAME(), and TUNER_SLIDER::TUNER_SLIDER().
void BITMAP_BUTTON::SetIsRadioButton | ( | ) |
Definition at line 424 of file bitmap_button.cpp.
References m_isRadioButton, and setFlag().
Referenced by DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), DIALOG_FOOTPRINT_CHOOSER::DIALOG_FOOTPRINT_CHOOSER(), DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES(), DIALOG_TABLECELL_PROPERTIES::DIALOG_TABLECELL_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES(), FOOTPRINT_CHOOSER_FRAME::FOOTPRINT_CHOOSER_FRAME(), and PROPERTIES_FRAME::PROPERTIES_FRAME().
void BITMAP_BUTTON::SetIsSeparator | ( | ) |
Render button as a toolbar separator.
Also disables the button. Bitmap, if set, is ignored.
Definition at line 431 of file bitmap_button.cpp.
References invalidateBestSize(), setFlag(), and wxCONTROL_SEPARATOR.
Referenced by DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), DIALOG_FOOTPRINT_CHOOSER::DIALOG_FOOTPRINT_CHOOSER(), DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES(), DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE(), DIALOG_SHEET_PIN_PROPERTIES::DIALOG_SHEET_PIN_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES(), FOOTPRINT_CHOOSER_FRAME::FOOTPRINT_CHOOSER_FRAME(), PROPERTIES_FRAME::PROPERTIES_FRAME(), and TUNER_SLIDER::TUNER_SLIDER().
|
inline |
Definition at line 124 of file bitmap_button.h.
Referenced by ACTION_TOOLBAR_PALETTE::AddAction().
void BITMAP_BUTTON::SetPadding | ( | int | aPadding | ) |
Set the amount of padding present on each side of the bitmap.
aPadding | is the amount in px of padding for each side. |
Definition at line 119 of file bitmap_button.cpp.
References invalidateBestSize(), and m_padding.
Referenced by ACTION_TOOLBAR_PALETTE::AddAction(), APPEARANCE_CONTROLS::APPEARANCE_CONTROLS(), PANEL_KICAD_LAUNCHER::CreateLaunchers(), KISTATUSBAR::KISTATUSBAR(), and NET_INSPECTOR_PANEL::NET_INSPECTOR_PANEL().
|
inline |
Definition at line 109 of file bitmap_button.h.
Referenced by KISTATUSBAR::KISTATUSBAR(), and KICAD_MANAGER_FRAME::updatePcmButtonBadge().
|
protected |
Definition at line 75 of file bitmap_button.cpp.
References OnDPIChanged(), OnKillFocus(), OnLeftButtonDown(), OnLeftButtonUp(), OnMouseEnter(), OnMouseLeave(), OnPaint(), and OnSetFocus().
Referenced by BITMAP_BUTTON().
|
private |
Draws bitmap centered in the control.
Definition at line 174 of file bitmap_button.h.
Referenced by AcceptDragInAsClick(), and OnLeftButtonUp().
|
private |
Definition at line 165 of file bitmap_button.h.
Referenced by OnPaint().
|
private |
Definition at line 167 of file bitmap_button.h.
Referenced by BITMAP_BUTTON(), and OnPaint().
|
private |
Definition at line 164 of file bitmap_button.h.
Referenced by OnPaint().
|
private |
Definition at line 166 of file bitmap_button.h.
Referenced by OnPaint().
|
private |
Definition at line 168 of file bitmap_button.h.
|
private |
Definition at line 177 of file bitmap_button.h.
Referenced by OnPaint().
|
private |
Definition at line 160 of file bitmap_button.h.
Referenced by OnPaint(), and SetDisabledBitmap().
|
private |
Definition at line 162 of file bitmap_button.h.
Referenced by OnLeftButtonDown(), and SetIsRadioButton().
|
private |
Accept mouse-up as click even if mouse-down happened outside of the control.
Definition at line 171 of file bitmap_button.h.
Referenced by OnPaint(), and SetBitmap().
|
private |
Definition at line 159 of file bitmap_button.h.
Referenced by OnDPIChanged(), OnPaint(), and SetBitmap().
|
private |
Definition at line 169 of file bitmap_button.h.
Referenced by DoGetBestSize(), OnPaint(), and SetPadding().
|
private |
Definition at line 163 of file bitmap_button.h.
Referenced by OnPaint().
|
private |
Definition at line 170 of file bitmap_button.h.
Referenced by DoGetBestSize(), OnDPIChanged(), OnPaint(), and SetBitmap().