ObjectivelyMVC 0.1.0
Object oriented MVC framework for OpenGL, SDL2 and GNU C
TableView.h
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#pragma once
25
26#include <Objectively/IndexSet.h>
27#include <Objectively/MutableArray.h>
28
36
49
50typedef struct TableViewInterface TableViewInterface;
51
57
61 ident self;
62
67 size_t (*numberOfRows)(const TableView *tableView);
68
76 ident (*valueForColumnAndRow)(const TableView *tableView, const TableColumn *column, size_t row);
77};
78
84
88 ident self;
89
97 TableCellView *(*cellForColumnAndRow)(const TableView *tableView, const TableColumn *column, size_t row);
98
105 void (*didSelectRowsAtIndexes)(TableView *tableView, const IndexSet *selectedRowIndexes);
106
114 void (*didSetSortColumn)(TableView *tableView);
115};
116
122struct TableView {
123
128
133 TableViewInterface *interface;
134
138 MutableArray *columns;
139
144
149
154
159
163 MutableArray *rows;
164
169
174};
175
179struct TableViewInterface {
180
184 ControlInterface controlInterface;
185
193 void (*addColumn)(TableView *self, TableColumn *column);
194
202 void (*addColumnWithIdentifier)(TableView *self, const char *identifier);
203
211 TableColumn *(*columnAtPoint)(const TableView *self, const SDL_Point *point);
212
220 TableColumn *(*columnWithIdentifier)(const TableView *self, const char *identifier);
221
228 void (*deselectAll)(TableView *self);
229
237 void (*deselectRowAtIndex)(TableView *self, size_t index);
238
246 void (*deselectRowsAtIndexes)(TableView *self, const IndexSet *indexSet);
247
256 TableView *(*initWithFrame)(TableView *self, const SDL_Rect *frame);
257
264 SDL_Size (*naturalSize)(const TableView *self);
265
274 void (*reloadData)(TableView *self);
275
283 void (*removeColumn)(TableView *self, TableColumn *column);
284
292 ssize_t (*rowAtPoint)(const TableView *self, const SDL_Point *point);
293
300 void (*selectAll)(TableView *self);
301
308 IndexSet *(*selectedRowIndexes)(const TableView *self);
309
317 void (*selectRowAtIndex)(TableView *self, size_t index);
318
326 void (*selectRowsAtIndexes)(TableView *self, const IndexSet *indexes);
327
335 void (*setSortColumn)(TableView *self, TableColumn *column);
336};
337
static void selectAll(CollectionView *self)
static SDL_Size naturalSize(const CollectionView *self)
static void deselectAll(CollectionView *self)
static void reloadData(CollectionView *self)
Controls are Views which capture events and dispatch Actions.
ScrollViews allow users to pan their internal contents.
StackViews are containers that manage the arrangement of their subviews.
Each row in a TableView is comprised of TableCellViews.
Columns for TableViews.
Header rows for TableViews.
Rows for TableViews.
static void setSortColumn(TableView *self, TableColumn *column)
Definition: TableView.c:543
static void selectRowAtIndex(TableView *self, size_t index)
Definition: TableView.c:516
static void deselectRowsAtIndexes(TableView *self, const IndexSet *indexes)
Definition: TableView.c:318
static void selectRowsAtIndexes(TableView *self, const IndexSet *indexes)
Definition: TableView.c:530
static IndexSet * selectedRowIndexes(const TableView *self)
Definition: TableView.c:495
static void addColumnWithIdentifier(TableView *self, const char *identifier)
Definition: TableView.c:227
static void addColumn(TableView *self, TableColumn *column)
Definition: TableView.c:214
static ssize_t rowAtPoint(const TableView *self, const SDL_Point *point)
Definition: TableView.c:458
static void removeColumn(TableView *self, TableColumn *column)
Definition: TableView.c:440
static void deselectRowAtIndex(TableView *self, size_t index)
Definition: TableView.c:304
#define OBJECTIVELYMVC_EXPORT
Definition: Types.h:39
Controls are Views which capture events and dispatch Actions.
Definition: Control.h:83
The SDL_Size type.
Definition: Types.h:62
ScrollViews allow users to pan their internal contents.
Definition: ScrollView.h:62
StackViews are containers that manage the arrangement of their subviews.
Definition: StackView.h:68
Each row in a TableView is comprised of TableCellViews.
Definition: TableCellView.h:41
Columns provide alignment, spacing and sorting hints for TableView instances.
Definition: TableColumn.h:45
The header row is a specialized TableRow depicting the TableColumn handles.
The TableView data source protocol.
Definition: TableView.h:56
ident self
The data source self-reference.
Definition: TableView.h:61
ident(* valueForColumnAndRow)(const TableView *tableView, const TableColumn *column, size_t row)
Called by the TableView for the associated value of a cell.
Definition: TableView.h:76
size_t(* numberOfRows)(const TableView *tableView)
Definition: TableView.h:67
The TableView delegate protocol.
Definition: TableView.h:83
void(* didSelectRowsAtIndexes)(TableView *tableView, const IndexSet *selectedRowIndexes)
Called by the TableView when the row selection changes.
Definition: TableView.h:105
void(* didSetSortColumn)(TableView *tableView)
Called by the TableView when the sort column or order changes.
Definition: TableView.h:114
ident self
The delegate self-reference.
Definition: TableView.h:88
TableViews provide sortable, tabular presentations of data.
Definition: TableView.h:122
Control control
The superclass.
Definition: TableView.h:127
ScrollView * scrollView
The scroll view.
Definition: TableView.h:168
TableViewInterface * interface
The interface.
Definition: TableView.h:133
Class * _TableView(void)
The TableView archetype.
Definition: TableView.c:608
TableViewDelegate delegate
The delegate.
Definition: TableView.h:153
MutableArray * columns
The column definitions.
Definition: TableView.h:138
TableColumn * sortColumn
The column to sort by.
Definition: TableView.h:173
TableViewDataSource dataSource
The data source.
Definition: TableView.h:148
StackView * contentView
The content View.
Definition: TableView.h:143
TableHeaderView * headerView
The header.
Definition: TableView.h:158
MutableArray * rows
The rows.
Definition: TableView.h:163