annotate libgui/graphics/Object.h @ 27919:1891570abac8

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2020.
author John W. Eaton <jwe@octave.org>
date Mon, 06 Jan 2020 22:29:51 -0500
parents b442ec6dda5c
children bd51beb6205e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1 /*
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2
27919
1891570abac8 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27918
diff changeset
3 Copyright (C) 2011-2020 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27647
diff changeset
4
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27647
diff changeset
5 See the file COPYRIGHT.md in the top-level directory of this distribution
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27647
diff changeset
6 or <https://octave.org/COPYRIGHT.html/>.
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27647
diff changeset
7
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8
18500
49877d3be064 update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents: 18498
diff changeset
9 This file is part of Octave.
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
10
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23457
diff changeset
11 Octave is free software: you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22413
diff changeset
12 under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23457
diff changeset
13 the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22413
diff changeset
14 (at your option) any later version.
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22413
diff changeset
16 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22413
diff changeset
17 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22413
diff changeset
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22413
diff changeset
19 GNU General Public License for more details.
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 You should have received a copy of the GNU General Public License
18500
49877d3be064 update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents: 18498
diff changeset
22 along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23457
diff changeset
23 <https://www.gnu.org/licenses/>.
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
24
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25 */
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26
21203
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 21139
diff changeset
27 #if ! defined (octave_Object_h)
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 21139
diff changeset
28 #define octave_Object_h 1
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30 #include <QObject>
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31
27303
07b330708e3c use Qt signals for interpreter callbacks in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
32 #include "event-manager.h"
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 #include "graphics.h"
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 class QObject;
19681
35bca657d74d printing for Qt plot widget (bug #42537)
John W. Eaton <jwe@octave.org>
parents: 19625
diff changeset
36 class QString;
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37 class QWidget;
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38
27647
2a506bc4a7af eliminate global access to Octave interpreter in qt graphics classes
John W. Eaton <jwe@octave.org>
parents: 27376
diff changeset
39 namespace octave
2a506bc4a7af eliminate global access to Octave interpreter in qt graphics classes
John W. Eaton <jwe@octave.org>
parents: 27376
diff changeset
40 {
2a506bc4a7af eliminate global access to Octave interpreter in qt graphics classes
John W. Eaton <jwe@octave.org>
parents: 27376
diff changeset
41 class base_qobject;
2a506bc4a7af eliminate global access to Octave interpreter in qt graphics classes
John W. Eaton <jwe@octave.org>
parents: 27376
diff changeset
42 class interpreter;
2a506bc4a7af eliminate global access to Octave interpreter in qt graphics classes
John W. Eaton <jwe@octave.org>
parents: 27376
diff changeset
43 }
2a506bc4a7af eliminate global access to Octave interpreter in qt graphics classes
John W. Eaton <jwe@octave.org>
parents: 27376
diff changeset
44
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 namespace QtHandles
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46 {
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
48 class Container;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
49 class ObjectProxy;
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
51 class Object : public QObject
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
52 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
53 Q_OBJECT
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
55 public:
27647
2a506bc4a7af eliminate global access to Octave interpreter in qt graphics classes
John W. Eaton <jwe@octave.org>
parents: 27376
diff changeset
56 Object (octave::base_qobject& qobj, octave::interpreter& interp,
2a506bc4a7af eliminate global access to Octave interpreter in qt graphics classes
John W. Eaton <jwe@octave.org>
parents: 27376
diff changeset
57 const graphics_object& go, QObject *obj = nullptr);
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
59 virtual ~Object (void);
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
61 base_properties& properties (void)
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62 { return object ().get_properties (); }
19595
be7ac98fab43 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 18501
diff changeset
63
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
64 const base_properties& properties (void) const
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65 { return object ().get_properties (); }
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
67 template <typename T>
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
68 typename T::properties& properties (void)
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69 {
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70 return dynamic_cast<typename T::properties&>
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
71 (object ().get_properties ());
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72 }
19595
be7ac98fab43 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 18501
diff changeset
73
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
74 template <typename T>
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
75 const typename T::properties& properties (void) const
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
76 {
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
77 return dynamic_cast<const typename T::properties&>
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
78 (object ().get_properties ());
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
79 }
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
81 graphics_object object (void) const;
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
82
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
83 virtual QObject * qObject (void) { return m_qobject; }
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
84
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
85 template <typename T>
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
86 T * qWidget (void) { return qobject_cast<T *>(qObject ()); }
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
87
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
88 virtual Container * innerContainer (void) = 0;
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
89
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
90 static Object * fromQObject (QObject *obj);
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
91
27376
1952e110d346 Allow Qt graphics callbacks to work again (bug #56857)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27319
diff changeset
92 virtual void do_connections (const QObject *receiver,
1952e110d346 Allow Qt graphics callbacks to work again (bug #56857)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27319
diff changeset
93 const QObject *emitter = nullptr);
1952e110d346 Allow Qt graphics callbacks to work again (bug #56857)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27319
diff changeset
94
27303
07b330708e3c use Qt signals for interpreter callbacks in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
95 signals:
07b330708e3c use Qt signals for interpreter callbacks in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
96
07b330708e3c use Qt signals for interpreter callbacks in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
97 void interpreter_event (const octave::fcn_callback& fcn);
07b330708e3c use Qt signals for interpreter callbacks in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
98 void interpreter_event (const octave::meth_callback& meth);
07b330708e3c use Qt signals for interpreter callbacks in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
99
27319
6b2d20317b26 use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 27317
diff changeset
100 void gh_callback_event (const graphics_handle& h, const std::string& name);
6b2d20317b26 use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 27317
diff changeset
101
6b2d20317b26 use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 27317
diff changeset
102 void gh_callback_event (const graphics_handle& h, const std::string& name,
6b2d20317b26 use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 27317
diff changeset
103 const octave_value& data);
6b2d20317b26 use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 27317
diff changeset
104
6b2d20317b26 use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 27317
diff changeset
105 void gh_set_event (const graphics_handle& h, const std::string& name,
6b2d20317b26 use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 27317
diff changeset
106 const octave_value& value);
6b2d20317b26 use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 27317
diff changeset
107
6b2d20317b26 use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 27317
diff changeset
108 void gh_set_event (const graphics_handle& h, const std::string& name,
6b2d20317b26 use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 27317
diff changeset
109 const octave_value& value, bool notify_toolkit);
6b2d20317b26 use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 27317
diff changeset
110
6b2d20317b26 use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 27317
diff changeset
111 void gh_set_event (const graphics_handle& h, const std::string& name,
6b2d20317b26 use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 27317
diff changeset
112 const octave_value& value, bool notify_toolkit,
6b2d20317b26 use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 27317
diff changeset
113 bool redraw_figure);
6b2d20317b26 use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 27317
diff changeset
114
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
115 public slots:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
116 void slotUpdate (int pId);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
117 void slotFinalize (void);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
118 void slotRedraw (void);
25799
d04b74f5d02e make shg and figure (N) activate and raise figure windows (bug #45943)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
119 void slotShow (void);
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
120 void slotPrint (const QString& file_cmd, const QString& term);
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
121
23457
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23449
diff changeset
122 void objectDestroyed (QObject *obj = nullptr);
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
123
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
124 protected:
27647
2a506bc4a7af eliminate global access to Octave interpreter in qt graphics classes
John W. Eaton <jwe@octave.org>
parents: 27376
diff changeset
125 static Object *
2a506bc4a7af eliminate global access to Octave interpreter in qt graphics classes
John W. Eaton <jwe@octave.org>
parents: 27376
diff changeset
126 parentObject (octave::interpreter& interp, const graphics_object& go);
2a506bc4a7af eliminate global access to Octave interpreter in qt graphics classes
John W. Eaton <jwe@octave.org>
parents: 27376
diff changeset
127
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
128 void init (QObject *obj, bool callBase = false);
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
129
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
130 virtual void update (int pId);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
131 virtual void finalize (void);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
132 virtual void redraw (void);
25799
d04b74f5d02e make shg and figure (N) activate and raise figure windows (bug #45943)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
133 virtual void show (void);
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
134 virtual void print (const QString& file_cmd, const QString& term);
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
135
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
136 virtual void beingDeleted (void);
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
137
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
138 protected:
25044
b6aea95a7bf9 store graphics object in Qt backend to avoid crash (bug #53487, #53500)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
139
27647
2a506bc4a7af eliminate global access to Octave interpreter in qt graphics classes
John W. Eaton <jwe@octave.org>
parents: 27376
diff changeset
140 octave::base_qobject& m_octave_qobj;
2a506bc4a7af eliminate global access to Octave interpreter in qt graphics classes
John W. Eaton <jwe@octave.org>
parents: 27376
diff changeset
141 octave::interpreter& m_interpreter;
2a506bc4a7af eliminate global access to Octave interpreter in qt graphics classes
John W. Eaton <jwe@octave.org>
parents: 27376
diff changeset
142
25044
b6aea95a7bf9 store graphics object in Qt backend to avoid crash (bug #53487, #53500)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
143 // Store the graphics object directly so that it will exist when
b6aea95a7bf9 store graphics object in Qt backend to avoid crash (bug #53487, #53500)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
144 // we need it. Previously, it was possible for the graphics
27317
718116e9c7d3 rename Backend to qt_graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 27303
diff changeset
145 // toolkit to get a handle to a figure, then have the interpreter
718116e9c7d3 rename Backend to qt_graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 27303
diff changeset
146 // thread delete the corresponding object before the graphics
718116e9c7d3 rename Backend to qt_graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 27303
diff changeset
147 // toolkit (GUI) thread had a chance to display it. It should be OK
718116e9c7d3 rename Backend to qt_graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 27303
diff changeset
148 // to store this object and use it in both threads (graphics_object
718116e9c7d3 rename Backend to qt_graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 27303
diff changeset
149 // uses a std::shared_ptr) provided that we protect access with
718116e9c7d3 rename Backend to qt_graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 27303
diff changeset
150 // mutex locks.
25044
b6aea95a7bf9 store graphics object in Qt backend to avoid crash (bug #53487, #53500)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
151 graphics_object m_go;
b6aea95a7bf9 store graphics object in Qt backend to avoid crash (bug #53487, #53500)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
152
b6aea95a7bf9 store graphics object in Qt backend to avoid crash (bug #53487, #53500)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
153 // Handle to the graphics object. This may be redundant now.
b6aea95a7bf9 store graphics object in Qt backend to avoid crash (bug #53487, #53500)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
154 // Also, the whole ObjectProxy thing may not need to store a
b6aea95a7bf9 store graphics object in Qt backend to avoid crash (bug #53487, #53500)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
155 // pointer now? Maybe we can just have a lookup table from figure
b6aea95a7bf9 store graphics object in Qt backend to avoid crash (bug #53487, #53500)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
156 // handle to Object? What does the FLTK toolkit do? Why does
b6aea95a7bf9 store graphics object in Qt backend to avoid crash (bug #53487, #53500)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
157 // this seem to be so complicated?
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
158 graphics_handle m_handle;
25044
b6aea95a7bf9 store graphics object in Qt backend to avoid crash (bug #53487, #53500)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
159
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
160 QObject *m_qobject;
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
161 };
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
162
22413
8758addcf265 maint: Remove ';' at end of namespace declaration.
Rik <rik@octave.org>
parents: 22411
diff changeset
163 }
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
164
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
165 #endif