rofi  1.6.1
widget-internal.h
Go to the documentation of this file.
1 /*
2  * rofi
3  *
4  * MIT/X11 License
5  * Copyright © 2013-2017 Qball Cow <qball@gmpclient.org>
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining
8  * a copy of this software and associated documentation files (the
9  * "Software"), to deal in the Software without restriction, including
10  * without limitation the rights to use, copy, modify, merge, publish,
11  * distribute, sublicense, and/or sell copies of the Software, and to
12  * permit persons to whom the Software is furnished to do so, subject to
13  * the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be
16  * included in all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25  *
26  */
27 
28 #ifndef WIDGET_INTERNAL_H
29 #define WIDGET_INTERNAL_H
30 
31 #include "theme.h"
35 struct _widget
36 {
40  short x;
42  short y;
44  short w;
46  short h;
56 
58  gboolean enabled;
60  gboolean expand;
62  gboolean end;
64  struct _widget *parent;
66  gboolean need_redraw;
68  int ( *get_width )( struct _widget * );
70  int ( *get_height )( struct _widget * );
72  void ( *draw )( struct _widget *widget, cairo_t *draw );
74  void ( *resize )( struct _widget *, short, short );
76  void ( *update )( struct _widget * );
77 
79  gboolean ( *motion_notify )( struct _widget *, gint x, gint y );
80 
81  int ( *get_desired_height )( struct _widget * );
82  int ( *get_desired_width )( struct _widget * );
83 
84  void ( *set_state ) ( struct _widget *, const char * );
85 
92 
94  void ( *free )( struct _widget *widget );
95 
97  char *name;
98  const char *state;
99 };
100 
110 void widget_init ( widget *wid, widget *parent, WidgetType type, const char *name );
111 
118 void widget_set_state ( widget *widget, const char *state );
119 
127 int widget_padding_get_left ( const widget *wid );
128 
136 int widget_padding_get_right ( const widget *wid );
137 
145 int widget_padding_get_top ( const widget *wid );
146 
154 int widget_padding_get_bottom ( const widget *wid );
155 
163 int widget_padding_get_remaining_width ( const widget *wid );
179 int widget_padding_get_padding_height ( const widget *wid );
187 int widget_padding_get_padding_width ( const widget *wid );
188 #endif // WIDGET_INTERNAL_H
struct _widget widget
Definition: widget.h:51
WidgetType
Definition: widget.h:57
WidgetTriggerActionResult(* widget_trigger_action_cb)(widget *widget, guint action, gint x, gint y, void *user_data)
Definition: widget.h:112
widget *(* widget_find_mouse_target_cb)(widget *widget, WidgetType type, gint x, gint y)
Definition: widget.h:99
void(* update)(struct _widget *)
int(* get_desired_height)(struct _widget *)
gboolean end
const char * state
RofiPadding border
widget_find_mouse_target_cb find_mouse_target
gboolean(* motion_notify)(struct _widget *, gint x, gint y)
gboolean enabled
gboolean need_redraw
widget_trigger_action_cb trigger_action
void * trigger_action_cb_data
RofiPadding padding
RofiPadding margin
RofiPadding border_radius
RofiPadding def_border_radius
char * name
void(* resize)(struct _widget *, short, short)
void(* free)(struct _widget *widget)
void(* set_state)(struct _widget *, const char *)
RofiPadding def_margin
int(* get_width)(struct _widget *)
int(* get_height)(struct _widget *)
void(* draw)(struct _widget *widget, cairo_t *draw)
int(* get_desired_width)(struct _widget *)
RofiPadding def_border
struct _widget * parent
gboolean expand
RofiPadding def_padding
WidgetType type
int widget_padding_get_remaining_width(const widget *wid)
Definition: widget.c:523
void widget_init(widget *wid, widget *parent, WidgetType type, const char *name)
Definition: widget.c:74
void widget_set_state(widget *widget, const char *state)
Definition: widget.c:93
int widget_padding_get_padding_width(const widget *wid)
Definition: widget.c:544
int widget_padding_get_left(const widget *wid)
Definition: widget.c:482
int widget_padding_get_right(const widget *wid)
Definition: widget.c:492
int widget_padding_get_padding_height(const widget *wid)
Definition: widget.c:537
int widget_padding_get_top(const widget *wid)
Definition: widget.c:502
int widget_padding_get_bottom(const widget *wid)
Definition: widget.c:512
int widget_padding_get_remaining_height(const widget *wid)
Definition: widget.c:530