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 );
111 wxSize aCheckerboardSize,
KIGFX::COLOR4D aCheckerboardBackground );
142 #endif // COLOR_SWATCH__H_ void SetSwatchColor(KIGFX::COLOR4D aColor, bool aSendEvent)
Set the current swatch color directly.
KIGFX::COLOR4D GetSwatchColor() const
wxDECLARE_EVENT(COLOR_SWATCH_CHANGED, wxCommandEvent)
Event signalling a swatch has changed color.
COLOR_SWATCH(wxWindow *aParent, KIGFX::COLOR4D aColor, int aID, KIGFX::COLOR4D aBackground, const KIGFX::COLOR4D aDefault, SWATCH_SIZE aSwatchType)
Construct a COLOR_SWATCH.
void SetDefaultColor(KIGFX::COLOR4D aColor)
Sets the color that will be chosen with the "Reset to Default" button in the chooser.
static wxBitmap MakeBitmap(KIGFX::COLOR4D aColor, KIGFX::COLOR4D aBackground, wxSize aSize, wxSize aCheckerboardSize, KIGFX::COLOR4D aCheckerboardBackground)
Make a simple color swatch bitmap.
static const wxSize SWATCH_SIZE_LARGE_DU(24, 16)
void SetSwatchBackground(KIGFX::COLOR4D aBackground)
Set the swatch background color.
void SetReadOnly(bool aReadOnly=true)
void SetReadOnlyCallback(std::function< void()> aCallback)
Registers a handler for when the user tries to interact with a read-only swatch.
wxSize m_checkerboardSize
KIGFX::COLOR4D m_background
static const wxSize SWATCH_SIZE_MEDIUM_DU(24, 10)
std::function< void()> m_readOnlyCallback
wxStaticBitmap * m_swatch
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)
Class representing 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.
A color representation with 4 components: red, green, blue, alpha.