ObjectivelyMVC 0.1.0
Object oriented MVC framework for OpenGL, SDL2 and GNU C
Macros | Functions
TableRowView.c File Reference
#include <assert.h>
#include "TableRowView.h"
#include "TableView.h"

Go to the source code of this file.

Macros

#define _Class   _TableRowView
 

Functions

Class * _TableRowView (void)
 
static void addCell (TableRowView *self, TableCellView *cell)
 
static void dealloc (Object *self)
 
static void initialize (Class *clazz)
 
static TableRowViewinitWithTableView (TableRowView *self, TableView *tableView)
 
static _Bool matchesSelector (const View *self, const SimpleSelector *simpleSelector)
 
static void removeAllCells (TableRowView *self)
 
static void removeAllCells_enumerate (const Array *array, ident obj, ident data)
 ArrayEnumerator to remove TableCellViews from the row. More...
 
static void removeCell (TableRowView *self, TableCellView *cell)
 
static void setSelected (TableRowView *self, _Bool isSelected)
 

Macro Definition Documentation

◆ _Class

#define _Class   _TableRowView

Definition at line 29 of file TableRowView.c.

Function Documentation

◆ _TableRowView()

Class * _TableRowView ( void  )

Definition at line 162 of file TableRowView.c.

162 {
163 static Class *clazz;
164 static Once once;
165
166 do_once(&once, {
167 clazz = _initialize(&(const ClassDef) {
168 .name = "TableRowView",
169 .superclass = _StackView(),
170 .instanceSize = sizeof(TableRowView),
171 .interfaceOffset = offsetof(TableRowView, interface),
172 .interfaceSize = sizeof(TableRowViewInterface),
174 });
175 });
176
177 return clazz;
178}
static void initialize(Class *clazz)
Definition: TableRowView.c:145
Class * _StackView(void)
The StackView archetype.
Definition: StackView.c:262
Rows for TableViews.
Definition: TableRowView.h:44

◆ addCell()

static void addCell ( TableRowView self,
TableCellView cell 
)
static

Definition at line 69 of file TableRowView.c.

69 {
70
71 assert(cell);
72
73 $(self->cells, addObject, cell);
74
75 $((View *) self, addSubview, (View *) cell);
76}
MutableArray * cells
The cells.
Definition: TableRowView.h:60
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
Definition: View.h:133
void addSubview(View *self, View *subview)
Adds a subview to this view, to be drawn above its siblings.
Definition: PageView.c:35

◆ dealloc()

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

Definition at line 36 of file TableRowView.c.

36 {
37
38 TableRowView *this = (TableRowView *) self;
39
40 release(this->cells);
41
42 super(Object, self, dealloc);
43}
static void dealloc(Object *self)
Definition: TableRowView.c:36

◆ initialize()

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

Definition at line 145 of file TableRowView.c.

145 {
146
147 ((ObjectInterface *) clazz->interface)->dealloc = dealloc;
148
149 ((ViewInterface *) clazz->interface)->matchesSelector = matchesSelector;
150
151 ((TableRowViewInterface *) clazz->interface)->addCell = addCell;
152 ((TableRowViewInterface *) clazz->interface)->initWithTableView = initWithTableView;
153 ((TableRowViewInterface *) clazz->interface)->removeAllCells = removeAllCells;
154 ((TableRowViewInterface *) clazz->interface)->removeCell = removeCell;
155 ((TableRowViewInterface *) clazz->interface)->setSelected = setSelected;
156}
void setSelected(CollectionItemView *self, _Bool isSelected)
Sets the selected state of this item.
TableHeaderView * initWithTableView(TableHeaderView *self, TableView *tableView)
Initializes this TableHeaderView with the give table.
void removeAllCells(TableRowView *self)
Removes all cells from this row.
Definition: TableRowView.c:111
void removeCell(TableRowView *self, TableCellView *cell)
Removes the specified cell from this row.
Definition: TableRowView.c:119
void addCell(TableRowView *self, TableCellView *cell)
Adds the specified cell to this row.
Definition: TableRowView.c:69
_Bool matchesSelector(const View *self, const SimpleSelector *simpleSelector)

◆ initWithTableView()

static TableRowView * initWithTableView ( TableRowView self,
TableView tableView 
)
static

Definition at line 82 of file TableRowView.c.

82 {
83
84 self = (TableRowView *) super(StackView, self, initWithFrame, NULL);
85 if (self) {
86
87 const Array *columns = (Array *) tableView->columns;
88
89 self->cells = $$(MutableArray, arrayWithCapacity, columns->count);
90 assert(self->cells);
91
92 self->tableView = tableView;
93 assert(self->tableView);
94 }
95
96 return self;
97}
Box * initWithFrame(Box *self, const SDL_Rect *frame)
Initializes this Box with the given frame.
Definition: Box.c:92
StackViews are containers that manage the arrangement of their subviews.
Definition: StackView.h:68
TableView * tableView
The table.
Definition: TableRowView.h:70
MutableArray * columns
The column definitions.
Definition: TableView.h:138

◆ matchesSelector()

static _Bool matchesSelector ( const View self,
const SimpleSelector simpleSelector 
)
static
See also
View::matchesSelector(const View *, const SimpleSelector *)

Definition at line 50 of file TableRowView.c.

50 {
51
52 TableRowView *this = (TableRowView *) self;
53
54 if (simpleSelector->type == SimpleSelectorTypePseudo) {
55 if (strcmp("selected", simpleSelector->pattern) == 0) {
56 return this->isSelected;
57 }
58 }
59
60 return super(View, self, matchesSelector, simpleSelector);
61}
@ SimpleSelectorTypePseudo
_Bool isSelected(const Control *self)
Definition: Control.c:325
SimpleSelectorType type
The SimpleSelectorType.
char * pattern
The pattern, as provided by the user.

◆ removeAllCells()

static void removeAllCells ( TableRowView self)
static

Definition at line 111 of file TableRowView.c.

111 {
112 $(self->cells, removeAllObjectsWithEnumerator, removeAllCells_enumerate, NULL);
113}
static void removeAllCells_enumerate(const Array *array, ident obj, ident data)
ArrayEnumerator to remove TableCellViews from the row.
Definition: TableRowView.c:102

◆ removeAllCells_enumerate()

static void removeAllCells_enumerate ( const Array *  array,
ident  obj,
ident  data 
)
static

ArrayEnumerator to remove TableCellViews from the row.

Definition at line 102 of file TableRowView.c.

102 {
103 $((View *) obj, removeFromSuperview);
104}
void removeFromSuperview(View *self)
Removes this View from its superview.
Definition: View.c:1175

◆ removeCell()

static void removeCell ( TableRowView self,
TableCellView cell 
)
static

Definition at line 119 of file TableRowView.c.

119 {
120
121 assert(cell);
122
123 $(self->cells, removeObject, cell);
124
125 $((View *) self, removeSubview, (View *) cell);
126}
void removeSubview(View *self, View *subview)
Removes the given subview from this View.
Definition: PageView.c:58

◆ setSelected()

static void setSelected ( TableRowView self,
_Bool  isSelected 
)
static

Definition at line 132 of file TableRowView.c.

132 {
133
134 if (isSelected != self->isSelected) {
135 self->isSelected = isSelected;
136 $((View *) self, invalidateStyle);
137 }
138}
_Bool isSelected
True when this row is selected, false otherwise.
Definition: TableRowView.h:65
void invalidateStyle(View *self)
Invalidates the computed Style for this View and its descendants.
Definition: View.c:822