summaryrefslogtreecommitdiffstats
path: root/include/widget.h
blob: 4271fdb2f721fd75d4a58f594d9b5b0bc7db6003 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef ROFI_WIDGET_H
#define ROFI_WIDGET_H

/**
 * @defgroup Widgets Widgets
 *
 * Generic Widget class
 *
 * @{
 */
typedef struct _Widget
{
    /** 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;
} Widget;

/** Macro to get widget from an implementation (e.g. textbox/scrollbar) */
#define WIDGET( a )    ( a != NULL ? &( a->widget ) : NULL )

/**
 * @param widget The widget to check
 * @param x The X position relative to parent window
 * @param y the Y position relative to parent window
 *
 * Check if x,y falls within the widget.
 *
 * @return TRUE if x,y falls within the widget
 */
int widget_intersect ( const Widget *widget, int x, int y );

/**
 * @param widget The widget to move
 * @param x The new X position relative to parent window
 * @param y The new Y position relative to parent window
 *
 * Moves the widget.
 */
void widget_move ( Widget *widget, short x, short y );

/*@}*/
#endif // ROFI_WIDGET_H