libxputty  0.1
A damn tiny abstraction Layer to create X11 window/widgets with cairo surfaces
xslider.c
Go to the documentation of this file.
1 /*
2  * 0BSD
3  *
4  * BSD Zero Clause License
5  *
6  * Copyright (c) 2019 Hermann Meyer
7  *
8  * Permission to use, copy, modify, and/or distribute this software for any
9  * purpose with or without fee is hereby granted.
10 
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13  * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  *
19  */
20 
21 
22 #include "xslider.h"
23 #include "xslider_private.h"
24 
25 
26 Widget_t* add_vslider(Widget_t *parent, const char * label,
27  int x, int y, int width, int height) {
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 }
40 
41 Widget_t* add_hslider(Widget_t *parent, const char * label,
42  int x, int y, int width, int height) {
43 
44  Widget_t *wid = create_widget(parent->app, parent, x, y, width, height);
45  wid->label = label;
46  wid->adj_x = add_adjustment(wid,0.0, 0.0, 0.0, 1.0,0.01, CL_CONTINUOS);
47  wid->adj = wid->adj_x;
48  wid->scale.gravity = ASPECT;
53  return wid;
54 }
Func_t::leave_callback
xevfunc leave_callback
Definition: xwidget.h:83
Func_t::enter_callback
xevfunc enter_callback
Definition: xwidget.h:82
_slider_released
void _slider_released(void *w_, void *button_, void *user_data)
_slider_released - redraw the slider when button released
Definition: xslider_private.c:187
Resize_t::gravity
Gravity gravity
Definition: xwidget.h:192
add_vslider
Widget_t * add_vslider(Widget_t *parent, const char *label, int x, int y, int width, int height)
add_vslider - add a vertical slider to a Widget_t connect to func.value_changed_callback to implement...
Definition: xslider.c:26
_draw_vslider
void _draw_vslider(void *w_, void *user_data)
_draw_vslider - internal draw the slider to the buffer
Definition: xslider_private.c:47
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
add_hslider
Widget_t * add_hslider(Widget_t *parent, const char *label, int x, int y, int width, int height)
add_hslider - add a horizontal slider to a Widget_t connect to func.value_changed_callback to impleme...
Definition: xslider.c:41
xslider_private.h
Widget_t::adj
Adjustment_t * adj
Definition: xwidget.h:334
Widget_t::scale
Resize_t scale
Definition: xwidget.h:356
Widget_t::app
Xputty * app
Definition: xwidget.h:300
xslider.h
_draw_hslider
void _draw_hslider(void *w_, void *user_data)
_draw_hslider - internal draw the slider to the buffer
Definition: xslider_private.c:117
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
Widget_t::adj_x
Adjustment_t * adj_x
Definition: xwidget.h:330
CL_CONTINUOS
@ CL_CONTINUOS
Definition: xadjustment.h:49