source: flair-src/trunk/lib/FlairCore/src/TextEdit.cpp@ 10

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

flaircore

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
25{
26namespace gui
27{
28
29TextEdit::TextEdit(const LayoutPosition* position,string name,size_t buf_size): Widget(position->getLayout(),name,"TextEdit")
30{
31 SetVolatileXmlProp("row",position->Row());
32 SetVolatileXmlProp("col",position->Col());
33 SendXml();
34
35 delete position;
36
37// text_node=AddXmlChild("Text");
38
39 printf_buffer=(char*)malloc(buf_size);
40 if(printf_buffer==NULL) Err("erreur malloc\n");
41}
42
43TextEdit::~TextEdit()
44{
45 free(printf_buffer);
46}
47
48
49void TextEdit::Append(const char * format, ...)
50{
51 int n;
52
53 va_list args;
54 va_start(args, format);
55 n = vsprintf(printf_buffer,format, args);
56 va_end (args);
57 if (n<=0) return;
58
59 SetVolatileXmlProp("value",printf_buffer,text_node);
60 SendXml();
61
62}
63
64} // end namespace gui
65} // end namespace flair
Note: See TracBrowser for help on using the repository browser.