summaryrefslogtreecommitdiffstats
path: root/include/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'include/widgets')
-rw-r--r--include/widgets/box.h12
-rw-r--r--include/widgets/container.h4
-rw-r--r--include/widgets/icon.h6
-rw-r--r--include/widgets/listview.h73
-rw-r--r--include/widgets/scrollbar.h27
-rw-r--r--include/widgets/textbox.h191
-rw-r--r--include/widgets/widget-internal.h154
-rw-r--r--include/widgets/widget.h144
8 files changed, 309 insertions, 302 deletions
diff --git a/include/widgets/box.h b/include/widgets/box.h
index fa455f4f..d2a0d72f 100644
--- a/include/widgets/box.h
+++ b/include/widgets/box.h
@@ -28,17 +28,17 @@
#ifndef ROFI_HBOX_H
#define ROFI_HBOX_H
-#include "widget.h"
#include "rofi-types.h"
+#include "widget.h"
/**
* @defgroup box box
* @ingroup widget
*
* Widget used to pack multiple widgets either horizontally or vertically.
- * It supports packing widgets horizontally or vertically. Child widgets are always
- * expanded to the maximum size in the opposite direction of the packing direction.
- * e.g. vertically packed widgets use the full box width.
+ * It supports packing widgets horizontally or vertically. Child widgets are
+ * always expanded to the maximum size in the opposite direction of the packing
+ * direction. e.g. vertically packed widgets use the full box width.
*
* @{
*/
@@ -55,7 +55,7 @@ typedef struct _box box;
*
* @returns a newly created box, free with #widget_free
*/
-box * box_create ( widget *parent, const char *name, RofiOrientation type );
+box *box_create(widget *parent, const char *name, RofiOrientation type);
/**
* @param box Handle to the box widget.
@@ -64,6 +64,6 @@ box * box_create ( widget *parent, const char *name, RofiOrientation type );
*
* Add a widget to the box.
*/
-void box_add ( box *box, widget *child, gboolean expand );
+void box_add(box *box, widget *child, gboolean expand);
/**@}*/
#endif // ROFI_HBOX_H
diff --git a/include/widgets/container.h b/include/widgets/container.h
index 33e8fd7a..15dd225f 100644
--- a/include/widgets/container.h
+++ b/include/widgets/container.h
@@ -49,7 +49,7 @@ typedef struct _container container;
*
* @returns a newly created container, free with #widget_free
*/
-container * container_create ( widget *parent, const char *name );
+container *container_create(widget *parent, const char *name);
/**
* @param container Handle to the container widget.
@@ -57,6 +57,6 @@ container * container_create ( widget *parent, const char *name );
*
* Add a widget to the container.
*/
-void container_add ( container *container, widget *child );
+void container_add(container *container, widget *child);
/**@}*/
#endif // ROFI_CONTAINER_H
diff --git a/include/widgets/icon.h b/include/widgets/icon.h
index 99793c8c..e0da5c7f 100644
--- a/include/widgets/icon.h
+++ b/include/widgets/icon.h
@@ -49,19 +49,19 @@ typedef struct _icon icon;
*
* @returns a newly created icon, free with #widget_free
*/
-icon * icon_create ( widget *parent, const char *name );
+icon *icon_create(widget *parent, const char *name);
/**
* @param icon The icon widget handle.
* @param size The size of the icon.
*
*/
-void icon_set_size ( widget *icon, const int size );
+void icon_set_size(widget *icon, const int size);
/**
* @param icon The icon widget handle.
* @param surf The surface to display.
*/
-void icon_set_surface ( icon *icon, cairo_surface_t *surf );
+void icon_set_surface(icon *icon, cairo_surface_t *surf);
/**@}*/
#endif // ROFI_ICON_H
diff --git a/include/widgets/listview.h b/include/widgets/listview.h
index 5e3410c0..9b551f2b 100644
--- a/include/widgets/listview.h
+++ b/include/widgets/listview.h
@@ -46,29 +46,31 @@ typedef struct _listview listview;
/**
* The scrolling type used in the list view
*/
-typedef enum
-{
- /** Flip through the pages. */
- LISTVIEW_SCROLL_PER_PAGE,
- /** keep selected item centered */
- LISTVIEW_SCROLL_CONTINIOUS
+typedef enum {
+ /** Flip through the pages. */
+ LISTVIEW_SCROLL_PER_PAGE,
+ /** keep selected item centered */
+ LISTVIEW_SCROLL_CONTINIOUS
} ScrollType;
/**
* @param tb The textbox to set
* @param entry The position of the textbox
* @param udata User data
- * @param type The textbox font style to apply to this entry (normal, selected, alternative row)
+ * @param type The textbox font style to apply to this entry (normal, selected,
+ * alternative row)
* @param full If true Set both text and style.
*
* Update callback, this is called to set the value of each (visible) element.
*/
-typedef void ( *listview_update_callback )( textbox *tb, icon *ico, unsigned int entry, void *udata, TextBoxFontType *type, gboolean full );
+typedef void (*listview_update_callback)(textbox *tb, icon *ico,
+ unsigned int entry, void *udata,
+ TextBoxFontType *type, gboolean full);
/**
* Callback when a element is activated.
*/
-typedef void ( *listview_mouse_activated_cb )( listview *, gboolean, void * );
+typedef void (*listview_mouse_activated_cb)(listview *, gboolean, void *);
/**
* @param parent The widget's parent.
@@ -80,7 +82,9 @@ typedef void ( *listview_mouse_activated_cb )( listview *, gboolean, void * );
*
* @returns a new listview
*/
-listview *listview_create ( widget *parent, const char *name, listview_update_callback cb, void *udata, unsigned int eh, gboolean reverse );
+listview *listview_create(widget *parent, const char *name,
+ listview_update_callback cb, void *udata,
+ unsigned int eh, gboolean reverse);
/**
* @param lv The listview handle
@@ -88,7 +92,7 @@ listview *listview_create ( widget *parent, const char *name, listview_update_ca
*
* Set the maximum number of elements to display.
*/
-void listview_set_num_elements ( listview *lv, unsigned int rows );
+void listview_set_num_elements(listview *lv, unsigned int rows);
/**
* @param lv The listview handle
@@ -96,7 +100,7 @@ void listview_set_num_elements ( listview *lv, unsigned int rows );
*
* Select the row, if selected > the number of rows, it selects the last one.
*/
-void listview_set_selected ( listview *lv, unsigned int selected );
+void listview_set_selected(listview *lv, unsigned int selected);
/**
* @param lv The listview handle
@@ -105,7 +109,7 @@ void listview_set_selected ( listview *lv, unsigned int selected );
*
* @returns the selected row.
*/
-unsigned int listview_get_selected ( listview *lv );
+unsigned int listview_get_selected(listview *lv);
/**
* @param lv The listview handle
@@ -113,14 +117,14 @@ unsigned int listview_get_selected ( listview *lv );
* Move the selection one row up.
* - Wrap around.
*/
-void listview_nav_up ( listview *lv );
+void listview_nav_up(listview *lv);
/**
* @param lv listview handle.
*
* Move the selection one row down.
* - Wrap around.
*/
-void listview_nav_down ( listview *lv );
+void listview_nav_down(listview *lv);
/**
* @param lv The listview handle
*
@@ -128,14 +132,14 @@ void listview_nav_down ( listview *lv );
* - No wrap around.
* - Do not move to top row when at start.
*/
-void listview_nav_right ( listview *lv );
+void listview_nav_right(listview *lv);
/**
* @param lv The listview handle
*
* Move the selection one column to the left.
* - No wrap around.
*/
-void listview_nav_left ( listview *lv );
+void listview_nav_left(listview *lv);
/**
* @param lv The listview handle
*
@@ -143,7 +147,7 @@ void listview_nav_left ( listview *lv );
* - No wrap around.
* - Clip at top/bottom
*/
-void listview_nav_page_next ( listview *lv );
+void listview_nav_page_next(listview *lv);
/**
* @param lv The listview handle
@@ -152,7 +156,7 @@ void listview_nav_page_next ( listview *lv );
* - No wrap around.
* - Clip at top/bottom
*/
-void listview_nav_page_prev ( listview *lv );
+void listview_nav_page_prev(listview *lv);
/**
* @param lv Handler to the listview object
@@ -160,14 +164,14 @@ void listview_nav_page_prev ( listview *lv );
*
* Hide the scrollbar.
*/
-void listview_set_show_scrollbar ( listview *lv, gboolean enabled );
+void listview_set_show_scrollbar(listview *lv, gboolean enabled);
/**
* @param lv Handler to the listview object
* @param width Width in pixels
*
* Set the width of the scrollbar
*/
-void listview_set_scrollbar_width ( listview *lv, unsigned int width );
+void listview_set_scrollbar_width(listview *lv, unsigned int width);
/**
* @param lv Handler to the listview object
@@ -175,14 +179,15 @@ void listview_set_scrollbar_width ( listview *lv, unsigned int width );
*
* Set cycle mode. On last entry go to first.
*/
-void listview_set_cycle ( listview *lv, gboolean cycle );
+void listview_set_cycle(listview *lv, gboolean cycle);
/**
* @param lv Handler to the listview object
* @param type ScrollType
*
- * Set the scroll type ScrollType::LISTVIEW_SCROLL_CONTINIOUS or ScrollType::LISTVIEW_SCROLL_PER_PAGE
+ * Set the scroll type ScrollType::LISTVIEW_SCROLL_CONTINIOUS or
+ * ScrollType::LISTVIEW_SCROLL_PER_PAGE
*/
-void listview_set_scroll_type ( listview *lv, ScrollType type );
+void listview_set_scroll_type(listview *lv, ScrollType type);
/**
* @param lv Handler to the listview object
@@ -191,21 +196,23 @@ void listview_set_scroll_type ( listview *lv, ScrollType type );
*
* Set the mouse activated callback.
*/
-void listview_set_mouse_activated_cb ( listview *lv, listview_mouse_activated_cb cb, void *udata );
+void listview_set_mouse_activated_cb(listview *lv,
+ listview_mouse_activated_cb cb,
+ void *udata);
/**
* @param lv Handler to the listview object
* @param enable boolean to enable/disable multi-select
*
* Enable,disable multi-select.
*/
-void listview_set_multi_select ( listview *lv, gboolean enable );
+void listview_set_multi_select(listview *lv, gboolean enable);
/**
* @param lv Handler to the listview object.
* @param num_lines the maximum number of lines to display.
*
* Set the maximum number of lines to display.
*/
-void listview_set_num_lines ( listview *lv, unsigned int num_lines );
+void listview_set_num_lines(listview *lv, unsigned int num_lines);
/**
* @param lv Handler to the listview object.
@@ -214,7 +221,7 @@ void listview_set_num_lines ( listview *lv, unsigned int num_lines );
*
* @returns get the number of lines to display.
*/
-unsigned int listview_get_num_lines ( listview *lv );
+unsigned int listview_get_num_lines(listview *lv);
/**
* @param lv Handler to the listview object.
@@ -223,14 +230,14 @@ unsigned int listview_get_num_lines ( listview *lv );
*
* @returns get fixed-height.
*/
-gboolean listview_get_fixed_num_lines ( listview *lv );
+gboolean listview_get_fixed_num_lines(listview *lv);
/**
* @param lv Handler to the listview object.
*
* Set fixed num lines mode.
*/
-void listview_set_fixed_num_lines ( listview *lv );
+void listview_set_fixed_num_lines(listview *lv);
/**
* @param lv Handler to the listview object.
@@ -238,14 +245,14 @@ void listview_set_fixed_num_lines ( listview *lv );
*
* Set the maximum number of lines to display.
*/
-void listview_set_max_lines ( listview *lv, unsigned int max_lines );
+void listview_set_max_lines(listview *lv, unsigned int max_lines);
/**
* @param lv Handler to the listview object.
*
* Set ellipsize mode.
*/
-void listview_toggle_ellipsizing ( listview *lv );
+void listview_toggle_ellipsizing(listview *lv);
/**
* @param lv Handler to the listview object.
@@ -253,7 +260,7 @@ void listview_toggle_ellipsizing ( listview *lv );
* Set ellipsize mode to start.
*/
-void listview_set_ellipsize_start ( listview *lv );
+void listview_set_ellipsize_start(listview *lv);
/** @} */
#endif // ROFI_LISTVIEW_H
diff --git a/include/widgets/scrollbar.h b/include/widgets/scrollbar.h
index b9bb9915..ce3d8d7d 100644
--- a/include/widgets/scrollbar.h
+++ b/include/widgets/scrollbar.h
@@ -27,9 +27,9 @@
#ifndef ROFI_SCROLLBAR_H
#define ROFI_SCROLLBAR_H
-#include <cairo.h>
-#include "widgets/widget.h"
#include "widgets/widget-internal.h"
+#include "widgets/widget.h"
+#include <cairo.h>
/**
* @defgroup Scrollbar Scrollbar
@@ -40,13 +40,12 @@
/**
* Internal structure for the scrollbar.
*/
-typedef struct _scrollbar
-{
- widget widget;
- unsigned int length;
- unsigned int pos;
- unsigned int pos_length;
- RofiDistance width;
+typedef struct _scrollbar {
+ widget widget;
+ unsigned int length;
+ unsigned int pos;
+ unsigned int pos_length;
+ RofiDistance width;
} scrollbar;
/**
@@ -57,7 +56,7 @@ typedef struct _scrollbar
*
* @returns the scrollbar object.
*/
-scrollbar *scrollbar_create ( widget *parent, const char *name );
+scrollbar *scrollbar_create(widget *parent, const char *name);
/**
* @param sb scrollbar object
@@ -65,7 +64,7 @@ scrollbar *scrollbar_create ( widget *parent, const char *name );
*
* set the length of the handle relative to the max value of bar.
*/
-void scrollbar_set_handle_length ( scrollbar *sb, unsigned int pos_length );
+void scrollbar_set_handle_length(scrollbar *sb, unsigned int pos_length);
/**
* @param sb scrollbar object
@@ -73,7 +72,7 @@ void scrollbar_set_handle_length ( scrollbar *sb, unsigned int pos_length );
*
* set the position of the handle relative to the set max value of bar.
*/
-void scrollbar_set_handle ( scrollbar *sb, unsigned int pos );
+void scrollbar_set_handle(scrollbar *sb, unsigned int pos);
/**
* @param sb scrollbar object
@@ -81,7 +80,7 @@ void scrollbar_set_handle ( scrollbar *sb, unsigned int pos );
*
* set the max value of the bar.
*/
-void scrollbar_set_max_value ( scrollbar *sb, unsigned int max );
+void scrollbar_set_max_value(scrollbar *sb, unsigned int max);
/**
* @param sb scrollbar object
@@ -89,7 +88,7 @@ void scrollbar_set_max_value ( scrollbar *sb, unsigned int max );
*
* Calculate the position of the click relative to the max value of bar
*/
-guint scrollbar_scroll_get_line ( const scrollbar *sb, int y );
+guint scrollbar_scroll_get_line(const scrollbar *sb, int y);
/**@}*/
#endif // ROFI_SCROLLBAR_H
diff --git a/include/widgets/textbox.h b/include/widgets/textbox.h
index b009953d..3386557c 100644
--- a/include/widgets/textbox.h
+++ b/include/widgets/textbox.h
@@ -28,14 +28,14 @@
#ifndef ROFI_TEXTBOX_H
#define ROFI_TEXTBOX_H
-#include <xkbcommon/xkbcommon.h>
-#include <pango/pango.h>
+#include "keyb.h"
+#include "widgets/widget-internal.h"
+#include "widgets/widget.h"
+#include <cairo.h>
#include <pango/pango-fontmap.h>
+#include <pango/pango.h>
#include <pango/pangocairo.h>
-#include <cairo.h>
-#include "widgets/widget.h"
-#include "widgets/widget-internal.h"
-#include "keyb.h"
+#include <xkbcommon/xkbcommon.h>
/**
* @defgroup Textbox Textbox
@@ -44,83 +44,80 @@
* @{
*/
-/** Cache to hold font descriptions. This it to avoid having to lookup each time. */
-typedef struct TBFontConfig
-{
- /** Font description */
- PangoFontDescription *pfd;
- /** Font metrics */
- PangoFontMetrics *metrics;
- /** height */
- double height;
-}TBFontConfig;
+/** Cache to hold font descriptions. This it to avoid having to lookup each
+ * time. */
+typedef struct TBFontConfig {
+ /** Font description */
+ PangoFontDescription *pfd;
+ /** Font metrics */
+ PangoFontMetrics *metrics;
+ /** height */
+ double height;
+} TBFontConfig;
/**
* Internal structure of a textbox widget.
* TODO make this internal to textbox
*/
-typedef struct
-{
- widget widget;
- unsigned long flags;
- short cursor;
- char *text;
- const char *placeholder;
- int show_placeholder;
- PangoLayout *layout;
- int tbft;
- int markup;
- int changed;
+typedef struct {
+ widget widget;
+ unsigned long flags;
+ short cursor;
+ char *text;
+ const char *placeholder;
+ int show_placeholder;
+ PangoLayout *layout;
+ int tbft;
+ int markup;
+ int changed;
- int blink;
- guint blink_timeout;
+ int blink;
+ guint blink_timeout;
- double yalign;
- double xalign;
+ double yalign;
+ double xalign;
- TBFontConfig *tbfc;
+ TBFontConfig *tbfc;
- PangoEllipsizeMode emode;
- //
- const char *theme_name;
+ PangoEllipsizeMode emode;
+ //
+ const char *theme_name;
} textbox;
/**
* Flags for configuring textbox behaviour and looks during creation.
*/
-typedef enum
-{
- 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,
+typedef enum {
+ 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,
} TextboxFlags;
/**
* Flags indicating current state of the textbox.
*/
-typedef enum
-{
- /** Normal */
- NORMAL = 0,
- /** Text in box is urgent. */
- URGENT = 1,
- /** Text in box is active. */
- ACTIVE = 2,
- /** Text in box is selected. */
- SELECTED = 4,
- /** Text in box has pango markup. */
- MARKUP = 8,
+typedef enum {
+ /** Normal */
+ NORMAL = 0,
+ /** Text in box is urgent. */
+ URGENT = 1,
+ /** Text in box is active. */
+ ACTIVE = 2,
+ /** Text in box is selected. */
+ SELECTED = 4,
+ /** Text in box has pango markup. */
+ MARKUP = 8,
- /** Text is on an alternate row */
- ALT = 16,
- /** Render font highlighted (inverted colors.) */
- HIGHLIGHT = 32,
- /** Mask for alternate and highlighted */
- FMOD_MASK = ( ALT | HIGHLIGHT ),
- /** Mask of bits indicating state */
- STATE_MASK = ~( SELECTED | MARKUP | ALT | HIGHLIGHT )
+ /** Text is on an alternate row */
+ ALT = 16,
+ /** Render font highlighted (inverted colors.) */
+ HIGHLIGHT = 32,
+ /** Mask for alternate and highlighted */
+ FMOD_MASK = (ALT | HIGHLIGHT),
+ /** Mask of bits indicating state */
+ STATE_MASK = ~(SELECTED | MARKUP | ALT | HIGHLIGHT)
} TextBoxFontType;
/**
@@ -138,15 +135,16 @@ typedef enum
* free with #widget_free
* @returns a new #textbox
*/
-textbox* textbox_create ( widget *parent, WidgetType type, const char *name, TextboxFlags flags,
- TextBoxFontType tbft, const char *text, double xalign, double yalign );
+textbox *textbox_create(widget *parent, WidgetType type, const char *name,
+ TextboxFlags flags, TextBoxFontType tbft,
+ const char *text, double xalign, double yalign);
/**
* @param tb Handle to the textbox
* @param tbft The style of font to render.
*
* Set the font render style.
*/
-void textbox_font ( textbox *tb, TextBoxFontType tbft );
+void textbox_font(textbox *tb, TextBoxFontType tbft);
/**
* @param tb Handle to the textbox
@@ -154,7 +152,7 @@ void textbox_font ( textbox *tb, TextBoxFontType tbft );
*
* Set the text to show. Cursor is moved to end (if visible)
*/
-void textbox_text ( textbox *tb, const char *text );
+void textbox_text(textbox *tb, const char *text);
/**
* @param tb Handle to the textbox
@@ -164,16 +162,16 @@ void textbox_text ( textbox *tb, const char *text );
*
* @return TRUE if action was taken.
*/
-int textbox_keybinding ( textbox *tb, KeyBindingAction action );
+int textbox_keybinding(textbox *tb, KeyBindingAction action);
/**
* @param tb Handle to the textbox
* @param pad The text to insert
* @param 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
+ * The text should be one insert from a keypress.. the first gunichar is
+ * validated to be (or not) control return TRUE if inserted
*/
-gboolean textbox_append_text ( textbox *tb, const char *pad, const int pad_len );
+gboolean textbox_append_text(textbox *tb, const char *pad, const int pad_len);
/**
* @param tb Handle to the textbox
@@ -181,7 +179,7 @@ gboolean textbox_append_text ( textbox *tb, const char *pad, const int pad_len )
*
* Set the cursor position (string index)
*/
-void textbox_cursor ( textbox *tb, int pos );
+void textbox_cursor(textbox *tb, int pos);
/**
* @param tb Handle to the textbox
@@ -191,19 +189,20 @@ void textbox_cursor ( textbox *tb, int pos );
*
* Insert the string str at position pos.
*/
-void textbox_insert ( textbox *tb, const int char_pos, const char *str, const int slen );
+void textbox_insert(textbox *tb, const int char_pos, const char *str,
+ const int slen);
/**
* Setup the cached fonts. This is required to do
* before any of the textbox_ functions is called.
* Clean with textbox_cleanup()
*/
-void textbox_setup ( void );
+void textbox_setup(void);
/**
* Cleanup the allocated colors and fonts by textbox_setup().
*/
-void textbox_cleanup ( void );
+void textbox_cleanup(void);
/**
* @param tb Handle to the textbox
@@ -212,7 +211,7 @@ void textbox_cleanup ( void );
*
* @returns the height of the textbox in pixels.
*/
-int textbox_get_height ( const textbox *tb );
+int textbox_get_height(const textbox *tb);
/**
* @param tb Handle to the textbox
@@ -221,7 +220,7 @@ int textbox_get_height ( const textbox *tb );
*
* @returns the height of the string in pixels.
*/
-int textbox_get_font_height ( const textbox *tb );
+int textbox_get_font_height(const textbox *tb);
/**
* @param tb Handle to the textbox
@@ -230,27 +229,27 @@ int textbox_get_font_height ( const textbox *tb );
*
* @returns the width of the string in pixels.
*/
-int textbox_get_font_width ( const textbox *tb );
+int textbox_get_font_width(const textbox *tb);
/**
* Estimate the width of a character.
*
* @returns the width of a character in pixels.
*/
-double textbox_get_estimated_char_width ( void );
+double textbox_get_estimated_char_width(void);
/**
* Estimate the width of a 0.
*
* @returns the width of a 0 in pixels.
*/
-double textbox_get_estimated_ch ( void );
+double textbox_get_estimated_ch(void);
/**
* Estimate the height of a character.
*
* @returns the height of a character in pixels.
*/
-double textbox_get_estimated_char_height ( void );
+double textbox_get_estimated_char_height(void);
/**
* @param tb Handle to the textbox
@@ -259,7 +258,7 @@ double textbox_get_estimated_char_height ( void );
*
* Remove dlen bytes from position pos.
*/
-void textbox_delete ( textbox *tb, int pos, int dlen );
+void textbox_delete(textbox *tb, int pos, int dlen);
/**
* @param tb Handle to the textbox
@@ -271,32 +270,32 @@ void textbox_delete ( textbox *tb, int pos, int dlen );
* Move and resize the textbox.
* TODO remove for #widget_resize and #widget_move
*/
-void textbox_moveresize ( textbox *tb, int x, int y, int w, int h );
+void textbox_moveresize(textbox *tb, int x, int y, int w, int h);
/**
* @param tb Handle to the textbox
* @param eh The number of rows to display
*
- * Get the (estimated) with of a character, can be used to calculate window width.
- * This includes padding.
+ * Get the (estimated) with of a character, can be used to calculate window
+ * width. This includes padding.
*
* @returns the estimated width of a character.
*/
-int textbox_get_estimated_height ( const textbox *tb, int eh );
+int textbox_get_estimated_height(const textbox *tb, int eh);
/**
* @param font The name of the font used.
* @param p The new default PangoContext
*
* Set the default pango context (with font description) for all textboxes.
*/
-void textbox_set_pango_context ( const char *font, PangoContext *p );
+void textbox_set_pango_context(const char *font, PangoContext *p);
/**
* @param tb Handle to the textbox
* @param list New pango attributes
*
* Sets list as active pango attributes.
*/
-void textbox_set_pango_attributes ( textbox *tb, PangoAttrList *list );
+void textbox_set_pango_attributes(textbox *tb, PangoAttrList *list);
/**
* @param tb Handle to the textbox
@@ -305,14 +304,14 @@ void textbox_set_pango_attributes ( textbox *tb, PangoAttrList *list );
*
* @returns the pango attributes
*/
-PangoAttrList *textbox_get_pango_attributes ( textbox *tb );
+PangoAttrList *textbox_get_pango_attributes(textbox *tb);
/**
* @param tb Handle to the textbox
*
* @returns the visible text.
*/
-const char *textbox_get_visible_text ( const textbox *tb );
+const char *textbox_get_visible_text(const textbox *tb);
/**
* @param wid The handle to the textbox.
*
@@ -320,14 +319,14 @@ const char *textbox_get_visible_text ( const textbox *tb );
*
* @returns the desired width of the textbox.
*/
-int textbox_get_desired_width ( widget *wid );
+int textbox_get_desired_width(widget *wid);
/**
* @param tb Handle to the textbox
*
* Move the cursor to the end of the string.
*/
-void textbox_cursor_end ( textbox *tb );
+void textbox_cursor_end(textbox *tb);
/**
* @param tb Handle to the textbox
@@ -335,6 +334,6 @@ void textbox_cursor_end ( textbox *tb );
*
* Set the ellipsizing mode used on the string.
*/
-void textbox_set_ellipsize ( textbox *tb, PangoEllipsizeMode mode );
+void textbox_set_ellipsize(textbox *tb, PangoEllipsizeMode mode);
/**@}*/
-#endif //ROFI_TEXTBOX_H
+#endif // ROFI_TEXTBOX_H
diff --git a/include/widgets/widget-internal.h b/include/widgets/widget-internal.h
index ece8094a..159c80f2 100644
--- a/include/widgets/widget-internal.h
+++ b/include/widgets/widget-internal.h
@@ -32,73 +32,72 @@
/**
* Data structure holding the internal state of the Widget
*/
-struct _widget
-{
- /** The type of the widget */
- WidgetType type;
- /** X position relative to parent */
- short x;
- /** Y position relative to parent */
- short y;
- /** Width of the widget */
- short w;
- /** Height of the widget */
- short h;
- /** RofiPadding */
- RofiPadding def_margin;
- RofiPadding def_padding;
- RofiPadding def_border;
- RofiPadding def_border_radius;
- RofiPadding margin;
- RofiPadding padding;
- RofiPadding border;
- RofiPadding border_radius;
-
- /** Cursor that is set when the widget is hovered */
- RofiCursorType cursor_type;
-
- /** enabled or not */
- gboolean enabled;
- /** Expand the widget when packed */
- gboolean expand;
- /** Place widget at end of parent */
- gboolean end;
- /** Parent widget */
- struct _widget *parent;
- /** Internal */
- gboolean need_redraw;
- /** get width of widget implementation function */
- int ( *get_width )( struct _widget * );
- /** get height of widget implementation function */
- int ( *get_height )( struct _widget * );
- /** draw widget implementation function */
- void ( *draw )( struct _widget *widget, cairo_t *draw );
- /** resize widget implementation function */
- void ( *resize )( struct _widget *, short, short );
- /** update widget implementation function */
- void ( *update )( struct _widget * );
-
- /** Handle mouse motion, used for dragging */
- gboolean ( *motion_notify )( struct _widget *, gint x, gint y );
-
- int ( *get_desired_height )( struct _widget * );
- int ( *get_desired_width )( struct _widget * );
-
- void ( *set_state ) ( struct _widget *, const char * );
-
- /** widget find_mouse_target callback */
- widget_find_mouse_target_cb find_mouse_target;
- /** widget trigger_action callback */
- widget_trigger_action_cb trigger_action;
- /** user data for find_mouse_target and trigger_action callback */
- void *trigger_action_cb_data;
-
- /** Free widget callback */
- void ( *free )( struct _widget *widget );
-
- /** Name of widget (used for theming) */
- char *name;
- const char *state;
+struct _widget {
+ /** The type of the widget */
+ WidgetType type;
+ /** X position relative to parent */
+ short x;
+ /** Y position relative to parent */
+ short y;
+ /** Width of the widget */
+ short w;
+ /** Height of the widget */
+ short h;
+ /** RofiPadding */
+ RofiPadding def_margin;
+ RofiPadding def_padding;
+ RofiPadding def_border;
+ RofiPadding def_border_radius;
+ RofiPadding margin;
+ RofiPadding padding;
+ RofiPadding border;
+ RofiPadding border_radius;
+
+ /** Cursor that is set when the widget is hovered */
+ RofiCursorType cursor_type;
+
+ /** enabled or not */
+ gboolean enabled;
+ /** Expand the widget when packed */
+ gboolean expand;
+ /** Place widget at end of parent */
+ gboolean end;
+ /** Parent widget */
+ struct _widget *parent;
+ /** Internal */
+ gboolean need_redraw;
+ /** get width of widget implementation function */
+ int (*get_width)(struct _widget *);
+ /** get height of widget implementation function */
+ int (*get_height)(struct _widget *);
+ /** draw widget implementation function */
+ void (*draw)(struct _widget *widget, cairo_t *draw);
+ /** resize widget implementation function */
+ void (*resize)(struct _widget *, short, short);
+ /** update widget implementation function */
+ void (*update)(struct _widget *);
+
+ /** Handle mouse motion, used for dragging */
+ gboolean (*motion_notify)(struct _widget *, gint x, gint y);
+
+ int (*get_desired_height)(struct _widget *);
+ int (*get_desired_width)(struct _widget *);
+
+ void (*set_state)(struct _widget *, const char *);
+
+ /** widget find_mouse_target callback */
+ widget_find_mouse_target_cb find_mouse_target;
+ /** widget trigger_action callback */
+ widget_trigger_action_cb trigger_action;
+ /** user data for find_mouse_target and trigger_action callback */
+ void *trigger_action_cb_data;
+
+ /** Free widget callback */
+ void (*free)(struct _widget *widget);
+
+ /** Name of widget (used for theming) */
+ char *name;
+ const char *state;
};
/**
@@ -110,7 +109,8 @@ struct _widget
* Initializes the widget structure.
*
*/
-void widget_init ( widget *wid, widget *parent, WidgetType type, const char *name );
+void widget_init(widget *wid, widget *parent, WidgetType type,
+ const char *name);
/**
* @param widget The widget handle.
@@ -118,7 +118,7 @@ void widget_init ( widget *wid, widget *parent, WidgetType type, const char *nam
*
* Set the state of the widget.
*/
-void widget_set_state ( widget *widget, const char *state );
+void widget_set_state(widget *widget, const char *state);
/**
* @param wid The widget handle.
@@ -127,7 +127,7 @@ void widget_set_state ( widget *widget, const char *state );
*
* @returns the left padding in pixels.
*/
-int widget_padding_get_left ( const widget *wid );
+int widget_padding_get_left(const widget *wid);
/**
* @param wid The widget handle.
@@ -136,7 +136,7 @@ int widget_padding_get_left ( const widget *wid );
*
* @returns the right padding in pixels.
*/
-int widget_padding_get_right ( const widget *wid );
+int widget_padding_get_right(const widget *wid);
/**
* @param wid The widget handle.
@@ -145,7 +145,7 @@ int widget_padding_get_right ( const widget *wid );
*
* @returns the top padding in pixels.
*/
-int widget_padding_get_top ( const widget *wid );
+int widget_padding_get_top(const widget *wid);
/**
* @param wid The widget handle.
@@ -154,7 +154,7 @@ int widget_padding_get_top ( con