entry.h (1857B)
1 /* 2 * Copyright (c) 2022-2023 lumidify <nobody@lumidify.org> 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 #ifndef LTK_ENTRY_H 18 #define LTK_ENTRY_H 19 20 /* Requires the following includes: <X11/Xlib.h>, "rect.h", "widget.h", "ltk.h", "color.h", "text.h" */ 21 22 #include "cmd.h" 23 #include "err.h" 24 #include "config.h" 25 26 typedef struct { 27 ltk_widget widget; 28 ltk_text_line *tl; 29 ltk_surface_cache_key *key; 30 char *text; 31 size_t len, alloc, pos, sel_start, sel_end; 32 int cur_offset; 33 /* 0 when side of selection that is expanded by cursor keys 34 is left, 1 when it is right */ 35 char sel_side; 36 char selecting; 37 } ltk_entry; 38 39 int ltk_entry_ini_handler(ltk_window *window, const char *prop, const char *value); 40 int ltk_entry_fill_theme_defaults(ltk_window *window); 41 void ltk_entry_uninitialize_theme(ltk_window *window); 42 43 /* FIXME: document that pointers inside binding are taken over! */ 44 int ltk_entry_register_keypress(const char *func_name, size_t func_len, ltk_keypress_binding b); 45 int ltk_entry_register_keyrelease(const char *func_name, size_t func_len, ltk_keyrelease_binding b); 46 void ltk_entry_cleanup(void); 47 48 GEN_CMD_HELPERS_PROTO(ltk_entry_cmd) 49 50 #endif /* LTK_ENTRY_H */