1 /**
2  * @file
3  * Shared code for the Alias and Query Dialogs
4  *
5  * @authors
6  * Copyright (C) 2020 Richard Russon <rich@flatcap.org>
7  *
8  * @copyright
9  * This program is free software: you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License as published by the Free Software
11  * Foundation, either version 2 of the License, or (at your option) any later
12  * version.
13  *
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
17  * details.
18  *
19  * You should have received a copy of the GNU General Public License along with
20  * this program.  If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef MUTT_ALIAS_GUI_H
24 #define MUTT_ALIAS_GUI_H
25 
26 #include <stdbool.h>
27 #include "mutt/lib.h"
28 
29 struct Alias;
30 struct MuttWindow;
31 
32 /**
33  * struct AliasView - GUI data wrapping an Alias
34  */
35 struct AliasView
36 {
37   int num;              ///< Index number in list
38   int orig_seq;         ///< Sequence in alias config file
39   bool is_searched : 1; ///< Alias has been searched
40   bool is_matched  : 1; ///< Search matches this Alias
41   bool is_tagged   : 1; ///< Is it tagged?
42   bool is_deleted  : 1; ///< Is it deleted?
43   bool is_visible  : 1; ///< Is visible?
44   struct Alias *alias;  ///< Alias
45 };
46 ARRAY_HEAD(AliasViewArray, struct AliasView);
47 
48 /**
49  * struct AliasMenuData - AliasView array wrapper with Pattern information - @extends Menu
50  */
51 struct AliasMenuData
52 {
53   char *str;                 ///< String representing the limit being used
54   struct AliasViewArray ava; ///< Array of AliasView
55   struct ConfigSubset *sub;  ///< Config items
56 };
57 
58 int alias_config_observer(struct NotifyCallback *nc);
59 
60 int  alias_array_alias_add    (struct AliasViewArray *ava, struct Alias *alias);
61 int  alias_array_alias_delete (struct AliasViewArray *ava, struct Alias *alias);
62 int  alias_array_count_visible(struct AliasViewArray *ava);
63 
64 void alias_set_title(struct MuttWindow *sbar, char *menu_name, char *limit);
65 int alias_recalc(struct MuttWindow *win);
66 
67 #endif /* MUTT_ALIAS_GUI_H */
68