gwenhywfar 5.10.1
qt4/w_textbrowser.cpp
Go to the documentation of this file.
1/***************************************************************************
2 begin : Mon Feb 15 2010
3 copyright : (C) 2010 by Martin Preuss
4 email : martin@libchipcard.de
5
6 ***************************************************************************
7 * Please see toplevel file COPYING for license details *
8 ***************************************************************************/
9
10
11#include <gwen-gui-cpp/cppwidget.hpp>
12
13
15public:
17 }
18
19
20
22 }
23
24
25
26 virtual int setup() {
27 QTextBrowser *qw;
28 uint32_t flags;
29 GWEN_WIDGET *wParent;
30 QSizePolicy::Policy hpolicy=QSizePolicy::Minimum;
31 QSizePolicy::Policy vpolicy=QSizePolicy::Minimum;
32 const char *s;
33 QString text;
34
36 wParent=GWEN_Widget_Tree_GetParent(_widget);
38 if (s)
39 text=QString::fromUtf8(s);
40
41 qw=new QTextBrowser();
42 qw->setText(text);
43
44 /* handle flags */
45 if (flags & GWEN_WIDGET_FLAGS_FILLX)
46 hpolicy=QSizePolicy::Expanding;
47 if (flags & GWEN_WIDGET_FLAGS_FILLY)
48 vpolicy=QSizePolicy::Expanding;
49 qw->setSizePolicy(hpolicy, vpolicy);
50
52
53 if (wParent)
55 return 0;
56 }
57
58
59
61 int index,
62 const char *value,
63 int doSignal) {
64 QTextBrowser *qw;
65 QString text;
66
68 assert(qw);
69
70 if (value)
71 text=QT4_Gui::extractHtml(value);
72
73 switch(prop) {
75 qw->setText("");
76 qw->append(text);
77 return 0;
78
80 qw->append(text);
81 return 0;
82
84 qw->setText("");
85 return 0;
86
87 default:
88 break;
89 }
90
92 "Function is not appropriate for this type of widget (%s)",
94 return GWEN_ERROR_INVALID;
95 };
96
97
98
99};
100
101
102
103
104
105
106
GWEN_WIDGET * _widget
Definition: cppwidget.hpp:66
static QString extractHtml(const char *text)
Definition: qt4_gui.cpp:64
Qt4_W_TextBrowser(GWEN_WIDGET *w)
int setCharProperty(GWEN_DIALOG_PROPERTY prop, int index, const char *value, int doSignal)
#define DBG_WARN(dbg_logger, format, args...)
Definition: debug.h:125
#define GWEN_WIDGET_FLAGS_FILLY
Definition: dialog.h:62
#define GWEN_WIDGET_FLAGS_FILLX
Definition: dialog.h:61
GWEN_DIALOG_PROPERTY
Definition: dialog.h:260
@ GWEN_DialogProperty_AddValue
Definition: dialog.h:268
@ GWEN_DialogProperty_ClearValues
Definition: dialog.h:269
@ GWEN_DialogProperty_Value
Definition: dialog.h:264
#define GWEN_ERROR_INVALID
Definition: error.h:67
#define GWEN_LOGDOMAIN
Definition: logger.h:35
#define QT4_DIALOG_WIDGET_REAL
int GWEN_Widget_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild)
Definition: widget.c:828
void GWEN_Widget_SetImplData(GWEN_WIDGET *w, int index, void *ptr)
Store a pointer with the widget.
Definition: widget.c:136
void * GWEN_Widget_GetImplData(const GWEN_WIDGET *w, int index)
Definition: widget.c:122
const char * GWEN_Widget_GetText(const GWEN_WIDGET *w, int idx)
Definition: widget.c:293
uint32_t GWEN_Widget_GetFlags(const GWEN_WIDGET *w)
Definition: widget.c:149
const char * GWEN_Widget_Type_toString(GWEN_WIDGET_TYPE t)
Definition: widget.c:452
GWEN_WIDGET_TYPE GWEN_Widget_GetType(const GWEN_WIDGET *w)
Definition: widget.c:185
struct GWEN_WIDGET GWEN_WIDGET
Definition: widget_be.h:34