source: flair-src/branches/sanscv/lib/FlairCore/src/TextEdit.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:   TextEdit.cpp
7//
8//  author:     Guillaume Sanahuja
9//              Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11//  version:    $Id: $
12//
13//  purpose:    Class displaying a QTextEdit on the ground station
14//
15//
16/*********************************************************************/
17
18#include "TextEdit.h"
19#include "Layout.h"
20#include "LayoutPosition.h"
21
22using std::string;
23
24namespace flair {
25namespace gui {
26
27TextEdit::TextEdit(const LayoutPosition *position, string name, size_t buf_size)
28    : Widget(position->getLayout(), name, "TextEdit") {
29  SetVolatileXmlProp("row", position->Row());
30  SetVolatileXmlProp("col", position->Col());
31  SendXml();
32
33  delete position;
34
35  //    text_node=AddXmlChild("Text");
36
37  printf_buffer = (char *)malloc(buf_size);
38  if (printf_buffer == NULL)
39    Err("erreur malloc\n");
40}
41
42TextEdit::~TextEdit() { free(printf_buffer); }
43
44void TextEdit::Append(const char *format, ...) {
45  int n;
46
47  va_list args;
48  va_start(args, format);
49  n = vsprintf(printf_buffer, format, args);
50  va_end(args);
51  if (n <= 0)
52    return;
53
54  SetVolatileXmlProp("value", printf_buffer, text_node);
55  SendXml();
56}
57
58} // end namespace gui
59} // end namespace flair
Note: See TracBrowser for help on using the repository browser.