Atrinik Client  4.0
scrollbar.h
Go to the documentation of this file.
1 /*************************************************************************
2  * Atrinik, a Multiplayer Online Role Playing Game *
3  * *
4  * Copyright (C) 2009-2014 Alex Tokar and Atrinik Development Team *
5  * *
6  * Fork from Crossfire (Multiplayer game for X-windows). *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the Free Software *
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
21  * *
22  * The author can be reached at admin@atrinik.org *
23  ************************************************************************/
24 
30 #ifndef SCROLLBAR_H
31 #define SCROLLBAR_H
32 
36 typedef struct scrollbar_element {
38  int x;
39 
41  int y;
42 
44  int w;
45 
47  int h;
48 
50  uint8_t highlight;
51 
63  void (*render_func)(SDL_Surface *surface, SDL_Rect *box, struct scrollbar_element *element, uint8_t horizontal);
65 
69 typedef struct scrollbar_struct {
71  uint32_t *scroll_offset;
72 
74  uint32_t *num_lines;
75 
77  uint32_t max_lines;
78 
81 
87  uint8_t *redraw;
88 
90  int x;
91 
93  int y;
94 
96  int px;
97 
99  int py;
100 
103 
105  uint8_t dragging;
106 
108  uint32_t click_ticks;
109 
112 
115 
118 
121 
124 
128 
133 typedef struct scrollbar_info_struct {
135  uint32_t scroll_offset;
136 
138  uint32_t num_lines;
139 
141  uint8_t redraw;
143 
149 #define SCROLL_DIRECTION_NONE 0
150 
151 #define SCROLL_DIRECTION_UP 1
152 
153 #define SCROLL_DIRECTION_DOWN 2
154 
157 #define SCROLL_BOTTOM(_scrollbar) ((uint32_t) (MAX(0, (int) *(_scrollbar)->num_lines - (int) (_scrollbar)->max_lines)))
158 
159 #define SCROLL_TOP(_scrollbar) (0)
160 
161 #endif
scrollbar_element slider
Definition: scrollbar.h:126
uint8_t highlight
Definition: scrollbar.h:50
uint8_t dragging
Definition: scrollbar.h:105
uint32_t * num_lines
Definition: scrollbar.h:74
scrollbar_element arrow_up
Definition: scrollbar.h:120
uint32_t max_lines
Definition: scrollbar.h:77
struct scrollbar_info_struct scrollbar_info_struct
scrollbar_element background
Definition: scrollbar.h:117
struct scrollbar_element scrollbar_element
struct scrollbar_struct scrollbar_struct
uint32_t * scroll_offset
Definition: scrollbar.h:71
scrollbar_element arrow_down
Definition: scrollbar.h:123
uint32_t click_ticks
Definition: scrollbar.h:108
uint8_t * redraw
Definition: scrollbar.h:87
uint32_t click_repeat_ticks
Definition: scrollbar.h:111
void(* render_func)(SDL_Surface *surface, SDL_Rect *box, struct scrollbar_element *element, uint8_t horizontal)
Definition: scrollbar.h:63
uint32_t scroll_offset
Definition: scrollbar.h:135