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

Go to the source code of this file.

Functions

Widget_tadd_knob (Widget_t *parent, const char *label, int x, int y, int width, int height)
 add_knob - add a knob to a Widget_t connect to func.value_changed_callback to implement your actions use set_adjustment(w->adj_y, . . ) to set the range you need
 
Widget_tadd_image_knob (Widget_t *parent, const char *label, int x, int y, int width, int height)
 add_image_knob - add a knob from image to a Widget_t without value display on the knob connect to func.value_changed_callback to implement your actions use set_adjustment(w->adj_y, . . ) to set the range you need
 

Function Documentation

◆ add_image_knob()

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

add_image_knob - add a knob from image to a Widget_t without value display on the knob connect to func.value_changed_callback to implement your actions use set_adjustment(w->adj_y, . . ) to set the range you need

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

Definition at line 41 of file xknob.c.

42 {
43
44 Widget_t *wid = create_widget(parent->app, parent, x, y, width, height);
45 wid->label = label;
46 wid->adj_y = add_adjustment(wid,0.0, 0.0, 0.0, 1.0,0.01, CL_CONTINUOS);
47 wid->adj = wid->adj_y;
48 wid->scale.gravity = ASPECT;
53 return wid;
54}
evfunc button_release_callback
Definition xwidget.h:101
xevfunc expose_callback
Definition xwidget.h:85
xevfunc leave_callback
Definition xwidget.h:88
xevfunc enter_callback
Definition xwidget.h:87
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
Adjustment_t * adj_y
Definition xwidget.h:495
Adjustment_t * adj
Definition xwidget.h:497
const char * label
Definition xwidget.h:463
Func_t func
Definition xwidget.h:481
Xputty * app
Definition xwidget.h:465
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
void _draw_knob_image(void *w_, void *user_data)
_draw_knob_image - internal draw the knob to the buffer
void _knob_released(void *w_, void *button_, void *user_data)
_knob_released - redraw the slider when buttob released
void os_transparent_draw(void *w_, void *user_data)
os_transparent_draw - Draw the Widget_t to the back buffer
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
@ ASPECT
Definition xwidget.h:322

References _draw_knob_image(), _knob_released(), add_adjustment(), Widget_t::adj, Widget_t::adj_y, Widget_t::app, ASPECT, Func_t::button_release_callback, CL_CONTINUOS, create_widget(), 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.

Referenced by add_my_image_knob().

◆ add_knob()

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

add_knob - add a knob to a Widget_t connect to func.value_changed_callback to implement your actions use set_adjustment(w->adj_y, . . ) to set the range you need

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

Definition at line 26 of file xknob.c.

27 {
28
29 Widget_t *wid = create_widget(parent->app, parent, x, y, width, height);
30 wid->label = label;
31 wid->adj_y = add_adjustment(wid,0.0, 0.0, 0.0, 1.0,0.01, CL_CONTINUOS);
32 wid->adj = wid->adj_y;
33 wid->scale.gravity = ASPECT;
38 return wid;
39}
void _draw_knob(void *w_, void *user_data)
_draw_knob - internal draw the knob to the buffer

References _draw_knob(), _knob_released(), add_adjustment(), Widget_t::adj, Widget_t::adj_y, Widget_t::app, ASPECT, Func_t::button_release_callback, CL_CONTINUOS, create_widget(), 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.

Referenced by add_keyboard_knob(), add_my_knob(), and add_my_value_knob().