gwenhywfar  5.14.1
qt5/w_widget.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 class Qt5_W_Widget: public CppWidget {
12 public:
14  }
15 
16 
17 
19  }
20 
21 
22 
23  virtual int setup() {
24  QWidget *qw;
25  uint32_t flags;
26  GWEN_WIDGET *wParent;
27  QSizePolicy::Policy hpolicy=QSizePolicy::Minimum;
28  QSizePolicy::Policy vpolicy=QSizePolicy::Minimum;
29 
31  wParent=GWEN_Widget_Tree_GetParent(_widget);
32 
33  qw=new QWidget();
34 
35  /* handle flags */
36  if (flags & GWEN_WIDGET_FLAGS_FILLX)
37  hpolicy=QSizePolicy::Expanding;
38  if (flags & GWEN_WIDGET_FLAGS_FILLY)
39  vpolicy=QSizePolicy::Expanding;
40  qw->setSizePolicy(hpolicy, vpolicy);
41 
44 
45  if (wParent)
47  return 0;
48  }
49 
50 
51 
52  static QWidget *getQWidget(GWEN_WIDGET *w) {
53  QWidget *qw;
54 
56  assert(qw);
57 
58  return qw;
59  }
60 
61 
63  GWEN_UNUSED int index,
64  int value,
65  GWEN_UNUSED int doSignal) {
66  QWidget *qw;
67 
69  assert(qw);
70 
71  switch(prop) {
73  qw->resize(value, qw->height());
74  return 0;
75 
77  qw->resize(qw->width(), value);
78  return 0;
79 
81  qw->setEnabled((value==0)?false:true);
82  return 0;
83 
85  qw->setFocus();
86  return 0;
87 
89  if (value==0)
90  qw->hide();
91  else
92  qw->show();
93  return 0;
94 
95  default:
96  break;
97  }
98 
100  "Function is not appropriate for this type of widget (%s)",
102  return GWEN_ERROR_INVALID;
103  };
104 
105 
106 
108  GWEN_UNUSED int index,
109  int defaultValue) {
110  QWidget *qw;
111 
113  assert(qw);
114 
115  switch(prop) {
117  return qw->width();
118 
120  return qw->height();
121 
123  return (qw->isEnabled())?1:0;
124 
126  return (qw->hasFocus())?1:0;
127 
128  default:
129  break;
130  }
131 
133  "Function is not appropriate for this type of widget (%s)",
135  return defaultValue;
136  };
137 
138 
139 
141  GWEN_UNUSED int index,
142  GWEN_UNUSED const char *value,
143  GWEN_UNUSED int doSignal) {
145  "Function is not appropriate for this type of widget (%s)",
147  return GWEN_ERROR_INVALID;
148  };
149 
150 
151 
153  GWEN_UNUSED int index,
154  const char *defaultValue) {
156  "Function is not appropriate for this type of widget (%s)",
158  return defaultValue;
159  };
160 
161 };
162 
163 
164 
165 
166 
167 
168 
GWEN_WIDGET_TYPE GWEN_Widget_GetType(const GWEN_WIDGET *w)
Definition: widget.c:185
#define GWEN_ERROR_INVALID
Definition: error.h:67
virtual int setup()
Qt5_W_Widget(GWEN_WIDGET *w)
GWEN_DIALOG_PROPERTY
Definition: dialog.h:260
const char * getCharProperty(GWEN_UNUSED GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, const char *defaultValue)
uint32_t GWEN_Widget_GetFlags(const GWEN_WIDGET *w)
Definition: widget.c:149
#define GWEN_LOGDOMAIN
Definition: logger.h:32
int setCharProperty(GWEN_UNUSED GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, GWEN_UNUSED const char *value, GWEN_UNUSED int doSignal)
void GWEN_Widget_SetImplData(GWEN_WIDGET *w, int index, void *ptr)
Store a pointer with the widget.
Definition: widget.c:136
#define DBG_WARN(dbg_logger, format,...)
Definition: debug.h:125
void * GWEN_Widget_GetImplData(const GWEN_WIDGET *w, int index)
Definition: widget.c:122
struct GWEN_WIDGET GWEN_WIDGET
Definition: widget_be.h:34
int GWEN_Widget_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild)
Definition: widget.c:836
#define GWEN_WIDGET_FLAGS_FILLY
Definition: dialog.h:62
A C++ binding for the C module GWEN_WIDGET.
Definition: cppwidget.hpp:32
#define GWEN_WIDGET_FLAGS_FILLX
Definition: dialog.h:61
int setIntProperty(GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, int value, GWEN_UNUSED int doSignal)
static QWidget * getQWidget(GWEN_WIDGET *w)
#define QT5_DIALOG_WIDGET_CONTENT
const char * GWEN_Widget_Type_toString(GWEN_WIDGET_TYPE t)
Definition: widget.c:456
GWEN_WIDGET * _widget
Definition: cppwidget.hpp:66
int getIntProperty(GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, int defaultValue)
#define QT5_DIALOG_WIDGET_REAL
#define GWEN_UNUSED