diff --git a/src/lib/aqdiagram/graph/w_graph.c b/src/lib/aqdiagram/graph/w_graph.c index b27fed8..b2879cf 100644 --- a/src/lib/aqdiagram/graph/w_graph.c +++ b/src/lib/aqdiagram/graph/w_graph.c @@ -22,6 +22,10 @@ #include "aqdiagram/draw/w_drawable.h" #include +#include + + +#define I18N(msg) msg @@ -35,6 +39,8 @@ static void _setupObjectTree(AQDG_OBJECT *o); static void _setupMatrix(AQDG_OBJECT *o); static AQDG_OBJECT *_createLabel(AQDG_OBJECT *o, AQDG_OBJECT *parent, const char *name, uint32_t options, const char *s, int penIdx, int fontIdx); +static AQDG_OBJECT *_createTimeLabel(AQDG_OBJECT *o, AQDG_OBJECT *parent, const char *name, + uint32_t options, int penIdx, int fontIdx); @@ -159,6 +165,12 @@ void _setupObjectTree(AQDG_OBJECT *o) _setupMatrix(o); AQDG_LegendWidget_new(o, AQDG_OBJECT_OPTIONS_STRETCHX, o); + _createTimeLabel(o, + o, + "updateLabel", + AQDG_OBJECT_OPTIONS_HALIGNRIGHT, + AQDG_GRAPHWIDGET_PEN_IDX_SUBTITLE, + AQDG_GRAPHWIDGET_FONT_IDX_SUBTITLE); } @@ -231,6 +243,25 @@ AQDG_OBJECT *_createLabel(AQDG_OBJECT *o, AQDG_OBJECT *parent, const char *name, +AQDG_OBJECT *_createTimeLabel(AQDG_OBJECT *o, AQDG_OBJECT *parent, const char *name, + uint32_t options, int penIdx, int fontIdx) +{ + AQDG_OBJECT *oLabel; + GWEN_TIME *ti; + GWEN_BUFFER *buf; + + ti=GWEN_CurrentTime(); + buf=GWEN_Buffer_new(0, 64, 0, 1); + GWEN_Buffer_AppendString(buf, I18N("Last update: ")); + GWEN_Time_toString(ti, "YYYY/MM/DD-hh:mm:ss", buf); + oLabel=_createLabel(o, parent, name, options, GWEN_Buffer_GetStart(buf), penIdx, fontIdx); + GWEN_Buffer_free(buf); + GWEN_Time_free(ti); + return oLabel; +} + + + void _presetPens(AQDG_OBJECT *o) { if (o) {