libxputty  0.1
A damn tiny abstraction Layer to create X11 window/widgets with cairo surfaces
xknob.h File Reference
#include "xputty.h"
Include dependency graph for xknob.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define XKNOB_H_
 

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 More...
 
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 More...
 

Macro Definition Documentation

◆ XKNOB_H_

#define XKNOB_H_

Definition at line 24 of file xknob.h.

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 }

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, Widget_t::scale, and transparent_draw().

◆ 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 }

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, Widget_t::scale, and transparent_draw().

Func_t::leave_callback
xevfunc leave_callback
Definition: xwidget.h:83
Func_t::enter_callback
xevfunc enter_callback
Definition: xwidget.h:82
Resize_t::gravity
Gravity gravity
Definition: xwidget.h:192
_draw_knob_image
void _draw_knob_image(void *w_, void *user_data)
_draw_knob_image - internal draw the knob to the buffer
Definition: xknob_private.c:51
create_widget
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:268
transparent_draw
void transparent_draw(void *wid, void *user_data)
transparent_draw - copy parent surface to child surface you usaualy didn't need to call this,...
Definition: xwidget.c:469
Func_t::expose_callback
xevfunc expose_callback
Definition: xwidget.h:80
Widget_t::adj
Adjustment_t * adj
Definition: xwidget.h:334
Widget_t::scale
Resize_t scale
Definition: xwidget.h:356
_knob_released
void _knob_released(void *w_, void *button_, void *user_data)
_knob_released - redraw the slider when buttob released
Definition: xknob_private.c:141
_draw_knob
void _draw_knob(void *w_, void *user_data)
_draw_knob - internal draw the knob to the buffer
Definition: xknob_private.c:57
Widget_t::app
Xputty * app
Definition: xwidget.h:300
Widget_t
Widget_t - struct to hold the basic Widget_t info.
Definition: xwidget.h:298
ASPECT
@ ASPECT
Definition: xwidget.h:167
Func_t::button_release_callback
evfunc button_release_callback
Definition: xwidget.h:94
Widget_t::adj_y
Adjustment_t * adj_y
Definition: xwidget.h:332
Widget_t::func
Func_t func
Definition: xwidget.h:310
add_adjustment
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
Widget_t::label
const char * label
Definition: xwidget.h:326
CL_CONTINUOS
@ CL_CONTINUOS
Definition: xadjustment.h:49