ObjectivelyMVC
Object oriented MVC framework for SDL3 and GNU C
Loading...
Searching...
No Matches
TableCellView.c
Go to the documentation of this file.
1
/*
2
* ObjectivelyMVC: Object oriented MVC framework for SDL3 and C.
3
* Copyright (C) 2014 Jay Dolan <jay@jaydolan.com>
4
*
5
* This software is provided 'as-is', without any express or implied
6
* warranty. In no event will the authors be held liable for any damages
7
* arising from the use of this software.
8
*
9
* Permission is granted to anyone to use this software for any purpose,
10
* including commercial applications, and to alter it and redistribute it
11
* freely, subject to the following restrictions:
12
*
13
* 1. The origin of this software must not be misrepresented; you must not
14
* claim that you wrote the original software. If you use this software
15
* in a product, an acknowledgment in the product documentation would be
16
* appreciated but is not required.
17
*
18
* 2. Altered source versions must be plainly marked as such, and must not be
19
* misrepresented as being the original software.
20
*
21
* 3. This notice may not be removed or altered from any source distribution.
22
*/
23
24
#include <assert.h>
25
26
#include "
TableCellView.h
"
27
28
#define _Class _TableCellView
29
30
#pragma mark - Object
31
35
static
void
dealloc
(Object *self) {
36
37
TableCellView
*
this
= (
TableCellView
*) self;
38
39
release(this->text);
40
41
super(Object, self,
dealloc
);
42
}
43
44
#pragma mark - TableCellView
45
50
static
TableCellView
*
initWithFrame
(
TableCellView
*self,
const
SDL_Rect *frame) {
51
52
self = (
TableCellView
*) super(
View
, self,
initWithFrame
, frame);
53
if
(self) {
54
self->
text
= $(alloc(
Text
),
initWithText
, NULL, NULL);
55
assert(self->
text
);
56
57
$((
View
*) self,
addSubview
, (
View
*) self->text);
58
}
59
60
return
self;
61
}
62
63
#pragma mark - Class lifecycle
64
68
static
void
initialize
(Class *clazz) {
69
70
((ObjectInterface *) clazz->interface)->dealloc =
dealloc
;
71
72
((TableCellViewInterface *) clazz->interface)->
initWithFrame
=
initWithFrame
;
73
}
74
79
Class *
_TableCellView
(
void
) {
80
static
Class *clazz;
81
static
Once once;
82
83
do_once(&once, {
84
clazz = _initialize(&(
const
ClassDef) {
85
.name =
"TableCellView"
,
86
.superclass =
_View
(),
87
.instanceSize =
sizeof
(
TableCellView
),
88
.interfaceOffset = offsetof(
TableCellView
, interface),
89
.interfaceSize =
sizeof
(TableCellViewInterface),
90
.
initialize
=
initialize
,
91
});
92
});
93
94
return
clazz;
95
}
96
97
#undef _Class
98
initWithText
static Label * initWithText(Label *self, const char *text, Font *font)
Definition
Label.c:97
addSubview
static void addSubview(View *self, View *subview)
Definition
PageView.c:49
_TableCellView
Class * _TableCellView(void)
Definition
TableCellView.c:79
dealloc
static void dealloc(Object *self)
Definition
TableCellView.c:35
initialize
static void initialize(Class *clazz)
Definition
TableCellView.c:68
initWithFrame
static TableCellView * initWithFrame(TableCellView *self, const SDL_Rect *frame)
Definition
TableCellView.c:50
TableCellView.h
Each row in a TableView is comprised of TableCellViews.
_View
Class * _View(void)
Definition
View.c:2067
TableCellView
Each row in a TableView is comprised of TableCellViews.
Definition
TableCellView.h:41
TableCellView::initWithFrame
TableCellView * initWithFrame(TableCellView *self, const SDL_Rect *frame)
Initializes this TableCellView with the specified frame.
Definition
TableCellView.c:50
TableCellView::text
Text * text
The text.
Definition
TableCellView.h:57
Text
Text rendered with TrueType fonts.
Definition
Text.h:69
View
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
Definition
View.h:134
Sources
ObjectivelyMVC
TableCellView.c
Generated on Mon Jul 6 2026 21:12:10 for ObjectivelyMVC by
1.9.8