29#include <wx/statbmp.h>
68 SWATCH_SIZE aSwatchType,
bool aTriggerWithSingleClick =
false );
73 COLOR_SWATCH( wxWindow *aParent, wxWindowID aId,
const wxPoint &aPos = wxDefaultPosition,
74 const wxSize &aSize = wxDefaultSize,
long aStyle = 0 );
126 const wxSize& aSize,
const wxSize& aCheckerboardSize,
128 const std::vector<int>& aMargins = { 0, 0, 0, 0 } );
130 static void RenderToDC( wxDC* aDC,
const KIGFX::COLOR4D& aColor,
const KIGFX::COLOR4D& aBackground,
131 const wxRect& aRect,
const wxSize& aCheckerboardSize,
132 const KIGFX::COLOR4D& aCheckerboardBackground,
133 const std::vector<int>& aMargins = { 0, 0, 0, 0 } );
void SetSwatchColor(const KIGFX::COLOR4D &aColor, bool aSendEvent)
Set the current swatch color directly.
wxSize m_checkerboardSize
KIGFX::COLOR4D m_checkerboardBg
bool m_supportsOpacity
If opacity is not supported the color chooser dialog will be displayed without it.
wxStaticBitmap * m_swatch
static void RenderToDC(wxDC *aDC, const KIGFX::COLOR4D &aColor, const KIGFX::COLOR4D &aBackground, const wxRect &aRect, const wxSize &aCheckerboardSize, const KIGFX::COLOR4D &aCheckerboardBackground, const std::vector< int > &aMargins={ 0, 0, 0, 0 })
void OnDarkModeToggle()
Respond to a change in the OS's DarkMode setting.
void GetNewSwatchColor()
Prompt for a new colour, using the colour picker dialog.
static wxBitmap MakeBitmap(const KIGFX::COLOR4D &aColor, const KIGFX::COLOR4D &aBackground, const wxSize &aSize, const wxSize &aCheckerboardSize, const KIGFX::COLOR4D &aCheckerboardBackground, const std::vector< int > &aMargins={ 0, 0, 0, 0 })
void SetSupportsOpacity(bool aSupportsOpacity)
bool m_readOnly
A read-only swatch won't show the color chooser dialog but otherwise works normally.
KIGFX::COLOR4D GetSwatchColor() const
void SetReadOnlyCallback(std::function< void()> aCallback)
Register a handler for when the user tries to interact with a read-only swatch.
COLOR_SWATCH(wxWindow *aParent, const KIGFX::COLOR4D &aColor, int aID, const KIGFX::COLOR4D &aBackground, const KIGFX::COLOR4D &aDefault, SWATCH_SIZE aSwatchType, bool aTriggerWithSingleClick=false)
Construct a COLOR_SWATCH.
KIGFX::COLOR4D m_background
void setupEvents(bool aTriggerWithSingleClick)
void SetReadOnly(bool aReadOnly=true)
std::function< void()> m_readOnlyCallback
void SetDefaultColor(const KIGFX::COLOR4D &aColor)
Sets the color that will be chosen with the "Reset to Default" button in the chooser.
void SetSwatchBackground(const KIGFX::COLOR4D &aBackground)
Set the swatch background color.
CUSTOM_COLORS_LIST * m_userColors
void rePostEvent(wxEvent &aEvent)
Pass unwanted events on to listeners of this object.
void SetWindowID(wxWindowID aId)
Update the window ID of this control and its children.
A color representation with 4 components: red, green, blue, alpha.
static const wxSize SWATCH_SIZE_LARGE_DU(24, 16)
static const wxSize SWATCH_SIZE_MEDIUM_DU(24, 10)
static const wxSize CHECKERBOARD_SIZE_DU(3, 3)
static const wxSize SWATCH_SIZE_SMALL_DU(8, 6)
wxDECLARE_EVENT(COLOR_SWATCH_CHANGED, wxCommandEvent)
Event signaling a swatch has changed color.
std::vector< CUSTOM_COLOR_ITEM > CUSTOM_COLORS_LIST