File: cppwidget.hpp

package info (click to toggle)
libgwenhywfar 5.14.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,300 kB
  • sloc: ansic: 135,622; cpp: 11,186; sh: 5,025; objc: 2,548; makefile: 2,357; xml: 1,882
file content (97 lines) | stat: -rw-r--r-- 2,522 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/***************************************************************************
    begin       : Tue Jul 13 2010
    copyright   : (C) 2010 by Martin Preuss
    email       : martin@libchipcard.de

 ***************************************************************************
 *          Please see toplevel file COPYING for license details           *
 ***************************************************************************/

#ifndef CPPWIDGET_HPP
#define CPPWIDGET_HPP

#include <gwenhywfar/dialog_be.h>
#include <list>
#include <string>

class CppWidget;
class CppDialog;

#include <gwen-gui-cpp/api.h>


/**
 * @brief A C++ binding for the C module @ref GWEN_WIDGET
 *
 * This class simply is a C++ binding for the C module @ref GWEN_WIDGET.
 * It redirects C callbacks used by GWEN_WIDGET to virtual functions in
 * this class.
 *
 * @author Martin Preuss<martin@aquamaniac.de>
 */
class CPPGUI_API CppWidget {
  friend class CppWidgetLinker;

private:
  GWEN_WIDGET_SETINTPROPERTY_FN _setIntPropertyFn;
  GWEN_WIDGET_GETINTPROPERTY_FN _getIntPropertyFn;
  GWEN_WIDGET_SETCHARPROPERTY_FN _setCharPropertyFn;
  GWEN_WIDGET_GETCHARPROPERTY_FN _getCharPropertyFn;
  GWEN_WIDGET_ADDCHILDGUIWIDGET_FN _addChildGuiWidgetFn;

public:
  CppWidget(GWEN_WIDGET *w);
  virtual ~CppWidget();

  GWEN_WIDGET *getCInterface();
  static CPPGUI_API CppWidget *getWidget(GWEN_WIDGET *w);

  CppDialog *getDialog();

  const char *getName();
  GWEN_WIDGET_TYPE getType();
  int getColumns();
  int getRows();
  uint32_t getFlags();

  int getGroupId();
  int getWidth();
  int getHeight();
  const char *getText(int idx);
  const char *getIconFileName();
  const char *getImageFileName();


protected:
  GWEN_WIDGET *_widget;

  CppWidget();

  virtual int setIntProperty(GWEN_DIALOG_PROPERTY prop,
                             int index,
                             int value,
                             int doSignal);

  virtual int getIntProperty(GWEN_DIALOG_PROPERTY prop,
                             int index,
                             int defaultValue);

  virtual int setCharProperty(GWEN_DIALOG_PROPERTY prop,
                              int index,
                              const char *value,
                              int doSignal);

  virtual const char *getCharProperty(GWEN_DIALOG_PROPERTY prop,
                                      int index,
                                      const char *defaultValue);

  virtual int addChildGuiWidget(GWEN_WIDGET *wChild);

};




#endif /* CPPWIDGET_HPP */