Ananas Library 0.9.5
awidget.h
1/****************************************************************************
2** $Id: awidget.h,v 1.37 2006/09/27 12:01:38 gr Exp $
3**
4** Header file of the Ananas visual bject of Ananas
5** Designer and Engine applications
6**
7** Created : 20031201
8**
9** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved.
10**
11** This file is part of the Library of the Ananas
12** automation accounting system.
13**
14** This file may be distributed and/or modified under the terms of the
15** GNU General Public License version 2 as published by the Free Software
16** Foundation and appearing in the file LICENSE.GPL included in the
17** packaging of this file.
18**
19** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21**
22** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
23** See http://www.leaderit.ru/gpl/ for GPL licensing information.
24**
25** Contact org@leaderit.ru if any conditions of this licensing are
26** not clear to you.
27**
28**********************************************************************/
29
30#ifndef AWIDGET_H
31#define AWIDGET_H
32#include <qsqlform.h>
33#include <qtoolbar.h>
34#include <qmainwindow.h>
35#include "ananas.h"
36
37class QWidget;
38
39
40
52class ANANAS_EXPORT aWidget : public QWidget
53{
54 Q_OBJECT
55// Q_PROPERTY( QString Name READ getName WRITE setName STORED true DESIGNABLE false )
56 Q_PROPERTY( int Id READ getId WRITE setId STORED true DESIGNABLE false )
57 Q_PROPERTY( bool openEditor READ getOpenEditor WRITE setOpenEditor STORED false )
58 Q_PROPERTY( int FormMode READ formMode WRITE setFormMode STORED true )
59public:
60 aDatabase* db;
61 aCfg* md;
62 aEngine* engine;
63
64 aWidget( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 );
65 aWidget( const QString &oname, aDatabase *adb, QWidget *parent = 0, const char *name = 0, WFlags fl = 0 );
66 aWidget( aCfgItem context, aDatabase *adb, QWidget *parent = 0, const char *name = 0, WFlags fl = 0 );
67 virtual ~aWidget();
68
69 virtual bool checkStructure();
70 virtual void initObject( aDatabase *adb );
71 virtual void widgetEditor();
72 static void widgetEditor( QWidget *object, QDialog *editor );
73 virtual QDialog* createEditor( QWidget *parent );
74 virtual QToolBar* createToolBar( QMainWindow *parent );
75 virtual aObject* createDBObject( aCfgItem obj, aDatabase * );
76 virtual QString displayString();
77
78 void init( aDatabase *adb );
79 bool getOpenEditor() const { return false; };
80 void setOpenEditor( bool );// { widgetEditor(); };
81 bool isInited() { return vInited; };
82 virtual bool isContainer();
83 void setInited( bool flag ){ vInited = flag; };
84// void formInsert( QWidget *widget, const QString &field );
85// void formRemove( const QString &field );
86 static aWidget* parentContainer( QWidget *w );
87 static aForm* parentForm( QWidget *w );
88 aCfgItem* getMDObject();
89 void setMDObject( aCfgItem object );
90 aSQLTable* table( const QString &name = "" );
91// bool tableInsert( const QString &name );
92// bool tableRemove( const QString &name );
93 void setObjectData( QWidget *object, aCfg *md );
94 void getObjectData( QWidget *object );
95 aCfg* getMd();
96 virtual Q_ULLONG uid();
97 virtual ERR_Code New();
98 virtual ERR_Code Update();
99 virtual ERR_Code TurnOn();
100 virtual ERR_Code Select( Q_ULLONG id );
101 aObject* dataObject(){ return dbobj; };
102
103 virtual Q_ULLONG docId();
104 int formMode() const { return vFormMode; };
105 virtual void setFormMode( int mode ){ vFormMode = mode; };
106 virtual QString getFieldName() const { return ""; };
107
108 static QString widgetName( QWidget *w );
109 static QWidget* Widget( QWidget *owner, QString name );
110
111// QString getName() const;
112// void setName( QString fn );
113 int getId() const { return vId ;};
114 void setId( int fn ){ vId = fn; };
115
116public slots:
117 virtual QVariant value( const QString & name );
118 virtual QString value() const {return QString::null;};
119 virtual QString textValue() {return QString::null;};
120 virtual void setValue( const QString &);
121 virtual int setValue( const QString & name, const QVariant &value );
122 virtual int setObjValue( const QString & nameWidget, aObject *value );
123 virtual void SetReadOnly(bool);
124 virtual int Refresh();
125 QWidget* Widget( QString name, bool onlyMyWidgets = true );
126
127 virtual aDataField* getAttribute( const QString & name );
128 virtual int setAttribute( const QString & name, const aDataField *value );
129
130signals:
131 void setData( QWidget *, aCfg * );
132 void getData( QWidget * );
133 void getMd( aCfg ** );
134 void valueChanged( const QString &, const QVariant & );
135 void valueChanged( const QString &, const QVariant &, const QString & );
136 void changeObj(const QString &);
137 void changeObjId(const Q_ULLONG);
138 void keyPressed(QKeyEvent *e);
139
140protected:
141 aObject *dbobj;
142 virtual void updateProp() {};
143 virtual void keyPressEvent ( QKeyEvent * e );
144private:
145 bool vInited;
146 QString vName;
147 int vId, vFormMode;
148 aCfgItem obj;
149 QSqlForm* form;
150// QDict <aSQLTable> dbtables;
151};
152
153
154#endif
Класс реализует програмный интерфейс доступа к элементам метаданных системы. Наследует QObject.
Definition acfg.h:437
Класс определяет программный интерфейс для доступа к полям бизнес объектов Ананаса....
Definition adatafield.h:61
Класс для работы с СУБД. Ananas Data Abstraction Layer. Наследует QObject.
Definition adatabase.h:78
Определяет программный интерфейс Runtime системы, который используется Ананас скриптом....
Definition engine.h:88
Определяет программный интерфейс экранных форм Ананаса, предназначенный для использования Ананас....
Definition aform.h:76
Базовый класс для невизуальных классов (моделей в терминологии MVC) Ананаса, которым необходим доступ...
Definition aobject.h:64
Базовый класс для визуальных объектов. Наследует QWidget.
Definition awidget.h:53