ObjectivelyMVC
Object oriented MVC framework for SDL3 and GNU C
Loading...
Searching...
No Matches
TableView.h
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#pragma once
25
26#include <Objectively/IndexSet.h>
27#include <Objectively/Array.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
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
Controls are Views which capture and respond to events.
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 IndexSet * selectedRowIndexes(const TableView *self)
Definition TableView.c:499
OBJECTIVELYMVC_EXPORT Class * _TableView(void)
Definition TableView.c:614
#define OBJECTIVELYMVC_EXPORT
Definition Types.h:40
Controls are Views which capture and respond to events.
Definition Control.h:83
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.
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
Array * rows
The rows.
Definition TableView.h:163
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
TableViewDelegate delegate
The delegate.
Definition TableView.h:153
TableColumn * sortColumn
The column to sort by.
Definition TableView.h:173
TableViewDataSource dataSource
The data source.
Definition TableView.h:148
Array * columns
The column definitions.
Definition TableView.h:138
StackView * contentView
The content View.
Definition TableView.h:143
TableHeaderView * headerView
The header.
Definition TableView.h:158