rofi  1.7.0
mode.h
Go to the documentation of this file.
1 /*
2  * rofi
3  *
4  * MIT/X11 License
5  * Copyright © 2013-2021 Qball Cow <qball@gmpclient.org>
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining
8  * a copy of this software and associated documentation files (the
9  * "Software"), to deal in the Software without restriction, including
10  * without limitation the rights to use, copy, modify, merge, publish,
11  * distribute, sublicense, and/or sell copies of the Software, and to
12  * permit persons to whom the Software is furnished to do so, subject to
13  * the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be
16  * included in all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25  *
26  */
27 
28 #ifndef ROFI_MODE_H
29 #define ROFI_MODE_H
30 #include "rofi-types.h"
31 #include <cairo.h>
32 G_BEGIN_DECLS
44 typedef struct rofi_mode Mode;
45 
49 typedef enum {
51  MODE_EXIT = 1000,
53  NEXT_DIALOG = 1001,
55  RELOAD_DIALOG = 1002,
59  RESET_DIALOG = 1004,
60 } ModeMode;
61 
65 typedef enum {
67  MENU_OK = 0x00010000,
69  MENU_CANCEL = 0x00020000,
71  MENU_NEXT = 0x00040000,
73  MENU_CUSTOM_INPUT = 0x00080000,
75  MENU_ENTRY_DELETE = 0x00100000,
77  MENU_QUICK_SWITCH = 0x00200000,
79  MENU_CUSTOM_COMMAND = 0x00800000,
81  MENU_PREVIOUS = 0x00400000,
83  MENU_COMPLETE = 0x01000000,
85  MENU_CUSTOM_ACTION = 0x10000000,
87  MENU_LOWER_MASK = 0x0000FFFF
89 
97 int mode_init(Mode *mode);
98 
104 void mode_destroy(Mode *mode);
105 
113 unsigned int mode_get_num_entries(const Mode *mode);
114 
129 char *mode_get_display_value(const Mode *mode, unsigned int selected_line,
130  int *state, GList **attribute_list, int get_entry);
131 
141 cairo_surface_t *mode_get_icon(const Mode *mode, unsigned int selected_line,
142  int height);
143 
153 char *mode_get_completion(const Mode *mode, unsigned int selected_line);
154 
165 ModeMode mode_result(Mode *mode, int menu_retv, char **input,
166  unsigned int selected_line);
167 
177 int mode_token_match(const Mode *mode, rofi_int_matcher **tokens,
178  unsigned int selected_line);
179 
187 const char *mode_get_name(const Mode *mode);
188 
194 void mode_free(Mode **mode);
195 
202 void *mode_get_private_data(const Mode *mode);
203 
211 void mode_set_private_data(Mode *mode, void *pd);
212 
220 const char *mode_get_display_name(const Mode *mode);
221 
228 void mode_set_config(Mode *mode);
229 
239 char *mode_preprocess_input(Mode *mode, const char *input);
240 
249 char *mode_get_message(const Mode *mode);
251 G_END_DECLS
252 #endif
char * mode_get_completion(const Mode *mode, unsigned int selected_line)
Definition: mode.c:81
void mode_destroy(Mode *mode)
Definition: mode.c:48
int mode_init(Mode *mode)
Definition: mode.c:42
unsigned int mode_get_num_entries(const Mode *mode)
Definition: mode.c:54
void mode_free(Mode **mode)
Definition: mode.c:122
const char * mode_get_display_name(const Mode *mode)
Definition: mode.c:144
ModeMode mode_result(Mode *mode, int menu_retv, char **input, unsigned int selected_line)
Definition: mode.c:91
char * mode_get_display_value(const Mode *mode, unsigned int selected_line, int *state, GList **attribute_list, int get_entry)
Definition: mode.c:60
char * mode_preprocess_input(Mode *mode, const char *input)
Definition: mode.c:167
MenuReturn
Definition: mode.h:65
void mode_set_private_data(Mode *mode, void *pd)
Definition: mode.c:136
int mode_token_match(const Mode *mode, rofi_int_matcher **tokens, unsigned int selected_line)
Definition: mode.c:110
char * mode_get_message(const Mode *mode)
Definition: mode.c:173
void * mode_get_private_data(const Mode *mode)
Definition: mode.c:131
ModeMode
Definition: mode.h:49
const char * mode_get_name(const Mode *mode)
Definition: mode.c:117
cairo_surface_t * mode_get_icon(const Mode *mode, unsigned int selected_line, int height)
Definition: mode.c:71
void mode_set_config(Mode *mode)
Definition: mode.c:160
@ MENU_CUSTOM_COMMAND
Definition: mode.h:79
@ MENU_COMPLETE
Definition: mode.h:83
@ MENU_LOWER_MASK
Definition: mode.h:87
@ MENU_PREVIOUS
Definition: mode.h:81
@ MENU_CANCEL
Definition: mode.h:69
@ MENU_QUICK_SWITCH
Definition: mode.h:77
@ MENU_ENTRY_DELETE
Definition: mode.h:75
@ MENU_NEXT
Definition: mode.h:71
@ MENU_CUSTOM_ACTION
Definition: mode.h:85
@ MENU_OK
Definition: mode.h:67
@ MENU_CUSTOM_INPUT
Definition: mode.h:73
@ MODE_EXIT
Definition: mode.h:51
@ NEXT_DIALOG
Definition: mode.h:53
@ RELOAD_DIALOG
Definition: mode.h:55
@ PREVIOUS_DIALOG
Definition: mode.h:57
@ RESET_DIALOG
Definition: mode.h:59