rofi 1.7.5
|
Topics | |
box | |
container | |
icon | |
listview | |
Scrollbar | |
Textbox | |
Macros | |
#define | WIDGET(a) ((widget *)(a)) |
Typedefs | |
typedef struct _widget | widget |
typedef widget *(* | widget_find_mouse_target_cb) (widget *widget, WidgetType type, gint x, gint y) |
typedef WidgetTriggerActionResult(* | widget_trigger_action_cb) (widget *widget, guint action, gint x, gint y, void *user_data) |
Enumerations | |
enum | WidgetType { WIDGET_TYPE_UNKNOWN , WIDGET_TYPE_LISTVIEW = SCOPE_MOUSE_LISTVIEW , WIDGET_TYPE_LISTVIEW_ELEMENT = SCOPE_MOUSE_LISTVIEW_ELEMENT , WIDGET_TYPE_EDITBOX = SCOPE_MOUSE_EDITBOX , WIDGET_TYPE_SCROLLBAR = SCOPE_MOUSE_SCROLLBAR , WIDGET_TYPE_MODE_SWITCHER = SCOPE_MOUSE_MODE_SWITCHER , WIDGET_TYPE_TEXTBOX_TEXT } |
enum | WidgetTriggerActionResult { WIDGET_TRIGGER_ACTION_RESULT_IGNORED , WIDGET_TRIGGER_ACTION_RESULT_HANDLED , WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_BEGIN , WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_END } |
Generic abstract widget class. Widgets should 'inherit' from this class (first structure in there structure should be widget). The generic widget implements generic functions like get_width, get_height, draw, resize, update, free and clicked. It also holds information about how the widget should be packed.
#define WIDGET | ( | a | ) | ((widget *)(a)) |
Macro to get widget from an implementation (e.g. textbox/scrollbar)
Definition at line 119 of file widget.h.
Referenced by __create_window(), __textbox_update_pango_text(), barview_draw(), box_add(), box_create(), container_add(), container_create(), container_update(), hori_calculate_size(), icon_create(), icon_draw(), icon_set_surface(), listview_add_widget(), listview_create(), listview_create_row(), listview_draw(), listview_element_motion_notify(), listview_element_trigger_action(), listview_find_mouse_target(), listview_free(), listview_get_desired_height(), listview_nav_column_left_int(), listview_nav_column_right_int(), listview_nav_down_int(), listview_nav_left(), listview_nav_page_next_int(), listview_nav_page_prev_int(), listview_nav_right(), listview_nav_up_int(), listview_recompute_elements(), listview_resize(), listview_set_num_elements(), listview_set_selected(), listview_set_show_scrollbar(), listview_set_state(), rofi_view_add_widget(), rofi_view_calculate_height(), rofi_view_calculate_window_position(), rofi_view_calculate_window_width(), rofi_view_check_action(), rofi_view_create(), rofi_view_error_dialog(), rofi_view_free(), rofi_view_handle_mouse_motion(), rofi_view_reload_message_bar(), rofi_view_resolve_cursor(), rofi_view_set_overlay(), rofi_view_setup_fake_transparency(), rofi_view_temp_configure_notify(), rofi_view_trigger_action(), rofi_view_update(), rofi_view_window_update_size(), scrollbar_create(), scrollbar_draw(), selection_changed_callback(), textbox_blink(), textbox_create(), textbox_cursor(), textbox_cursor_end(), textbox_draw(), textbox_font(), textbox_get_desired_height(), textbox_get_desired_width(), textbox_get_estimated_height(), textbox_get_height(), textbox_initialize_font(), textbox_moveresize(), textbox_set_ellipsize(), textbox_sidebar_modes_trigger_action(), textbox_tab_stops(), textbox_text(), update_callback(), and vert_calculate_size().
Abstract structure holding internal state of a widget. Structure is elaborated in widget-internal.h
typedef widget *(* widget_find_mouse_target_cb) (widget *widget, WidgetType type, gint x, gint y) |
widget | The container widget itself |
type | The widget type searched for |
x | The X coordination of the mouse event relative to widget |
y | The Y coordination of the mouse event relative to widget |
This callback must only iterate over the children of a Widget, and return NULL if none of them is relevant.
typedef WidgetTriggerActionResult(* widget_trigger_action_cb) (widget *widget, guint action, gint x, gint y, void *user_data) |
widget | The target widget |
action | The action value (which enum it is depends on the widget type) |
x | The X coordination of the mouse event relative to widget |
y | The Y coordination of the mouse event relative to widget |
user_data | The data passed to widget_set_trigger_action_handler() |
This callback should handle the action if relevant, and returns whether it did or not.
Whether and how the action was handled
enum WidgetType |
Type of the widget. It is used to bubble events to the relevant widget.
WidgetTriggerActionResult widget_check_action | ( | widget * | wid, |
guint | action, | ||
gint | x, | ||
gint | y ) |
wid | The widget handle |
action | The action to trigger |
x | A pointer to the x coordinate of the click |
y | A pointer to the y coordinate of the click |
Trigger an action on widget. param x and param y are relative to param wid .
|
inlinestatic |
widget | Handle to widget |
Disable the widget.
Definition at line 170 of file widget.h.
References widget_set_enabled().
Referenced by listview_set_show_scrollbar(), rofi_view_add_widget(), rofi_view_reload_message_bar(), and rofi_view_set_overlay().
void widget_draw | ( | widget * | widget, |
cairo_t * | d ) |
widget | widget Handle to the widget |
d | The cairo object used to draw itself. |
Render the textbox.
Definition at line 135 of file widget.c.
References _widget::border, _widget::border_radius, RofiPadding::bottom, distance_get_linestyle(), distance_get_pixel(), _widget::draw, _widget::enabled, _widget::h, RofiPadding::left, _widget::margin, _widget::need_redraw, RofiPadding::right, ROFI_ORIENTATION_HORIZONTAL, ROFI_ORIENTATION_VERTICAL, rofi_theme_get_color(), rofi_theme_get_image(), RofiPadding::top, _widget::w, _widget::x, and _widget::y.
Referenced by barview_draw(), box_draw(), container_draw(), listview_draw(), and rofi_view_update().
|
inlinestatic |
widget | Handle to widget |
Enable the widget.
Definition at line 178 of file widget.h.
References widget_set_enabled().
Referenced by listview_set_show_scrollbar(), rofi_view_reload_message_bar(), and rofi_view_set_overlay().
gboolean widget_enabled | ( | widget * | widget | ) |
widget | Handle to widget |
Check if widget is enabled.
Definition at line 116 of file widget.c.
References _widget::enabled.
Referenced by listview_draw(), and listview_find_mouse_target().
widget * widget_find_mouse_target | ( | widget * | wid, |
WidgetType | type, | ||
gint | x, | ||
gint | y ) |
wid | The widget handle |
type | The type of the wanted widget |
x | The x coordinate of the mouse event |
y | The y coordinate of the mouse event |
Get the widget that should handle a mouse event.
Definition at line 510 of file widget.c.
References _widget::find_mouse_target, _widget::type, and WIDGET_TYPE_UNKNOWN.
Referenced by box_find_mouse_target(), container_find_mouse_target(), listview_find_mouse_target(), rofi_view_check_action(), rofi_view_handle_mouse_motion(), rofi_view_resolve_cursor(), and rofi_view_trigger_action().
void widget_free | ( | widget * | wid | ) |
wid | Handle to the widget |
Free the widget and all allocated memory.
Definition at line 425 of file widget.c.
References _widget::free, and _widget::name.
Referenced by __create_window(), box_free(), container_free(), listview_create(), listview_free(), listview_recompute_elements(), and rofi_view_free().
int widget_get_absolute_xpos | ( | widget * | wid | ) |
wid | The widget handle |
Get the absolute x-position on the root widget..
Definition at line 663 of file widget.c.
References _widget::parent, widget_get_absolute_xpos(), and _widget::x.
Referenced by widget_get_absolute_xpos().
int widget_get_absolute_ypos | ( | widget * | wid | ) |
wid | The widget handle |
Get the absolute y-position on the root widget..
Definition at line 673 of file widget.c.
References _widget::parent, widget_get_absolute_ypos(), and _widget::y.
Referenced by widget_get_absolute_ypos().
int widget_get_desired_height | ( | widget * | wid, |
const int | width ) |
wid | The widget handle |
width | The Widget width to get height for |
Get the desired height of this widget recursively.
Definition at line 644 of file widget.c.
References _widget::get_desired_height, and _widget::h.
Referenced by box_get_desired_height(), container_get_desired_height(), listview_create(), rofi_view_calculate_height(), selection_changed_callback(), update_callback(), and vert_calculate_size().
int widget_get_desired_width | ( | widget * | wid, |
const int | height ) |
wid | The widget handle |
height | The Widget height to get height for |
Get the desired width of this widget recursively.
Definition at line 653 of file widget.c.
References _widget::get_desired_width, and _widget::w.
Referenced by barview_draw(), box_get_desired_width(), and hori_calculate_size().
int widget_get_height | ( | widget * | widget | ) |
widget | The widget handle |
Definition at line 437 of file widget.c.
References _widget::get_height, and _widget::h.
Referenced by vert_calculate_size().
int widget_get_width | ( | widget * | widget | ) |
widget | The widget handle |
Definition at line 446 of file widget.c.
References _widget::get_width, and _widget::w.
Referenced by hori_calculate_size(), listview_draw(), and listview_resize().
int widget_get_x_pos | ( | widget * | widget | ) |
widget | The widget handle |
Definition at line 455 of file widget.c.
References _widget::x.
Referenced by listview_find_mouse_target().
int widget_get_y_pos | ( | widget * | widget | ) |
widget | The widget handle |
Definition at line 461 of file widget.c.
References _widget::y.
Referenced by listview_find_mouse_target().
int widget_intersect | ( | const widget * | widget, |
int | x, | ||
int | y ) |
widget | The widget to check |
x | The X position relative to parent window |
y | the Y position relative to parent window |
Check if x,y falls within the widget.
Definition at line 75 of file widget.c.
References _widget::h, _widget::w, _widget::x, and _widget::y.
Referenced by box_find_mouse_target(), container_find_mouse_target(), and listview_find_mouse_target().
gboolean widget_motion_notify | ( | widget * | wid, |
gint | x, | ||
gint | y ) |
wid | The widget handle |
x | The x coordinate of the mouse event |
y | The y coordinate of the mouse event |
Motion notify.
Definition at line 566 of file widget.c.
References _widget::motion_notify.
Referenced by rofi_view_handle_mouse_motion().
void widget_move | ( | widget * | widget, |
short | x, | ||
short | y ) |
widget | The widget to move |
x | The new X position relative to parent window |
y | The new Y position relative to parent window |
Moves the widget.
Definition at line 102 of file widget.c.
References _widget::x, and _widget::y.
Referenced by barview_draw(), container_update(), hori_calculate_size(), listview_draw(), listview_resize(), and vert_calculate_size().
gboolean widget_need_redraw | ( | widget * | wid | ) |
wid | The widget handle |
Check the flag indicating the widget needs to be redrawn.
Definition at line 500 of file widget.c.
References _widget::enabled, and _widget::need_redraw.
Referenced by rofi_view_update().
void widget_queue_redraw | ( | widget * | wid | ) |
wid | The widget handle |
Indicate that the widget needs to be redrawn. This is done by setting the redraw flag on the toplevel widget.
Definition at line 487 of file widget.c.
References _widget::need_redraw, and _widget::parent.
Referenced by icon_set_surface(), listview_nav_column_left_int(), listview_nav_column_right_int(), listview_nav_down_int(), listview_nav_left(), listview_nav_page_next_int(), listview_nav_page_prev_int(), listview_nav_right(), listview_nav_up_int(), listview_resize(), listview_set_num_elements(), listview_set_selected(), rofi_view_create(), rofi_view_error_dialog(), rofi_view_temp_configure_notify(), textbox_blink(), textbox_cursor(), textbox_cursor_end(), textbox_font(), textbox_moveresize(), textbox_set_ellipsize(), textbox_text(), widget_resize(), widget_set_enabled(), and widget_set_state().
void widget_resize | ( | widget * | widget, |
short | w, | ||
short | h ) |
widget | The widget toresize |
w | The new width |
h | The new height |
Resizes the widget.
Definition at line 87 of file widget.c.
References _widget::h, _widget::resize, _widget::w, and widget_queue_redraw().
Referenced by barview_draw(), container_update(), hori_calculate_size(), listview_draw(), listview_resize(), rofi_view_temp_configure_notify(), rofi_view_window_update_size(), and vert_calculate_size().
void widget_set_enabled | ( | widget * | widget, |
gboolean | enabled ) |
widget | Handle to widget |
enabled | The new state |
Disable the widget.
Definition at line 123 of file widget.c.
References _widget::enabled, _widget::parent, widget_queue_redraw(), and widget_update().
Referenced by widget_disable(), and widget_enable().
void widget_set_trigger_action_handler | ( | widget * | wid, |
widget_trigger_action_cb | cb, | ||
void * | cb_data ) |
wid | The widget handle |
cb | The widget trigger action callback |
cb_data | the user data to pass to callback |
Override the widget trigger action handler on widget.
Definition at line 557 of file widget.c.
References _widget::trigger_action, and _widget::trigger_action_cb_data.
Referenced by listview_recompute_elements(), and rofi_view_add_widget().
void widget_set_type | ( | widget * | widget, |
WidgetType | type ) |
widget | Handle to widget |
type | The widget type. |
Set the widget type.
Definition at line 109 of file widget.c.
References _widget::type.
Referenced by listview_create_row().
WidgetTriggerActionResult widget_trigger_action | ( | widget * | wid, |
guint | action, | ||
gint | x, | ||
gint | y ) |
wid | The widget handle |
action | The action to trigger |
x | A pointer to the x coordinate of the click |
y | A pointer to the y coordinate of the click |
Trigger an action on widget. param x and param y are relative to param wid .
Definition at line 546 of file widget.c.
References _widget::trigger_action, and _widget::trigger_action_cb_data.
Referenced by rofi_view_trigger_action().
void widget_update | ( | widget * | widget | ) |
widget | The widget handle |
Update the widget, and its parent recursively. This should be called when size of widget changes.
Definition at line 477 of file widget.c.
References _widget::update.
Referenced by box_add(), box_resize(), box_update(), container_add(), container_resize(), icon_resize(), textbox_text(), and widget_set_enabled().
void widget_xy_to_relative | ( | widget * | widget, |
gint * | x, | ||
gint * | y ) |
widget | The widget handle |
x | A pointer to the absolute X coordinates |
y | A pointer to the absolute Y coordinates |
Will modify param x and param y to make them relative to param widget .
Definition at line 468 of file widget.c.
References _widget::parent, widget_xy_to_relative(), _widget::x, and _widget::y.
Referenced by rofi_view_check_action(), rofi_view_handle_mouse_motion(), rofi_view_trigger_action(), and widget_xy_to_relative().