ScummVM API documentation
gui_scroller.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef NUVIE_GUI_GUI_SCROLLER_H
23 #define NUVIE_GUI_GUI_SCROLLER_H
24 
25 
26 
27 #include "ultima/nuvie/gui/widgets/gui_widget.h"
28 #include "ultima/nuvie/screen/screen.h"
29 
30 namespace Ultima {
31 namespace Nuvie {
32 
33 class GUI_ScrollBar;
34 
35 class GUI_Scroller : public GUI_Widget {
36 
37  uint8 R, G, B;
38  uint32 bg_color;
39  uint16 row_height;
40  uint16 rows_per_page;
41  uint16 num_rows;
42  GUI_ScrollBar *scroll_bar;
43  uint16 disp_offset;
44 
45 public:
46  /* Passed the area, color and shape */
47  GUI_Scroller(int x, int y, int w, int h, uint8 r, uint8 g, uint8 b, uint16 r_height);
48 
49  /* Map the color to the display */
50  void SetDisplay(Screen *s) override;
51  void PlaceOnScreen(Screen *s, GUI_DragManager *dm, int x, int y) override;
52  void move_up();
53  void move_down();
54  void page_up(bool all = false);
55  void page_down(bool all = false);
56 
57  int AddWidget(GUI_Widget *widget);
58 
59  /* Show the widget */
60  void Display(bool full_redraw) override;
61 
62  /* events, used for dragging the area. */
63  GUI_status MouseDown(int x, int y, Shared::MouseButton button) override;
64  GUI_status MouseUp(int x, int y, Shared::MouseButton button) override;
65  GUI_status MouseMotion(int x, int y, uint8 state) override;
66  GUI_status MouseWheel(sint32 x, sint32 y) override;
67 
68 protected:
69  void update_viewport(bool update_slider);
70  void move_percentage(float offset_percentage);
71  GUI_status callback(uint16 msg, GUI_CallBack *caller, void *data) override;
72 };
73 
74 } // End of namespace Nuvie
75 } // End of namespace Ultima
76 
77 #endif
Definition: gui_widget.h:38
Definition: gui_scroller.h:35
Definition: gui_scroll_bar.h:47
Definition: screen.h:41
Definition: detection.h:27
Definition: gui_drag_manager.h:36
Definition: gui_callback.h:31