ObjectivelyMVC
Object oriented MVC framework for SDL3 and GNU C
Loading...
Searching...
No Matches
TableColumn.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
#include <stdlib.h>
26
#include <string.h>
27
28
#include <Objectively/String.h>
29
30
#include "
TableColumn.h
"
31
32
#define _Class _TableColumn
33
34
#pragma mark - Object
35
39
static
void
dealloc
(Object *self) {
40
41
TableColumn
*
this
= (
TableColumn
*) self;
42
43
release(this->headerCell);
44
45
free(this->identifier);
46
47
super(Object, self,
dealloc
);
48
}
49
50
#pragma mark - TableColumn
51
56
static
TableColumn
*
initWithIdentifier
(
TableColumn
*self,
const
char
*identifier) {
57
58
self = (
TableColumn
*) super(Object, self,
init
);
59
if
(self) {
60
61
self->
headerCell
= $(alloc(
TableHeaderCellView
),
initWithFrame
, NULL);
62
assert(self->
headerCell
);
63
64
self->
identifier
= strdup(identifier);
65
assert(self->
identifier
);
66
67
self->
headerCell
->
tableCellView
.
view
.
identifier
= strdup(self->
identifier
);
68
69
$(((
TableCellView
*) self->
headerCell
)->text,
setText
, self->
identifier
);
70
}
71
72
return
self;
73
}
74
75
#pragma mark - Class lifecycle
76
80
static
void
initialize
(Class *clazz) {
81
82
((ObjectInterface *) clazz->interface)->dealloc =
dealloc
;
83
84
((TableColumnInterface *) clazz->interface)->
initWithIdentifier
=
initWithIdentifier
;
85
}
86
91
Class *
_TableColumn
(
void
) {
92
static
Class *clazz;
93
static
Once once;
94
95
do_once(&once, {
96
clazz = _initialize(&(
const
ClassDef) {
97
.name =
"TableColumn"
,
98
.superclass = _Object(),
99
.instanceSize =
sizeof
(
TableColumn
),
100
.interfaceOffset = offsetof(
TableColumn
, interface),
101
.interfaceSize =
sizeof
(TableColumnInterface),
102
.
initialize
=
initialize
,
103
});
104
});
105
106
return
clazz;
107
}
108
109
#undef _Class
110
init
static View * init(View *self)
Definition
Box.c:67
initWithFrame
static Box * initWithFrame(Box *self, const SDL_Rect *frame)
Definition
Box.c:92
initWithIdentifier
static TableColumn * initWithIdentifier(TableColumn *self, const char *identifier)
Definition
TableColumn.c:56
dealloc
static void dealloc(Object *self)
Definition
TableColumn.c:39
_TableColumn
Class * _TableColumn(void)
Definition
TableColumn.c:91
initialize
static void initialize(Class *clazz)
Definition
TableColumn.c:80
TableColumn.h
Columns for TableViews.
setText
static void setText(Text *self, const char *text)
Definition
Text.c:532
TableCellView
Each row in a TableView is comprised of TableCellViews.
Definition
TableCellView.h:41
TableCellView::view
View view
The superclass.
Definition
TableCellView.h:46
TableColumn
Columns provide alignment, spacing and sorting hints for TableView instances.
Definition
TableColumn.h:45
TableColumn::initWithIdentifier
TableColumn * initWithIdentifier(TableColumn *self, const char *identifier)
Initializes this TableColumn with the given identifier.
Definition
TableColumn.c:56
TableColumn::identifier
char * identifier
The identifier.
Definition
TableColumn.h:66
TableColumn::headerCell
TableHeaderCellView * headerCell
The header cell.
Definition
TableColumn.h:61
TableHeaderCellView
Header cells provide clickable sort handles for TableView instances.
Definition
TableHeaderCellView.h:41
TableHeaderCellView::tableCellView
TableCellView tableCellView
The superclass.
Definition
TableHeaderCellView.h:46
View::identifier
char * identifier
An optional identifier.
Definition
View.h:202
Sources
ObjectivelyMVC
TableColumn.c
Generated on Mon Jul 6 2026 21:12:10 for ObjectivelyMVC by
1.9.8