Last change
on this file since 204 was 15, checked in by Bayard Gildas, 8 years ago |
sources reformatted with flair-format-dir script
|
File size:
1.3 KB
|
Rev | Line | |
---|
[2] | 1 | // %flair:license{
|
---|
[15] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[2] | 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 |
|
---|
| 22 | using std::string;
|
---|
| 23 |
|
---|
[15] | 24 | namespace flair {
|
---|
| 25 | namespace gui {
|
---|
[2] | 26 |
|
---|
[15] | 27 | TextEdit::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();
|
---|
[2] | 32 |
|
---|
[15] | 33 | delete position;
|
---|
[2] | 34 |
|
---|
[15] | 35 | // text_node=AddXmlChild("Text");
|
---|
[2] | 36 |
|
---|
[15] | 37 | printf_buffer = (char *)malloc(buf_size);
|
---|
| 38 | if (printf_buffer == NULL)
|
---|
| 39 | Err("erreur malloc\n");
|
---|
[2] | 40 | }
|
---|
| 41 |
|
---|
[15] | 42 | TextEdit::~TextEdit() { free(printf_buffer); }
|
---|
[2] | 43 |
|
---|
[15] | 44 | void TextEdit::Append(const char *format, ...) {
|
---|
| 45 | int n;
|
---|
[2] | 46 |
|
---|
[15] | 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;
|
---|
[2] | 53 |
|
---|
[15] | 54 | SetVolatileXmlProp("value", printf_buffer, text_node);
|
---|
| 55 | SendXml();
|
---|
[2] | 56 | }
|
---|
| 57 |
|
---|
| 58 | } // end namespace gui
|
---|
| 59 | } // end namespace flair
|
---|
Note:
See
TracBrowser
for help on using the repository browser.