1 /* SPDX-License-Identifier: Zlib */ 2 3 #ifndef GIRARA_SHORTCUTS_H 4 #define GIRARA_SHORTCUTS_H 5 6 #include "types.h" 7 #include "macros.h" 8 #include <glib.h> 9 10 /** 11 * Adds a shortcut 12 * 13 * Note: currently argument_data accepts only a character string 14 * 15 * @param session The used girara session 16 * @param modifier The modifier 17 * @param key The key 18 * @param buffer Buffer command 19 * @param function Executed function 20 * @param mode Available modes 21 * @param argument_n Argument identifier 22 * @param argument_data Argument data 23 * @return true No error occurred 24 * @return false An error occurred 25 */ 26 bool girara_shortcut_add(girara_session_t* session, guint modifier, guint key, 27 const char* buffer, girara_shortcut_function_t function, girara_mode_t mode, 28 int argument_n, void* argument_data) GIRARA_VISIBLE; 29 30 /** 31 * Removes a shortcut 32 * 33 * @param session The used girara session 34 * @param modifier The modifier 35 * @param key The key 36 * @param buffer Buffer command 37 * @param mode Available modes 38 * @return true No error occurred 39 * @return false An error occurred 40 */ 41 bool girara_shortcut_remove(girara_session_t* session, guint modifier, guint 42 key, const char* buffer, girara_mode_t mode) GIRARA_VISIBLE; 43 44 /** 45 * Adds an inputbar shortcut 46 * 47 * @param session The used girara session 48 * @param modifier The modifier 49 * @param key The key 50 * @param function Executed function 51 * @param argument_n Argument identifier 52 * @param argument_data Argument data 53 * @return true No error occurred 54 * @return false An error occurred 55 */ 56 bool girara_inputbar_shortcut_add(girara_session_t* session, guint modifier, 57 guint key, girara_shortcut_function_t function, int argument_n, void* 58 argument_data) GIRARA_VISIBLE; 59 60 /** 61 * Removes an inputbar shortcut 62 * 63 * @param session The used girara session 64 * @param modifier The modifier 65 * @param key The key 66 * @return true No error occurred 67 * @return false An error occurred 68 */ 69 bool girara_inputbar_shortcut_remove(girara_session_t* session, guint modifier, 70 guint key) GIRARA_VISIBLE; 71 72 /** 73 * Default shortcut function to focus the inputbar 74 * 75 * @param session The used girara session 76 * @param argument The argument 77 * @param event Girara event 78 * @param t Number of executions 79 * @return true No error occurred 80 * @return false An error occurred (abort execution) 81 */ 82 bool girara_sc_focus_inputbar(girara_session_t* session, girara_argument_t* 83 argument, girara_event_t* event, unsigned int t) GIRARA_VISIBLE; 84 85 /** 86 * Default shortcut function to abort 87 * 88 * @param session The used girara session 89 * @param argument The argument 90 * @param event Girara event 91 * @param t Number of executions 92 * @return true No error occurred 93 * @return false An error occurred (abort execution) 94 */ 95 bool girara_sc_abort(girara_session_t* session, girara_argument_t* argument, 96 girara_event_t* event, unsigned int t) GIRARA_VISIBLE; 97 98 /** 99 * Default shortcut function to quit the application 100 * 101 * @param session The used girara session 102 * @param argument The argument 103 * @param event Girara event 104 * @param t Number of executions 105 * @return true No error occurred 106 * @return false An error occurred (abort execution) 107 */ 108 bool girara_sc_quit(girara_session_t* session, girara_argument_t* argument, 109 girara_event_t* event, unsigned int t) GIRARA_VISIBLE; 110 111 /** 112 * Toggles the visibility of the inputbar 113 * 114 * @param session The used girara session 115 * @param argument The argument 116 * @param event Girara event 117 * @param t Numbr of execution 118 * @return true No error occurred 119 * @return false An error occurred (abort execution) 120 */ 121 bool girara_sc_toggle_inputbar(girara_session_t* session, girara_argument_t* 122 argument, girara_event_t* event, unsigned int t) GIRARA_VISIBLE; 123 124 /** 125 * Toggles the visibility of the statusbar 126 * 127 * @param session The used girara session 128 * @param argument The argument 129 * @param event Girara event 130 * @param t Numbr of execution 131 * @return true No error occurred 132 * @return false An error occurred (abort execution) 133 */ 134 bool girara_sc_toggle_statusbar(girara_session_t* session, girara_argument_t* 135 argument, girara_event_t* event, unsigned int t) GIRARA_VISIBLE; 136 137 /** 138 * Passes the argument to the set command 139 * 140 * @param session The used girara session 141 * @param argument The argument 142 * @param event Girara event 143 * @param t Number ofexecutions 144 * @return true No error occurred 145 * @return false An error occurred (abort execution) 146 */ 147 bool girara_sc_set(girara_session_t* session, girara_argument_t* argument, 148 girara_event_t* event, unsigned int t) GIRARA_VISIBLE; 149 150 /** 151 * Executes a command. 152 * 153 * @param session The used girara session 154 * @param argument The argument 155 * @param event Girara event 156 * @param t Number ofexecutions 157 * @return true No error occurred 158 * @return false An error occurred (abort execution) 159 */ 160 bool girara_sc_exec(girara_session_t* session, girara_argument_t* argument, 161 girara_event_t* event, unsigned int t) GIRARA_VISIBLE; 162 163 /** 164 * Default shortcut function to activate 165 * 166 * @param session The used girara session 167 * @param argument The argument 168 * @param event Girara event 169 * @param t Number of executions 170 * @return true No error occurred 171 * @return false An error occurred (abort execution) 172 */ 173 bool girara_isc_activate(girara_session_t* session, girara_argument_t* argument, 174 girara_event_t* event, unsigned int t) GIRARA_VISIBLE; 175 176 /** 177 * Default inputbar shortcut to abort 178 * 179 * @param session The used girara session 180 * @param argument The argument 181 * @param event Girara event 182 * @param t Number of executions 183 * @return true No error occurred 184 * @return false An error occurred (abort execution) 185 */ 186 bool girara_isc_abort(girara_session_t* session, girara_argument_t* argument, 187 girara_event_t* event, unsigned int t) GIRARA_VISIBLE; 188 189 /** 190 * Default inputbar shortcut that completes the given input 191 * in the statusbar 192 * 193 * @param session The used girara session 194 * @param argument The argument 195 * @param event Girara event 196 * @param t Number of executions 197 * @return true No error occurred 198 * @return false An error occurred (abort execution) 199 */ 200 bool girara_isc_completion(girara_session_t* session, girara_argument_t* 201 argument, girara_event_t* event, unsigned int t) GIRARA_VISIBLE; 202 203 /** 204 * Default inputbar shortcut to manipulate the inputbar string 205 * 206 * @param session The used girara session 207 * @param argument The argument 208 * @param event Girara event 209 * @param t Number of executions 210 * @return true No error occurred 211 * @return false An error occurred (abort execution) 212 */ 213 bool girara_isc_string_manipulation(girara_session_t* session, 214 girara_argument_t* argument, girara_event_t* event, unsigned int t) GIRARA_VISIBLE; 215 216 /** 217 * Default inputbar shortcut to navigate through the command history 218 * 219 * @param session The used girara session 220 * @param argument The argument 221 * @param event Girara event 222 * @param t Number of executions 223 * @return true No error occurred 224 * @return false An error occurred (abort execution) 225 */ 226 bool girara_isc_command_history(girara_session_t* session, 227 girara_argument_t* argument, girara_event_t* event, unsigned int t) GIRARA_VISIBLE; 228 229 /** 230 * Creates a mapping between a shortcut function and an identifier and is used 231 * to evaluate the mapping command 232 * 233 * @param session The girara session 234 * @param identifier Optional identifier 235 * @param function The function that should be mapped 236 * @return true if no error occurred 237 */ 238 bool girara_shortcut_mapping_add(girara_session_t* session, 239 const char* identifier, girara_shortcut_function_t function) GIRARA_VISIBLE; 240 241 /** 242 * Creates a mapping between a shortcut argument and an identifier and is used 243 * to evalue the mapping command 244 * 245 * @param session The girara session 246 * @param identifier The identifier 247 * @param value The value that should be represented 248 * @return true if no error occurred 249 */ 250 bool girara_argument_mapping_add(girara_session_t* session, 251 const char* identifier, int value) GIRARA_VISIBLE; 252 253 /** 254 * Adds a mouse event 255 * 256 * @param session The used girara session 257 * @param mask The mask 258 * @param button Pressed button 259 * @param function Executed function 260 * @param mode Available mode 261 * @param event_type Event type 262 * @param argument_n Argument identifier 263 * @param argument_data Argument data 264 * @return true No error occurred 265 * @return false An error occurred 266 */ 267 bool girara_mouse_event_add(girara_session_t* session, guint mask, guint button, 268 girara_shortcut_function_t function, girara_mode_t mode, 269 girara_event_type_t event_type, int argument_n, void* argument_data) GIRARA_VISIBLE; 270 271 /** 272 * Removes a mouse event 273 * 274 * @param session The used girara session 275 * @param mask The mask 276 * @param button Pressed button 277 * @param mode Available mode 278 * @return true No error occurred 279 * @return false An error occurred 280 */ 281 bool girara_mouse_event_remove(girara_session_t* session, guint mask, 282 guint button, girara_mode_t mode) GIRARA_VISIBLE; 283 284 #endif 285