libxputty 0.1
Loading...
Searching...
No Matches
Functions
xtabbox.h File Reference

Go to the source code of this file.

Functions

Widget_ttabbox_add_tab (Widget_t *tabbox, const char *label)
 tabbox_add_tab - add a tab to a tabbox Widget_t
 
Widget_tadd_tabbox (Widget_t *parent, const char *label, int x, int y, int width, int height)
 add_tabbox - add a tabbox to a Widget_t
 
void tabbox_remove_tab (Widget_t *tabbox, int tab)
 tabbox_remove_tab - remove a tab from a tabbox Widget_t
 

Function Documentation

◆ add_tabbox()

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

add_tabbox - add a tabbox to a Widget_t

Parameters
*parent- pointer to the Widget_t request the tabbox
*label- the label of the tabbox
x,y,width,height- the position/geometry to create the tabbox
Returns
Widget_t* - pointer to the Widget_t tabbox struct

Definition at line 42 of file xtabbox.c.

43 {
44
45 Widget_t *wid = create_widget(parent->app, parent, x, y, width, height);
46 wid->label = label;
47 wid->scale.gravity = CENTER;
48 wid->adj_y = add_adjustment(wid,0.0, 0.0, 0.0, -1.0,1.0, CL_NONE);
49 wid->adj = wid->adj_y;
51 //wid->func.button_press_callback = _tab_button_pressed;
53 //wid->func.map_notify_callback = _tabbox_mapped_callback;
54 return wid;
55}
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
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_NONE
Definition xadjustment.h:47
void _draw_tabbox(void *w_, void *user_data)
_draw_tabbox - draw the tabbox on expose call
void _tab_button_released(void *w_, void *button_, void *user_data)
_tab_button_released - select the tab to show (hide all other)
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
@ CENTER
Definition xwidget.h:320

References _draw_tabbox(), _tab_button_released(), add_adjustment(), Widget_t::adj, Widget_t::adj_y, Widget_t::app, Func_t::button_release_callback, CENTER, CL_NONE, create_widget(), Func_t::expose_callback, Widget_t::func, Resize_t::gravity, Widget_t::label, and Widget_t::scale.

◆ tabbox_add_tab()

Widget_t * tabbox_add_tab ( Widget_t tabbox,
const char *  label 
)

tabbox_add_tab - add a tab to a tabbox Widget_t

Parameters
*tabbox- pointer to the tabbox Widget_t the tab should added to
*label- the label of the tab
Returns
Widget_t* - pointer to the Widget_t tab struct

Definition at line 26 of file xtabbox.c.

26 {
27 Metrics_t metrics;
28 os_get_window_metrics(tabbox, &metrics);
29 int width = metrics.width;
30 int height = metrics.height;
31 Widget_t *wid = create_widget(tabbox->app,tabbox, 4, 20, width-8, height-24);
32 wid->scale.gravity = NORTHWEST;
33 wid->label = label;
35 //wid->func.map_notify_callback = _tab_mapped_callback;
36 float max_value = tabbox->adj->max_value+1.0;
37 set_adjustment(tabbox->adj,0.0, max_value, 0.0, max_value,1.0, CL_NONE);
38 adj_set_value(tabbox->adj,0.0);
39 return wid;
40}
float max_value
Definition xadjustment.h:92
Metrics_t - struct to receive window size, position & visibility Pass this struct to os_get_window_...
void adj_set_value(Adjustment_t *adj, float value)
adj_set_value - set the current value to the Adjustment_t
void set_adjustment(Adjustment_t *adj, float std_value, float value, float min_value, float max_value, float step, CL_type type)
*set_adjustment - set a new range to a existing Adjustment_t or create if it not exists yet
Definition xadjustment.c:80
void _draw_tab(void *w_, void *user_data)
_draw_tab - draw a single tab on expose call
void os_get_window_metrics(Widget_t *w, Metrics_t *metrics)
os_get_window_metrics - Get the Merics_t struct related to a Widget_t
@ NORTHWEST
Definition xwidget.h:300

References _draw_tab(), Widget_t::adj, adj_set_value(), Widget_t::app, CL_NONE, create_widget(), Func_t::expose_callback, Widget_t::func, Resize_t::gravity, Metrics_t::height, Widget_t::label, Adjustment_t::max_value, NORTHWEST, os_get_window_metrics(), Widget_t::scale, set_adjustment(), and Metrics_t::width.

◆ tabbox_remove_tab()

void tabbox_remove_tab ( Widget_t tabbox,
int  tab 
)

tabbox_remove_tab - remove a tab from a tabbox Widget_t

Parameters
*tabbox- pointer to the tabbox Widget_t the tab should removed from
tab- the number of the tab

Definition at line 57 of file xtabbox.c.

57 {
58 int elem = tabbox->childlist->elem;
59 if (tab > elem) return;
60 Widget_t *wid = tabbox->childlist->childs[tab];
61 destroy_widget(wid, tabbox->app);
62 float max_value = tabbox->adj->max_value-1.0;
63 set_adjustment(tabbox->adj,0.0, max_value, 0.0, max_value,1.0, CL_NONE);
64}
Widget_t ** childs
Definition xchildlist.h:51
Childlist_t * childlist
Definition xwidget.h:499
void destroy_widget(Widget_t *w, Xputty *main)
destroy_widget - destroy a widget When a Widget_t receive a destroy_widget() call,...
Definition xwidget.c:86

References Widget_t::adj, Widget_t::app, Widget_t::childlist, Childlist_t::childs, CL_NONE, destroy_widget(), Childlist_t::elem, Adjustment_t::max_value, and set_adjustment().