ObjectivelyMVC 0.1.0
Object oriented MVC framework for OpenGL, SDL2 and GNU C
Macros | Functions
TableColumn.c File Reference
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <Objectively/String.h>
#include "TableColumn.h"

Go to the source code of this file.

Macros

#define _Class   _TableColumn
 

Functions

Class * _TableColumn (void)
 
static void dealloc (Object *self)
 
static void initialize (Class *clazz)
 
static TableColumninitWithIdentifier (TableColumn *self, const char *identifier)
 

Macro Definition Documentation

◆ _Class

#define _Class   _TableColumn

Definition at line 32 of file TableColumn.c.

Function Documentation

◆ _TableColumn()

Class * _TableColumn ( void  )

Definition at line 91 of file TableColumn.c.

91 {
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),
103 });
104 });
105
106 return clazz;
107}
static void initialize(Class *clazz)
Definition: TableColumn.c:80
Columns provide alignment, spacing and sorting hints for TableView instances.
Definition: TableColumn.h:45

◆ dealloc()

static void dealloc ( Object *  self)
static
See also
Object::dealloc(Object *)

Definition at line 39 of file TableColumn.c.

39 {
40
41 TableColumn *this = (TableColumn *) self;
42
43 release(this->headerCell);
44
45 free(this->identifier);
46
47 super(Object, self, dealloc);
48}
static void dealloc(Object *self)
Definition: TableColumn.c:39

◆ initialize()

static void initialize ( Class *  clazz)
static
See also
Class::initialize(Class *)

Definition at line 80 of file TableColumn.c.

80 {
81
82 ((ObjectInterface *) clazz->interface)->dealloc = dealloc;
83
84 ((TableColumnInterface *) clazz->interface)->initWithIdentifier = initWithIdentifier;
85}
TableColumn * initWithIdentifier(TableColumn *self, const char *identifier)
Initializes this TableColumn with the given identifier.
Definition: TableColumn.c:56

◆ initWithIdentifier()

static TableColumn * initWithIdentifier ( TableColumn self,
const char *  identifier 
)
static

Definition at line 56 of file TableColumn.c.

56 {
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}
Box * initWithFrame(Box *self, const SDL_Rect *frame)
Initializes this Box with the given frame.
Definition: Box.c:92
CollectionView * init(CollectionView *self, const SDL_Rect *frame)
Initializes this CollectionView with the specified frame and style.
Each row in a TableView is comprised of TableCellViews.
Definition: TableCellView.h:41
View view
The superclass.
Definition: TableCellView.h:46
char * identifier
The identifier.
Definition: TableColumn.h:66
TableHeaderCellView * headerCell
The header cell.
Definition: TableColumn.h:61
Header cells provide clickable sort handles for TableView instances.
TableCellView tableCellView
The superclass.
void setText(Text *self, const char *text)
Sets this Text's text.
Definition: Text.c:261
char * identifier
An optional identifier.
Definition: View.h:201