26 #define YUILogComponent "qt-ui" 27 #include <yui/YUILog.h> 28 #include <QResizeEvent> 31 #include <yui/YEvent.h> 33 #include "YQMainWinDock.h" 35 #define VERBOSE_RESIZE 1 52 YQUI::ui()->noBorder() ?
53 Qt::FramelessWindowHint :
57 setFocusPolicy( Qt::StrongFocus );
59 resize(
YQUI::ui()->defaultSize( YD_HORIZ ),
60 YQUI::ui()->defaultSize( YD_VERT ) );
62 yuiDebug() <<
"MainWinDock initial size: " 63 << size().width() <<
" x " << size().height()
79 resize( event->size() );
88 for ( YQWidgetStack::reverse_iterator it = _widgetStack.rbegin(); it != _widgetStack.rend(); it++ )
92 QRect rect = QRect( QPoint( 0, 0 ), size() );
97 yuiDebug() << dialog <<
" with " << wizard <<
" isSecondary: " << std::boolalpha << wizard->
isSecondary() << std::endl;
101 if ( QApplication::isLeftToRight() )
104 rect.setWidth( rect.width() );
107 if ( dialog->rect() != rect )
110 yuiDebug() <<
"Resizing child dialog " << std::hex << ( (
void *) dialog ) << std::dec
111 <<
" to " << rect.width() <<
" x " << rect.height()
114 dialog->setGeometry( rect );
125 if ( ! _widgetStack.empty() )
127 QWidget * dialog = _widgetStack.back();
137 YUI_CHECK_PTR( dialog );
146 yuiDebug() <<
"Adding dialog " << std::hex << (
void *) dialog << std::dec
150 _widgetStack.push_back( dialog );
160 if ( _widgetStack.empty() )
168 YQDialog * dialog = _widgetStack.back();
169 QWidget * widget = (QWidget *) dialog->widgetRep();
197 if ( ! _widgetStack.empty() )
199 QWidget * dialog = _widgetStack.back();
200 yuiDebug() <<
"Showing dialog " << std::hex << (
void *) dialog << std::dec << std::endl;
210 if ( _widgetStack.empty() )
214 dialog = _widgetStack.back();
216 if ( dialog == _widgetStack.back() )
221 _widgetStack.pop_back();
223 yuiDebug() <<
"Removing dialog " << std::hex << (
void *) dialog << std::dec
224 <<
" from mainWinDock" 229 YQMainWinDock::YQWidgetStack::iterator pos = findInStack( dialog );
231 if ( pos == _widgetStack.end() )
234 yuiWarning() <<
"Found dialog somewhere in the middle of the widget stack" << std::endl;
235 yuiDebug() <<
"Removing dialog " << std::hex << (
void *) dialog << std::dec
236 <<
" from mainWinDock" 239 _widgetStack.erase( pos );
242 if ( _widgetStack.empty() )
246 dialog = _widgetStack.back();
255 YQMainWinDock::YQWidgetStack::iterator
256 YQMainWinDock::findInStack(
YQDialog * dialog )
258 for ( YQMainWinDock::YQWidgetStack::iterator it = _widgetStack.begin();
259 it != _widgetStack.end();
266 return _widgetStack.end();
273 if ( _widgetStack.empty() )
276 return _widgetStack.back();
283 YDialog * topDialog = YDialog::topmostDialog(
false );
303 yuiMilestone() <<
"Caught window manager close event - returning with YCancelEvent" << std::endl;
319 if ( _sideBarWidth == width )
322 _sideBarWidth = width;
327 #include "YQMainWinDock.moc" void showCurrentDialog()
Show the current dialog.
bool isSecondary() const
Returns true if the wizard should follow the first wizard with steps.
YQMainWinDock()
Constructor.
virtual ~YQMainWinDock()
Destructor.
void remove(YQDialog *dialog=0)
Remove a dialog from the MainWinDock (if it belongs to the MainWinDock).
void setSideBarWidth(int width)
For secondary wizards.
YQWizard * findWizard() const
Find the first wizard in that dialog, if there is any.
void activateCurrentDialog(bool active)
Activate or deactivate the next-lower dialog in the dock when a new dialog is opened or when a dialog...
virtual void resizeEvent(QResizeEvent *event)
Resize event.
void add(YQDialog *dialog)
Add a dialog (the widgetRep() of a YQDialog) to the MainWinDock (on top of its widget stack...
Container window for YQDialogs of type YMainWindowDialog:
void resizeVisibleChild()
Resize the visible child to the current size of the dock.
virtual void setEnabled(bool enabled)
Set enabled/disabled state.
bool couldDock()
Return 'true' if the next main dialog could be docked, i.e., if there is either no open dialog at all...
static YQMainWinDock * mainWinDock()
Static method to access the singleton for this class.
virtual void paintEvent(QPaintEvent *event)
Paint event.
void sendEvent(YEvent *event)
Widget event handlers (slots) call this when an event occured that should be the answer to a UserInpu...
virtual void show()
Show the widget (make it visible).
virtual void closeEvent(QCloseEvent *event)
Window manager close event (Alt-F4): Send a YCancelEvent and let the application handle that event...
static YQUI * ui()
Access the global Qt-UI.
YQDialog * topmostDialog() const
Return the current topmost dialog (the widgetRep() of a YQDialog) or 0 if there is none...