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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
/*
* Copyright (c) 2003-2009 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __WEECHAT_GUI_BAR_H
#define __WEECHAT_GUI_BAR_H 1
struct t_weechat_plugin;
struct t_gui_window;
struct t_gui_buffer;
#define GUI_BAR_DEFAULT_NAME_INPUT "input"
#define GUI_BAR_DEFAULT_NAME_STATUS "status"
#define GUI_BAR_DEFAULT_NAME_TITLE "title"
#define GUI_BAR_DEFAULT_NAME_NICKLIST "nicklist"
enum t_gui_bar_option
{
GUI_BAR_OPTION_HIDDEN = 0, /* true if bar is hidden */
GUI_BAR_OPTION_PRIORITY, /* bar priority */
GUI_BAR_OPTION_TYPE, /* type (root or window) */
GUI_BAR_OPTION_CONDITIONS, /* conditions for display */
GUI_BAR_OPTION_POSITION, /* bottom, top, left, right */
GUI_BAR_OPTION_FILLING_TOP_BOTTOM, /* filling when pos. is top/bottom */
GUI_BAR_OPTION_FILLING_LEFT_RIGHT, /* filling when pos. is left/right */
GUI_BAR_OPTION_SIZE, /* size of bar (in chars, 0 = auto) */
GUI_BAR_OPTION_SIZE_MAX, /* max size of bar (0 = no limit) */
GUI_BAR_OPTION_COLOR_FG, /* default text color for bar */
GUI_BAR_OPTION_COLOR_DELIM, /* default delimiter color for bar */
GUI_BAR_OPTION_COLOR_BG, /* default background color for bar */
GUI_BAR_OPTION_SEPARATOR, /* true if separator line displayed */
GUI_BAR_OPTION_ITEMS, /* bar items */
/* number of bar options */
GUI_BAR_NUM_OPTIONS,
};
enum t_gui_bar_type
{
GUI_BAR_TYPE_ROOT = 0,
GUI_BAR_TYPE_WINDOW,
/* number of bar types */
GUI_BAR_NUM_TYPES,
};
enum t_gui_bar_position
{
GUI_BAR_POSITION_BOTTOM = 0,
GUI_BAR_POSITION_TOP,
GUI_BAR_POSITION_LEFT,
GUI_BAR_POSITION_RIGHT,
/* number of bar positions */
GUI_BAR_NUM_POSITIONS,
};
enum t_gui_bar_filling
{
GUI_BAR_FILLING_HORIZONTAL = 0,
GUI_BAR_FILLING_VERTICAL,
GUI_BAR_FILLING_COLUMNS_HORIZONTAL,
GUI_BAR_FILLING_COLUMNS_VERTICAL,
/* number of bar positions */
GUI_BAR_NUM_FILLING,
};
struct t_gui_bar
{
/* user choices */
char *name; /* bar name */
struct t_config_option *options[GUI_BAR_NUM_OPTIONS];
/* internal vars */
int conditions_count; /* number of conditions */
char **conditions_array; /* exploded bar conditions */
int items_count; /* number of bar items */
int *items_subcount; /* number of sub items */
char ***items_array; /* exploded bar items */
struct t_gui_bar_window *bar_window; /* pointer to bar window */
/* (for type root only) */
int bar_refresh_needed; /* refresh for bar is needed? */
struct t_gui_bar *prev_bar; /* link to previous bar */
struct t_gui_bar *next_bar; /* link to next bar */
};
/* variables */
extern char *gui_bar_type_string[];
extern char *gui_bar_position_string[];
extern char *gui_bar_filling_string[];
extern struct t_gui_bar *gui_bars;
extern struct t_gui_bar *last_gui_bar;
extern struct t_gui_bar *gui_temp_bars;
extern struct t_gui_bar *last_gui_temp_bar;
/* functions */
extern int gui_bar_valid (struct t_gui_bar *bar);
extern int gui_bar_search_option (const char *option_name);
extern int gui_bar_search_type (const char *type);
extern int gui_bar_search_position (const char *position);
extern enum t_gui_bar_filling gui_bar_get_filling (struct t_gui_bar *bar);
extern void gui_bar_get_item_index (struct t_gui_bar *bar,
const char *item_name,
int *index_item, int *index_subitem);
extern int gui_bar_check_conditions_for_window (struct t_gui_bar *bar,
struct t_gui_window *window);
extern int gui_bar_root_get_size (struct t_gui_bar *bar,
enum t_gui_bar_position position);
extern struct t_gui_bar *gui_bar_search (const char *name);
extern void gui_bar_ask_refresh (struct t_gui_bar *bar);
extern void gui_bar_draw (struct t_gui_bar *bar);
extern int gui_bar_set (struct t_gui_bar *bar, const char *property, const char *value);
extern void gui_bar_create_option_temp (struct t_gui_bar *temp_bar,
int index_option, const char *value);
extern struct t_gui_bar *gui_bar_alloc (const char *name);
extern struct t_gui_bar *gui_bar_new (const char *name,
const char *hidden,
const char *priority,
const char *type,
const char *conditions,
const char *position,
const char *filling_top_bottom,
const char *filling_left_right,
const char *size,
const char *size_max,
const char *color_fg,
const char *color_delim,
const char *color_bg,
const char *separator,
const char *items);
extern void gui_bar_use_temp_bars ();
extern void gui_bar_create_default_input ();
extern void gui_bar_create_default ();
extern void gui_bar_update (const char *name);
extern int gui_bar_scroll (struct t_gui_bar *bar, struct t_gui_buffer *buffer,
const char *scroll);
extern void gui_bar_free (struct t_gui_bar *bar);
extern void gui_bar_free_all ();
extern int gui_bar_add_to_infolist (struct t_infolist *infolist,
struct t_gui_bar *bar);
extern void gui_bar_print_log ();
#endif /* gui-bar.h */
|