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. More... | |
void | SetBitmap (const wxBitmapBundle &aBmp) |
Set the bitmap shown when the button is enabled. More... | |
void | SetDisabledBitmap (const wxBitmapBundle &aBmp) |
Set the bitmap shown when the button is disabled. More... | |
bool | Enable (bool aEnable=true) override |
Enable the button. More... | |
void | SetIsCheckButton () |
Setup the control as a two-state button (checked or unchecked). More... | |
void | SetIsRadioButton () |
void | Check (bool aCheck=true) |
Check the control. More... | |
bool | IsChecked () const |
void | SetIsSeparator () |
Render button as a toolbar separator. More... | |
void | AcceptDragInAsClick (bool aAcceptDragIn=true) |
Accept mouse-up as click even if mouse-down happened outside of the control. More... | |
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 | setFlag (int aFlag) |
void | clearFlag (int aFlag) |
bool | hasFlag (int aFlag) const |
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. More... | |
bool | m_acceptDraggedInClicks |
Draws bitmap centered in the control. More... | |
bool | m_centerBitmap |
A bitmap button widget that behaves like an AUI toolbar item's button when it is drawn.
Specifically:
Definition at line 40 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, m_padding, 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 59 of file bitmap_button.cpp.
References m_badgeFont, m_padding, and setupEvents().
BITMAP_BUTTON::~BITMAP_BUTTON | ( | ) |
Definition at line 93 of file bitmap_button.cpp.
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 135 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 406 of file bitmap_button.cpp.
References clearFlag(), hasFlag(), Refresh(), and setFlag().
Referenced by PROPERTIES_FRAME::CopyPrmsFromItemToPanel(), DIALOG_DIMENSION_PROPERTIES::onFontSelected(), DIALOG_TEXT_PROPERTIES::onFontSelected(), DIALOG_TEXTBOX_PROPERTIES::onFontSelected(), DIALOG_DIMENSION_PROPERTIES::onThickness(), DIALOG_TEXT_PROPERTIES::onThickness(), DIALOG_TEXTBOX_PROPERTIES::onThickness(), DIALOG_FIELD_PROPERTIES::TransferDataToWindow(), DIALOG_LABEL_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), and DIALOG_TEXTBOX_PROPERTIES::TransferDataToWindow().
|
inlineprotected |
Definition at line 142 of file bitmap_button.h.
References m_buttonState.
Referenced by Check(), Enable(), OnKillFocus(), OnLeftButtonDown(), OnLeftButtonUp(), and OnMouseLeave().
|
override |
Enable the button.
Definition at line 362 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_LIB_TEXT_PROPERTIES_BASE::DIALOG_LIB_TEXT_PROPERTIES_BASE(), DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::DIALOG_LIB_TEXTBOX_PROPERTIES_BASE(), DIALOG_SHEET_PIN_PROPERTIES_BASE::DIALOG_SHEET_PIN_PROPERTIES_BASE(), DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_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 147 of file bitmap_button.h.
References m_buttonState.
Referenced by Check(), Enable(), IsChecked(), OnKillFocus(), OnLeftButtonDown(), OnLeftButtonUp(), OnMouseEnter(), OnMouseLeave(), OnPaint(), and OnSetFocus().
bool BITMAP_BUTTON::IsChecked | ( | ) | const |
Definition at line 424 of file bitmap_button.cpp.
References hasFlag().
Referenced by PROPERTIES_FRAME::CopyPrmsFromPanelToItem(), DIALOG_FIELD_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataFromWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog(), and TUNER_SLIDER::updateValueText().
|
inline |
Definition at line 124 of file bitmap_button.h.
References m_isToolbarButton.
|
protected |
Definition at line 165 of file bitmap_button.cpp.
References clearFlag(), hasFlag(), and Refresh().
Referenced by setupEvents().
|
protected |
Definition at line 214 of file bitmap_button.cpp.
References clearFlag(), hasFlag(), m_isRadioButton, Refresh(), and setFlag().
Referenced by setupEvents().
|
protected |
Definition at line 192 of file bitmap_button.cpp.
References clearFlag(), hasFlag(), m_acceptDraggedInClicks, and Refresh().
Referenced by setupEvents().
|
protected |
Definition at line 153 of file bitmap_button.cpp.
References hasFlag(), Refresh(), and setFlag().
Referenced by setupEvents().
|
protected |
Definition at line 141 of file bitmap_button.cpp.
References clearFlag(), hasFlag(), and Refresh().
Referenced by setupEvents().
|
protected |
Definition at line 256 of file bitmap_button.cpp.
References KIPLATFORM::UI::GetPixelScaleFactor(), hasFlag(), KIPLATFORM::UI::IsDarkTheme(), m_badgeColor, m_badgeFont, m_badgeText, m_badgeTextColor, m_centerBitmap, m_disabledBitmap, m_isToolbarButton, m_normalBitmap, m_padding, m_showBadge, Pgm(), scale, and wxCONTROL_SEPARATOR.
Referenced by setupEvents().
|
protected |
Definition at line 177 of file bitmap_button.cpp.
References hasFlag(), Refresh(), and setFlag().
Referenced by setupEvents().
|
inline |
Definition at line 112 of file bitmap_button.h.
References m_badgeColor, and m_badgeTextColor.
|
inline |
Definition at line 110 of file bitmap_button.h.
References m_badgeText.
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 105 of file bitmap_button.cpp.
References m_isToolbarButton, m_normalBitmap, m_padding, 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_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES(), DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES(), DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES(), DIALOG_SHEET_PIN_PROPERTIES::DIALOG_SHEET_PIN_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES(), KISTATUSBAR::KISTATUSBAR(), PROPERTIES_FRAME::PROPERTIES_FRAME(), and TUNER_SLIDER::TUNER_SLIDER().
|
inline |
Definition at line 118 of file bitmap_button.h.
References m_centerBitmap.
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 129 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 386 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_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES(), DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_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 392 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_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES(), DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES(), DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES(), 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 399 of file bitmap_button.cpp.
References m_padding, setFlag(), and wxCONTROL_SEPARATOR.
Referenced by DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES(), DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE(), DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES(), DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES(), DIALOG_SHEET_PIN_PROPERTIES::DIALOG_SHEET_PIN_PROPERTIES(), DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES(), PROPERTIES_FRAME::PROPERTIES_FRAME(), and TUNER_SLIDER::TUNER_SLIDER().
|
inline |
Definition at line 123 of file bitmap_button.h.
References m_isToolbarButton.
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 98 of file bitmap_button.cpp.
References m_padding, and m_unadjustedMinSize.
Referenced by ACTION_TOOLBAR_PALETTE::AddAction(), APPEARANCE_CONTROLS::APPEARANCE_CONTROLS(), PANEL_KICAD_LAUNCHER::CreateLaunchers(), and KISTATUSBAR::KISTATUSBAR().
|
inline |
Definition at line 108 of file bitmap_button.h.
References m_showBadge.
Referenced by KISTATUSBAR::KISTATUSBAR(), and KICAD_MANAGER_FRAME::updatePcmButtonBadge().
|
protected |
Definition at line 81 of file bitmap_button.cpp.
References OnKillFocus(), OnLeftButtonDown(), OnLeftButtonUp(), OnMouseEnter(), OnMouseLeave(), OnPaint(), and OnSetFocus().
Referenced by BITMAP_BUTTON().
|
private |
Draws bitmap centered in the control.
Definition at line 168 of file bitmap_button.h.
Referenced by AcceptDragInAsClick(), and OnLeftButtonUp().
|
private |
Definition at line 159 of file bitmap_button.h.
Referenced by OnPaint(), and SetBadgeColors().
|
private |
Definition at line 161 of file bitmap_button.h.
Referenced by BITMAP_BUTTON(), and OnPaint().
|
private |
Definition at line 158 of file bitmap_button.h.
Referenced by OnPaint(), and SetBadgeText().
|
private |
Definition at line 160 of file bitmap_button.h.
Referenced by OnPaint(), and SetBadgeColors().
|
private |
Definition at line 162 of file bitmap_button.h.
Referenced by clearFlag(), hasFlag(), and setFlag().
|
private |
Definition at line 171 of file bitmap_button.h.
Referenced by OnPaint(), and SetBitmapCentered().
|
private |
Definition at line 154 of file bitmap_button.h.
Referenced by OnPaint(), and SetDisabledBitmap().
|
private |
Definition at line 156 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 165 of file bitmap_button.h.
Referenced by IsToolbarButton(), OnPaint(), SetBitmap(), and SetIsToolbarButton().
|
private |
Definition at line 153 of file bitmap_button.h.
Referenced by OnPaint(), and SetBitmap().
|
private |
Definition at line 163 of file bitmap_button.h.
Referenced by BITMAP_BUTTON(), OnPaint(), SetBitmap(), SetIsSeparator(), and SetPadding().
|
private |
Definition at line 157 of file bitmap_button.h.
Referenced by OnPaint(), and SetShowBadge().
|
private |
Definition at line 164 of file bitmap_button.h.
Referenced by SetBitmap(), and SetPadding().