rofi
1.5.1
|
![]() |
Data Structures | |
struct | textbox |
Enumerations | |
enum | TextboxFlags { TB_AUTOHEIGHT = 1 << 0, TB_AUTOWIDTH = 1 << 1, TB_EDITABLE = 1 << 19, TB_MARKUP = 1 << 20, TB_WRAP = 1 << 21, TB_PASSWORD = 1 << 22, TB_INDICATOR = 1 << 23, TB_ICON = 1 << 24 } |
enum | TextBoxFontType { NORMAL = 0, URGENT = 1, ACTIVE = 2, SELECTED = 4, MARKUP = 8, ALT = 16, HIGHLIGHT = 32, FMOD_MASK = ( ALT | HIGHLIGHT ), STATE_MASK = ~( SELECTED | MARKUP | ALT | HIGHLIGHT ) } |
Functions | |
textbox * | textbox_create (widget *parent, WidgetType type, const char *name, TextboxFlags flags, TextBoxFontType tbft, const char *text, double xalign, double yalign) |
void | textbox_font (textbox *tb, TextBoxFontType tbft) |
void | textbox_text (textbox *tb, const char *text) |
void | textbox_icon (textbox *tb, cairo_surface_t *icon) |
int | textbox_keybinding (textbox *tb, KeyBindingAction action) |
gboolean | textbox_append_text (textbox *tb, const char *pad, const int pad_len) |
void | textbox_cursor (textbox *tb, int pos) |
void | textbox_insert (textbox *tb, const int char_pos, const char *str, const int slen) |
void | textbox_setup (void) |
void | textbox_cleanup (void) |
int | textbox_get_height (const textbox *tb) |
int | textbox_get_font_height (const textbox *tb) |
int | textbox_get_font_width (const textbox *tb) |
double | textbox_get_estimated_char_width (void) |
double | textbox_get_estimated_ch (void) |
double | textbox_get_estimated_char_height (void) |
void | textbox_delete (textbox *tb, int pos, int dlen) |
void | textbox_moveresize (textbox *tb, int x, int y, int w, int h) |
int | textbox_get_estimated_height (const textbox *tb, int eh) |
void | textbox_set_pango_context (const char *font, PangoContext *p) |
void | textbox_set_pango_attributes (textbox *tb, PangoAttrList *list) |
void | textbox_set_icon_index (textbox *tb, int index) |
PangoAttrList * | textbox_get_pango_attributes (textbox *tb) |
const char * | textbox_get_visible_text (const textbox *tb) |
int | textbox_get_desired_width (widget *wid) |
void | textbox_cursor_end (textbox *tb) |
enum TextboxFlags |
enum TextBoxFontType |
Flags indicating current state of the textbox.
gboolean textbox_append_text | ( | textbox * | tb, |
const char * | pad, | ||
const int | pad_len | ||
) |
tb | Handle to the textbox |
pad | The text to insert |
pad_len | the length of the text |
The text should be one insert from a keypress.. the first gunichar is validated to be (or not) control return TRUE if inserted
Definition at line 785 of file textbox.c.
References textbox::cursor, textbox::flags, TB_EDITABLE, textbox_cursor(), and textbox_insert().
Referenced by rofi_view_handle_text().
void textbox_cleanup | ( | void | ) |
Cleanup the allocated colors and fonts by textbox_setup().
Definition at line 835 of file textbox.c.
References p_context, and tbfc_cache.
Referenced by teardown().
textbox* textbox_create | ( | widget * | parent, |
WidgetType | type, | ||
const char * | name, | ||
TextboxFlags | flags, | ||
TextBoxFontType | tbft, | ||
const char * | text, | ||
double | xalign, | ||
double | yalign | ||
) |
parent | The widget's parent. |
type | The type of the to be created widget. |
name | The name of the to be created widget. |
flags | TextboxFlags indicating the type of textbox. |
tbft | TextBoxFontType current state of textbox. |
text | initial text to display. |
xalign | Set the Xalign value. |
yalign | set the yalign value. |
Create a new textbox widget.
free with widget_free
Definition at line 165 of file textbox.c.
References _textbox_get_height(), textbox::blink, textbox::blink_timeout, textbox::changed, _widget::draw, textbox::flags, flags, _widget::free, _widget::get_desired_height, _widget::get_desired_width, _widget::get_height, _widget::get_width, _widget::h, textbox::layout, textbox::left_offset, p_context, _widget::resize, rofi_theme_get_double(), rofi_theme_get_string(), TB_EDITABLE, TB_ICON, TB_WRAP, textbox_blink(), textbox_cursor_end(), textbox_draw(), textbox_editable_trigger_action(), textbox_font(), textbox_free(), textbox_get_desired_height(), textbox_get_desired_width(), textbox_get_width(), textbox_initialize_font(), textbox_moveresize(), textbox_resize(), textbox_text(), _widget::trigger_action, _widget::w, textbox::widget, WIDGET, widget_init(), _widget::x, textbox::xalign, _widget::y, and textbox::yalign.
Referenced by listview_create(), listview_recompute_elements(), rofi_view_add_widget(), rofi_view_create(), and rofi_view_error_dialog().
void textbox_cursor | ( | textbox * | tb, |
int | pos | ||
) |
tb | Handle to the textbox |
pos | New cursor position |
Set the cursor position (string index)
Definition at line 481 of file textbox.c.
References textbox::blink, textbox::cursor, textbox::text, WIDGET, and widget_queue_redraw().
Referenced by textbox_append_text(), textbox_cursor_dec(), textbox_cursor_dec_word(), textbox_cursor_inc(), textbox_cursor_inc_word(), textbox_editable_trigger_action(), and textbox_keybinding().
void textbox_cursor_end | ( | textbox * | tb | ) |
tb | Handle to the textbox |
Move the cursor to the end of the string.
Definition at line 584 of file textbox.c.
References textbox::blink, textbox::cursor, textbox::text, WIDGET, and widget_queue_redraw().
Referenced by rofi_view_create(), textbox_create(), textbox_editable_trigger_action(), and textbox_keybinding().
void textbox_delete | ( | textbox * | tb, |
int | pos, | ||
int | dlen | ||
) |
tb | Handle to the textbox |
pos | The start position |
dlen | The length |
Remove dlen bytes from position pos.
Definition at line 622 of file textbox.c.
References textbox::blink, textbox::changed, textbox::cursor, and textbox::text.
Referenced by textbox_cursor_bkspc_word(), textbox_cursor_del(), textbox_cursor_del_eol(), textbox_cursor_del_sol(), and textbox_cursor_del_word().
void textbox_font | ( | textbox * | tb, |
TextBoxFontType | tbft | ||
) |
tb | Handle to the textbox |
tbft | The style of font to render. |
Set the font render style.
Definition at line 229 of file textbox.c.
References ACTIVE, ALT, FMOD_MASK, HIGHLIGHT, _widget::state, STATE_MASK, textbox::tbft, theme_prop_names, URGENT, textbox::widget, WIDGET, widget_queue_redraw(), and widget_set_state().
Referenced by rofi_view_switch_mode(), textbox_create(), and update_callback().
int textbox_get_desired_width | ( | widget * | wid | ) |
Definition at line 918 of file textbox.c.
References distance_get_pixel(), DOT_OFFSET, _widget::expand, textbox::flags, textbox::layout, textbox::left_offset, ROFI_ORIENTATION_HORIZONTAL, rofi_theme_get_distance(), TB_AUTOWIDTH, TB_INDICATOR, textbox_get_font_width(), WIDGET, widget_padding_get_left(), widget_padding_get_padding_width(), and widget_padding_get_right().
Referenced by barview_draw(), and textbox_create().
double textbox_get_estimated_ch | ( | void | ) |
Estimate the width of a 0.
Definition at line 904 of file textbox.c.
References ch_width, and p_metrics.
Referenced by distance_get_pixel().
double textbox_get_estimated_char_height | ( | void | ) |
Estimate the height of a character.
Definition at line 883 of file textbox.c.
References char_height, and p_metrics.
Referenced by distance_get_pixel(), and textbox_initialize_font().
double textbox_get_estimated_char_width | ( | void | ) |
Estimate the width of a character.
Definition at line 894 of file textbox.c.
References char_width, and p_metrics.
Referenced by rofi_view_calculate_window_width().
int textbox_get_estimated_height | ( | const textbox * | tb, |
int | eh | ||
) |
tb | Handle to the textbox |
eh | The number of rows to display |
Get the (estimated) with of a character, can be used to calculate window width. This includes padding.
Definition at line 913 of file textbox.c.
References textbox::metrics, WIDGET, and widget_padding_get_padding_height().
Referenced by listview_create().
int textbox_get_font_height | ( | const textbox * | tb | ) |
tb | Handle to the textbox |
Get the height of the rendered string.
Definition at line 867 of file textbox.c.
References textbox::layout.
Referenced by textbox_get_height(), and update_callback().
int textbox_get_font_width | ( | const textbox * | tb | ) |
tb | Handle to the textbox |
Get the width of the rendered string.
Definition at line 874 of file textbox.c.
References textbox::layout.
Referenced by textbox_editable_trigger_action(), textbox_get_desired_width(), textbox_get_width(), and textbox_moveresize().
int textbox_get_height | ( | const textbox * | tb | ) |
tb | Handle to the textbox |
Get the height of the textbox
Definition at line 862 of file textbox.c.
References textbox_get_font_height(), WIDGET, and widget_padding_get_padding_height().
Referenced by _textbox_get_height(), textbox_get_desired_height(), and textbox_moveresize().
PangoAttrList* textbox_get_pango_attributes | ( | textbox * | tb | ) |
tb | Handle to the textbox |
Get the list of currently active pango attributes.
Definition at line 287 of file textbox.c.
References textbox::layout.
Referenced by update_callback().
const char* textbox_get_visible_text | ( | const textbox * | tb | ) |
tb | Handle to the textbox |
Definition at line 280 of file textbox.c.
References textbox::layout.
Referenced by update_callback().
void textbox_icon | ( | textbox * | tb, |
cairo_surface_t * | icon | ||
) |
tb | Handle to the textbox |
icon | The icon to show on the textbox |
Set the text to show. Cursor is moved to end (if visible)
Definition at line 335 of file textbox.c.
References textbox::icon, WIDGET, and widget_queue_redraw().
Referenced by update_callback().
void textbox_insert | ( | textbox * | tb, |
const int | char_pos, | ||
const char * | str, | ||
const int | slen | ||
) |
tb | Handle to the textbox |
char_pos | The position to insert the string at |
str | The string to insert. |
slen | The length of the string. |
Insert the string str at position pos.
Definition at line 598 of file textbox.c.
References textbox::blink, textbox::changed, and textbox::text.
Referenced by textbox_append_text().
int textbox_keybinding | ( | textbox * | tb, |
KeyBindingAction | action | ||
) |
tb | Handle to the textbox |
action | the KeyBindingAction to execute on textbox |
Execute an action on the textbox.
Definition at line 721 of file textbox.c.
References CLEAR_LINE, textbox::flags, MOVE_CHAR_BACK, MOVE_CHAR_FORWARD, MOVE_END, MOVE_FRONT, MOVE_WORD_BACK, MOVE_WORD_FORWARD, REMOVE_CHAR_BACK, REMOVE_CHAR_FORWARD, REMOVE_TO_EOL, REMOVE_TO_SOL, REMOVE_WORD_BACK, REMOVE_WORD_FORWARD, TB_EDITABLE, textbox_cursor(), textbox_cursor_bkspc(), textbox_cursor_bkspc_word(), textbox_cursor_dec(), textbox_cursor_dec_word(), textbox_cursor_del(), textbox_cursor_del_eol(), textbox_cursor_del_sol(), textbox_cursor_del_word(), textbox_cursor_end(), textbox_cursor_inc(), textbox_cursor_inc_word(), and textbox_text().
Referenced by rofi_view_nav_row_select(), and rofi_view_trigger_global_action().
void textbox_moveresize | ( | textbox * | tb, |
int | x, | ||
int | y, | ||
int | w, | ||
int | h | ||
) |
tb | Handle to the textbox |
x | The new horizontal position to place with textbox |
y | The new vertical position to place with textbox |
w | The new width of the textbox |
h | The new height of the textbox |
Move and resize the textbox. TODO remove for widget_resize and widget_move
Definition at line 343 of file textbox.c.
References DOT_OFFSET, textbox::flags, _widget::h, textbox::layout, textbox::left_offset, TB_AUTOHEIGHT, TB_AUTOWIDTH, TB_EDITABLE, TB_INDICATOR, TB_WRAP, textbox_get_font_width(), textbox_get_height(), _widget::w, textbox::widget, WIDGET, widget_padding_get_padding_width(), widget_queue_redraw(), _widget::x, and _widget::y.
Referenced by barview_draw(), listview_draw(), textbox_create(), textbox_resize(), and textbox_text().
void textbox_set_icon_index | ( | textbox * | tb, |
int | index | ||
) |
tb | Handle to the textbox |
index | character index to draw the icon at. -1 for no icon |
Sets the character index where the icon should be drawn
void textbox_set_pango_attributes | ( | textbox * | tb, |
PangoAttrList * | list | ||
) |
tb | Handle to the textbox |
list | New pango attributes |
Sets list as active pango attributes.
Definition at line 294 of file textbox.c.
References textbox::layout.
Referenced by update_callback().
void textbox_set_pango_context | ( | const char * | font, |
PangoContext * | p | ||
) |
font | The name of the font used. |
p | The new default PangoContext |
Set the default pango context (with font description) for all textboxes.
Definition at line 824 of file textbox.c.
References default_font_name, TBFontConfig::height, TBFontConfig::metrics, p_context, p_metrics, and tbfc_cache.
Referenced by __create_window().
void textbox_setup | ( | void | ) |
Setup the cached fonts. This is required to do before any of the textbox_ functions is called. Clean with textbox_cleanup()
Definition at line 817 of file textbox.c.
References tbfc_cache, and tbfc_entry_free().
Referenced by main().
void textbox_text | ( | textbox * | tb, |
const char * | text | ||
) |
tb | Handle to the textbox |
text | The text to show in the textbox |
Set the text to show. Cursor is moved to end (if visible)
Definition at line 303 of file textbox.c.
References __textbox_update_pango_text(), textbox::cursor, textbox::flags, _widget::h, TB_AUTOWIDTH, textbox::text, textbox_moveresize(), _widget::w, textbox::widget, WIDGET, widget_queue_redraw(), widget_update(), _widget::x, and _widget::y.
Referenced by rofi_view_add_widget(), rofi_view_clear_input(), rofi_view_create(), rofi_view_nav_row_select(), rofi_view_reload_message_bar(), rofi_view_set_overlay(), rofi_view_trigger_global_action(), rofi_view_update_prompt(), textbox_create(), textbox_keybinding(), and update_callback().