source: flair-src/branches/sanscv/lib/FlairCore/src/Label.cpp @ 326

Last change on this file since 326 was 324, checked in by Sanahuja Guillaume, 2 years ago

removing opencv dependency

File size: 1.3 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
5//  created:    2012/08/17
6//  filename:   Label.cpp
7//
8//  author:     Guillaume Sanahuja
9//              Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11//  version:    $Id: $
12//
13//  purpose:    Class displaying a QLabel on the ground station
14//
15//
16/*********************************************************************/
17
18#include "Label.h"
19#include "Layout.h"
20#include "LayoutPosition.h"
21
22using std::string;
23
24namespace flair {
25namespace gui {
26
27Label::Label(const LayoutPosition *position, string name, size_t buf_size)
28    : Widget(position->getLayout(), name, "Label") {
29  SetVolatileXmlProp("row", position->Row());
30  SetVolatileXmlProp("col", position->Col());
31
32  SendXml();
33
34  printf_buffer = (char *)malloc(buf_size);
35  if (printf_buffer == NULL)
36    Err("erreur malloc\n");
37
38  delete position;
39}
40
41Label::~Label() {
42  if (printf_buffer != NULL)
43    free(printf_buffer);
44  printf_buffer = NULL;
45}
46
47void Label::SetText(const char *format, ...) {
48  int n;
49
50  va_list args;
51  va_start(args, format);
52  n = vsprintf(printf_buffer, format, args);
53  va_end(args);
54  if (n <= 0)
55    return;
56
57  SetVolatileXmlProp("value", printf_buffer);
58  SendXml();
59}
60
61} // end namespace gui
62} // end namespace flair
Note: See TracBrowser for help on using the repository browser.