| 
    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 | 
| 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 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_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 56 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 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 428 of file bitmap_button.cpp.
References clearFlag(), hasFlag(), Refresh(), and setFlag().
      
  | 
  inlineprotected | 
Definition at line 146 of file bitmap_button.h.
References m_buttonState.
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 383 of file bitmap_button.cpp.
References clearFlag(), hasFlag(), Refresh(), and setFlag().
Referenced by PANEL_KICAD_LAUNCHER::CreateLaunchers().
      
  | 
  inlineprotected | 
Definition at line 151 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 110 of file bitmap_button.cpp.
Referenced by OnDPIChanged(), SetBitmap(), SetIsSeparator(), and SetPadding().
| bool BITMAP_BUTTON::IsChecked | ( | ) | const | 
Definition at line 446 of file bitmap_button.cpp.
References hasFlag().
      
  | 
  inline | 
Definition at line 125 of file bitmap_button.h.
References m_isToolbarButton.
      
  | 
  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 hasFlag(), KIPLATFORM::UI::IsDarkTheme(), m_badgeColor, m_badgeFont, m_badgeText, m_badgeTextColor, m_centerBitmap, m_disabledBitmap, m_normalBitmap, m_padding, m_showBadge, m_unadjustedMinSize, 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.
References m_badgeColor, and m_badgeTextColor.
      
  | 
  inline | 
Definition at line 111 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 127 of file bitmap_button.cpp.
References invalidateBestSize(), m_isToolbarButton, m_normalBitmap, and m_unadjustedMinSize.
Referenced by ACTION_TOOLBAR_PALETTE::AddAction(), and PANEL_KICAD_LAUNCHER::CreateLaunchers().
      
  | 
  inline | 
Definition at line 119 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 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.
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 407 of file bitmap_button.cpp.
References setFlag().
| void BITMAP_BUTTON::SetIsRadioButton | ( | ) | 
Definition at line 413 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 420 of file bitmap_button.cpp.
References invalidateBestSize(), setFlag(), and wxCONTROL_SEPARATOR.
Referenced by FOOTPRINT_CHOOSER_FRAME::FOOTPRINT_CHOOSER_FRAME().
      
  | 
  inline | 
Definition at line 124 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 119 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 109 of file bitmap_button.h.
References m_showBadge.
      
  | 
  protected | 
Definition at line 75 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 174 of file bitmap_button.h.
Referenced by AcceptDragInAsClick(), BITMAP_BUTTON(), BITMAP_BUTTON(), and OnLeftButtonUp().
      
  | 
  private | 
Definition at line 165 of file bitmap_button.h.
Referenced by BITMAP_BUTTON(), BITMAP_BUTTON(), OnPaint(), and SetBadgeColors().
      
  | 
  private | 
Definition at line 167 of file bitmap_button.h.
Referenced by BITMAP_BUTTON(), BITMAP_BUTTON(), and OnPaint().
      
  | 
  private | 
Definition at line 164 of file bitmap_button.h.
Referenced by OnPaint(), and SetBadgeText().
      
  | 
  private | 
Definition at line 166 of file bitmap_button.h.
Referenced by BITMAP_BUTTON(), BITMAP_BUTTON(), OnPaint(), and SetBadgeColors().
      
  | 
  private | 
Definition at line 168 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 177 of file bitmap_button.h.
Referenced by BITMAP_BUTTON(), BITMAP_BUTTON(), OnPaint(), and SetBitmapCentered().
      
  | 
  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 BITMAP_BUTTON(), BITMAP_BUTTON(), OnLeftButtonDown(), and SetIsRadioButton().
      
  | 
  private | 
Definition at line 171 of file bitmap_button.h.
Referenced by BITMAP_BUTTON(), BITMAP_BUTTON(), IsToolbarButton(), SetBitmap(), and SetIsToolbarButton().
      
  | 
  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 BITMAP_BUTTON(), BITMAP_BUTTON(), DoGetBestSize(), OnPaint(), and SetPadding().
      
  | 
  private | 
Definition at line 163 of file bitmap_button.h.
Referenced by BITMAP_BUTTON(), BITMAP_BUTTON(), OnPaint(), and SetShowBadge().
      
  | 
  private | 
Definition at line 170 of file bitmap_button.h.
Referenced by DoGetBestSize(), OnDPIChanged(), OnPaint(), and SetBitmap().