Salome HOME
updated copyright message
[modules/gui.git] / src / Qtx / QtxDialog.cxx
1 // Copyright (C) 2007-2023  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 // File:      QtxDialog.cxx
24 // Author:    Sergey TELKOV
25 //
26 #include "QtxDialog.h"
27
28 #include <QLabel>
29 #include <QLayout>
30 #include <QKeyEvent>
31 #include <QFrame>
32 #include <QTabWidget>
33 #include <QPushButton>
34 #include <QApplication>
35
36 /*!
37   \class QtxDialog::Area
38   \internal
39   \brief Area containing dialog box buttons.
40 */
41
42 class QtxDialog::Area : public QFrame
43 {
44 public:
45   Area( Qt::Orientation, QtxDialog*, QWidget* = 0 );
46   virtual ~Area();
47
48   bool                     isBorderEnabled() const;
49   void                     setBorderEnabled( const bool );
50
51   void                     setBorderWidget( QLabel* );
52
53   void                     insertButton( QAbstractButton* );
54   void                     removeButton( QAbstractButton* );
55   bool                     contains( QAbstractButton* ) const;
56
57   int                      policy() const;
58   void                     setPolicy( const int );
59
60   void                     layoutButtons();
61
62   const QList<QAbstractButton*>& buttons() const;
63
64 private:
65   void                     updateBorder();
66
67 private:
68   QtxDialog*               myDlg;          //!< parent dialog box
69   QLabel*                  myLine;         //!< border widget 
70   bool                     myBorder;       //!< "has border" flag
71   int                      myPolicy;       //!< button layout type (QtxDialog::PlacePolicy)
72   QList<QAbstractButton*>  myButtons;      //!< buttons list
73   Qt::Orientation          myOrientation;  //!< buttons orientation (Qt::Orientation)
74 };
75
76 /*!
77   \brief Constructor.
78   \param o buttons orientation
79   \param dlg dialog box owning this area
80   \param parent parent widget
81 */
82 QtxDialog::Area::Area( Qt::Orientation o, QtxDialog* dlg, QWidget* parent )
83 : QFrame( parent ),
84   myDlg( dlg ),
85   myLine( 0 ),
86   myBorder( false ),
87   myPolicy( Position ),
88   myOrientation( o )
89 {
90   if ( myOrientation == Qt::Horizontal )
91     setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ) );
92   else
93     setSizePolicy( QSizePolicy( QSizePolicy::Maximum, QSizePolicy::Preferred ) );
94
95   hide();
96 }
97
98 /*!
99   \brief Destructor.
100 */
101 QtxDialog::Area::~Area()
102 {
103 }
104
105 /*!
106   \brief Insert button to the area.
107   \param b button to be added
108   \sa removeButton()
109 */
110 void QtxDialog::Area::insertButton( QAbstractButton* b )
111 {
112   if ( !b || myButtons.contains( b ) )
113     return;
114
115   QWidget* parent = b->parentWidget();
116   if ( parent != this )
117     b->setParent( this );
118
119   myButtons.append( b );
120
121   if ( myDlg )
122     myDlg->adjustButtons();
123   layoutButtons();
124
125   show();
126
127   updateBorder();
128 }
129
130 /*!
131   \brief Remove button from the area.
132   \param b button to be removed
133   \sa insertButton()
134 */
135 void QtxDialog::Area::removeButton( QAbstractButton* b )
136 {
137   if ( !b )
138     return;
139
140   myButtons.removeAll( b );
141
142   if ( myButtons.isEmpty() )
143     hide();
144
145   updateBorder();
146
147   if ( myDlg )
148     myDlg->adjustButtons();
149
150   layoutButtons();
151 }
152
153 /*!
154   \brief Check if area owns the button specified.
155   \param b button to be checked
156   \return \c true if area contains button
157 */
158 bool QtxDialog::Area::contains( QAbstractButton* b ) const
159 {
160   return myButtons.contains( b );
161 }
162
163 /*!
164   \brief Get buttons layout policy.
165   \return policy of button layouting (Qtx::PlacePolicy)
166   \sa setPolicy()
167 */
168 int QtxDialog::Area::policy() const
169 {
170   return myPolicy;
171 }
172
173 /*!
174   \brief Set buttons layout policy.
175   \param p new policy
176 */
177 void QtxDialog::Area::setPolicy( const int p )
178 {
179   if ( myPolicy == p )
180     return;
181
182   myPolicy = p;
183   layoutButtons();
184 }
185
186 /*!
187   \brief Check of the border is enabled.
188   \return \c true if border is enabled
189   \sa setBorderEnabled(), setBorderWidget()
190 */
191 bool QtxDialog::Area::isBorderEnabled() const
192 {
193   return myLine && myBorder;
194 }
195
196 /*!
197   \brief Enable/disable border (separator between main frame and button frame)
198   \param on new state
199 */
200 void QtxDialog::Area::setBorderEnabled( const bool on )
201 {
202   if ( !myLine || myBorder == on )
203     return;
204
205   myBorder = on;
206   updateBorder();
207 }
208
209 /*!
210   \brief Set border widget (separator between main frame and button frame).
211   \param line new separator widget
212 */
213 void QtxDialog::Area::setBorderWidget( QLabel* line )
214 {
215   if ( myLine == line )
216     return;
217
218   delete myLine;
219   myLine = line;
220   updateBorder();
221 }
222
223 /*!
224   \brief Get all area buttons.
225   \return const reference to the list of buttons
226 */
227 const QList<QAbstractButton*>& QtxDialog::Area::buttons() const
228 {
229   return myButtons;
230 }
231
232 /*!
233   \brief Update border visibility.
234 */
235 void QtxDialog::Area::updateBorder()
236 {
237   if ( !myLine )
238     return;
239
240   bool isVis = isVisibleTo( parentWidget() );
241   myLine->setVisible( isVis );
242
243   myLine->setLineWidth( myBorder ? 1 : 0 );
244 }
245
246 /*!
247   \brief Layout buttons in the area.
248 */
249 void QtxDialog::Area::layoutButtons()
250 {
251   int aPolicy = policy();
252
253   QMap<QAbstractButton*, int> buttonId;
254   for ( QList<QAbstractButton*>::iterator it1 = myButtons.begin(); it1 != myButtons.end(); ++it1 )
255     buttonId.insert( *it1, 0 );
256
257   QList<QAbstractButton*> src;
258   for ( ButtonMap::Iterator mit = myDlg->myButton.begin(); mit != myDlg->myButton.end(); ++mit )
259   {
260     if ( buttonId.contains( mit.value() ) )
261     {
262       buttonId[mit.value()] = mit.key();
263       if ( mit.key() >= 0 )
264         src.append( mit.value() );
265     }
266   }
267
268   for ( QList<QAbstractButton*>::iterator it2 = myButtons.begin(); it2 != myButtons.end(); ++it2 )
269   {
270     if ( buttonId[*it2] < 0 )
271       src.append( *it2 );
272   }
273
274   QList<QAbstractButton*> left, right, center, other;
275   for ( QList<QAbstractButton*>::iterator it = src.begin(); it != src.end(); ++it )
276   {
277     if ( !(*it)->isVisibleTo( this ) )
278       continue;
279
280     int aPosition = myDlg->buttonPosition( *it );
281     if ( aPosition == -1 )
282       continue;
283
284     if ( aPolicy != QtxDialog::Position )
285       other.append( *it );
286     else if ( aPosition == QtxDialog::Left )
287       left.append( *it );
288     else if ( aPosition == QtxDialog::Right )
289       right.append( *it );
290     else if ( aPosition == QtxDialog::Center )
291       center.append( *it );
292   }
293
294   delete layout();
295
296   QBoxLayout* buttonLayout = 0;
297   if ( myOrientation == Qt::Vertical )
298     buttonLayout = new QVBoxLayout( this );
299   else
300     buttonLayout = new QHBoxLayout( this );
301
302   if ( !buttonLayout )
303     return;
304
305   buttonLayout->setMargin( 0 );
306   buttonLayout->setSpacing( 5 );
307
308   if ( aPolicy == QtxDialog::Position )
309   {
310     for ( QList<QAbstractButton*>::iterator lit = left.begin(); lit != left.end(); ++lit )
311       buttonLayout->addWidget( *lit );
312     buttonLayout->addStretch( 1 );
313     for ( QList<QAbstractButton*>::iterator cit = center.begin(); cit != center.end(); ++cit )
314       buttonLayout->addWidget( *cit );
315     buttonLayout->addStretch( 1 );
316     for ( QList<QAbstractButton*>::iterator rit = right.begin(); rit != right.end(); ++rit )
317       buttonLayout->addWidget( *rit );
318   }
319   else
320   {
321     for ( int i = 0; i < (int)other.count(); i++ )
322     {
323       buttonLayout->addWidget( other[i] );
324       if ( aPolicy == QtxDialog::Uniform && i < (int)other.count() - 1  )
325         buttonLayout->addStretch( 1 );
326     }
327   }
328
329   QWidgetList wids;
330   if ( layout() )
331   {
332     for ( int i = 0; i < layout()->count(); i++ )
333     {
334       if ( !layout()->itemAt( i ) || layout()->itemAt( i )->widget() )
335         continue;
336
337       if ( QApplication::layoutDirection() == Qt::RightToLeft )
338         wids.prepend( layout()->itemAt( i )->widget() );
339       else
340         wids.append( layout()->itemAt( i )->widget() );
341     }
342   }
343   Qtx::setTabOrder( wids );
344 }
345
346
347 /*!
348   \class QtxDialog::Border
349   \internal
350   \brief Special label used as border widget (separator
351          between main frame and button frame).
352 */
353
354 class QtxDialog::Border : public QLabel
355 {
356 public:
357   Border( QWidget* = 0 );
358   virtual ~Border();
359
360   virtual void setLineWidth( int );
361
362   virtual QSize sizeHint() const;
363   virtual QSize minimumSizeHint() const;
364 };
365
366 /*!
367   \brief Constructor.
368   \param parent parent widget
369 */
370 QtxDialog::Border::Border( QWidget* parent )
371 : QLabel( parent )
372 {
373   setAlignment( Qt::AlignCenter );
374 }
375
376 /*!
377   \brief Destructor.
378 */
379 QtxDialog::Border::~Border()
380 {
381 }
382
383 /*!
384   \brief Set separator line width.
385   \param lw new line width
386 */
387 void QtxDialog::Border::setLineWidth( int lw )
388 {
389   bool isOn = lineWidth() > 0;
390
391   QLabel::setLineWidth( lw );
392     
393   if ( isOn != ( lineWidth() > 0 ) )
394     updateGeometry();
395 }
396
397 /*!
398   \brief Get recommended size for the widget.
399   \return recommended size for the widget
400 */
401 QSize QtxDialog::Border::sizeHint() const
402 {
403   QSize sz( 5, 5 );
404
405   if ( lineWidth() > 0 )
406   {
407     if ( frameShape() == VLine )
408       sz += QSize( 5 + lineWidth(), 0 );
409     else if ( frameShape() == HLine )
410       sz += QSize( 0, 5 + lineWidth() );
411   }
412
413   return sz;
414 }
415
416 /*!
417   \brief Get recommended minimum size for the widget.
418   \return recommended minimum size for the widget
419 */
420 QSize QtxDialog::Border::minimumSizeHint() const
421 {
422   return sizeHint();
423 }
424
425 /*!
426   \class QtxDialog
427   \brief Generic dialog box class.
428 */
429
430 /*!
431   \brief Constructor.
432
433   Construct a dialog with specified parent and name.
434   By default non-modal, non-resizable with the OK, Cancel and Help buttons
435   dialog box is created.
436
437   \param parent parent widget
438   \param modal if \c true dialog box is modal
439   \param allowResize if \c true then dialog can be resized by user
440   \param f specified control buttons for dialog box (QtxDialog::ButtonFlags)
441   \param wf dialog box flags (Qt::WindowFlags)
442 */
443 QtxDialog::QtxDialog( QWidget* parent, bool modal, bool allowResize, const int f, Qt::WindowFlags wf )
444 : QDialog( parent, (Qt::WindowFlags)( wf | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint | Qt::Dialog |
445 #ifdef WIN32
446            ( allowResize ? (Qt::WindowType)0 : Qt::FramelessWindowHint ) |
447 #endif
448            ( ( allowResize 
449 #ifdef WIN32 
450                // in qwidget_win.cpp flag WStyle_ContextHelp will be unset in WStyle_MinMax in switched ON
451                && !( wf & Qt::WindowContextHelpButtonHint )
452 #endif
453                ) ? Qt::WindowMaximizeButtonHint : (Qt::WindowType)0 ) ) ),
454   myInited( false ),
455   mySender( 0 ),
456   myAlignment( 0 ),
457   myDialogFlags( Accept | SetFocus )
458 {
459   setModal( modal );
460
461   QVBoxLayout* base = new QVBoxLayout( this );
462   base->setMargin( 5 );
463   base->setSpacing( 0 );
464
465   QWidget* main = new QWidget( this );
466   base->addWidget( main );
467
468   QVBoxLayout* lMain = new QVBoxLayout( main );
469   lMain->setMargin( 0 );
470   lMain->setSpacing( 0 );
471
472   Area* topArea = new Area( Qt::Horizontal, this, main );
473   QLabel* topLine = new Border( main );
474   lMain->addWidget( topArea );
475   lMain->addWidget( topLine );
476
477   QWidget* midGroup = new QWidget( main );
478   lMain->addWidget( midGroup );
479
480   QVBoxLayout* midLyout = new QVBoxLayout( midGroup );
481   midLyout->setMargin( 0 );
482   midLyout->setSpacing( 0 );
483
484   QLabel* botLine = new Border( main );
485   Area* botArea = new Area( Qt::Horizontal, this, main );
486   lMain->addWidget( botLine );
487   lMain->addWidget( botArea );
488
489   Area* leftArea = new Area( Qt::Vertical, this, midGroup );
490   QLabel* leftLine = new Border( midGroup );
491   midLyout->addWidget( leftArea );
492   midLyout->addWidget( leftLine );
493
494   myMainFrame = new QFrame( midGroup );
495   midLyout->addWidget( myMainFrame );
496
497   QLabel* rightLine = new Border( midGroup );
498   Area* rightArea = new Area( Qt::Vertical, this, midGroup );
499   midLyout->addWidget( rightLine );
500   midLyout->addWidget( rightArea );
501
502   myMainFrame->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
503
504   topLine->setFrameStyle( QFrame::Sunken | QFrame::HLine );
505   botLine->setFrameStyle( QFrame::Sunken | QFrame::HLine );
506   leftLine->setFrameStyle( QFrame::Sunken | QFrame::VLine );
507   rightLine->setFrameStyle( QFrame::Sunken | QFrame::VLine );
508
509   topArea->setBorderWidget( topLine );
510   botArea->setBorderWidget( botLine );
511   leftArea->setBorderWidget( leftLine );
512   rightArea->setBorderWidget( rightLine );
513
514   myArea.insert( TopArea,    topArea );
515   myArea.insert( BottomArea, botArea );
516   myArea.insert( LeftArea,   leftArea );
517   myArea.insert( RightArea,  rightArea );
518
519   for ( AreaMap::Iterator itr = myArea.begin(); itr != myArea.end(); ++ itr )
520     itr.value()->setBorderEnabled( false );
521
522   myButton.insert( OK,     new QPushButton( tr( "&OK" ),     this ) );
523   myButton.insert( Cancel, new QPushButton( tr( "&Cancel" ), this ) );
524   myButton.insert( Close,  new QPushButton( tr( "C&lose" ),  this ) );
525   myButton.insert( Help,   new QPushButton( tr( "&Help" ),   this ) );
526   myButton.insert( Apply,  new QPushButton( tr( "&Apply" ),  this ) );
527   myButton.insert( Yes,    new QPushButton( tr( "&Yes" ),    this ) );
528   myButton.insert( No,     new QPushButton( tr( "&No" ),     this ) );
529
530   for ( ButtonMap::Iterator it = myButton.begin(); it != myButton.end(); ++it )
531   {
532     ((QPushButton*)it.value())->setAutoDefault( false );
533     connect( it.value(), SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
534   }
535
536   setButtonPosition( Left,   OK | Cancel | Apply );
537   setButtonPosition( Center, Yes | No | Close );
538   setButtonPosition( Right,  Help );
539   setButtonPlace( BottomArea, All );
540
541   connect( myButton[Apply],  SIGNAL( clicked() ), this, SIGNAL( dlgApply() ) );
542   connect( myButton[Help],   SIGNAL( clicked() ), this, SIGNAL( dlgHelp() ) );
543
544   connect( myButton[OK],     SIGNAL( clicked() ), this, SLOT( onAccept() ) );
545   connect( myButton[Cancel], SIGNAL( clicked() ), this, SLOT( onReject() ) );
546   connect( myButton[Yes],    SIGNAL( clicked() ), this, SLOT( onAccept() ) );
547   connect( myButton[No],     SIGNAL( clicked() ), this, SLOT( onReject() ) );
548   connect( myButton[Close],  SIGNAL( clicked() ), this, SLOT( onReject() ) );
549
550   QIcon icon;
551   QWidget* p = parentWidget();
552   while( p && p->parentWidget() )
553     p = p->parentWidget();
554
555   if ( p )
556     setWindowIcon( p->windowIcon() );
557
558   myButtonFlags = f;
559
560 #ifndef WIN32
561   if ( !allowResize )
562     setMaximumSize( minimumSize() );
563 #endif
564
565   update();
566 }
567
568 /*!
569   \brief Destructor.
570 */
571 QtxDialog::~QtxDialog()
572 {
573 }
574
575 /*!
576   \brief Add specified control button(s) to the dialog box.
577   \param f ORed buttons flags (Qtx::ButtonFlags)
578   \sa clearButtonFlags(), testButtonFlags()
579 */
580 void QtxDialog::setButtonFlags( const int f )
581 {
582   int old = myButtonFlags;
583   myButtonFlags = myButtonFlags | f;
584   if ( old != myButtonFlags )
585     update();
586 }
587
588 /*!
589   \brief Remove specified control button(s) from the dialog box.
590   \param f ORed buttons flags (Qtx::ButtonFlags)
591   \sa setButtonFlags(), testButtonFlags()
592 */
593 void QtxDialog::clearButtonFlags( const int f )
594 {
595   int old = myButtonFlags;
596   myButtonFlags = myButtonFlags & ~f;
597   if ( old != myButtonFlags )
598     update();
599 }
600
601 /*!
602   \brief Test specified buttons.
603   \return \c true if specified control buttons are used in the dialog box
604   \sa setButtonFlags(), clearButtonFlags()
605 */
606 bool QtxDialog::testButtonFlags( const int f ) const
607 {
608   return ( myButtonFlags & f ) == f;
609 }
610
611 /*!
612   \brief Set specified dialog box flags.
613   \param f dialog box flags (QtxDialog::DialogFlags)
614   \sa clearDialogFlags(), testDialogFlags(), acceptData(), rejectData()
615 */
616 void QtxDialog::setDialogFlags( const int f )
617 {
618   myDialogFlags = myDialogFlags | f;
619 }
620
621 /*!
622   \brief Clear specified the dialog flags.
623   \param f dialog box flags (QtxDialog::DialogFlags)
624   \sa setDialogFlags(), testDialogFlags()
625 */
626 void QtxDialog::clearDialogFlags( const int f )
627 {
628   myDialogFlags = myDialogFlags & ~f;
629 }
630
631 /*!
632   \brief Test specified dialog flags.
633   \return \c true if specified dialog box falgs are set
634   \sa setDialogFlags(), clearDialogFlags()
635 */
636 bool QtxDialog::testDialogFlags( const int f ) const
637 {
638   return ( myDialogFlags & f ) == f;
639 }
640
641 /*!
642   \brief Get dialog box main frame widget.
643
644   Main frame is an internal widget which should contains all
645   elements of dialog box except control buttons.
646
647   \return main frame widget 
648 */
649 QFrame* QtxDialog::mainFrame() const
650 {
651   return myMainFrame;
652 }
653
654 /*!
655   \brief Get specified control button position
656   \param id control button ID (QtxDialog::ButtonFlags)
657   \return button's position (QtxDialog::ButtonPosition) or -1 if it is not set or invalid \a id is given
658   \sa setButtonPosition()
659 */
660 int QtxDialog::buttonPosition( const int id ) const
661 {
662   int pos = -1;
663   if ( myPosition.contains( id ) )
664     pos = myPosition[id];
665   return pos;
666 }
667 /*!
668   \brief Set the specified control button(s) position.
669   \param id control button(s) ID (QtxDialog::ButtonFlags)
670   \param pos button(s) position (QtxDialog::ButtonPosition)
671 */
672 void QtxDialog::setButtonPosition( const int pos, const int id )
673 {
674   ButtonMap map = buttons( id );
675
676   QMap<QObject*, int> changed;
677   for ( ButtonMap::Iterator it = map.begin(); it != map.end(); ++it )
678   {
679     if ( myPosition[it.key()] == pos )
680       continue;
681       
682     myPosition[it.key()] = pos;
683     if ( button( it.key() ) )
684       changed.insert( button( it.key() )->parent(), 0 );
685   }
686   
687   for ( AreaMap::Iterator itr = myArea.begin(); itr != myArea.end(); ++itr )
688   {
689     if ( changed.contains( itr.value() ) )
690       itr.value()->layoutButtons();
691   }
692 }
693
694 /*!
695   \brief Set button position for all buttons in specified \a area.
696   \param pos button(s) position (QtxDialog::ButtonPosition)
697   \param area buttons area (QtxDialog::ButtonArea)
698   \sa setButtonPosition()
699 */
700 void QtxDialog::setPlacePosition( const int pos, const int area )
701 {
702   if ( !myArea.contains( area ) )
703     return;
704
705   Area* anArea = myArea[area];
706
707   bool changed = false;
708   for ( ButtonMap::Iterator it = myButton.begin(); it != myButton.end(); ++it )
709   {
710     if ( !anArea->contains( it.value() ) )
711       continue;
712
713     changed = changed &&  myPosition[it.key()] != pos;
714
715     myPosition[it.key()] = pos;
716   }
717
718   if ( changed )
719     anArea->layoutButtons();
720 }
721
722 /*!
723   \brief Get buttons layouting policy for the specified \a area.
724   \param area buttons area (QtxDialog::ButtonArea)
725   \sa setPlacePolicy()
726 */
727 int QtxDialog::placePolicy( const int area ) const
728 {
729   int res = -1;
730   if ( myArea.contains( area ) )
731     res = myArea[area]->policy();
732   return res;
733 }
734
735 /*!
736   \brief set buttons layouting policy for the specified \a area.
737   \param policy buttons layouting policy (QtxDialog::PlacePolicy)
738   \param area buttons area (QtxDialog::ButtonArea)
739   \sa placePolicy()
740 */
741 void QtxDialog::setPlacePolicy( const int policy, const int area )
742 {
743   if ( area < 0 )
744   {
745     for ( AreaMap::Iterator itr = myArea.begin(); itr != myArea.end(); ++itr )
746       itr.value()->setPolicy( policy );
747   }
748   else if ( myArea.contains( area ) )
749     myArea[area]->setPolicy( policy );
750 }
751
752 /*!
753   \brief Move specified button(s) into specified area.
754   \param area buttons area (QtxDialog::ButtonArea)
755   \param id control button(s) ID (QtxDialog::ButtonFlags)
756 */
757 void QtxDialog::setButtonPlace( const int area, const int id )
758 {
759   if ( !myArea.contains( area ) )
760     return;
761
762   Area* anArea = myArea[area];
763   ButtonMap map = buttons( id );
764   QMap<Area*, int> areaMap;
765   for ( AreaMap::ConstIterator aIt = myArea.begin(); aIt != myArea.end(); ++aIt )
766     areaMap.insert( aIt.value(), 0 );
767
768   for ( ButtonMap::Iterator it = map.begin(); it != map.end(); ++it )
769   {
770     Area* old = (Area*)it.value()->parent();
771     if ( old == anArea )
772       continue;
773
774     if ( areaMap.contains( old ) )
775       old->removeButton( it.value() );
776     anArea->insertButton( it.value() );
777   }
778 }
779
780 /*!
781   \brief Check if border is enabled.
782   \param area buttons area (QtxDialog::ButtonArea)
783   \return \c true if border is enabled for specified button area.
784   \sa setBorderEnabled()
785 */
786 bool QtxDialog::isBorderEnabled( const int area ) const
787 {
788   bool res = false;
789   if ( myArea.contains( area ) )
790     res  = myArea[area]->isBorderEnabled();
791   return res;
792 }
793
794 /*!
795   \brief Show/hide border for the specified button area.
796
797   Border is a line which separate main frame and control buttons.
798
799   \param area buttons area (QtxDialog::ButtonArea)
800   \param on enable border flag
801   \sa isBorderEnabled()
802 */
803 void QtxDialog::setBorderEnabled( const bool on, const int area )
804 {
805   if ( !myArea.contains( area ) )
806     return;
807
808   if ( myArea[area]->isBorderEnabled() == on )
809     return;
810
811   myArea[area]->setBorderEnabled( on );
812
813   if ( isVisible() )
814   {
815     QApplication::sendPostedEvents();
816     adjustSize();
817   }
818 }
819
820 /*!
821   \brief Get "enabled" status of the specified button(s).
822   \param id control button(s) ID (QtxDialog::ButtonFlags)
823   \return \c true if all specified buttons are enabled.
824   \sa setButtonEnabled()
825 */
826 bool QtxDialog::isButtonEnabled( const int id ) const
827 {
828   ButtonMap map = buttons( id );
829   bool result = !map.isEmpty();
830   for ( ButtonMap::Iterator it = map.begin(); it != map.end(); ++it )
831     result = result && it.value()->isEnabled();
832   return result;
833 }
834
835 /*!
836   \brief Enable/disable specified button(s).
837   \param on enable button(s) flag
838   \param id control button(s) ID (QtxDialog::ButtonFlags)
839   \sa isButtonEnabled()
840 */
841 void QtxDialog::setButtonEnabled( const bool on, const int id )
842 {
843   ButtonMap map = buttons( id );
844   for ( ButtonMap::Iterator it = map.begin(); it != map.end(); ++it )
845     it.value()->setEnabled( on );
846 }
847
848 /*!
849   \brief Check if specified button has keyboard focus.
850   \param id control button ID (QtxDialog::ButtonFlags)
851   \return \c true if specified button has keyboard focus
852   \sa setButtonFocus()
853 */
854 bool QtxDialog::hasButtonFocus( const int id ) const
855 {
856   bool res = false;
857   QAbstractButton* pb = button( id );
858   if ( pb )
859     res = pb->hasFocus();
860   return res;
861 }
862
863 /*!
864   \brief Sets the keyboard focus to the specified button.
865   \param id control button ID (QtxDialog::ButtonFlags)
866   \sa hasButtonFocus()
867 */
868 void QtxDialog::setButtonFocus( const int id )
869 {
870   QAbstractButton* pb = button( id );
871   if ( pb )
872     pb->setFocus();
873 }
874
875 /*!
876   \brief Get specified button's text.
877   \param id control button ID (QtxDialog::ButtonFlags)
878   \return button's text
879   \sa setButtonText()
880 */
881 QString QtxDialog::buttonText( const int id )
882 {
883   QString retval;
884   QAbstractButton* but = button( id );
885   if ( but )
886     retval = but->text();
887   return retval;
888 }
889
890 /*!
891   \brief Set specified button's text.
892   \param id control button ID (QtxDialog::ButtonFlags)
893   \param text button's text
894   \sa buttonText()
895 */
896 void QtxDialog::setButtonText( const int id, const QString& text )
897 {
898   QAbstractButton* but = button( id );
899   if ( but && but->text() != text )
900   {
901     but->setText( text );
902     adjustButtons();
903   }
904 }
905
906 /*!
907   \brief Sets alignment policy.
908
909   Use the function before the the dialog is first time shown.
910   If dialog flag AlignOnce is set then alignment is performed
911   only once, otherwise the dialog is aligned each time when it
912   is shown. 
913   Dialog box is aligned relatively to its parent.
914   By default, dialog box is aligned to the center of the parent 
915   widget (usually desktop or another dialog box).
916   
917   \param align alignment flag(s) (Qtx::AlignmentFlags)
918   \return previous alignment policy
919 */
920 uint QtxDialog::setAlignment( uint align )
921 {
922   uint oldAlign = myAlignment;
923   myAlignment = align;
924   return oldAlign;
925 }
926
927 /*!
928   \brief Update dialog box.
929 */
930 void QtxDialog::update()
931 {
932   for ( ButtonMap::Iterator it = myButton.begin(); it != myButton.end(); ++it )
933     if ( it.key() >= 0 )
934       it.value()->setVisible( testButtonFlags( it.key() ) );
935
936   for ( AreaMap::Iterator itr = myArea.begin(); itr != myArea.end(); ++itr )
937     itr.value()->layoutButtons();
938
939   adjustButtons();
940
941   QDialog::update();
942 }
943
944 /*!
945   \brief Show/hide dialog box, set keyboard focus to the dialog.
946   
947   Re-implemented from Qt.
948   
949   \param on show/hide flag
950 */
951 void QtxDialog::setVisible( bool on )
952 {
953   resize( sizeHint() );
954
955   QDialog::setVisible( on );
956
957   if ( on )
958   {
959     if ( testDialogFlags( SetFocus ) )
960       setFocus();
961     myInited = true;
962   }
963   else
964     QApplication::instance()->processEvents();
965 }
966
967 /*!
968   \brief Get user button by the specified \a id.
969   \param id user button ID
970   \return user button or 0 if it is not found
971   \sa insertButton(), removeButton(), userButtonIds()
972 */
973 QAbstractButton* QtxDialog::userButton( const int id ) const
974 {
975   QAbstractButton* b = 0;
976   if ( id < -1 && myButton.contains( id ) )
977     b = myButton[id];
978   return b;
979 }
980
981 /*!
982   \brief Get all user button IDs.
983   \return list of user buttons identificators
984   \sa insertButton(), removeButton(), userButton()
985 */
986 QIntList QtxDialog::userButtonIds() const
987 {
988   QIntList retlist;
989   for ( ButtonMap::ConstIterator it = myButton.begin(); it != myButton.end(); ++it )
990     if ( it.key() < 0 )
991       retlist.append( it.key() );
992   return retlist;
993 }
994
995 /*!
996   \brief Add user button to the dialog box.
997
998   The button is inserted to the specified dialog box area.
999   if the button is added successfully, the unique identificator of 
1000   the added button is returned, otherwise -1 is returned.
1001
1002   \param text text of the added button
1003   \param area buttons area (QtxDialog::ButtonArea)
1004   \return button ID
1005   \sa removeButton(), userButton(), userButtonIds()
1006 */
1007 int QtxDialog::insertButton( const QString& text, const int area )
1008 {
1009   if ( !myArea.contains( area ) )
1010     return -1;
1011
1012   int id = -2;
1013   while ( myButton.contains( id ) )
1014     id--;
1015
1016   Area* anArea = myArea[area];
1017   QAbstractButton* b = createButton( this );
1018   if ( b )
1019   {
1020     b->setText( text );
1021     myButton.insert( id, b );
1022     myPosition.insert( id, Left );
1023     
1024     connect( b, SIGNAL( clicked() ), this, SLOT( onButton() ) );
1025     connect( b, SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
1026
1027     anArea->insertButton( b );
1028     update();
1029   }
1030   else
1031     id = -1;
1032
1033   return id;
1034 }
1035
1036 /*!
1037   \brief Remove user button.
1038
1039   If \c id is -1, all user buttons are removed.
1040
1041   \param id user button ID
1042   \sa insertButton(), userButton(), userButtonIds()
1043 */
1044 void QtxDialog::removeButton( const int id )
1045 {
1046   if ( id >= 0 )
1047     return;
1048
1049   ButtonMap map;
1050   if ( id == -1 )
1051   {
1052     for ( ButtonMap::Iterator it = myButton.begin(); it != myButton.end(); ++it )
1053     {
1054       if ( it.key() < 0 )
1055         map.insert( it.key(), it.value() );
1056     }
1057   }
1058   else if ( myButton.contains( id ) )
1059     map.insert( id, myButton[id] );
1060
1061   for ( ButtonMap::Iterator itr = map.begin(); itr != map.end(); ++itr )
1062   {
1063     for ( AreaMap::Iterator it = myArea.begin(); it != myArea.end(); ++it )
1064       it.value()->removeButton( itr.value() );
1065
1066     myButton.remove( itr.key() );
1067     myPosition.remove( itr.key() );
1068     
1069     delete itr.value();
1070   }
1071   update();
1072 }
1073
1074 /*!
1075   \brief Set measure units to the specified label.
1076
1077   In the dialog box label the measure units are closed in braces.
1078   If measure units do not exist they will be added.
1079
1080   For example:
1081   \code
1082   // create label "Radius"
1083   QLabel* aLabel = new QLabel( "Radius", mainFrame() );
1084   // set measure units to "mm"
1085   setUnits( aLabel, "mm" )    // => aLabel contains 'Radius (mm)'
1086   // set measure units to "cm"
1087   setUnits( aLabel, "cm" )    // => aLabel contains 'Radius (cm)'
1088
1089   // create label "Radius" with initially not set measure units
1090   QLabel* aLabel = new QLabel( "Radius ():", mainFrame() );
1091   // set measure units to "mm"
1092   setUnits( aLabel, "mm" )    // => aLabel contains 'Radius (mm):'
1093   // set measure units to "cm"
1094   setUnits( aLabel, "cm" )    // => aLabel contains 'Radius (cm):'
1095   \endcode
1096
1097   \param aLabel label widget
1098   \param aUnits measure units
1099 */
1100 void QtxDialog::setUnits( QLabel* aLabel, const QString& aUnits )
1101 {
1102   QString label = aLabel->text();
1103
1104   int begin;
1105   int end = label.lastIndexOf( ')' );
1106
1107   QString startLabel = label;
1108   QString finalLabel;
1109
1110   if ( end != -1 )
1111   {
1112     begin = label.left( end ).lastIndexOf( '(' );
1113     if ( begin != -1 )
1114     {
1115       startLabel = label.mid( 0, begin );
1116       finalLabel = label.mid( end + 1 );
1117     }
1118   }
1119   else
1120   {
1121     startLabel = startLabel.trimmed();
1122     if ( startLabel.at( startLabel.length() - 1 ) == ':' )
1123     {
1124       finalLabel = startLabel.mid( startLabel.length() - 1 );
1125       startLabel = startLabel.mid( 0, startLabel.length() - 1 );
1126     }
1127   }
1128   if ( aUnits.length() )
1129     label = startLabel.trimmed() + " (" + aUnits + ") " + finalLabel.trimmed();
1130   else
1131     label = startLabel.trimmed() + " " + finalLabel.trimmed();
1132   aLabel->setText( label );
1133 }
1134
1135 /*!
1136   \brief Check if data entered by the user is valid.
1137
1138   This method can be re-implemented in the successor class if it
1139   requires to check user input consistency.
1140   Default implementation returns \c true.
1141
1142   This method is called if dialog flag QtxDialog::Accept is set.
1143   If this method returns \c true, then dialog will be accepted and closed.
1144
1145   \return \c true if user input is valid
1146   \sa accept()
1147 */
1148 bool QtxDialog::acceptData() const
1149 {
1150   return true;
1151 }
1152
1153 /*!
1154   \brief Check if dialog box can be cancelled.
1155
1156   This method can be re-implemented in the successor class if it
1157   requires to check possibility to cancel dialog box safely.
1158   Default implementation returns \c true.
1159
1160   This method is called if dialog flag QtxDialog::Reject is set.
1161   If this method returns \c true, then dialog will be rejected and closed.
1162
1163   \return \c true if dialog box can be cancelled
1164   \sa reject()
1165 */
1166 bool QtxDialog::rejectData() const
1167 {
1168   return true;
1169 }
1170
1171 /*!
1172   \brief Create new user button.
1173
1174   This method is invoked from method insertButton().
1175
1176   \param parent parent widget
1177   \return new user button
1178 */
1179 QAbstractButton* QtxDialog::createButton( QWidget* parent )
1180 {
1181   QPushButton* pb = new QPushButton( parent );
1182   pb->setAutoDefault( false );
1183   return pb;
1184 }
1185
1186 /*!
1187   \brief Get button by the specified ID.
1188   \param f control button ID (QtxDialog::ButtonFlags)
1189   \return button or 0 if \a id is invalid
1190 */
1191 QAbstractButton* QtxDialog::button( const int f ) const
1192 {
1193   QAbstractButton* retval = 0;
1194   if ( myButton.contains( f ) )
1195     retval = myButton[f];
1196   return retval;
1197 }
1198
1199 /*!
1200   \brief Get buttons by the specified IDs.
1201   \param f control button(s) ID(s) (QtxDialog::ButtonFlags)
1202   \return button map
1203 */
1204 QtxDialog::ButtonMap QtxDialog::buttons( const int f ) const
1205 {
1206   ButtonMap retmap;
1207   if ( f < -1 )
1208   {
1209     if ( myButton.contains( f ) )
1210       retmap.insert( f, myButton[f] );
1211   }
1212   else
1213   {
1214     for ( ButtonMap::ConstIterator it = myButton.begin(); it != myButton.end(); ++it )
1215       if ( f == -1 || ( it.key() >= 0 && f & it.key() ) )
1216         retmap.insert( it.key(), it.value() );
1217   }
1218   return retmap;
1219 }
1220
1221 /*!
1222   \brief Get specified button's identifier.
1223   \param b button
1224   \return button ID
1225 */
1226 int QtxDialog::buttonId( const QAbstractButton* b ) const
1227 {
1228   int id = -1;
1229   for ( ButtonMap::ConstIterator it = myButton.begin(); it != myButton.end() && id == -1; ++it )
1230     if ( it.value() == b )
1231       id = it.key();
1232   return id;
1233 }
1234
1235 /*!
1236   \brief Get position of specified button.
1237   \param b button
1238   \return button position (QtxDialog::ButtonPosition)
1239 */
1240 int QtxDialog::buttonPosition( QAbstractButton* b ) const
1241 {
1242   return buttonPosition( buttonId( b ) );
1243 }
1244
1245 /*!
1246   \brief Align this dialog according to the parent widget and alignment
1247          policy before the dialog box is shown.
1248
1249   Re-implemented from Qt.
1250
1251   \param e show event
1252 */
1253 void QtxDialog::showEvent( QShowEvent* e )
1254 {
1255   if ( !testDialogFlags( AlignOnce ) || !myInited )
1256     Qtx::alignWidget( this, parentWidget(), myAlignment );
1257   QDialog::showEvent( e );
1258 }
1259
1260 /*!
1261   \brief Process all existing events when dialog box is hidden.
1262
1263   Re-implemented from Qt.
1264
1265   \param e hide event
1266 */
1267 void QtxDialog::hideEvent( QHideEvent* e )
1268 {
1269   QApplication::instance()->processEvents();
1270   QDialog::hideEvent( e );
1271 }
1272
1273 /*!
1274   \brief Update dialog box layout when the size grip is added.
1275
1276   Re-implemented from Qt.
1277
1278   \param e child event
1279 */
1280 void QtxDialog::childEvent( QChildEvent* e )
1281 {
1282   QDialog::childEvent( e );
1283   if ( layout() && e->added() && e->child()->inherits( "QSizeGrip" ) )
1284   {
1285     layout()->setMargin( 12 );
1286     connect( e->child(), SIGNAL( destroyed() ), this, SLOT( onSizeGripDestroyed() ) );
1287   }
1288 }
1289
1290 /*!
1291   \brief Process key pressing event.
1292
1293   Re-implemented from Qt.
1294
1295   Call reject() if "Escape" key is pressed.
1296   Call accept() if "Ctrl+Enter" key-sequence is pressed.
1297   Process "F1" key and emit signal dlgHelp().
1298   Transfer "Ctrl+(Shift+)Tab" key-sequence press event 
1299   to the child Tab widget (if there is any).
1300
1301   \param e key press event
1302 */
1303 void QtxDialog::keyPressEvent( QKeyEvent* e )
1304 {
1305   QDialog::keyPressEvent( e );
1306
1307   if ( e->isAccepted() )
1308     return;
1309
1310   if ( !e->modifiers() && e->key() == Qt::Key_Escape )
1311     reject();
1312
1313   if ( e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_Return )
1314   {
1315     if ( testButtonFlags( OK ) || testButtonFlags( Yes ) )
1316       accept();
1317     else if ( testButtonFlags( Apply ) && isButtonEnabled( Apply ) )
1318       emit dlgApply();
1319     e->accept();
1320   }
1321
1322   if ( e->key() == Qt::Key_F1 && testButtonFlags( Help ) && isButtonEnabled( Help ) )
1323   {
1324     e->accept();
1325     emit dlgHelp();
1326   }
1327
1328   if ( e->key() == Qt::Key_Tab && e->modifiers() & Qt::ControlModifier )
1329   {
1330     QObject* tab = this->findChild<QTabWidget*>();
1331     if ( tab && !property( "in_tab_event" ).toBool() ) {
1332       setProperty( "in_tab_event", true );
1333       QApplication::sendEvent( tab, e );
1334       setProperty( "in_tab_event", false );
1335     }
1336   }
1337 }
1338
1339 /*!
1340   \brief Called when user closes dialog box.
1341   
1342   Call reject() method.
1343   
1344   \param e close event (not used)
1345 */
1346 void QtxDialog::closeEvent( QCloseEvent* /*e*/ )
1347 {
1348   reject();
1349 }
1350
1351 /*!
1352   \brief Accept the dialog box.
1353
1354   This method is used when any accept button is pressed (usually
1355   "OK", "Yes", etc).
1356
1357   If dialog flag QtxDialog::Accept is set, this function invokes 
1358   acceptData() method, which should in this case return \c true to
1359   allow further processing. 
1360
1361   If acceptData() returns \c false, this function just returns.
1362
1363   If acceptData() returns \c true, the Accepted result is set
1364   and signal according to the pressed control button is emitted.
1365   Then the default implementation of accept() method is called
1366   (which hides the dialog box and, depending on the dialog box flags,
1367   can close and destroy it).
1368  
1369   \sa acceptData()
1370 */
1371 void QtxDialog::accept()
1372 {
1373   if ( !mySender )
1374   {
1375     if ( testButtonFlags( OK ) )
1376       mySender = button( OK );
1377     else if ( testButtonFlags( Yes ) )
1378       mySender = button( Yes );
1379     else
1380       mySender = button( Close );
1381   }
1382
1383   if ( !mySender || !mySender->isWidgetType() ||
1384        !((QWidget*)mySender)->isEnabled() )
1385     return;
1386
1387   if ( testDialogFlags( Accept ) && !acceptData() )
1388     return;
1389
1390   QDialog::accept();
1391
1392   emitSignal();
1393 }
1394
1395 /*!
1396   \brief Reject the dialog box.
1397
1398   This method is used when any reject button is pressed (usually
1399   "Close", "Cancel", "No", etc).
1400
1401   If dialog flag QtxDialog::Reject is set, this function invokes 
1402   rejectData() method, which should in this case return \c true to
1403   allow further processing. 
1404
1405   If rejectData() returns \c false, this function just returns.
1406
1407   If rejectData() returns \c true, the Rejected result is set
1408   and signal according to the pressed control button is emitted.
1409   Then the default implementation of reject() method is called
1410   (which hides the dialog box and, depending on the dialog box flags,
1411   can close and destroy it).
1412  
1413   \sa rejectData()
1414 */
1415 void QtxDialog::reject()
1416 {
1417   if ( testDialogFlags( Reject ) && !rejectData() )
1418     return;
1419
1420   if ( !mySender )
1421   {
1422     if ( testButtonFlags( Cancel ) )
1423       mySender = button( Cancel );
1424     else if ( testButtonFlags( No ) )
1425       mySender = button( No );
1426     else
1427       mySender = button( Close );
1428   }
1429
1430   if ( !mySender || !mySender->isWidgetType() ||
1431        !((QWidget*)mySender)->isEnabled() )
1432     return;
1433
1434   QDialog::reject();
1435
1436   emitSignal();
1437 }
1438
1439 /*!
1440   \brief Emit signal correspondingly to the control button.
1441 */
1442 void QtxDialog::emitSignal()
1443 {
1444   QApplication::instance()->processEvents();
1445   int id = buttonId( (QAbstractButton*)mySender );
1446   mySender = 0;
1447
1448   switch ( id )
1449   {
1450   case OK:
1451     emit dlgOk();
1452     break;
1453   case Cancel:
1454     emit dlgCancel();
1455     break;
1456   case Close:
1457     emit dlgClose();
1458     break;
1459   case Yes:
1460     emit dlgYes();
1461     break;
1462   case No:
1463     emit dlgNo();
1464     break;
1465   }
1466 }
1467
1468 /*!
1469   \brief This slot is called when user presses on of the buttons
1470          "OK", "Yes", etc.
1471
1472   Call accept() method.
1473 */
1474 void QtxDialog::onAccept()
1475 {
1476   const QObject* obj = sender();
1477   mySender = obj;
1478   accept();
1479 }
1480
1481 /*!
1482   \brief This slot is called when user presses on of the buttons
1483          "Cancel", "No", "Close".
1484
1485   Call reject() method.
1486 */
1487
1488 void QtxDialog::onReject()
1489 {
1490   const QObject* obj = sender();
1491   mySender = obj;
1492   reject();
1493 }
1494
1495 /*!
1496   \brief Process user button click event.
1497   
1498   This method is called when user presses one of custom user buttons.
1499   Emits signal dlgButton(int) with identificator of the clicked user
1500   button passed as parameter.
1501 */
1502 void QtxDialog::onButton()
1503 {
1504   int id = buttonId( (QAbstractButton*)sender() );
1505   if ( id != -1 )
1506     emit dlgButton( id );
1507 }
1508
1509 /*!
1510   \brief Watch for the user button destroying.
1511   \param obj button being destroyed
1512 */
1513 void QtxDialog::onDestroyed( QObject* obj )
1514 {
1515   QAbstractButton* b = (QAbstractButton*)obj;
1516   int id = buttonId( b );
1517   if ( id == -1 )
1518     return;
1519
1520   myButton.remove( id );
1521   myPosition.remove( id );
1522   for ( AreaMap::Iterator it = myArea.begin(); it != myArea.end(); ++it )
1523     it.value()->removeButton( b );
1524 }
1525
1526 /*!
1527   \brief Update dialog box layout when the size grip is destroyed.
1528 */
1529 void QtxDialog::onSizeGripDestroyed()
1530 {
1531   if ( layout() )
1532     layout()->setMargin( 5 );
1533 }
1534
1535 /*!
1536   \brief Adjust buttons (set equal size for all buttons).
1537 */
1538 void QtxDialog::adjustButtons()
1539 {
1540   int minWidth = 0;
1541   for ( AreaMap::Iterator aIt = myArea.begin(); aIt != myArea.end(); ++aIt )
1542   {
1543     const QList<QAbstractButton*>& lst = aIt.value()->buttons();
1544     for ( QList<QAbstractButton*>::const_iterator bIt = lst.begin(); bIt != lst.end(); ++bIt )
1545       if ( (*bIt)->isVisibleTo( this ) )
1546         minWidth = qMax( minWidth, (*bIt)->sizeHint().width() );
1547   }
1548
1549   for ( AreaMap::Iterator aItr = myArea.begin(); aItr != myArea.end(); ++aItr )
1550   {
1551     const QList<QAbstractButton*>& lst = aItr.value()->buttons();
1552     for ( QList<QAbstractButton*>::const_iterator bItr = lst.begin(); bItr != lst.end(); ++bItr )
1553       if ( (*bItr)->isVisibleTo( this ) )
1554         (*bItr)->setMinimumWidth( minWidth );
1555   }
1556 }
1557
1558 /*!
1559   \fn void QtxDialog::dlgButton( int id )
1560   \brief Emitted when the user button is clicked.
1561   \param id user button identificator
1562 */
1563 /*!
1564   \fn void QtxDialog::dlgParamChanged()
1565   \brief This signal can be used in successor classes to signalize about
1566          some dialog parameter changing.
1567 */
1568 /*!
1569   \fn void QtxDialog::dlgHelp()
1570   \brief Emitted when the "Help" button is clicked.
1571 */
1572 /*!
1573   \fn void QtxDialog::dlgApply()
1574   \brief Emitted when the "Apply" button is clicked.
1575 */
1576 /*!
1577   \fn void QtxDialog::dlgOk()
1578   \brief Emitted when the "OK" button is clicked.
1579 */
1580 /*!
1581   \fn void QtxDialog::dlgNo()
1582   \brief Emitted when the "No" button is clicked.
1583 */
1584 /*!
1585   \fn void QtxDialog::dlgYes()
1586   \brief Emitted when the "Yes" button is clicked.
1587 */
1588 /*!
1589   \fn void QtxDialog::dlgClose()
1590   \brief Emitted when the "Close" button is clicked.
1591 */
1592 /*!
1593   \fn void QtxDialog::dlgCancel()
1594   \brief Emitted when the "Cancel" button is clicked.
1595 */