2016-01-09 15:22:09 +00:00
|
|
|
#ifndef ROFI_WIDGET_H
|
|
|
|
#define ROFI_WIDGET_H
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup Widgets Widgets
|
|
|
|
*
|
|
|
|
* Generic Widget class
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
2016-03-24 21:13:19 +00:00
|
|
|
typedef struct
|
2016-01-09 15:22:09 +00:00
|
|
|
{
|
|
|
|
/** X position relative to parent */
|
2016-06-26 13:48:12 +00:00
|
|
|
short x;
|
2016-01-09 15:22:09 +00:00
|
|
|
/** Y position relative to parent */
|
2016-06-26 13:48:12 +00:00
|
|
|
short y;
|
2016-01-09 15:22:09 +00:00
|
|
|
/** Width of the widget */
|
2016-06-26 13:48:12 +00:00
|
|
|
short w;
|
2016-01-09 15:22:09 +00:00
|
|
|
/** Height of the widget */
|
2016-06-26 13:48:12 +00:00
|
|
|
short h;
|
|
|
|
/** enabled or not */
|
|
|
|
gboolean enabled;
|
2016-01-09 15:22:09 +00:00
|
|
|
} Widget;
|
|
|
|
|
|
|
|
/** Macro to get widget from an implementation (e.g. textbox/scrollbar) */
|
2016-01-09 18:25:03 +00:00
|
|
|
#define WIDGET( a ) ( a != NULL ? &( a->widget ) : NULL )
|
2016-01-09 15:22:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @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
|
|
|
|
*/
|
2016-01-09 18:25:03 +00:00
|
|
|
int widget_intersect ( const Widget *widget, int x, int y );
|
2016-01-09 15:22:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @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.
|
|
|
|
*/
|
2016-01-09 18:25:03 +00:00
|
|
|
void widget_move ( Widget *widget, short x, short y );
|
2016-01-09 15:22:09 +00:00
|
|
|
|
2016-06-26 13:48:12 +00:00
|
|
|
gboolean widget_enabled ( Widget *widget );
|
|
|
|
void widget_disable ( Widget *widget );
|
|
|
|
void widget_enable ( Widget *widget );
|
|
|
|
|
2016-01-09 15:22:09 +00:00
|
|
|
/*@}*/
|
|
|
|
#endif // ROFI_WIDGET_H
|