gwenhywfar  4.7.0beta
w_label.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 
14 class Qt4_W_Label: public Qt4_W_Widget {
15 public:
17  }
18 
19 
20 
22  }
23 
24 
25 
26  virtual int setup() {
27  QLabel *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=QT4_Gui::extractHtml(s);
40 
41  qw=new QLabel(text);
42  qw->setWordWrap(true);
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  QLabel *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(text);
76  return 0;
77  default:
78  break;
79  }
80 
82  "Function is not appropriate for this type of widget (%s)",
84  return GWEN_ERROR_INVALID;
85  };
86 
87 
88 
90  int index,
91  const char *defaultValue) {
92  QLabel *qw;
93  QString str;
94 
96  assert(qw);
97 
98  switch(prop) {
100  str=qw->text();
101  if (str.isEmpty())
102  return defaultValue;
103  else {
106  }
107  break;
108 
109  default:
110  break;
111  }
112 
114  "Function is not appropriate for this type of widget (%s)",
116  return defaultValue;
117  };
118 
119 };
120 
121 
122 
123 
124 
125 
126