1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/
19 // File: QtxDialog.hxx
20 // Author: Sergey TELKOV
29 #include <qvaluelist.h>
36 #pragma warning( disable:4251 )
39 class QTX_EXPORT QtxDialog : public QDialog
47 typedef enum { Position, Expand, Uniform } PlacePolicy;
48 typedef enum { TopArea, BottomArea, LeftArea, RightArea } ButtonArea;
49 typedef enum { Left, Right, Center, Top = Left, Bottom = Right } ButtonPosition;
51 typedef enum { None = 0x00000000,
59 OKCancel = OK | Cancel,
61 Standard = OK | Cancel | Help,
62 All = Standard | YesNo | Apply | Close } ButtonFlags;
64 typedef enum { Accept = 0x000001,
67 SetFocus = 0x000008 } DialogFlags;
70 QtxDialog( QWidget* = 0, const char* = 0, bool = false,
71 bool = false, const int = Standard, WFlags = 0 );
74 void setDialogFlags( const int );
75 void clearDialogFlags( const int );
76 bool testDialogFlags( const int ) const;
78 void setButtonFlags( const int );
79 void clearButtonFlags( const int );
80 bool testButtonFlags( const int ) const;
82 int buttonPosition( const int ) const;
83 void setButtonPosition( const int, const int = -1 );
84 void setPlacePosition( const int, const int );
86 int placePolicy( const int ) const;
87 void setPlacePolicy( const int, const int );
88 void setButtonPlace( const int, const int );
90 QString buttonText( const int );
91 void setButtonText( const int, const QString& text );
93 void setButtonFocus( const int );
94 bool hasButtonFocus( const int ) const;
96 bool isButtonEnabled( const int ) const;
97 void setButtonEnabled( const bool, const int );
99 bool isBorderEnabled( const int ) const;
100 void setBorderEnabled( const bool, const int );
102 void removeButton( const int );
103 int insertButton( const QString&, const int = BottomArea );
105 QValueList<int> userButtonIds() const;
106 QButton* userButton( const int ) const;
111 uint setAlignment( uint align );
112 static void setUnits( QLabel*, const QString& );
115 void dlgButton( int );
116 void dlgParamChanged();
131 virtual void accept();
132 virtual void reject();
138 void onSizeGripDestroyed();
139 void onDestroyed( QObject* );
142 typedef QMap<int, QButton*> ButtonMap;
145 QFrame* mainFrame() const;
147 virtual bool acceptData() const;
148 virtual bool rejectData() const;
150 virtual QButton* createButton( QWidget* );
152 QButton* button( const int ) const;
153 ButtonMap buttons( const int = All ) const;
154 int buttonId( const QButton* ) const;
155 int buttonPosition( QButton* ) const;
157 virtual void showEvent( QShowEvent* );
158 virtual void hideEvent( QHideEvent* );
159 virtual void closeEvent( QCloseEvent* );
160 virtual void childEvent( QChildEvent* );
161 virtual void keyPressEvent( QKeyEvent* );
164 void adjustButtons();
168 typedef QMap<int, Area*> AreaMap;
169 typedef QMap<int, int> PositionMap;
176 PositionMap myPosition;
179 const QObject* mySender;
187 #pragma warning( default:4251 )