24 #ifndef COLOR_SWATCH__H_ 25 #define COLOR_SWATCH__H_ 27 #include <wx/bitmap.h> 28 #include <wx/gdicmn.h> 30 #include <wx/statbmp.h> 31 #include <wx/window.h> 74 COLOR_SWATCH( wxWindow *aParent, wxWindowID aId,
const wxPoint &aPos = wxDefaultPosition,
75 const wxSize &aSize = wxDefaultSize,
long aStyle = 0 );
128 const wxSize& aSize,
const wxSize& aCheckerboardSize,
164 #endif // COLOR_SWATCH__H_ void SetSwatchColor(const KIGFX::COLOR4D &aColor, bool aSendEvent)
Set the current swatch color directly.
KIGFX::COLOR4D GetSwatchColor() const
wxDECLARE_EVENT(COLOR_SWATCH_CHANGED, wxCommandEvent)
Event signaling a swatch has changed color.
static wxBitmap MakeBitmap(const KIGFX::COLOR4D &aColor, const KIGFX::COLOR4D &aBackground, const wxSize &aSize, const wxSize &aCheckerboardSize, const KIGFX::COLOR4D &aCheckerboardBackground)
static const wxSize SWATCH_SIZE_LARGE_DU(24, 16)
void SetReadOnly(bool aReadOnly=true)
std::vector< CUSTOM_COLOR_ITEM > CUSTOM_COLORS_LIST
COLOR_SWATCH(wxWindow *aParent, const KIGFX::COLOR4D &aColor, int aID, const KIGFX::COLOR4D &aBackground, const KIGFX::COLOR4D &aDefault, SWATCH_SIZE aSwatchType)
Construct a COLOR_SWATCH.
void SetReadOnlyCallback(std::function< void()> aCallback)
Registers a handler for when the user tries to interact with a read-only swatch.
bool m_supportsOpacity
If opacity is not supported the color chooser dialog will be displayed without it.
void SetSupportsOpacity(bool aSupportsOpacity)
wxSize m_checkerboardSize
KIGFX::COLOR4D m_background
static const wxSize SWATCH_SIZE_MEDIUM_DU(24, 10)
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.
CUSTOM_COLORS_LIST * m_userColors
wxStaticBitmap * m_swatch
void SetWindowID(wxWindowID aId)
Updates the window ID of this control and its children.
KIGFX::COLOR4D m_checkerboardBg
bool m_readOnly
A read-only swatch won't show the color chooser dialog but otherwise works normally.
void rePostEvent(wxEvent &aEvent)
Pass unwanted events on to listeners of this object.
static const wxSize CHECKERBOARD_SIZE_DU(3, 3)
A simple color swatch of the kind used to set layer colors.
static const wxSize SWATCH_SIZE_SMALL_DU(8, 6)
void GetNewSwatchColor()
Prompt for a new colour, using the colour picker dialog.
void SetUserColors(CUSTOM_COLORS_LIST *aUserColors)
Fetch a reference to the user colors list.
void SetSwatchBackground(const KIGFX::COLOR4D &aBackground)
Set the swatch background color.
A color representation with 4 components: red, green, blue, alpha.