itom
Loading...
Searching...
No Matches
abstractApiWidget.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2020, Institut für Technische Optik (ITO),
5 Universität Stuttgart, Germany
6
7 This file is part of itom and its software development toolkit (SDK).
8
9 itom is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Library General Public Licence as published by
11 the Free Software Foundation; either version 2 of the Licence, or (at
12 your option) any later version.
13
14 In addition, as a special exception, the Institut für Technische
15 Optik (ITO) gives you certain additional rights.
16 These rights are described in the ITO LGPL Exception version 1.0,
17 which can be found in the file LGPL_EXCEPTION.txt in this package.
18
19 itom is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
22 General Public Licence for more details.
23
24 You should have received a copy of the GNU Library General Public License
25 along with itom. If not, see <http://www.gnu.org/licenses/>.
26*********************************************************************** */
27
28#ifndef ABSTRACTAPIWIDGET_H
29#define ABSTRACTAPIWIDGET_H
30
31#include "apiFunctionsGraphInc.h"
32#include "apiFunctionsInc.h"
33
34#include <qwidget.h>
35
36#include "retVal.h"
37
38
39#if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC) //only moc this file in itomCommonQtLib but not in other libraries or executables linking against this itomCommonQtLib
40
41//place this macro in the header file of the designer plugin widget class right before the first section (e.g. public:)
42#define WIDGET_ITOM_API \
43 protected: \
44 void importItomApi(void** apiPtr) \
45 {ito::ITOM_API_FUNCS = apiPtr;} \
46 void importItomApiGraph(void** apiPtr) \
47 { ito::ITOM_API_FUNCS_GRAPH = apiPtr;} \
48 public: \
49 //.
50
51class QEvent; //forward declaration
52
53namespace ito {
54
55class AbstractApiWidgetPrivate; //forward declaration
56
57class ITOMCOMMONQT_EXPORT AbstractApiWidget : public QWidget
58{
59 Q_OBJECT
60
61public:
62 explicit AbstractApiWidget(QWidget *parent = 0);
63 virtual ~AbstractApiWidget();
64
65 virtual bool event(QEvent *e);
66 void setApiFunctionGraphBasePtr(void **apiFunctionGraphBasePtr);
67 void setApiFunctionBasePtr(void **apiFunctionBasePtr);
68 void ** getApiFunctionGraphBasePtr(void) { return m_apiFunctionsGraphBasePtr; }
69 void ** getApiFunctionBasePtr(void) { return m_apiFunctionsBasePtr; }
70
71protected:
72 virtual RetVal init() { return retOk; } //this method is called from after construction and after that the api pointers have been transmitted
73
74 virtual void importItomApi(void** apiPtr) = 0;
75 virtual void importItomApiGraph(void** apiPtr) = 0;
77 void **m_apiFunctionsGraphBasePtr;
78 void **m_apiFunctionsBasePtr;
79
80private:
82
83};
84
85} // namespace ito
86
87#endif //#if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC)
88
89#endif // ABSTRACTAPIWIDGET_H
Definition abstractApiWidget.h:58
virtual void importItomApi(void **apiPtr)=0
virtual void importItomApiGraph(void **apiPtr)=0
Definition abstractApiWidget.cpp:45
Class for managing status values (like errors or warning)
Definition retVal.h:54
Definition apiFunctionsGraph.cpp:40
@ retOk
Definition typeDefs.h:58