summaryrefslogtreecommitdiff
path: root/src/gui/gui-bar-item-custom.h
blob: 41783084d30061e58247d441226e181ec53b0d60 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 * Copyright (C) 2022-2024 Sébastien Helleu <flashcode@flashtux.org>
 *
 * This file is part of WeeChat, the extensible chat client.
 *
 * WeeChat is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * WeeChat is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with WeeChat.  If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef WEECHAT_GUI_BAR_ITEM_CUSTOM_H
#define WEECHAT_GUI_BAR_ITEM_CUSTOM_H

#define GUI_BAR_ITEM_CUSTOM_DEFAULT_CONDITIONS "${...}"
#define GUI_BAR_ITEM_CUSTOM_DEFAULT_CONTENTS "${...}"

struct t_gui_buffer;
struct t_gui_window;
struct t_hashtable;
struct t_weechat_plugin;

enum t_gui_bar_item_custom_option
{
    GUI_BAR_ITEM_CUSTOM_OPTION_CONDITIONS = 0, /* condition(s) to display   */
    GUI_BAR_ITEM_CUSTOM_OPTION_CONTENT,        /* item content              */
    /* number of bar options */
    GUI_BAR_ITEM_CUSTOM_NUM_OPTIONS,
};

struct t_gui_bar_item_custom
{
    /* custom choices */
    char *name;                              /* item name                   */
    struct t_config_option *options[GUI_BAR_ITEM_CUSTOM_NUM_OPTIONS];

    /* internal vars */
    struct t_gui_bar_item *bar_item;         /* pointer to bar item        */
    struct t_gui_bar_item_custom *prev_item; /* link to previous bar item  */
    struct t_gui_bar_item_custom *next_item; /* link to next bar item      */
};

/* variables */

extern struct t_gui_bar_item_custom *gui_custom_bar_items;
extern struct t_gui_bar_item_custom *last_gui_custom_bar_item;
extern struct t_gui_bar_item_custom *gui_temp_custom_bar_items;
extern struct t_gui_bar_item_custom *last_gui_temp_custom_bar_item;

/* functions */

extern int gui_bar_item_custom_search_option (const char *option_name);
extern struct t_gui_bar_item_custom *gui_bar_item_custom_search (const char *item_name);
extern void gui_bar_item_custom_create_option_temp (struct t_gui_bar_item_custom *temp_item,
                                                    int index_option,
                                                    const char *value);
extern struct t_gui_bar_item_custom *gui_bar_item_custom_alloc (const char *name);
extern struct t_gui_bar_item_custom *gui_bar_item_custom_new (const char *name,
                                                              const char *conditions,
                                                              const char *content);
extern void gui_bar_item_custom_use_temp_items ();
extern int gui_bar_item_custom_rename (struct t_gui_bar_item_custom *item,
                                       const char *new_name);
extern void gui_bar_item_custom_free_data (struct t_gui_bar_item_custom *item);
extern void gui_bar_item_custom_free (struct t_gui_bar_item_custom *item);
extern void gui_bar_item_custom_free_all ();

#endif /* WEECHAT_GUI_BAR_ITEM_CUSTOM_H */