ObjectivelyMVC
Object oriented MVC framework for SDL3 and GNU C
Loading...
Searching...
No Matches
Slider.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/Array.h>
27
#include <Objectively/Vector.h>
28
29
#include <
ObjectivelyMVC/Control.h
>
30
#include <
ObjectivelyMVC/Text.h
>
31
37
typedef
struct
SliderDelegate
SliderDelegate
;
38
39
typedef
struct
Slider
Slider
;
40
typedef
struct
SliderInterface SliderInterface;
41
45
struct
SliderDelegate
{
46
50
ident
self
;
51
57
void (*
didSetValue
)(
Slider
*slider,
double
value);
58
};
59
65
struct
Slider
{
66
70
Control
control
;
71
76
SliderInterface *
interface
[0];
77
81
View
*
bar
;
82
86
SliderDelegate
delegate
;
87
92
View
*handle;
93
97
Text
*
label
;
98
102
char
*
labelFormat
;
103
108
Array *
labels
;
109
113
double
min
,
max
;
114
118
double
step
;
119
123
bool
snapToStep
;
124
128
double
value
;
129
135
Vector *
values
;
136
};
137
141
struct
SliderInterface {
142
146
ControlInterface controlInterface;
147
154
void (*formatLabel)(
Slider
*self);
155
163
Slider
*(*initWithFrame)(
Slider
*self,
const
SDL_Rect *frame);
164
172
void (*setLabelFormat)(
Slider
*self,
const
char
*labelFormat);
173
181
void (*setValue)(
Slider
*self,
double
value);
182
};
183
190
OBJECTIVELYMVC_EXPORT
Class *
_Slider
(
void
);
Control.h
Controls are Views which capture and respond to events.
_Slider
OBJECTIVELYMVC_EXPORT Class * _Slider(void)
Definition
Slider.c:502
Text.h
Text rendered with TrueType fonts.
OBJECTIVELYMVC_EXPORT
#define OBJECTIVELYMVC_EXPORT
Definition
Types.h:40
Control
Controls are Views which capture and respond to events.
Definition
Control.h:83
SliderDelegate
The Slider delegate protocol.
Definition
Slider.h:45
SliderDelegate::didSetValue
void(* didSetValue)(Slider *slider, double value)
Delegate callback for Slider value modification.
Definition
Slider.h:57
SliderDelegate::self
ident self
The delegate self-reference.
Definition
Slider.h:50
Slider
A Control allowing users to drag a handle to select a numeric value.
Definition
Slider.h:65
Slider::max
double max
Definition
Slider.h:113
Slider::min
double min
The slider bounds.
Definition
Slider.h:113
Slider::values
Vector * values
An optional Vector of non-linear values.
Definition
Slider.h:135
Slider::labels
Array * labels
An optional Array of non-linear labels parallel to values.
Definition
Slider.h:108
Slider::bar
View * bar
The slider bar.
Definition
Slider.h:81
Slider::label
Text * label
The Text displaying the current value.
Definition
Slider.h:97
Slider::delegate
SliderDelegate delegate
The delegate.
Definition
Slider.h:86
Slider::labelFormat
char * labelFormat
The label format, e.g. "%0.01f".
Definition
Slider.h:102
Slider::value
double value
The slider value.
Definition
Slider.h:128
Slider::interface
SliderInterface * interface[0]
The interface type.
Definition
Slider.h:76
Slider::snapToStep
bool snapToStep
Enable snapping the slider handle to the step.
Definition
Slider.h:123
Slider::step
double step
The step to increment on key events.
Definition
Slider.h:118
Slider::control
Control control
The superclass.
Definition
Slider.h:70
Text
Text rendered with TrueType fonts.
Definition
Text.h:131
View
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
Definition
View.h:225
Sources
ObjectivelyMVC
Slider.h
Generated on Wed Oct 7 2026 14:14:28 for ObjectivelyMVC by
1.9.8