comparison examples/example-ui/button-style-glow.h @ 502:ab2816f9551c

ui: start reworking on styles While here, demonstrates how we can use a custom style on a button.
author David Demelier <markand@malikania.fr>
date Wed, 01 Mar 2023 10:34:12 +0100
parents
children 6100c643dba0
comparison
equal deleted inserted replaced
501:23559c7ccf47 502:ab2816f9551c
1 /*
2 * button-style-glow.h -- example of glowing button
3 *
4 * Copyright (c) 2020-2023 David Demelier <markand@malikania.fr>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #ifndef MLK_EXAMPLE_BUTTON_STYLE_H
20 #define MLK_EXAMPLE_BUTTON_STYLE_H
21
22 #include <mlk/ui/button.h>
23
24 #define BUTTON_STYLE_GLOW_COLOR_1 0x235b7cff
25 #define BUTTON_STYLE_GLOW_COLOR_2 0x2d80a6ff
26 #define BUTTON_STYLE_GLOW_DELAY 20
27
28 struct button_style_glow {
29 unsigned long colors[3];
30 unsigned int delay;
31 unsigned int elapsed;
32 struct mlk_button_style style;
33 };
34
35 void
36 button_style_glow_init(struct button_style_glow *);
37
38 #endif /* !MLK_EXAMPLE_BUTTON_GLOW_STYLE_H */