source: mainline/uspace/lib/ui/private/scrollbar.h

Last change on this file was ef4d684, checked in by Jiri Svoboda <jiri@…>, 19 months ago

It should be 'trough', not 'through', dummy! (thx thepinballroom)

Who said watching a guy making a pinball machine was a waste of time?

  • Property mode set to 100644
File size: 3.4 KB
RevLine 
[bd16113]1/*
[ef4d684]2 * Copyright (c) 2023 Jiri Svoboda
[bd16113]3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup libui
30 * @{
31 */
32/**
33 * @file Scrollbar structure
34 *
35 */
36
37#ifndef _UI_PRIVATE_SCROLLBAR_H
38#define _UI_PRIVATE_SCROLLBAR_H
39
40#include <gfx/coord.h>
41#include <stdbool.h>
[7ca7215]42#include <types/ui/scrollbar.h>
[bd16113]43
44/** Actual structure of scrollbar.
45 *
46 * This is private to libui.
47 */
48struct ui_scrollbar {
49 /** Base control object */
50 struct ui_control *control;
[8965860c]51 /** UI */
52 struct ui *ui;
53 /** UI window containing scrollbar */
54 struct ui_window *window;
[bd16113]55 /** Callbacks */
56 struct ui_scrollbar_cb *cb;
57 /** Callback argument */
58 void *arg;
59 /** Scrollbar rectangle */
60 gfx_rect_t rect;
[7ca7215]61 /** Scrollbar direction */
62 ui_scrollbar_dir_t dir;
[bd16113]63 /** Thumb length */
64 gfx_coord_t thumb_len;
65 /** Up button */
[d4ea1f6]66 struct ui_pbutton *up_btn;
[bd16113]67 /** Down button */
[d4ea1f6]68 struct ui_pbutton *down_btn;
[bd16113]69 /** Thumb is currently held down */
[1026cc4]70 bool thumb_held;
[ef4d684]71 /** Upper trough is currently held down */
72 bool upper_trough_held;
73 /** Pointer is inside upper trough */
74 bool upper_trough_inside;
75 /** Lower trough is currently held down */
76 bool lower_trough_held;
77 /** Pointer is inside lower trough */
78 bool lower_trough_inside;
[bd16113]79 /** Position where thumb was pressed */
80 gfx_coord2_t press_pos;
81 /** Last thumb position */
82 gfx_coord_t last_pos;
83 /** Thumb position */
84 gfx_coord_t pos;
[ef4d684]85 /** Last cursor position (when trough is held) */
[8965860c]86 gfx_coord2_t last_curs_pos;
[bd16113]87};
88
89/** Scrollbar geometry.
90 *
91 * Computed rectangles of scrollbar elements.
92 */
93typedef struct {
94 /** Up button rectangle */
95 gfx_rect_t up_btn_rect;
[ef4d684]96 /** Trough rectangle */
97 gfx_rect_t trough_rect;
98 /** Upper trough rectangle */
99 gfx_rect_t upper_trough_rect;
[bd16113]100 /** Thumb rectangle */
101 gfx_rect_t thumb_rect;
[ef4d684]102 /** Lower trough rectangle */
103 gfx_rect_t lower_trough_rect;
[bd16113]104 /** Down button rectangle */
105 gfx_rect_t down_btn_rect;
106} ui_scrollbar_geom_t;
107
108extern errno_t ui_scrollbar_paint_gfx(ui_scrollbar_t *);
[0d1d0ea]109extern errno_t ui_scrollbar_paint_text(ui_scrollbar_t *);
[bd16113]110extern void ui_scrollbar_get_geom(ui_scrollbar_t *, ui_scrollbar_geom_t *);
111
112#endif
113
114/** @}
115 */
Note: See TracBrowser for help on using the repository browser.