#include <assert.h>
#include "Checkbox.h"
#include "check.png.h"
Go to the source code of this file.
◆ _Class
◆ _Checkbox()
Class * _Checkbox |
( |
void |
| ) |
|
Definition at line 178 of file Checkbox.c.
178 {
179 static Class *clazz;
180 static Once once;
181
182 do_once(&once, {
183 clazz = _initialize(&(const ClassDef) {
184 .name = "Checkbox",
187 .interfaceOffset = offsetof(
Checkbox, interface),
188 .interfaceSize = sizeof(CheckboxInterface),
191 });
192 });
193
194 return clazz;
195}
static void destroy(Class *clazz)
static void initialize(Class *clazz)
Checkboxes are toggle Controls that respond to click events.
Class * _Control(void)
The Control archetype.
◆ awakeWithDictionary()
static void awakeWithDictionary |
( |
View * |
self, |
|
|
const Dictionary * |
dictionary |
|
) |
| |
|
static |
- See also
- View::awakeWithDictionary(View *, const Dictionary *)
Definition at line 54 of file Checkbox.c.
54 {
55
57
59
62 );
63
64 $(self,
bind, inlets, dictionary);
65}
#define MakeInlets(...)
Creates a null-termianted array of Inlets.
#define MakeInlet(name, type, dest, data)
Creates an Inlet with the specified parameters.
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.
void awakeWithDictionary(View *self, const Dictionary *dictionary)
Wakes this View with the specified Dictionary.
◆ captureEvent()
static _Bool captureEvent |
( |
Control * |
self, |
|
|
const SDL_Event * |
event |
|
) |
| |
|
static |
- See also
- Control::captureEvent(Control *, const SDL_Event *)
Definition at line 79 of file Checkbox.c.
79 {
80
82
83 if (event->type == SDL_MOUSEBUTTONDOWN) {
86 return true;
87 }
88 }
89 if (event->type == SDL_MOUSEBUTTONUP) {
92 self->
state &= ~ControlStateHighlighted;
93 return true;
94 }
95 }
96
98}
@ ControlStateHighlighted
Controls are Views which capture events and dispatch Actions.
_Bool captureEvent(Control *self, const SDL_Event *event)
Captures a given event, potentially altering the state of this Control.
unsigned int state
The bit mask of ControlState.
_Bool didReceiveEvent(const View *self, const SDL_Event *event)
◆ dealloc()
static void dealloc |
( |
Object * |
self | ) |
|
|
static |
- See also
- Object::dealloc(Object *)
Definition at line 39 of file Checkbox.c.
39 {
40
42
43 release(this->box);
44 release(this->check);
45
47}
static void dealloc(Object *self)
◆ destroy()
static void destroy |
( |
Class * |
clazz | ) |
|
|
static |
- See also
- Class::destroy(Class *)
Definition at line 170 of file Checkbox.c.
◆ init()
- See also
- View::init(View *)
Definition at line 70 of file Checkbox.c.
70 {
72}
Box * initWithFrame(Box *self, const SDL_Rect *frame)
Initializes this Box with the given frame.
◆ initialize()
static void initialize |
( |
Class * |
clazz | ) |
|
|
static |
- See also
- Class::initialize(Class *)
Definition at line 152 of file Checkbox.c.
152 {
153
154 ((ObjectInterface *) clazz->interface)->dealloc =
dealloc;
155
157 ((ViewInterface *) clazz->interface)->init =
init;
158
160 ((ControlInterface *) clazz->interface)->stateDidChange =
stateDidChange;
161
162 ((CheckboxInterface *) clazz->interface)->initWithFrame =
initWithFrame;
163
165}
CollectionView * init(CollectionView *self, const SDL_Rect *frame)
Initializes this CollectionView with the specified frame and style.
void stateDidChange(Control *self)
Called when the state of this Control changes.
Image * initWithBytes(Image *self, const uint8_t *bytes, size_t length)
Initializes this Image with the specified bytes.
◆ initWithFrame()
Definition at line 122 of file Checkbox.c.
122 {
123
125 if (self) {
126
128
131
133
136
139
142 }
143
144 return self;
145}
@ ViewAutoresizingContain
@ ViewAlignmentMiddleCenter
ImageView * check
The check.
Control control
The superclass.
ImageViews render an Image in the context of a View hierarchy.
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.
int autoresizingMask
The ViewAutoresizing bitmask.
◆ stateDidChange()
static void stateDidChange |
( |
Control * |
self | ) |
|
|
static |
◆ _check