27#define _Class _HueColorPicker
29#pragma mark - Delegates
42 if (this->delegate.didPickColor) {
43 this->delegate.didPickColor(
this, this->hue, this->saturation, this->value);
56 memset(&this->delegate, 0,
sizeof(this->delegate));
58 release(this->colorView);
59 release(this->hueInput);
60 release(this->hueSlider);
61 release(this->stackView);
87 $(self, bind, inlets, dictionary);
106 $(this->hueSlider,
setValue, this->hue);
108 this->colorView->backgroundColor = $(
this,
rgbColor);
111#pragma mark - HueColorPicker
128 assert(self->colorView);
134 assert(self->hueSlider);
136 self->hueSlider->delegate.self = self;
137 self->hueSlider->delegate.didSetValue =
didSetHue;
138 self->hueSlider->max = 360.0;
142 assert(self->hueInput);
145 $(self->hueInput->label->text,
setText,
"H");
187#pragma mark - Class lifecycle
194 ((ObjectInterface *) clazz->interface)->dealloc =
dealloc;
197 ((ViewInterface *) clazz->interface)->init =
init;
200 ((HueColorPickerInterface *) clazz->interface)->initWithFrame =
initWithFrame;
202 ((HueColorPickerInterface *) clazz->interface)->setColor =
setColor;
203 ((HueColorPickerInterface *) clazz->interface)->setRGBColor =
setRGBColor;
215 clazz = _initialize(&(
const ClassDef) {
216 .name =
"HueColorPicker",
220 .interfaceSize =
sizeof(HueColorPickerInterface),
SDL_Color MVC_HSVToRGB(double hue, double saturation, double value)
void MVC_RGBToHSV(const SDL_Color *color, double *hue, double *saturation, double *value)
static SDL_Color rgbColor(const HueColorPicker *self)
static void setColor(HueColorPicker *self, double hue, double saturation, double value)
static View * init(View *self)
static void awakeWithDictionary(View *self, const Dictionary *dictionary)
static HueColorPicker * initWithFrame(HueColorPicker *self, const SDL_Rect *frame)
Class * _HueColorPicker(void)
static void didSetHue(Slider *slider, double value)
SliderDelegate callback for hue modification.
static void dealloc(Object *self)
static void initialize(Class *clazz)
static void updateBindings(View *self)
static void setRGBColor(HueColorPicker *self, const SDL_Color *color)
static void addSubview(View *self, View *subview)
static void setValue(ProgressBar *self, double value)
static void setLabelFormat(ProgressBar *self, const char *labelFormat)
static void setText(Text *self, const char *text)
#define MakeInlets(...)
Creates a null-termianted array of Inlets.
#define MakeInlet(name, type, dest, data)
Creates an Inlet with the specified parameters.
static void addClassName(View *self, const char *className)
Controls are Views which capture and respond to events.
SDL_Color rgbColor(const HueColorPicker *self)
StackView * stackView
The StackView.
double hue
The color componenets.
Inlets enable inbound data binding of View attributes through JSON.
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.
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
void updateBindings(View *self)
Updates data bindings, prompting the appropriate layout changes.