libxputty 0.1
Loading...
Searching...
No Matches
Functions
xvaluedisplay.c File Reference

Go to the source code of this file.

Functions

Widget_tadd_popup_spinbox (Widget_t *parent, const char *label, int x, int y, int width, int height)
 add_popup_spinbox - add a popup spinbox to a valuedisplay this is implemented in the valuedisplay via double click
 
Widget_tadd_valuedisplay (Widget_t *parent, const char *label, int x, int y, int width, int height)
 add_valuedisplay - add a valuedisplay widget to a Widget_t
 

Function Documentation

◆ add_popup_spinbox()

Widget_t * add_popup_spinbox ( Widget_t parent,
const char *  label,
int  x,
int  y,
int  width,
int  height 
)

add_popup_spinbox - add a popup spinbox to a valuedisplay this is implemented in the valuedisplay via double click

Parameters
*parent- pointer to the Widget_t valuedisplay
*label- Label to show on the valuedisplay stub
x,y,width,height- the position/geometry to create the spinbox the spinbox will popup above the valuedisplay anyway
Returns
Widget_t* - pointer to the Widget_t valuedisplay struct

Definition at line 26 of file xvaluedisplay.c.

27 {
28 int x1, y1;
29 os_translate_coords(parent, parent->widget, os_get_root_window(parent->app, IS_WIDGET), 0, 0, &x1, &y1);
30 Widget_t *wid = create_window(parent->app, os_get_root_window(parent->app, IS_WIDGET), x1, y1, width +40, height+20);
32 os_set_transient_for_hint(parent, wid);
33 //wid->func.expose_callback = _draw_spinbox;
34 wid->flags |= IS_POPUP;
35 wid->scale.gravity = NONE;
36 wid->parent = parent;
37 childlist_add_child(parent->childlist, wid);
38 Widget_t *view_port = create_widget(wid->app, wid, 0 , 0, width+20, height+20);
40 Widget_t *buttons = create_widget(wid->app, wid, width+20 , 0, 20, height+20);
42 buttons->scale.gravity = NORTHWEST;
43 buttons->flags &= ~USE_TRANSPARENCY;
44 buttons->flags |= NO_AUTOREPEAT | NO_PROPAGATE;
46
47 return wid;
48}
evfunc button_release_callback
Definition xwidget.h:101
xevfunc expose_callback
Definition xwidget.h:85
Gravity gravity
Definition xwidget.h:347
Widget_t - struct to hold the basic Widget_t info.
Definition xwidget.h:457
Resize_t scale
Definition xwidget.h:525
void * parent
Definition xwidget.h:471
Window widget
Definition xwidget.h:469
Childlist_t * childlist
Definition xwidget.h:499
long long flags
Definition xwidget.h:461
Func_t func
Definition xwidget.h:481
Xputty * app
Definition xwidget.h:465
void childlist_add_child(Childlist_t *childlist, Widget_t *child)
childlist_add_child - internal use to add a child to the Childlist_t You usually didn't need to cal...
Definition xchildlist.c:42
void _draw_buttons(void *w_, void *user_data)
_draw_buttons - draw the spinbox buttons
void _draw_spinbox(void *w_, void *user_data)
_draw_spinbox - draw a spinbox expose call
void _buttons_released(void *w_, void *button, void *user_data)
_buttons_released - set the spinbox value on button releases
Window os_get_root_window(Xputty *main, int flag)
os_get_root_window - get a pointer to the root window (desktop)
void os_translate_coords(Widget_t *w, Window from_window, Window to_window, int from_x, int from_y, int *to_x, int *to_y)
os_translate_coords - get x,y related to destination Window
void os_set_transient_for_hint(Widget_t *parent, Widget_t *w)
os_set_ transient_for_hint - set a Widget_t transient to a other Widget_t only work on linux,...
void os_set_window_attrb(Widget_t *w)
os_set_window_attrb - set the attribute mask to a Widget_t only work on linux, stub on Windows
Widget_t * create_widget(Xputty *app, Widget_t *win, int x, int y, int width, int height)
*create_widget - create a widget A Widget_t could only be created as child of a other Widget_t To...
Definition xwidget.c:265
Widget_t * create_window(Xputty *app, Window win, int x, int y, int width, int height)
*create_window - create a Window You need to create as least minimun one Window to get started....
Definition xwidget.c:163
@ NONE
Definition xwidget.h:328
@ NORTHWEST
Definition xwidget.h:300
@ IS_WIDGET
Definition xwidget.h:388
@ NO_AUTOREPEAT
Definition xwidget.h:408
@ NO_PROPAGATE
Definition xwidget.h:416
@ IS_POPUP
Definition xwidget.h:392

References _buttons_released(), _draw_buttons(), _draw_spinbox(), Widget_t::app, Func_t::button_release_callback, Widget_t::childlist, childlist_add_child(), create_widget(), create_window(), Func_t::expose_callback, Widget_t::flags, Widget_t::func, Resize_t::gravity, IS_POPUP, IS_WIDGET, NO_AUTOREPEAT, NO_PROPAGATE, NONE, NORTHWEST, os_get_root_window(), os_set_transient_for_hint(), os_set_window_attrb(), os_translate_coords(), Widget_t::parent, Widget_t::scale, and Widget_t::widget.

Referenced by add_valuedisplay().

◆ add_valuedisplay()

Widget_t * add_valuedisplay ( Widget_t parent,
const char *  label,
int  x,
int  y,
int  width,
int  height 
)

add_valuedisplay - add a valuedisplay widget to a Widget_t

Parameters
*parent- pointer to the Widget_t request the valuedisplay
*label- Label to show on the valuedisplay
x,y,width,height- the position/geometry to create the valuedisplay
Returns
Widget_t* - pointer to the Widget_t valuedisplay struct

Definition at line 50 of file xvaluedisplay.c.

51 {
52
53 Widget_t *wid = create_widget(parent->app, parent, x, y, width, height);
54 add_popup_spinbox(wid, label, x, y, width, height);
55 wid->label = label;
56 wid->adj_y = add_adjustment(wid,0.0, 0.0, 0.0, 1.0, 0.01, CL_CONTINUOS);
57 wid->adj = wid->adj_y;
58 wid->scale.gravity = CENTER;
63 return wid;
64}
evfunc double_click_callback
Definition xwidget.h:102
xevfunc leave_callback
Definition xwidget.h:88
xevfunc enter_callback
Definition xwidget.h:87
Adjustment_t * adj_y
Definition xwidget.h:495
Adjustment_t * adj
Definition xwidget.h:497
const char * label
Definition xwidget.h:463
Adjustment_t * add_adjustment(Widget_t *w, float std_value, float value, float min_value, float max_value, float step, CL_type type)
*add_adjustment - adding a adjustment to a Widget_t
Definition xadjustment.c:25
@ CL_CONTINUOS
Definition xadjustment.h:49
Widget_t * add_popup_spinbox(Widget_t *parent, const char *label, int x, int y, int width, int height)
add_popup_spinbox - add a popup spinbox to a valuedisplay this is implemented in the valuedisplay via...
void _draw_valuedisplay(void *w_, void *user_data)
_draw_valuedisplay - draw a valuedisplay on expose call
void _popup_spinbox(void *w_, void *button, void *user_data)
_popup_spinbox - show a spinbox above a valuedisplay
void os_transparent_draw(void *w_, void *user_data)
os_transparent_draw - Draw the Widget_t to the back buffer
@ CENTER
Definition xwidget.h:320

References _draw_valuedisplay(), _popup_spinbox(), add_adjustment(), add_popup_spinbox(), Widget_t::adj, Widget_t::adj_y, Widget_t::app, CENTER, CL_CONTINUOS, create_widget(), Func_t::double_click_callback, Func_t::enter_callback, Func_t::expose_callback, Widget_t::func, Resize_t::gravity, Widget_t::label, Func_t::leave_callback, os_transparent_draw(), and Widget_t::scale.