ObjectivelyMVC
0.1.0
Object oriented MVC framework for OpenGL, SDL2 and GNU C
Sources
ObjectivelyMVC
TableColumn.c
Go to the documentation of this file.
1
/*
2
* ObjectivelyMVC: Object oriented MVC framework for OpenGL, SDL2 and GNU 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
dealloc
static void dealloc(Object *self)
Definition:
TableColumn.c:39
initialize
static void initialize(Class *clazz)
Definition:
TableColumn.c:80
TableColumn.h
Columns for TableViews.
Box::initWithFrame
Box * initWithFrame(Box *self, const SDL_Rect *frame)
Initializes this Box with the given frame.
Definition:
Box.c:92
CollectionView::init
CollectionView * init(CollectionView *self, const SDL_Rect *frame)
Initializes this CollectionView with the specified frame and style.
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
TableColumn::_TableColumn
Class * _TableColumn(void)
The TableColumn archetype.
Definition:
TableColumn.c:91
TableHeaderCellView
Header cells provide clickable sort handles for TableView instances.
Definition:
TableHeaderCellView.h:41
TableHeaderCellView::tableCellView
TableCellView tableCellView
The superclass.
Definition:
TableHeaderCellView.h:46
Text::setText
void setText(Text *self, const char *text)
Sets this Text's text.
Definition:
Text.c:261
View::identifier
char * identifier
An optional identifier.
Definition:
View.h:201
Generated on Mon Aug 29 2022 09:32:58 for ObjectivelyMVC by
1.9.3