30#define _Class _Checkbox
64 $(self,
bind, inlets, dictionary);
83 if (event->type == SDL_MOUSEBUTTONDOWN) {
89 if (event->type == SDL_MOUSEBUTTONUP) {
92 self->
state &= ~ControlStateHighlighted;
112 this->check->view.hidden =
true;
116#pragma mark - Checkbox
147#pragma mark - Class lifecycle
154 ((ObjectInterface *) clazz->interface)->dealloc =
dealloc;
157 ((ViewInterface *) clazz->interface)->init =
init;
160 ((ControlInterface *) clazz->interface)->stateDidChange =
stateDidChange;
162 ((CheckboxInterface *) clazz->interface)->initWithFrame =
initWithFrame;
183 clazz = _initialize(&(
const ClassDef) {
187 .interfaceOffset = offsetof(
Checkbox, interface),
188 .interfaceSize =
sizeof(CheckboxInterface),
static void destroy(Class *clazz)
static void dealloc(Object *self)
static void initialize(Class *clazz)
Checkboxes are toggle Controls that respond to click events.
@ ControlStateHighlighted
#define MakeInlets(...)
Creates a null-termianted array of Inlets.
#define MakeInlet(name, type, dest, data)
Creates an Inlet with the specified parameters.
@ ViewAutoresizingContain
@ ViewAlignmentMiddleCenter
Box * initWithFrame(Box *self, const SDL_Rect *frame)
Initializes this Box with the given frame.
Checkboxes are toggle Controls that respond to click events.
ImageView * check
The check.
Control control
The superclass.
Class * _Checkbox(void)
The Checkbox archetype.
CollectionView * init(CollectionView *self, const SDL_Rect *frame)
Initializes this CollectionView with the specified frame and style.
Controls are Views which capture events and dispatch Actions.
void stateDidChange(Control *self)
Called when the state of this Control changes.
_Bool captureEvent(Control *self, const SDL_Event *event)
Captures a given event, potentially altering the state of this Control.
Class * _Control(void)
The Control archetype.
unsigned int state
The bit mask of ControlState.
Image * initWithBytes(Image *self, const uint8_t *bytes, size_t length)
Initializes this Image with the specified bytes.
ImageViews render an Image in the context of a View hierarchy.
Inlets enable inbound data binding of View attributes through JSON.
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
_Bool bind(View *self, const Inlet *inlets, const Dictionary *dictionary)
Performs data binding for the Inlets described in dictionary.
ViewAlignment alignment
The alignment.
_Bool hidden
If true, this View is not drawn.
void addSubview(View *self, View *subview)
Adds a subview to this view, to be drawn above its siblings.
_Bool didReceiveEvent(const View *self, const SDL_Event *event)
int autoresizingMask
The ViewAutoresizing bitmask.
void awakeWithDictionary(View *self, const Dictionary *dictionary)
Wakes this View with the specified Dictionary.