CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
FxUIObject.h
Go to the documentation of this file.
1//
2// (C) Copyright 2005-2023 by Graebert GmbH.
3//
4// Permission to use, copy, modify, and distribute this software in
5// object code form for any purpose and without fee is hereby granted,
6// provided that the above copyright notice appears in all copies and
7// that both that copyright notice and the limited warranty and
8// restricted rights notice below appear in all supporting
9// documentation.
10//
11// GRAEBERT PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
12// GRAEBERT SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
13// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. GRAEBERT GMBH
14// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
15// UNINTERRUPTED OR ERROR FREE.
16
17#pragma once
18
19#include "../FxCommonFramework.h"
20
21#include <QtCore/QBuffer>
22#include <QtCore/QByteArray>
23#include <QtCore/QDate>
24#include <QtCore/QFile>
25#include <QtCore/QList>
26#include <QtCore/QMap>
27#include <QtCore/QString>
28#include <QtCore/QUuid>
29#include <QtCore/QVariant>
30#include <QtCore/QVector>
31#include <QtGui/QPalette>
32#include <QtGui/QValidator>
33#if !defined( XENON )
34#include <QtGui/QIcon>
35#include <QtGui/QPixmap>
36#endif
37
38using CFxUIBuffer = QBuffer;
39using CFxUIByteArray = QByteArray;
40using CFxUIByteArrayList = QByteArrayList;
41using CFxUIDate = QDate;
42using CFxUIFile = QFile;
43template<typename T>
44using CFxUIList = QList<T>;
45using CFxUIPainter = QPainter;
46using CFxUIPalette = QPalette;
47using CFxUISize = QSize;
48using CFxUIString = QString;
49using CFxUIStringList = QStringList;
50using CFxUIUuid = QUuid;
51using CFxUIValidator = QValidator;
52using CFxUIVariant = QVariant;
53using CFxUIFont = QFont;
54template< typename K, typename V >
56template< typename T >
57using CFxUIVector = QVector<T>;
58#if defined(XENON)
59#include <Wt/WLink.h>
60using CFxUIIcon = Wt::WLink;
61using CFxUIPixmap = Wt::WLink;
62#else
63using CFxUIIcon = QIcon;
64using CFxUIPixmap = QPixmap;
65#endif
66
67#if defined( Q_OS_IOS )
68 typedef void* FxNativeHandle;
69#elif defined( ANDROID )
70 #include <jni.h>
71 #include "../../../DDKERNEL/touch/FxJavaUtils.h"
72 typedef CFxJavaHandle* FxNativeHandle;
73#else
74 #if defined(XENON)
75#ifdef emit
76#undef emit
77#define FX_REDEFINE_EMIT
78#endif
79#ifdef slots
80#undef slots
81#define FX_REDEFINE_SLOTS
82#endif
83 #include <Wt/WObject.h>
84 typedef Wt::WObject* FxNativeHandle;
85#ifdef FX_REDEFINE_EMIT
86#define emit
87#endif
88#ifdef FX_REDEFINE_SLOTS
89#define slots
90#endif
91 #else
92 typedef QObject* FxNativeHandle;
93 #endif
94#endif
95
96class CFxUIObjectImpl;
97class CFxUIObjectData;
98class CFxUIEmitScope;
99
104{
105 friend CFxUIObjectData;
106 friend CFxUIEmitScope;
107public:
108
111
113 virtual ~CFxUIObject();
114
123
129 void setHandle( FxNativeHandle handle );
130
136 void setParent( CFxUIObject* parent );
137
144
150 const CFxUIObject* parent() const;
151
157 void setObjectName( const CFxUIString& objectName );
158
165
173 bool setProperty( const char* name, const CFxUIVariant& value );
174
182 CFxUIVariant property( const char* name );
183
190
198 template<typename T>
200 {
201 CFxUIList<T> result;
202
203 CFxUIList<CFxUIObject*> allChildren = children();
204 for ( CFxUIObject* child : allChildren )
205 {
206 if ( T obj = dynamic_cast<T>( child ) )
207 {
208 if ( !name.isEmpty() )
209 {
210 if ( name == obj->objectName() )
211 result.push_back( obj );
212 }
213 else
214 result.push_back( obj );
215 }
216 }
217
218 return result;
219 }
220
226 void blockSignals( bool block );
227
233 bool signalsBlocked() const;
234
235protected:
242
243private:
249 void setSender( CFxUIObject* pSender );
250
251protected:
252 CFxUIObjectImpl* m_pImpl;
253 CFxUIObjectData* m_pData;
254
255 //...
256};
#define COMMONUI_API
QUuid CFxUIUuid
Definition: FxUIObject.h:50
QByteArrayList CFxUIByteArrayList
Definition: FxUIObject.h:40
QList< T > CFxUIList
Definition: FxUIObject.h:44
QStringList CFxUIStringList
Definition: FxUIObject.h:49
QString CFxUIString
Definition: FxUIObject.h:48
QDate CFxUIDate
Definition: FxUIObject.h:41
QValidator CFxUIValidator
Definition: FxUIObject.h:51
QIcon CFxUIIcon
Definition: FxUIObject.h:63
QPalette CFxUIPalette
Definition: FxUIObject.h:46
QByteArray CFxUIByteArray
Definition: FxUIObject.h:39
QVector< T > CFxUIVector
Definition: FxUIObject.h:57
QFile CFxUIFile
Definition: FxUIObject.h:42
QPixmap CFxUIPixmap
Definition: FxUIObject.h:64
QVariant CFxUIVariant
Definition: FxUIObject.h:52
QFont CFxUIFont
Definition: FxUIObject.h:53
QBuffer CFxUIBuffer
Definition: FxUIObject.h:38
QObject * FxNativeHandle
Definition: FxUIObject.h:92
QPainter CFxUIPainter
Definition: FxUIObject.h:45
QSize CFxUISize
Definition: FxUIObject.h:47
CFxUIString objectName() const
CFxUIObjectData * m_pData
Definition: FxUIObject.h:253
CFxUIObjectImpl * m_pImpl
Definition: FxUIObject.h:252
CFxUIVariant property(const char *name)
void setParent(CFxUIObject *parent)
virtual ~CFxUIObject()
bool setProperty(const char *name, const CFxUIVariant &value)
FxNativeHandle getHandle() const
void setHandle(FxNativeHandle handle)
void blockSignals(bool block)
CFxUIObject * sender()
CFxUIObject * parent()
bool signalsBlocked() const
CFxUIList< T > findChildren(const CFxUIString &name=CFxUIString())
Definition: FxUIObject.h:199
void setObjectName(const CFxUIString &objectName)
CFxUIList< CFxUIObject * > children() const
const CFxUIObject * parent() const
GLuint const GLchar * name
Definition: gles2_ext.h:265
GLsizei const GLfloat * value
Definition: gles2_ext.h:302