00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef LIGHTAPP_DIALOG_H
00027 #define LIGHTAPP_DIALOG_H
00028
00029 #include "LightApp.h"
00030 #include <QtxDialog.h>
00031
00032 #include <QList>
00033 #include <QMap>
00034 #include <QPixmap>
00035
00036 class QLineEdit;
00037 class QAbstractButton;
00038 class QLabel;
00039
00040 class SUIT_ResourceMgr;
00041
00042 #ifdef WIN32
00043 #pragma warning ( disable:4251 )
00044 #endif
00045
00054 class LIGHTAPP_EXPORT LightApp_Dialog : public QtxDialog
00055 {
00056 Q_OBJECT
00057
00058 public:
00059 typedef QList<int> TypesList;
00060 typedef QMap<int,QStringList> SelectedObjects;
00061
00062 enum ObjectWg
00063 {
00064 Label = 0x00000001,
00065 Btn = 0x00000002,
00066 Control = 0x00000004
00067 };
00068
00069 typedef enum
00070 {
00071 OneName,
00072 OneNameOrCount,
00073
00074 ListOfNames,
00075 Count
00076
00077 } NameIndication;
00080
00081 public:
00082 LightApp_Dialog( QWidget* = 0, const char* = 0, bool = false,
00083 bool = false, const int = Standard, Qt::WindowFlags = 0 );
00084 virtual ~LightApp_Dialog();
00085
00086 virtual void show();
00087
00089 bool isExclusive() const;
00090
00092 void setExclusive( const bool );
00093
00095 bool isAutoResumed() const;
00096
00098 void setAutoResumed( const bool );
00099
00101 void showObject( const int );
00102
00104 void hideObject( const int );
00105
00107 void setObjectShown( const int, const bool );
00108
00110 bool isObjectShown( const int ) const;
00111
00113 void setObjectEnabled( const int, const bool );
00114
00116 bool isObjectEnabled( const int ) const;
00117
00119 QWidget* objectWg( const int theId, const int theWgId ) const;
00120
00122 void selectObject( const QString&, const int, const QString&, const bool = true );
00123
00128 void selectObject( const QStringList&, const TypesList&, const QStringList&, const bool = true );
00129
00131 QString objectText( const int ) const;
00132
00134 void setObjectText( const int, const QString& );
00135
00137 void selectObject( const int, const QString&, const int, const QString&, const bool = true );
00138 void selectObject( const int, const QStringList&, const TypesList&, const QStringList&, const bool = true );
00139
00141 bool hasSelection( const int ) const;
00142
00144 void clearSelection( const int = -1 );
00145
00147 void selectedObject( const int, QStringList& ) const;
00148
00150 QString selectedObject( const int ) const;
00151
00153 void objectSelection( SelectedObjects& ) const;
00154
00156 void activateObject( const int );
00157
00159 void deactivateAll();
00160
00161 signals:
00163 void selectionChanged ( int );
00164
00166 void objectActivated ( int );
00167
00169 void objectDeactivated( int );
00170
00171
00172
00173
00174
00175 void objectChanged( int, const QStringList& );
00176
00177 protected:
00179 SUIT_ResourceMgr* resMgr() const;
00180
00185 int createObject ( const QString&, QWidget*, const int = -1 );
00186
00188 void setObjectPixmap ( const QPixmap& );
00189
00191 void setObjectPixmap ( const QString&, const QString& );
00192
00194 void renameObject ( const int, const QString& );
00195
00197 void setObjectType ( const int, const int, ... );
00198
00200 void setObjectType ( const int, const TypesList& );
00201
00206 void addObjectType ( const int, const int, const int, ... );
00207
00209 void addObjectType ( const int, const TypesList& );
00210
00212 void addObjectType ( const int, const int );
00213
00215 void removeObjectType( const int );
00216
00218 void removeObjectType( const int, const TypesList& );
00219
00221 void removeObjectType( const int, const int );
00222
00224 bool hasObjectType ( const int, const int ) const;
00225
00227 void objectTypes ( const int, TypesList& ) const;
00228
00230 QString& typeName( const int );
00231 const QString typeName( const int ) const;
00232
00234 virtual QString selectionDescription( const QStringList&, const TypesList&, const NameIndication ) const;
00235
00237 virtual QString countOfTypes( const TypesList& ) const;
00238
00240 NameIndication nameIndication( const int ) const;
00241 void setNameIndication( const int, const NameIndication );
00242
00244 bool multipleSelection( const int ) const;
00245
00248 void setReadOnly( const int, const bool );
00249
00251 bool isReadOnly( const int ) const;
00252
00253 private slots:
00255 void onToggled( bool );
00256
00258 void onTextChanged( const QString& );
00259
00260 private:
00265 void updateButtons( const int = -1 );
00266
00271 void updateObject( const int, bool = true );
00272
00274 void filterTypes( const int, QStringList&, TypesList&, QStringList& ) const;
00275
00276 private:
00277 typedef struct
00278 {
00279 QLineEdit* myEdit;
00280 QAbstractButton* myBtn;
00281 QLabel* myLabel;
00282 QStringList myNames, myIds;
00283 TypesList myTypes, myPossibleTypes;
00284 NameIndication myNI;
00285
00286 } Object;
00287
00288 typedef QMap<int, Object> ObjectMap;
00289
00290 private:
00291 ObjectMap myObjects;
00292
00293 QMap<int,QString> myTypeNames;
00294 bool myIsExclusive, myIsBusy;
00295 QPixmap myPixmap;
00296 };
00297
00298 #ifdef WIN32
00299 #pragma warning ( default:4251 )
00300 #endif
00301
00302 #endif