#include <assert.h>
#include "Label.h"
Go to the source code of this file.
◆ _Class
◆ _Label()
Definition at line 130 of file Label.c.
130 {
131 static Class *clazz;
132 static Once once;
133
134 do_once(&once, {
135 clazz = _initialize(&(const ClassDef) {
136 .name = "Label",
137 .superclass =
_View(),
138 .instanceSize =
sizeof(
Label),
139 .interfaceOffset = offsetof(
Label, interface),
140 .interfaceSize = sizeof(LabelInterface),
142 });
143 });
144
145 return clazz;
146}
static void initialize(Class *clazz)
Labels provide a configurable container for Text.
Class * _View(void)
The View archetype.
◆ awakeWithDictionary()
static void awakeWithDictionary |
( |
View * |
self, |
|
|
const Dictionary * |
dictionary |
|
) |
| |
|
static |
- See also
- View::awakeWithDictionary(View *, const Dictionary *)
Definition at line 68 of file Label.c.
68 {
69
71
73
76 );
77
78 $(self,
bind, inlets, dictionary);
79
81}
#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.
_Bool needsLayout
If true, this View will layout its subviews before it is drawn.
void awakeWithDictionary(View *self, const Dictionary *dictionary)
Wakes this View with the specified Dictionary.
◆ dealloc()
static void dealloc |
( |
Object * |
self | ) |
|
|
static |
- See also
- Object::dealloc(Object *)
Definition at line 35 of file Label.c.
35 {
36
38
39 release(this->text);
40
42}
static void dealloc(Object *self)
◆ description()
static String * description |
( |
const Object * |
self | ) |
|
|
static |
- See also
- Object::description(const Object *)
Definition at line 47 of file Label.c.
47 {
48
50
51 String *classNames = $((Object *) this->classNames,
description);
52 String *
description = str(
"%s@%p \"%s\" %s [%d, %d, %d, %d]",
53 this->identifier ?: classnameof(self),
54 self,
55 ((
Label *) self)->text->text,
56 classNames->chars,
57 this->frame.x, this->frame.y, this->frame.w, this->frame.h);
58
59 release(classNames);
61}
static String * description(const Object *self)
◆ init()
- See also
- View::init(View *)
Definition at line 86 of file Label.c.
86 {
88}
Label * initWithText(Label *self, const char *text, Font *font)
Initializes this Label with the given text and Font.
◆ initialize()
static void initialize |
( |
Class * |
clazz | ) |
|
|
static |
- See also
- Class::initialize(Class *)
Definition at line 115 of file Label.c.
115 {
116
117 ((ObjectInterface *) clazz->interface)->dealloc =
dealloc;
118 ((ObjectInterface *) clazz->interface)->description =
description;
119
121 ((ViewInterface *) clazz->interface)->init =
init;
122
123 ((LabelInterface *) clazz->interface)->initWithText =
initWithText;
124}
CollectionView * init(CollectionView *self, const SDL_Rect *frame)
Initializes this CollectionView with the specified frame and style.
◆ initWithText()
static Label * initWithText |
( |
Label * |
self, |
|
|
const char * |
text, |
|
|
Font * |
font |
|
) |
| |
|
static |
Definition at line 96 of file Label.c.
96 {
97
99 if (self) {
100
103
105 }
106
107 return self;
108}
Box * initWithFrame(Box *self, const SDL_Rect *frame)
Initializes this Box with the given frame.
Text * text
The Label Text.
Text rendered with TrueType fonts.
void addSubview(View *self, View *subview)
Adds a subview to this view, to be drawn above its siblings.