eGUI alias D4D  Release 3.0
Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
d4d_scroll_bar.h
Go to the documentation of this file.
1 /**************************************************************************
2 *
3 * Copyright 2014 by Petr Gargulak. eGUI Community.
4 * Copyright 2009-2013 by Petr Gargulak. Freescale Semiconductor, Inc.
5 *
6 ***************************************************************************
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License Version 3
9 * or later (the "LGPL").
10 *
11 * As a special exception, the copyright holders of the eGUI project give you
12 * permission to link the eGUI sources with independent modules to produce an
13 * executable, regardless of the license terms of these independent modules,
14 * and to copy and distribute the resulting executable under terms of your
15 * choice, provided that you also meet, for each linked independent module,
16 * the terms and conditions of the license of that module.
17 * An independent module is a module which is not derived from or based
18 * on this library.
19 * If you modify the eGUI sources, you may extend this exception
20 * to your version of the eGUI sources, but you are not obligated
21 * to do so. If you do not wish to do so, delete this
22 * exception statement from your version.
23 *
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 *
28 * You should have received a copy of the GNU General Public License
29 * and the GNU Lesser General Public License along with this program.
30 * If not, see <http://www.gnu.org/licenses/>.
31 *
32 ***************************************************************************/
46 #ifndef __D4D_SCROLL_BAR_H
47 #define __D4D_SCROLL_BAR_H
48 
50 
51 /******************************************************************************
52 * D4D SCROLL BAR setting constants
53 *
54 */
60 #ifndef D4D_SCRLBR_F_DEFAULT
61  #define D4D_SCRLBR_F_DEFAULT (D4D_OBJECT_F_VISIBLE | D4D_OBJECT_F_ENABLED | D4D_OBJECT_F_TABSTOP | D4D_OBJECT_F_TOUCHENABLE | D4D_OBJECT_F_MOUSE_NORMAL | D4D_OBJECT_F_FOCUSRECT)
62 #endif
63 
66 #ifndef D4D_SCRLBAR_MIN_TAB_SIZE
67  #define D4D_SCRLBAR_MIN_TAB_SIZE ( 4 )
68 #endif
69 
72 /******************************************************************************
73 * D4D SCROLL BAR setting public types
74 *
75 */
79 /**************************************************************************/
88 typedef void (*D4D_SCRLBR_ON_CHANGE)(D4D_OBJECT* pThis, D4D_INDEX old_position, D4D_INDEX new_position);
89 
90 
93 /******************************************************************************
94 * Types
95 ******************************************************************************/
96 
97 
98 
99 typedef struct D4D_SCRLBAR_DATA_S
100 {
101  D4D_INDEX position; // index of last line
107 
108 // label configuration (goes to ROM by default)
109 
110 typedef struct
111 {
113  D4D_SCRLBAR_DATA* pData; // Run time data needed for ScrlBr
115 
116 
117 /******************************************************************************
118 * Macros
119 ******************************************************************************/
120 
121 // getting the SCROLL_BAR structure from general OBJECT
122 #define D4D_GET_SCROLL_BAR(pObj) ((D4D_SCROLL_BAR*)((pObj)->pParam))
123 #define D4D_GET_SCROLL_BAR_DATA(pObj) (D4D_GET_SCROLL_BAR(pObj)->pData)
124 
125 /******************************************************************************
126 * D4D SCROLL BAR setting public macros
127 *
128 */
132 /**************************************************************************/
153 #define _D4D_DECLARE_SCROLL_BAR(type, name, x, y, cx, cy, radius, pMargin, pRelations, flags, pScheme, pUser, pOnChange, pOnUsrMsg) \
154  static D4D_SCRLBAR_DATA name##_data = { 0, 0, 100, 1, 0};\
155  static type D4D_SCROLL_BAR name##_params = \
156  { \
157  pOnChange, /* OnChange*/ \
158  &name##_data, /* pData */ \
159  }; \
160  \
161  D4D_DECLARE_OBJECT(type, name, x, y, cx, cy, radius, pMargin, pRelations, pOnUsrMsg, &d4d_scroll_barSysFunc, &(name##_params), flags, pUser, pScheme)
162 
163 
164 /**************************************************************************/
182 #define D4D_DECLARE_SCROLL_BAR(name, x, y, cx, cy, flags, pScheme, pUser, pOnChange, pOnUsrMsg)\
183  _D4D_DECLARE_SCROLL_BAR(D4D_CONST, name, x, y, cx, cy, 0, NULL, NULL, flags, pScheme, pUser, pOnChange, pOnUsrMsg)
184 
185 /**************************************************************************/
199 #define D4D_DECLARE_STD_SCROLL_BAR(name, x, y, cx, cy, pOnChange)\
200  D4D_DECLARE_SCROLL_BAR(name, x, y, cx, cy, D4D_SCRLBR_F_DEFAULT, NULL, NULL, pOnChange, NULL)
201 
202 // Rounded scroll bar definition
203 /**************************************************************************/
222 #define D4D_DECLARE_RSCROLL_BAR(name, x, y, cx, cy, radius, flags, pScheme, pUser, pOnChange, pOnUsrMsg)\
223  _D4D_DECLARE_SCROLL_BAR(D4D_CONST, name, x, y, cx, cy, radius, NULL, NULL, flags, pScheme, pUser, pOnChange, pOnUsrMsg)
224 
225 /**************************************************************************/
240 #define D4D_DECLARE_STD_RSCROLL_BAR(name, x, y, cx, cy, radius, pOnChange)\
241  D4D_DECLARE_RSCROLL_BAR(name, x, y, cx, cy, radius, D4D_SCRLBR_F_DEFAULT, NULL, NULL, pOnChange, NULL)
242 
243 
244 // IN RAM instantions macros
245 /**************************************************************************/
248 #define D4D_DECLARE_SCROLL_BAR_INRAM(name, x, y, cx, cy, flags, pScheme, pUser, pOnChange, pOnUsrMsg)\
249  _D4D_DECLARE_SCROLL_BAR(D4D_NO_CONST, name, x, y, cx, cy, 0, NULL, NULL, flags, pScheme, pUser, pOnChange, pOnUsrMsg)
250 
251 /**************************************************************************/
254 #define D4D_DECLARE_STD_SCROLL_BAR_INRAM(name, x, y, cx, cy, pOnChange)\
255  D4D_DECLARE_SCROLL_BAR_INRAM(name, x, y, cx, cy, D4D_SCRLBR_F_DEFAULT, NULL, NULL, pOnChange, NULL)
256 
257 
258 // Rounded scroll bar definition
259 /**************************************************************************/
262 #define D4D_DECLARE_RSCROLL_BAR_INRAM(name, x, y, cx, cy, radius, flags, pScheme, pUser, pOnChange, pOnUsrMsg)\
263  _D4D_DECLARE_SCROLL_BAR(D4D_NO_CONST, name, x, y, cx, cy, radius, NULL, NULL, flags, pScheme, pUser, pOnChange, pOnUsrMsg)
264 
265 /**************************************************************************/
268 #define D4D_DECLARE_STD_RSCROLL_BAR_INRAM(name, x, y, cx, cy, radius, pOnChange)\
269  D4D_DECLARE_RSCROLL_BAR_INRAM(name, x, y, cx, cy, radius, D4D_SCRLBR_F_DEFAULT, NULL, NULL, pOnChange, NULL)
270 
273 /******************************************************************************
274 * Global variables
275 ******************************************************************************/
276 
277 
278 /******************************************************************************
279 * Global functions
280 ******************************************************************************/
281 
282 /*********************************************************
283 *
284 * Object API
285 *
286 *********************************************************/
287 
288 void D4D_ScrlBrSetRange(D4D_OBJECT_PTR pObj, D4D_INDEX minimum, D4D_INDEX maximum);
289 void D4D_ScrlBrSetStep(D4D_OBJECT_PTR pObj, D4D_INDEX page, D4D_INDEX step);
290 void D4D_ScrlBrSetPosition(D4D_OBJECT_PTR pObj, D4D_INDEX position);
293 
294 #endif /* __D4D_SCROLL_BAR_H */
struct D4D_SCRLBAR_DATA_S D4D_SCRLBAR_DATA
void D4D_ScrlBrSetPosition(D4D_OBJECT_PTR pObj, D4D_INDEX position)
The function sets the scroll bar position.
D4D_SCRLBAR_DATA * pData
void D4D_ScrlBrSetRange(D4D_OBJECT_PTR pObj, D4D_INDEX minimum, D4D_INDEX maximum)
The function sets the range of scroll bar scale.
void(* D4D_SCRLBR_ON_CHANGE)(D4D_OBJECT *pThis, D4D_INDEX old_position, D4D_INDEX new_position)
Type definition of scroll bar on change callback function.
const D4D_OBJECT_SYS_FUNCTION d4d_scroll_barSysFunc
void D4D_ScrlBrSetStep(D4D_OBJECT_PTR pObj, D4D_INDEX page, D4D_INDEX step)
The function sets the step and page of scroll bar scale.
LWord D4D_INDEX
Type definition of eGUI general index variables.
Definition: d4d_types.h:206
The object main structure type definition.
Definition: d4d_object.h:167
D4D_INDEX D4D_ScrlBrGetPosition(D4D_OBJECT_PTR pObj)
The function gets the scroll bar position.
The object system function needed for each object - this is part of D4D_OBJECT main structure...
Definition: d4d_object.h:134
void D4D_ScrlBrChangePosition(D4D_OBJECT_PTR pObj, D4D_INDEX_DELTA change)
The function change the scroll bar position.
sLWord D4D_INDEX_DELTA
Type definition of eGUI general index variables for signed offsets.
Definition: d4d_types.h:208
D4D_SCRLBR_ON_CHANGE OnChange