27#define _Class _HueColorPicker
29#pragma mark - Actions & delegates
42 if (this->delegate.didPickColor) {
43 this->delegate.didPickColor(
this, this->hue, this->saturation, this->value);
56 release(this->colorView);
57 release(this->hueInput);
58 release(this->hueSlider);
59 release(this->stackView);
85 $(self,
bind, inlets, dictionary);
104 $(this->hueSlider,
setValue, this->hue);
106 this->colorView->backgroundColor = $(
this,
rgbColor);
109#pragma mark - HueColorPicker
126 assert(self->colorView);
132 assert(self->hueSlider);
134 self->hueSlider->delegate.self = self;
135 self->hueSlider->delegate.didSetValue =
didSetHue;
136 self->hueSlider->max = 360.0;
140 assert(self->hueInput);
143 $(self->hueInput->label->text,
setText,
"H");
185#pragma mark - Class lifecycle
192 ((ObjectInterface *) clazz->interface)->dealloc =
dealloc;
195 ((ViewInterface *) clazz->interface)->init =
init;
198 ((HueColorPickerInterface *) clazz->interface)->initWithFrame =
initWithFrame;
199 ((HueColorPickerInterface *) clazz->interface)->rgbColor =
rgbColor;
200 ((HueColorPickerInterface *) clazz->interface)->setColor =
setColor;
201 ((HueColorPickerInterface *) clazz->interface)->setRGBColor =
setRGBColor;
213 clazz = _initialize(&(
const ClassDef) {
214 .name =
"HueColorPicker",
218 .interfaceSize =
sizeof(HueColorPickerInterface),
static void didSetHue(Slider *slider, double value)
SliderDelegate callback for hue modification.
static void dealloc(Object *self)
static void initialize(Class *clazz)
#define MakeRect(x, y, w, h)
Creates an SDL_Rect with the given origin and size.
#define MakeInlets(...)
Creates a null-termianted array of Inlets.
#define MakeInlet(name, type, dest, data)
Creates an Inlet with the specified parameters.
Box * initWithFrame(Box *self, const SDL_Rect *frame)
Initializes this Box with the given frame.
CollectionView * init(CollectionView *self, const SDL_Rect *frame)
Initializes this CollectionView with the specified frame and style.
OBJECTIVELYMVC_EXPORT void MVC_RGBToHSV(const SDL_Color *color, double *hue, double *saturation, double *value)
Converts the given RGB color to HSV components.
OBJECTIVELYMVC_EXPORT SDL_Color MVC_HSVToRGB(double hue, double saturation, double value)
Converts the given HSV components to an RGB color.
Controls are Views which capture events and dispatch Actions.
Class * _Control(void)
The Control archetype.
void setColor(HSVColorPicker *self, double hue, double saturation, double value)
Sets the color of the HSVColorPicker.
SDL_Color rgbColor(const HSVColorPicker *self)
void setRGBColor(HSVColorPicker *self, const SDL_Color *color)
Sets the color of the HSVColorPicker.
StackView * stackView
The StackView.
Class * _HueColorPicker(void)
The HueColorPicker archetype.
double hue
The color componenets.
Inlets enable inbound data binding of View attributes through JSON.
void setLabelFormat(ProgressBar *self, const char *labelFormat)
Changes this ProgressBar's label format and calls appropriate update functions.
void setValue(const ProgressBar *self, double value)
Sets the value, which is clamped to min and max.
ident self
The delegate self-reference.
A Control allowing users to drag a handle to select a numeric value.
SliderDelegate delegate
The delegate.
StackViews are containers that manage the arrangement of their subviews.
void setText(Text *self, const char *text)
Sets this Text's text.
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
void updateBindings(View *self)
Updates data bindings, prompting the appropriate layout changes.
_Bool bind(View *self, const Inlet *inlets, const Dictionary *dictionary)
Performs data binding for the Inlets described in dictionary.
void addSubview(View *self, View *subview)
Adds a subview to this view, to be drawn above its siblings.
void addClassName(View *self, const char *className)
Adds the given class name to this View.
void awakeWithDictionary(View *self, const Dictionary *dictionary)
Wakes this View with the specified Dictionary.