ObjectivelyMVC 0.1.0
Object oriented MVC framework for OpenGL, SDL2 and GNU C
Select.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
29
35typedef struct SelectDelegate SelectDelegate;
36
37typedef struct Select Select;
38typedef struct SelectInterface SelectInterface;
39
44
48 ident self;
49
55 void (*didSelectOption)(Select *select, Option *option);
56};
57
63struct Select {
64
69
74 SelectInterface *interface;
75
79 Comparator comparator;
80
85
89 MutableArray *options;
90
95};
96
100struct SelectInterface {
101
105 ControlInterface controlInterface;
106
115 void (*addOption)(Select *self, const char *title, ident value);
116
125 Select *(*initWithFrame)(Select *self, const SDL_Rect *frame);
126
134 Option *(*optionWithValue)(const Select *self, ident value);
135
142 void (*removeAllOptions)(Select *self);
143
151 void (*removeOption)(Select *self, Option *option);
152
160 void (*removeOptionWithValue)(Select *self, ident value);
161
169 void (*selectOption)(Select *self, Option *option);
170
178 void (*selectOptionWithValue)(Select *self, ident value);
179
188 Option *(*selectedOption)(const Select *self);
189
196 Array *(*selectedOptions)(const Select *self);
197};
198
205OBJECTIVELYMVC_EXPORT Class *_Select(void);
Controls are Views which capture events and dispatch Actions.
Select Options.
static void removeOption(Select *self, Option *option)
Definition: Select.c:288
static void selectOption(Select *self, Option *option)
Definition: Select.c:331
static void selectOptionWithValue(Select *self, ident value)
Definition: Select.c:351
static void removeOptionWithValue(Select *self, ident value)
Definition: Select.c:312
static void addOption(Select *self, const char *title, ident value)
Definition: Select.c:205
static void removeAllOptions(Select *self)
Definition: Select.c:280
StackViews are containers that manage the arrangement of their subviews.
#define OBJECTIVELYMVC_EXPORT
Definition: Types.h:39
Controls are Views which capture events and dispatch Actions.
Definition: Control.h:83
Select Options.
Definition: Option.h:41
The Select delegate protocol.
Definition: Select.h:43
ident self
The delegate self-reference.
Definition: Select.h:48
void(* didSelectOption)(Select *select, Option *option)
Called when a selection is made.
Definition: Select.h:55
A Control allowing users to select one or more Options.
Definition: Select.h:63
MutableArray * options
The Options.
Definition: Select.h:89
SelectInterface * interface
The interface.
Definition: Select.h:74
SelectDelegate delegate
The SelectDelegate.
Definition: Select.h:84
Comparator comparator
An optional Comparator to sort Options.
Definition: Select.h:79
StackView * stackView
The StackView for rendering the Options.
Definition: Select.h:94
Class * _Select(void)
The Select archetype.
Definition: Select.c:413
Control control
The superclass.
Definition: Select.h:68
StackViews are containers that manage the arrangement of their subviews.
Definition: StackView.h:68