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

Go to the source code of this file.

Macros

#define XLABEL_PRIVATE_H_
 

Functions

void _draw_label (void *w_, void *user_data)
 _draw_label - internal draw the label to the buffer More...
 

Macro Definition Documentation

◆ XLABEL_PRIVATE_H_

#define XLABEL_PRIVATE_H_

Definition at line 24 of file xlabel_private.h.

Function Documentation

◆ _draw_label()

void _draw_label ( void *  w_,
void *  user_data 
)

_draw_label - internal draw the label to the buffer

Parameters
*w_- void pointer to the Widget_t label
*user_data- void pointer to attached user_data
Returns
void

Definition at line 25 of file xlabel_private.c.

25  {
26  Widget_t *w = (Widget_t*)w_;
27  XWindowAttributes attrs;
28  XGetWindowAttributes(w->app->dpy, (Window)w->widget, &attrs);
29  int width = attrs.width;
30  int height = attrs.height;
31 
32  cairo_text_extents_t extents;
34  cairo_set_font_size (w->crb, w->app->normal_font/w->scale.ascale);
35  cairo_text_extents(w->crb,w->label , &extents);
36 
37  cairo_move_to (w->crb, (width*0.5)-(extents.width/2), height-(extents.height/4));
38  cairo_show_text(w->crb, w->label);
39  cairo_new_path (w->crb);
40 }

References Widget_t::app, Resize_t::ascale, Widget_t::crb, Xputty::dpy, get_color_state(), Widget_t::label, Xputty::normal_font, Widget_t::scale, use_text_color_scheme(), and Widget_t::widget.

use_text_color_scheme
void use_text_color_scheme(Widget_t *w, Color_state st)
use_text_color_scheme - use text Colors to paint on Widget_t
Definition: xcolor.c:199
get_color_state
Color_state get_color_state(Widget_t *wid)
get_color_state - get the Color_state to use in relation to the Widget_t state
Definition: xcolor.c:155
Xputty::normal_font
int normal_font
Definition: xputty.h:191
Widget_t::crb
cairo_t * crb
Definition: xwidget.h:318
Widget_t::scale
Resize_t scale
Definition: xwidget.h:356
Widget_t::app
Xputty * app
Definition: xwidget.h:300
Xputty::dpy
Display * dpy
Definition: xputty.h:181
Resize_t::ascale
float ascale
Definition: xwidget.h:214
Widget_t::widget
Window widget
Definition: xwidget.h:302
Widget_t
Widget_t - struct to hold the basic Widget_t info.
Definition: xwidget.h:298
Widget_t::label
const char * label
Definition: xwidget.h:326