Cairo-Dock  3.4.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
cairo-dock-data-renderer.h File Reference

Data Structures

struct  _CairoDataRendererAttribute
 Generic DataRenderer attributes structure. The attributes of any implementation of a DataRenderer will derive from this class. More...
 
struct  _CairoDataRendererInterface
 Interface of a DataRenderer. More...
 
struct  _CairoDataRenderer
 Generic DataRenderer. Any implementation of a DataRenderer will derive from this class. More...
 

Macros

#define cairo_dock_get_icon_data_renderer(pIcon)
 
#define CAIRO_DATA_RENDERER(r)
 
#define cairo_data_renderer_get_data(pRenderer)
 
#define CAIRO_DATA_RENDERER_ATTRIBUTE(pAttr)
 
#define cairo_data_renderer_get_nb_values(pRenderer)
 
#define cairo_data_renderer_get_min_value(pRenderer, i)
 
#define cairo_data_renderer_get_max_value(pRenderer, i)
 
#define cairo_data_renderer_get_value(pRenderer, i, t)
 
#define cairo_data_renderer_get_current_value(pRenderer, i)
 
#define cairo_data_renderer_get_previous_value(pRenderer, i)
 
#define cairo_data_renderer_get_normalized_value(pRenderer, i, t)
 
#define cairo_data_renderer_get_normalized_current_value(pRenderer, i)
 
#define cairo_data_renderer_get_normalized_previous_value(pRenderer, i)
 
#define cairo_data_renderer_get_normalized_current_value_with_latency(pRenderer, i)
 
#define cairo_data_renderer_format_value_full(pRenderer, i, cBuffer)
 
#define cairo_data_renderer_format_value(pRenderer, i)
 

Typedefs

typedef void(* CairoDataRendererFormatValueFunc )(CairoDataRenderer *pRenderer, int iNumValue, gchar *cFormatBuffer, int iBufferLength, gpointer data)
 Prototype of a function used to format the values in a short readable format (to be displayed as quick-info).
 

Functions

CairoDockGLFontcairo_dock_get_default_data_renderer_font (void)
 
void cairo_dock_add_new_data_renderer_on_icon (Icon *pIcon, GldiContainer *pContainer, CairoDataRendererAttribute *pAttribute)
 
void cairo_dock_render_new_data_on_icon (Icon *pIcon, GldiContainer *pContainer, cairo_t *pCairoContext, double *pNewValues)
 
void cairo_dock_remove_data_renderer_on_icon (Icon *pIcon)
 
void cairo_dock_reload_data_renderer_on_icon (Icon *pIcon, GldiContainer *pContainer)
 
void cairo_dock_resize_data_renderer_history (Icon *pIcon, int iNewMemorySize)
 
void cairo_dock_refresh_data_renderer (Icon *pIcon, GldiContainer *pContainer)
 

Detailed Description

This class defines the Data Renderer structure and API. A Data Renderer is a generic way to display a set of values on an icon. For instance you could represent the (cpu, memory, temperature) evolution over the time.

You bind a Data Renderer with /ref cairo_dock_add_new_data_renderer_on_icon. You can specify some attributes of the Data Renderer, especially the model that will be used; currently, 3 models are available: "gauge", "graph" and "progressbar".

You then feed the Data Renderer with /ref cairo_dock_render_new_data_on_icon, providing it the correct number of values.

To remove the Data Renderer from an icon, use /ref cairo_dock_remove_data_renderer_on_icon.

Macro Definition Documentation

#define cairo_dock_get_icon_data_renderer (   pIcon)

Structure Access

#define CAIRO_DATA_RENDERER (   r)

Get the elementary part of a Data Renderer

Parameters
ra high level data renderer
Returns
a CairoDataRenderer*
#define cairo_data_renderer_get_data (   pRenderer)

Get the data of a Data Renderer

Parameters
pRenderera data renderer
Returns
a CairoDataToRenderer*
#define CAIRO_DATA_RENDERER_ATTRIBUTE (   pAttr)

Get the elementary part of a Data Renderer Attribute

Parameters
pAttra high level data renderer attribute
Returns
a CairoDataRendererAttribute*
#define cairo_data_renderer_get_nb_values (   pRenderer)

Get the number of values a DataRenderer displays. It's also the size of any of its arrays.

Parameters
pRenderera data renderer
Returns
number of values a DataRenderer displays
#define cairo_data_renderer_get_min_value (   pRenderer,
 
)

Data Access Get the lower range of the i-th value.

Parameters
pRenderera data renderer
ithe number of the value
Returns
a double
#define cairo_data_renderer_get_max_value (   pRenderer,
 
)

Get the upper range of the i-th value.

Parameters
pRenderera data renderer
ithe number of the value
Returns
a double
#define cairo_data_renderer_get_value (   pRenderer,
  i,
 
)

Get the i-th value at the time t.

Parameters
pRenderera data renderer
ithe number of the value
tthe time (in number of steps)
Returns
a double
#define cairo_data_renderer_get_current_value (   pRenderer,
 
)

Get the current i-th value.

Parameters
pRenderera data renderer
ithe number of the value
Returns
a double
#define cairo_data_renderer_get_previous_value (   pRenderer,
 
)

Get the previous i-th value.

Parameters
pRenderera data renderer
ithe number of the value
Returns
a double
#define cairo_data_renderer_get_normalized_value (   pRenderer,
  i,
 
)

Get the normalized i-th value (between 0 and 1) at the time t.

Parameters
pRenderera data renderer
ithe number of the value
tthe time (in number of steps)
Returns
a double in [0,1]
#define cairo_data_renderer_get_normalized_current_value (   pRenderer,
 
)

Get the normalized current i-th value (between 0 and 1).

Parameters
pRenderera data renderer
ithe number of the value
Returns
a double in [0,1]
#define cairo_data_renderer_get_normalized_previous_value (   pRenderer,
 
)

Get the normalized previous i-th value (between 0 and 1).

Parameters
pRenderera data renderer
ithe number of the value
Returns
a double in [0,1]
#define cairo_data_renderer_get_normalized_current_value_with_latency (   pRenderer,
 
)

Get the normalized current i-th value (between 0 and 1), taking into account the latency of the smooth movement.

Parameters
pRenderera data renderer
ithe number of the value
Returns
a double in [0,1]
#define cairo_data_renderer_format_value_full (   pRenderer,
  i,
  cBuffer 
)

Data Format Write a value in a readable text format.

Parameters
pRenderera data renderer
ithe number of the value
cBuffera buffer where to write
#define cairo_data_renderer_format_value (   pRenderer,
 
)

Write a value in a readable text format in the renderer text buffer.

Parameters
pRenderera data renderer
ithe number of the value

Function Documentation

CairoDockGLFont* cairo_dock_get_default_data_renderer_font ( void  )

Renderer manipulation Get the default GLX font for Data Renderer. It can render strings of digits from 0 to 9. Don't destroy it.

Returns
the default GLX font
void cairo_dock_add_new_data_renderer_on_icon ( Icon pIcon,
GldiContainer pContainer,
CairoDataRendererAttribute pAttribute 
)

Add a Data Renderer on an icon. If the icon already has a Data Renderer, it is replaced by the new one, keeping the history alive.

Parameters
pIconthe icon
pContainerthe icon's container
pAttributeattributes defining the Renderer
void cairo_dock_render_new_data_on_icon ( Icon pIcon,
GldiContainer pContainer,
cairo_t *  pCairoContext,
double *  pNewValues 
)

Draw the current values associated with the Renderer on the icon.

Parameters
pIconthe icon
pContainerthe icon's container
pCairoContexta drawing context on the icon
pNewValuesa set a new values (must be of the size defined on the creation of the Renderer)
void cairo_dock_remove_data_renderer_on_icon ( Icon pIcon)

Remove the Data Renderer of an icon. All the allocated ressources will be freed.

Parameters
pIconthe icon
void cairo_dock_reload_data_renderer_on_icon ( Icon pIcon,
GldiContainer pContainer 
)

Reload the Data Renderer of an icon, keeping the history and the attributes. This is intended to be used when the icon size changes.

Parameters
pIconthe icon
pContainerthe icon's container
void cairo_dock_resize_data_renderer_history ( Icon pIcon,
int  iNewMemorySize 
)

Resize the history of a DataRenderer of an icon, that is to say change the number of previous values that are remembered by the DataRenderer.

Parameters
pIconthe icon
iNewMemorySizethe new size of history
void cairo_dock_refresh_data_renderer ( Icon pIcon,
GldiContainer pContainer 
)

Redraw the DataRenderer of an icon, with the current values.

Parameters
pIconthe icon
pContainerthe icon's container