gwenhywfar  4.7.0beta
w_textedit.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 
15 public:
17  }
18 
19 
20 
22  }
23 
24 
25 
26  virtual int setup() {
27  QTextEdit *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  QT4_GuiDialog *qtDialog;
35 
37  wParent=GWEN_Widget_Tree_GetParent(_widget);
39  if (s)
40  text=QString::fromUtf8(s);
41 
42  qw=new QTextEdit(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  qtDialog=dynamic_cast<QT4_GuiDialog*>(getDialog());
54  assert(qtDialog);
55 
56  qw->connect(qw, SIGNAL(returnPressed()),
57  qtDialog->getMainWindow(),
58  SLOT(slotActivated()));
59 
60 
61  if (wParent)
63  return 0;
64  }
65 
66 
67 
69  int index,
70  const char *value,
71  int doSignal) {
72  QTextEdit *qw;
73  QString text;
74 
76  assert(qw);
77 
78  if (value)
79  text=QString::fromUtf8(value);
80 
81  switch(prop) {
83  qw->setText(text);
84  return 0;
85  default:
86  break;
87  }
88 
90  "Function is not appropriate for this type of widget (%s)",
92  return GWEN_ERROR_INVALID;
93  };
94 
95 
96 
98  int index,
99  const char *defaultValue) {
100  QTextEdit *qw;
101  QString str;
102 
104  assert(qw);
105 
106  switch(prop) {
108  str=qw->toPlainText();
109  if (str.isEmpty())
110  return defaultValue;
111  else {
114  }
115  break;
116 
117  default:
118  break;
119  }
120 
122  "Function is not appropriate for this type of widget (%s)",
124  return defaultValue;
125  };
126 
127 };
128 
129 
130 
131 
132 
133 
134