ObjectivelyMVC
0.1.0
Object oriented MVC framework for OpenGL, SDL2 and GNU C
Sources
ObjectivelyMVC
Slider.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 <
ObjectivelyMVC/Control.h
>
27
#include <
ObjectivelyMVC/Text.h
>
28
34
typedef
struct
SliderDelegate
SliderDelegate
;
35
36
typedef
struct
Slider
Slider
;
37
typedef
struct
SliderInterface SliderInterface;
38
42
struct
SliderDelegate
{
43
47
ident
self
;
48
54
void (*
didSetValue
)(
Slider
*slider,
double
value);
55
};
56
62
struct
Slider
{
63
67
Control
control
;
68
73
SliderInterface *
interface
;
74
78
View
*
bar
;
79
83
SliderDelegate
delegate
;
84
89
Control
*handle;
90
94
Text
*
label
;
95
99
char
*
labelFormat
;
100
104
double
min
,
max
;
105
109
double
step
;
110
114
_Bool
snapToStep
;
115
119
double
value
;
120
};
121
125
struct
SliderInterface {
126
130
ControlInterface controlInterface;
131
138
void (*
formatLabel
)(
Slider
*self);
139
147
Slider
*(*initWithFrame)(
Slider
*self,
const
SDL_Rect *frame);
148
156
void (*
setLabelFormat
)(
Slider
*self,
const
char
*labelFormat);
157
165
void (*
setValue
)(
Slider
*self,
double
value);
166
};
167
174
OBJECTIVELYMVC_EXPORT
Class *
_Slider
(
void
);
Control.h
Controls are Views which capture events and dispatch Actions.
setValue
static void setValue(ProgressBar *self, double value)
Definition:
ProgressBar.c:159
setLabelFormat
static void setLabelFormat(ProgressBar *self, const char *labelFormat)
Definition:
ProgressBar.c:145
formatLabel
static void formatLabel(ProgressBar *self)
Definition:
ProgressBar.c:90
Text.h
Text rendered with TrueType fonts.
OBJECTIVELYMVC_EXPORT
#define OBJECTIVELYMVC_EXPORT
Definition:
Types.h:39
Control
Controls are Views which capture events and dispatch Actions.
Definition:
Control.h:83
SliderDelegate
The Slider delegate protocol.
Definition:
Slider.h:42
SliderDelegate::didSetValue
void(* didSetValue)(Slider *slider, double value)
Delegate callback for Slider value modification.
Definition:
Slider.h:54
SliderDelegate::self
ident self
The delegate self-reference.
Definition:
Slider.h:47
Slider
A Control allowing users to drag a handle to select a numeric value.
Definition:
Slider.h:62
Slider::max
double max
Definition:
Slider.h:104
Slider::min
double min
The slider bounds.
Definition:
Slider.h:104
Slider::_Slider
Class * _Slider(void)
The Slider archetype.
Definition:
Slider.c:298
Slider::bar
View * bar
The slider bar.
Definition:
Slider.h:78
Slider::label
Text * label
The Text displaying the current value.
Definition:
Slider.h:94
Slider::delegate
SliderDelegate delegate
The delegate.
Definition:
Slider.h:83
Slider::labelFormat
char * labelFormat
The label format, e.g. "%0.01f".
Definition:
Slider.h:99
Slider::snapToStep
_Bool snapToStep
Enable snapping the slider handle to the step.
Definition:
Slider.h:114
Slider::value
double value
The slider value.
Definition:
Slider.h:119
Slider::step
double step
The step to increment on key events.
Definition:
Slider.h:109
Slider::control
Control control
The superclass.
Definition:
Slider.h:67
Slider::interface
SliderInterface * interface
The interface.
Definition:
Slider.h:73
Text
Text rendered with TrueType fonts.
Definition:
Text.h:41
View
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
Definition:
View.h:133
Generated on Mon Aug 29 2022 09:32:58 for ObjectivelyMVC by
1.9.3