24#ifndef COLOR_SWATCH__H_ 
   25#define COLOR_SWATCH__H_ 
   30#include <wx/statbmp.h> 
   69                  SWATCH_SIZE aSwatchType, 
bool aTriggerWithSingleClick = 
false );
 
   74    COLOR_SWATCH( wxWindow *aParent, wxWindowID aId, 
const wxPoint &aPos = wxDefaultPosition,
 
   75                  const wxSize &aSize = wxDefaultSize, 
long aStyle = 0 );
 
  132                                const wxSize& aSize, 
const wxSize& aCheckerboardSize,
 
  137                            const wxSize&         aCheckerboardSize,
 
 
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
 
void OnDarkModeToggle()
Respond to a change in the OS's DarkMode setting.
 
void GetNewSwatchColor()
Prompt for a new colour, using the colour picker dialog.
 
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
 
static void RenderToDC(wxDC *aDC, const KIGFX::COLOR4D &aColor, const KIGFX::COLOR4D &aBackground, const wxRect &aRect, const wxSize &aCheckerboardSize, const KIGFX::COLOR4D &aCheckerboardBackground)
 
void setupEvents(bool aTriggerWithSingleClick)
 
void SetReadOnly(bool aReadOnly=true)
 
std::function< void()> m_readOnlyCallback
 
void SetUserColors(CUSTOM_COLORS_LIST *aUserColors)
Fetch a reference to the user colors list.
 
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.
 
static wxBitmap MakeBitmap(const KIGFX::COLOR4D &aColor, const KIGFX::COLOR4D &aBackground, const wxSize &aSize, const wxSize &aCheckerboardSize, const KIGFX::COLOR4D &aCheckerboardBackground)
 
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