1 /* SPDX-License-Identifier: Zlib */ 2 3 #ifndef GIRARA_TYPES_H 4 #define GIRARA_TYPES_H 5 6 #include "girara-version.h" 7 #include <stdbool.h> 8 9 typedef struct girara_tree_node_s girara_tree_node_t; 10 typedef struct girara_list_s girara_list_t; 11 typedef struct girara_list_iterator_s girara_list_iterator_t; 12 typedef struct girara_setting_s girara_setting_t; 13 typedef struct girara_session_s girara_session_t; 14 typedef struct girara_session_private_s girara_session_private_t; 15 typedef struct girara_command_s girara_command_t; 16 typedef struct girara_mouse_event_s girara_mouse_event_t; 17 typedef struct girara_config_handle_s girara_config_handle_t; 18 typedef struct girara_mode_string_s girara_mode_string_t; 19 typedef struct girara_tab_s girara_tab_t; 20 typedef struct girara_statusbar_item_s girara_statusbar_item_t; 21 typedef struct girara_argument_s girara_argument_t; 22 typedef struct girara_shortcut_mapping_s girara_shortcut_mapping_t; 23 typedef struct girara_argument_mapping_s girara_argument_mapping_t; 24 typedef struct girara_completion_element_s girara_completion_element_t; 25 typedef struct girara_completion_s girara_completion_t; 26 typedef struct girara_completion_group_s girara_completion_group_t; 27 typedef struct girara_shortcut_s girara_shortcut_t; 28 typedef struct girara_inputbar_shortcut_s girara_inputbar_shortcut_t; 29 typedef struct girara_special_command_s girara_special_command_t; 30 typedef struct girara_event_s girara_event_t; 31 32 /** 33 * This structure defines the possible argument identifiers 34 */ 35 enum 36 { 37 GIRARA_HIDE = 1, /**< Hide the completion list */ 38 GIRARA_NEXT, /**< Next entry */ 39 GIRARA_PREVIOUS, /**< Previous entry */ 40 GIRARA_NEXT_GROUP, /**< Next group in the completion list */ 41 GIRARA_PREVIOUS_GROUP, /**< Previous group in the completion list */ 42 GIRARA_HIGHLIGHT, /**< Highlight the entry */ 43 GIRARA_NORMAL, /**< Set to the normal state */ 44 GIRARA_DELETE_LAST_WORD, /**< Delete the last word */ 45 GIRARA_DELETE_LAST_CHAR, /**< Delete the last character */ 46 GIRARA_NEXT_CHAR, /**< Go to the next character */ 47 GIRARA_PREVIOUS_CHAR, /**< Go to the previous character */ 48 GIRARA_DELETE_TO_LINE_START, /**< Delete the line to the start */ 49 GIRARA_DELETE_TO_LINE_END, /**< Delete the line to the end */ 50 GIRARA_DELETE_CURR_CHAR, /**< Delete current char */ 51 GIRARA_GOTO_START, /**< Go to start of the line */ 52 GIRARA_GOTO_END /**< Go to end of the line */ 53 }; 54 55 /** 56 * Mode identifier 57 */ 58 typedef int girara_mode_t; 59 60 /** 61 * Function declaration of a function that generates a completion group 62 * 63 * @param session The current girara session 64 * @param input The current input 65 * @return The completion group 66 */ 67 typedef girara_completion_t* (*girara_completion_function_t)( 68 girara_session_t* session, const char* input); 69 70 /** 71 * Function declaration of a inputbar special function 72 * 73 * @param session The current girara session 74 * @param input The current input 75 * @param argument The given argument 76 * @return TRUE No error occurred 77 * @return FALSE Error occurred 78 */ 79 typedef bool (*girara_inputbar_special_function_t)(girara_session_t* session, 80 const char* input, girara_argument_t* argument); 81 82 /** 83 * Function declaration of a command function 84 * 85 * @param session The current girara session 86 * @param argc Number of arguments 87 * @param argv Arguments 88 */ 89 typedef bool (*girara_command_function_t)(girara_session_t* session, 90 girara_list_t* argument_list); 91 92 /** 93 * Function declaration of a shortcut function 94 * 95 * If a numeric value has been written into the buffer, this function gets as 96 * often executed as the value defines or until the function returns false the 97 * first time. 98 */ 99 typedef bool (*girara_shortcut_function_t)(girara_session_t*, 100 girara_argument_t*, girara_event_t*, unsigned int); 101 102 /** 103 * Function declaration of a function that frees something. 104 * 105 * @param data the data to be freed. 106 */ 107 typedef void (*girara_free_function_t)(void* data); 108 109 /** Function declaration of a function called as callback from girara_list_* 110 * functions. 111 * 112 * @param data a list element. 113 * @param userdata data passed as userdata to the calling function. 114 */ 115 typedef void (*girara_list_callback_t)(void* data, void* userdata); 116 117 /** Function declaration of a function which compares two elements. 118 * 119 * @param data1 the first element. 120 * @param data2 the second element. 121 * @return -1 if data1 < data2, 0 if data1 == data2 and 1 if data1 > data2 122 */ 123 typedef int (*girara_compare_function_t)(const void* data1, const void* data2); 124 125 /** 126 * This structure defines the possible types that a setting value can have 127 */ 128 typedef enum girara_setting_type_e 129 { 130 BOOLEAN, /**< Boolean type */ 131 FLOAT, /**< Floating number */ 132 INT, /**< Integer */ 133 STRING, /**< String */ 134 UNKNOWN = 0xFFFF /**< Unknown type */ 135 } girara_setting_type_t; 136 137 /** 138 * Function declaration for a settings callback 139 * 140 * @param session The current girara session 141 * @param name The name of the affected setting 142 * @param type The type of the affected setting 143 * @param value Pointer to the new value 144 * @param data User data 145 */ 146 typedef void (*girara_setting_callback_t)(girara_session_t* session, 147 const char* name, girara_setting_type_t type, const void* value, void* data); 148 149 /** 150 * Definition of an argument of a shortcut or buffered command 151 */ 152 struct girara_argument_s 153 { 154 int n; /**< Identifier */ 155 void *data; /**< Data */ 156 }; 157 158 /** 159 * Define mouse buttons 160 */ 161 typedef enum girara_mouse_button_e 162 { 163 GIRARA_MOUSE_BUTTON1 = 1, /**< Button 1 */ 164 GIRARA_MOUSE_BUTTON2 = 2, /**< Button 2 */ 165 GIRARA_MOUSE_BUTTON3 = 3, /**< Button 3 */ 166 GIRARA_MOUSE_BUTTON4 = 4, /**< Button 4 */ 167 GIRARA_MOUSE_BUTTON5 = 5, /**< Button 5 */ 168 GIRARA_MOUSE_BUTTON6 = 6, /**< Button 6 */ 169 GIRARA_MOUSE_BUTTON7 = 7, /**< Button 7 */ 170 GIRARA_MOUSE_BUTTON8 = 8, /**< Button 8 */ 171 GIRARA_MOUSE_BUTTON9 = 9 /**< Button 9 */ 172 } girara_mouse_button_t; 173 174 /** 175 * Describes the types of a girara 176 */ 177 typedef enum girara_event_type_e 178 { 179 GIRARA_EVENT_BUTTON_PRESS, /**< Single click */ 180 GIRARA_EVENT_2BUTTON_PRESS, /**< Double click */ 181 GIRARA_EVENT_3BUTTON_PRESS, /**< Triple click */ 182 GIRARA_EVENT_BUTTON_RELEASE, /**< Button released */ 183 GIRARA_EVENT_MOTION_NOTIFY, /**< Cursor moved */ 184 GIRARA_EVENT_SCROLL_UP, /**< Scroll event */ 185 GIRARA_EVENT_SCROLL_DOWN, /**< Scroll event */ 186 GIRARA_EVENT_SCROLL_LEFT, /**< Scroll event */ 187 GIRARA_EVENT_SCROLL_RIGHT, /**< Scroll event */ 188 GIRARA_EVENT_OTHER, /**< Unknown event */ 189 GIRARA_EVENT_SCROLL_BIDIRECTIONAL /**< Scroll event that carries extra data 190 * in girara_argument_t with motion 191 * information as double[2]. 192 * First component is horizontal shift, 193 * second - vertical. 194 */ 195 } girara_event_type_t; 196 197 /** 198 * Describes a girara event 199 */ 200 struct girara_event_s 201 { 202 girara_event_type_t type; /**< The event type */ 203 204 double x; /**< X coordinates where the event occurred */ 205 double y; /**< Y coordinates where the event occurred */ 206 }; 207 208 typedef struct girara_input_history_io_s GiraraInputHistoryIO; 209 typedef struct girara_input_history_io_interface_s GiraraInputHistoryIOInterface; 210 typedef struct girara_input_history_s GiraraInputHistory; 211 typedef struct girara_input_history_class_s GiraraInputHistoryClass; 212 213 typedef struct girara_template_s GiraraTemplate; 214 typedef struct girara_template_class_s GiraraTemplateClass; 215 216 #endif 217