summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Client/Code/Core/Core/DispatchListeners.h
blob: 252464e3eefb049a48fd230011818754cf077116 (plain)
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
/****************************************************************************
**
** Copyright (C) 2002 NVIDIA Corporation.
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt 3D Studio.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

#ifndef INCLUDED_DISPATCHLISTENERS_H
#define INCLUDED_DISPATCHLISTENERS_H 1

#pragma once

//==============================================================================
//	Includes
//==============================================================================
#include "CoreConst.h"
#include "Qt3DSId.h"
#include "Pt.h"
#include "Qt3DSDMHandles.h"
#include <QPoint>

//==============================================================================
//	Forwards
//==============================================================================

class CAsset;
class Qt3DSFile;
class CURL;
class ISelectable;
class CCmd;
class CSharedBuffer;

//=============================================================================
/**
 * Listener for drag events on the scene
 */
//=============================================================================
class CSceneDragListener
{
public:
    virtual ~CSceneDragListener() {}
    virtual void OnSceneMouseDown(SceneDragSenderType::Enum inSender, QPoint inPoint, int inToolMode)
    {
        Q_UNUSED(inSender);
        Q_UNUSED(inPoint);
        Q_UNUSED(inToolMode);
    }

    virtual void OnSceneMouseDrag(SceneDragSenderType::Enum inSender, QPoint inPoint, int inToolMode,
                                  int inFlags)
    {
        Q_UNUSED(inSender);
        Q_UNUSED(inPoint);
        Q_UNUSED(inToolMode);
        Q_UNUSED(inFlags);
    }

    virtual void OnSceneMouseMove(SceneDragSenderType::Enum /*inSender*/, QPoint /*inPoint*/) {}

    virtual void OnSceneMouseUp(SceneDragSenderType::Enum inSender) = 0;

    virtual void OnSceneMouseDblClick(SceneDragSenderType::Enum inSender, QPoint inPoint)
    {
        Q_UNUSED(inSender);
        Q_UNUSED(inPoint);
    }

    virtual void OnSceneMouseWheel(SceneDragSenderType::Enum inSender, short inDelta,
                                   int inToolMode)
    {
        Q_UNUSED(inSender);
        Q_UNUSED(inDelta);
        Q_UNUSED(inToolMode);
    }
};

//=============================================================================
/**
 * Listener for timebar change events
 */
//=============================================================================
class CTimeBarChangeListener
{
public:
    virtual ~CTimeBarChangeListener() {}
    virtual void OnTimeBarChange(CAsset *inAsset) = 0;
};

//=============================================================================
/**
 * Listener for object time dependent change events
 */
//=============================================================================
class CTimeDependentChangeListener
{
public:
    virtual ~CTimeDependentChangeListener() {}
    virtual void OnTimeDependentChange(CAsset *inAsset) = 0;
};

//=============================================================================
/**
 * Listener for toolbar change events
 */
//=============================================================================
class CToolbarChangeListener
{
public:
    virtual ~CToolbarChangeListener() {}
    virtual void OnToolbarChange() = 0;
};

//=============================================================================
/**
 * Listener for changes to the presentation.
 */
class CPresentationChangeListener
{
public:
    virtual ~CPresentationChangeListener() {}
    /**
     * New presentation or subpresentation (e.g. subtree such as component or pasted object) is
     * being loaded.
     */
    virtual void OnLoadingPresentation(bool inIsSubPresentation)
    {
        Q_UNUSED(inIsSubPresentation);
    }

    /**
     * New presentation is being created.
     */
    virtual void OnNewPresentation() {}

    /**
     * The current presentation is being closed.
     */
    virtual void OnClosingPresentation() {}

    /**
     * The current presentation is being saved.
     */
    virtual void OnSavingPresentation(const QString &inNewPresentationFile)
    {
        Q_UNUSED(inNewPresentationFile);
    }

    virtual void OnExportingAsset(qt3dsdm::Qt3DSDMInstanceHandle inInstance)
    {
        Q_UNUSED(inInstance);
    }

    virtual void OnPresentationModifiedExternally() {}
};

class CClientPlayChangeListener
{
public:
    virtual ~CClientPlayChangeListener() {}

    //==========================================================================
    /**
     * The presentation is being played (preview in studio)
     */
    virtual void OnPlayStart(){}

    //==========================================================================
    /**
     * The presentation is being stopped (preview in studio)
     */
    virtual void OnPlayStop(){}

    //==========================================================================
    /**
     * The presentation time has changed.
     * @param inTime the new client time.
     */
    virtual void OnTimeChanged(long inTime) = 0;
};

class CNavigationListener
{
public:
    virtual void OnNavigate(const QString &inURL, bool inForceDisplay) = 0;
};

class CFileOpenListener
{
public:
    virtual void OnOpenDocument(const QString &inFilename, bool inSucceeded) = 0;
    virtual void OnSaveDocument(const QString &inFilename, bool inSucceeded, bool inSaveCopy) = 0;
    virtual void OnDocumentPathChanged(const QString &inNewPath) = 0;
};

class CSelectedNodePropChangeListener
{
public:
    virtual void OnPropValueChanged(const QString &inPropertyName) = 0;
    virtual void OnMouseDragged(bool inConstrainXAxis, bool inConstrainYAxis) = 0;
};

//=============================================================================
/**
 * Listener for edit camera change events
 */
//=============================================================================
class CEditCameraChangeListener
{
public:
    virtual void onEditCameraChanged() = 0;
    virtual void onEditCamerasTransformed() = 0;
    virtual void onAuthorZoomChanged() = 0;
};

class CTimelineChangeListener
{
public:
    virtual void OnTimelineLayoutChanged() = 0;
};

///////////////////////////////////////////////////////////////////////////////
// Listener for async events originating in the core
class CCoreAsynchronousEventListener
{
public:
    virtual ~CCoreAsynchronousEventListener() {}
    virtual void OnAsynchronousCommand(CCmd *inCmd) = 0;
};

///////////////////////////////////////////////////////////////////////////////
// Clean way for anyone to set the app status message
class CAppStatusListener
{
public:
    virtual ~CAppStatusListener() {}
    virtual void OnDisplayAppStatus(const QString &inStatusMsg) = 0;
    virtual void OnProgressBegin(const QString &inActionText,
                                 const QString &inAdditionalText) = 0;
    virtual void OnProgressEnd() = 0;
};

///////////////////////////////////////////////////////////////////////////////
// Notification of failures
class CFailListener
{
public:
    virtual ~CFailListener() {}
    virtual void OnAssetDeleteFail() = 0;
    virtual void OnPasteFail() = 0;
    virtual void OnBuildconfigurationFileParseFail(const QString &inMessage) = 0;
    virtual void OnSaveFail(bool inKnownError) = 0;
    virtual void OnErrorFail(const QString &inText) = 0;
    virtual void OnRefreshResourceFail(const QString &inResourceName,
                                       const QString &inDescription) = 0;
    virtual void OnUndefinedDatainputsFail(
            const QMultiMap<QString,
                            QPair<qt3dsdm::Qt3DSDMInstanceHandle,
                                  qt3dsdm::Qt3DSDMPropertyHandle>> *map) = 0;
};

class IDataModelListener
{
public:
    virtual ~IDataModelListener() {}
    // Fired before a large group of notifications come out so views can
    // only refresh their view once.
    virtual void OnBeginDataModelNotifications() = 0;
    // Fired after a large gruop of notifications (onInstancePropertyChanged, etc) come out
    // so views can be careful about refreshing their data and there view
    virtual void OnEndDataModelNotifications() = 0;

    // Fired during 3d drag or mouse move events (or keyframe drag) or likewise
    // events so that views that need to update based on the new data can.
    virtual void OnImmediateRefreshInstanceSingle(qt3dsdm::Qt3DSDMInstanceHandle inInstance) = 0;
    // Same thing, but fired when more than one instance is being refreshed.
    virtual void OnImmediateRefreshInstanceMultiple(qt3dsdm::Qt3DSDMInstanceHandle *inInstance,
                                                    long inInstanceCount) = 0;
};

class IReloadListener
{
public:
    virtual void OnReloadEffectInstance(qt3dsdm::Qt3DSDMInstanceHandle inInstance) = 0;
};

class IDocumentBufferCacheListener
{
public:
    virtual ~IDocumentBufferCacheListener() {}
    // I can't get reference messages to work with the dispatch system.
    virtual void OnBufferInvalidated(const QString &inString) = 0;
};

///////////////////////////////////////////////////////////////////////////////
// For StudioRenderer to send messages
class CRendererListener
{
public:
    virtual void OnRendererInitialized() = 0;
};

#endif // INCLUDED_DISPATCHLISTENERS_H