GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Object.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2011-2017 Michael Goffioul
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_Object_h)
24 #define octave_Object_h 1
25 
26 #include <QObject>
27 
28 #include "graphics.h"
29 
30 class QObject;
31 class QString;
32 class QWidget;
33 
34 namespace QtHandles
35 {
36 
37  class Container;
38  class ObjectProxy;
39 
40  class Object : public QObject
41  {
42  Q_OBJECT
43 
44  public:
45  Object (const graphics_object& go, QObject* obj = 0);
46 
47  virtual ~Object (void);
48 
50  { return object ().get_properties (); }
51 
52  const base_properties& properties (void) const
53  { return object ().get_properties (); }
54 
55  template <typename T>
56  typename T::properties& properties (void)
57  {
58  return dynamic_cast<typename T::properties&>
59  (object ().get_properties ());
60  }
61 
62  template <typename T>
63  const typename T::properties& properties (void) const
64  {
65  return dynamic_cast<const typename T::properties&>
66  (object ().get_properties ());
67  }
68 
69  graphics_object object (void) const;
70 
71  virtual QObject* qObject (void) { return m_qobject; }
72 
73  template <typename T>
74  T* qWidget (void) { return qobject_cast<T*>(qObject ()); }
75 
76  virtual Container* innerContainer (void) = 0;
77 
78  static Object* fromQObject (QObject* obj);
79 
80  public slots:
81  void slotUpdate (int pId);
82  void slotFinalize (void);
83  void slotRedraw (void);
84  void slotPrint (const QString& file_cmd, const QString& term);
85 
86  void objectDestroyed (QObject *obj = 0);
87 
88  protected:
89  static Object* parentObject (const graphics_object& go);
90  void init (QObject* obj, bool callBase = false);
91 
92  virtual void update (int pId);
93  virtual void finalize (void);
94  virtual void redraw (void);
95  virtual void print (const QString& file_cmd, const QString& term);
96 
97  virtual void beingDeleted (void);
98 
99  protected:
102  };
103 
104 }
105 
106 #endif
const base_properties & properties(void) const
Definition: Object.h:52
virtual void redraw(void)
Definition: Object.cc:147
T::properties & properties(void)
Definition: Object.h:56
void slotUpdate(int pId)
Definition: Object.cc:85
static Object * parentObject(const graphics_object &go)
Definition: Object.cc:165
virtual Container * innerContainer(void)=0
const T::properties & properties(void) const
Definition: Object.h:63
void slotFinalize(void)
Definition: Object.cc:106
virtual ~Object(void)
Definition: Object.cc:68
void slotRedraw(void)
Definition: Object.cc:114
void init(QObject *obj, bool callBase=false)
Definition: Object.cc:51
graphics_handle m_handle
Definition: Object.h:100
T * qWidget(void)
Definition: Object.h:74
static Object * fromQObject(QObject *obj)
Definition: Object.cc:176
virtual void beingDeleted(void)
Definition: Object.cc:155
base_properties & get_properties(void)
Definition: graphics.h:3288
QObject * m_qobject
Definition: Object.h:101
virtual QObject * qObject(void)
Definition: Object.h:71
Object(const graphics_object &go, QObject *obj=0)
Definition: Object.cc:37
graphics_object object(void) const
Definition: Object.cc:72
virtual void finalize(void)
Definition: Object.cc:136
virtual void update(int pId)
Definition: Object.cc:132
virtual void print(const QString &file_cmd, const QString &term)
Definition: Object.cc:151
void objectDestroyed(QObject *obj=0)
Definition: Object.cc:158
void slotPrint(const QString &file_cmd, const QString &term)
Definition: Object.cc:123
base_properties & properties(void)
Definition: Object.h:49
T::properties & properties(graphics_object obj)