File: header.h

package info (click to toggle)
buffybox 3.4.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 108,056 kB
  • sloc: ansic: 357,060; cpp: 42,613; python: 10,534; xml: 1,214; sh: 823; asm: 665; ruby: 487; makefile: 66
file content (60 lines) | stat: -rw-r--r-- 1,416 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
 * Copyright 2025 buffybox contributors
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#ifndef BBX_HEADER_H
#define BBX_HEADER_H

#include "lvgl/lvgl.h"
#include <stdbool.h>

/**
 * Header configuration options
 */
typedef struct {
    /* Which elements to include */
    bool show_theme_toggle;
    bool show_keyboard_toggle;
    bool show_layout_dropdown;
    bool show_shutdown_button;

    /* Dropdown options (if enabled) */
    const char *dropdown_options;
    int dropdown_width;

    /* Button symbols */
    const char *theme_symbol;
    const char *keyboard_symbol;
    const char *shutdown_symbol;
} bbx_header_config_t;

/**
 * Header widget references for attaching callbacks
 */
typedef struct {
    lv_obj_t *header;
    lv_obj_t *theme_toggle_btn;
    lv_obj_t *keyboard_toggle_btn;
    lv_obj_t *layout_dropdown;
    lv_obj_t *shutdown_btn;
} bbx_header_widgets_t;

/**
 * Create a header bar with configurable elements.
 *
 * @param parent parent object (usually screen)
 * @param config header configuration
 * @param widgets output struct for widget references
 * @return header object
 */
lv_obj_t *bbx_header_create(lv_obj_t *parent, bbx_header_config_t *config, bbx_header_widgets_t *widgets);

/**
 * Initialize header config with default values.
 *
 * @param config config struct to initialize
 */
void bbx_header_init_config(bbx_header_config_t *config);

#endif /* BBX_HEADER_H */