• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

  • tdeui
kdockwidget.cpp
1 
2 /* This file is part of the KDE libraries
3  Copyright (C) 2000 Max Judin <novaprint@mtu-net.ru>
4  Copyright (C) 2002,2003 Joseph Wenninger <jowenn@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2 as published by the Free Software Foundation.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 #include "kdockwidget.h"
21 #include "kdockwidget_private.h"
22 #include "kdockwidget_p.h"
23 
24 #include <tqapplication.h>
25 #include <tqlayout.h>
26 #include <tqpainter.h>
27 #include <tqobjectlist.h>
28 #include <tqstrlist.h>
29 #include <tqcursor.h>
30 #include <tqwidgetlist.h>
31 #include <tqtabwidget.h>
32 #include <tqtooltip.h>
33 #include <tqstyle.h>
34 
35 #ifndef NO_KDE2
36 #include <tdeconfig.h>
37 #include <tdeglobal.h>
38 #include <tdelocale.h>
39 #include <tdetoolbar.h>
40 #include <tdepopupmenu.h>
41 #include <twin.h>
42 #include <kdebug.h>
43 #include <tdeglobalsettings.h>
44 
45 #include "config.h"
46 #ifdef Q_WS_X11
47 #include <X11/X.h>
48 #include <X11/Xlib.h>
49 #endif
50 
51 #else
52 #include <tqtoolbar.h>
53 #include <tqpopupmenu.h>
54 #endif
55 
56 #include <stdlib.h>
57 
58 #undef BORDERLESS_WINDOWS
59 
60 #define DOCK_CONFIG_VERSION "0.0.5"
61 
62 static const char* const dockback_xpm[]={
63 "6 6 2 1",
64 "# c black",
65 ". c None",
66 "......",
67 ".#....",
68 "..#..#",
69 "...#.#",
70 "....##",
71 "..####"};
72 
73 static const char* const todesktop_xpm[]={
74 "5 5 2 1",
75 "# c black",
76 ". c None",
77 "####.",
78 "##...",
79 "#.#..",
80 "#..#.",
81 "....#"};
82 
83 static const char* const not_close_xpm[]={
84 "5 5 2 1",
85 "# c black",
86 ". c None",
87 "#####",
88 "#...#",
89 "#...#",
90 "#...#",
91 "#####"};
92 
102 KDockMainWindow::KDockMainWindow( TQWidget* parent, const char *name, WFlags f)
103 :TDEMainWindow( parent, name, f )
104 {
105  TQString new_name = TQString(name) + TQString("_DockManager");
106  dockManager = new KDockManager( this, new_name.latin1() );
107  mainDockWidget = 0L;
108 }
109 
110 KDockMainWindow::~KDockMainWindow()
111 {
112  delete dockManager;
113 }
114 
115 void KDockMainWindow::setMainDockWidget( KDockWidget* mdw )
116 {
117  if ( mainDockWidget == mdw ) return;
118  mainDockWidget = mdw;
119  dockManager->setMainDockWidget2(mdw);
120 }
121 
122 void KDockMainWindow::setView( TQWidget *view )
123 {
124  if ( view->isA("KDockWidget") ){
125  if ( TQT_BASE_OBJECT(view->parent()) != TQT_BASE_OBJECT(this) ) ((KDockWidget*)view)->applyToWidget( this );
126  }
127 
128 #ifndef NO_KDE2
129  TDEMainWindow::setCentralWidget(view);
130 #else
131  TQMainWindow::setCentralWidget(view);
132 #endif
133 }
134 
135 KDockWidget* KDockMainWindow::createDockWidget( const TQString& name, const TQPixmap &pixmap, TQWidget* parent, const TQString& strCaption, const TQString& strTabPageLabel)
136 {
137  return new KDockWidget( dockManager, name.latin1(), pixmap, parent, strCaption, strTabPageLabel );
138 }
139 
140 void KDockMainWindow::makeDockVisible( KDockWidget* dock )
141 {
142  if ( dock )
143  dock->makeDockVisible();
144 }
145 
146 void KDockMainWindow::makeDockInvisible( KDockWidget* dock )
147 {
148  if ( dock )
149  dock->undock();
150 }
151 
152 void KDockMainWindow::makeWidgetDockVisible( TQWidget* widget )
153 {
154  makeDockVisible( dockManager->findWidgetParentDock(widget) );
155 }
156 
157 void KDockMainWindow::writeDockConfig(TQDomElement &base)
158 {
159  dockManager->writeConfig(base);
160 }
161 
162 void KDockMainWindow::readDockConfig(TQDomElement &base)
163 {
164  dockManager->readConfig(base);
165 }
166 
167 #ifndef NO_KDE2
168 void KDockMainWindow::writeDockConfig( TDEConfig* c, TQString group )
169 {
170  dockManager->writeConfig( c, group );
171 }
172 
173 void KDockMainWindow::readDockConfig( TDEConfig* c, TQString group )
174 {
175  dockManager->readConfig( c, group );
176 }
177 #endif
178 
179 void KDockMainWindow::slotDockWidgetUndocked()
180 {
181  TQObject* pSender = (TQObject*) sender();
182  if (!pSender->inherits("KDockWidget")) return;
183  KDockWidget* pDW = (KDockWidget*) pSender;
184  emit dockWidgetHasUndocked( pDW);
185 }
186 
187 /*************************************************************************/
188 KDockWidgetAbstractHeaderDrag::KDockWidgetAbstractHeaderDrag( KDockWidgetAbstractHeader* parent, KDockWidget* dock, const char* name )
189 :TQFrame( parent, name )
190 {
191  dw = dock;
192  installEventFilter( dock->dockManager() );
193 }
194 /*************************************************************************/
195 KDockWidgetHeaderDrag::KDockWidgetHeaderDrag( KDockWidgetAbstractHeader* parent, KDockWidget* dock, const char* name )
196 :KDockWidgetAbstractHeaderDrag( parent, dock, name )
197 {
198 }
199 
200 void KDockWidgetHeaderDrag::paintEvent( TQPaintEvent* )
201 {
202  TQPainter paint;
203 
204  paint.begin( this );
205 
206  style().tqdrawPrimitive (TQStyle::PE_DockWindowHandle, &paint, TQRect(0,0,width(), height()), colorGroup());
207 
208  paint.end();
209 }
210 /*************************************************************************/
211 KDockWidgetAbstractHeader::KDockWidgetAbstractHeader( KDockWidget* parent, const char* name )
212 :TQFrame( parent, name )
213 {
214 }
215 /*************************************************************************/
216 KDockWidgetHeader::KDockWidgetHeader( KDockWidget* parent, const char* name )
217 :KDockWidgetAbstractHeader( parent, name )
218 {
219 #ifdef BORDERLESS_WINDOWS
220  setCursor(TQCursor(ArrowCursor));
221 #endif
222  d = new KDockWidgetHeaderPrivate( TQT_TQOBJECT(this) );
223 
224  layout = new TQHBoxLayout( this );
225  layout->setResizeMode( TQLayout::Minimum );
226 
227  drag = new KDockWidgetHeaderDrag( this, parent );
228 
229  closeButton = new KDockButton_Private( this, "DockCloseButton" );
230  TQToolTip::add( closeButton, i18n("Close") );
231  closeButton->setPixmap( style().stylePixmap (TQStyle::SP_TitleBarCloseButton , this));
232  closeButton->setFixedSize(closeButton->pixmap()->width(),closeButton->pixmap()->height());
233  connect( closeButton, TQT_SIGNAL(clicked()), parent, TQT_SIGNAL(headerCloseButtonClicked()));
234  connect( closeButton, TQT_SIGNAL(clicked()), parent, TQT_SLOT(undock()));
235 
236  stayButton = new KDockButton_Private( this, "DockStayButton" );
237  TQToolTip::add( stayButton, i18n("Freeze the window geometry", "Freeze") );
238  stayButton->setToggleButton( true );
239  stayButton->setPixmap( const_cast< const char** >(not_close_xpm) );
240  stayButton->setFixedSize(closeButton->pixmap()->width(),closeButton->pixmap()->height());
241  connect( stayButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotStayClicked()));
242 
243  dockbackButton = new KDockButton_Private( this, "DockbackButton" );
244  TQToolTip::add( dockbackButton, i18n("Dock this window", "Dock") );
245  dockbackButton->setPixmap( const_cast< const char** >(dockback_xpm));
246  dockbackButton->setFixedSize(closeButton->pixmap()->width(),closeButton->pixmap()->height());
247  connect( dockbackButton, TQT_SIGNAL(clicked()), parent, TQT_SIGNAL(headerDockbackButtonClicked()));
248  connect( dockbackButton, TQT_SIGNAL(clicked()), parent, TQT_SLOT(dockBack()));
249 
250  d->toDesktopButton = new KDockButton_Private( this, "ToDesktopButton" );
251  TQToolTip::add( d->toDesktopButton, i18n("Detach") );
252  d->toDesktopButton->setPixmap( const_cast< const char** >(todesktop_xpm));
253  d->toDesktopButton->setFixedSize(closeButton->pixmap()->width(),closeButton->pixmap()->height());
254  connect( d->toDesktopButton, TQT_SIGNAL(clicked()), parent, TQT_SLOT(toDesktop()));
255  stayButton->hide();
256 
257  d->dummy = new TQWidget( this );
258  d->dummy->setFixedSize( 1,closeButton->pixmap()->height() );
259 
260 
261  layout->addWidget( drag );
262  layout->addWidget( dockbackButton );
263  layout->addWidget( d->toDesktopButton );
264  layout->addWidget( d->dummy);
265  layout->addWidget( stayButton );
266  layout->addWidget( closeButton );
267  layout->activate();
268  d->dummy->hide();
269  drag->setFixedHeight( layout->minimumSize().height() );
270 }
271 
272 void KDockWidgetHeader::setTopLevel( bool isTopLevel )
273 {
274  d->topLevel = isTopLevel;
275  if ( isTopLevel ){
276  KDockWidget* par = (KDockWidget*)parent();
277  if( par && par->isDockBackPossible() )
278  dockbackButton->show();
279  else
280  dockbackButton->hide();
281 
282  stayButton->hide();
283  closeButton->hide();
284  d->toDesktopButton->hide();
285  drag->setEnabled( true );
286  } else {
287  dockbackButton->hide();
288  stayButton->hide();
289  if (!d->forceCloseButtonHidden) closeButton->show();
290  if( d->showToDesktopButton )
291  d->toDesktopButton->show();
292  }
293  layout->activate();
294 
295  bool dontShowDummy=drag->isVisibleTo(this) || dockbackButton->isVisibleTo(this) ||
296  d->toDesktopButton->isVisibleTo(this) || stayButton->isVisibleTo(this) ||
297  closeButton->isVisibleTo(this);
298  for (TQPtrListIterator<KDockButton_Private> it( d->btns );it.current();++it) {
299  dontShowDummy=dontShowDummy || (it.current()->isVisibleTo(this));
300  }
301  if (dontShowDummy) d->dummy->hide(); else d->dummy->show();
302 
303  updateGeometry();
304 }
305 
306 void KDockWidgetHeader::forceCloseButtonHidden(bool hidden) {
307  d->forceCloseButtonHidden=hidden;
308  if (hidden) closeButton->hide();
309  else closeButton->show();
310 }
311 
312 KDockWidgetHeaderDrag *KDockWidgetHeader::dragPanel() {
313  return drag;
314 }
315 
316 void KDockWidgetHeader::setDragPanel( KDockWidgetHeaderDrag* nd )
317 {
318  if ( !nd ) return;
319 
320  delete layout;
321  layout = new TQHBoxLayout( this );
322  layout->setResizeMode( TQLayout::Minimum );
323 
324  delete drag;
325  drag = nd;
326  if (drag->parentWidget()!=this) {
327  drag->reparent(this,TQPoint(0,0));
328  }
329 
330 
331  layout->addWidget( drag );
332  layout->addWidget( dockbackButton );
333  layout->addWidget( d->dummy );
334  layout->addWidget( d->toDesktopButton );
335  layout->addWidget( stayButton );
336  bool dontShowDummy=drag->isVisibleTo(this) || dockbackButton->isVisibleTo(this) ||
337  d->toDesktopButton->isVisibleTo(this) || stayButton->isVisibleTo(this) ||
338  closeButton->isVisibleTo(this);
339  for (TQPtrListIterator<KDockButton_Private> it( d->btns );it.current();++it) {
340  layout->addWidget(it.current());
341  dontShowDummy=dontShowDummy || (it.current()->isVisibleTo(this));
342  }
343  if (dontShowDummy) d->dummy->hide(); else d->dummy->show();
344  layout->addWidget( closeButton );
345  layout->activate();
346  kdDebug(282)<<"KdockWidgetHeader::setDragPanel:minimum height="<<layout->minimumSize().height()<<endl;
347  //FIXME somebody left this here, but we don't know what the hell it's for.
348  drag->setFixedHeight( closeButton->height()); // /*layout->minimumS*/sizeHint().height() );
349 }
350 
351 void KDockWidgetHeader::addButton(KDockButton_Private* btn) {
352  if (!btn) return;
353 
354  if (btn->parentWidget()!=this) {
355  btn->reparent(this,TQPoint(0,0));
356  }
357  btn->setFixedSize(closeButton->pixmap()->width(),closeButton->pixmap()->height());
358  if (!d->btns.containsRef(btn)) d->btns.append(btn);
359 
360  btn->show();
361 
362  delete layout;
363  layout = new TQHBoxLayout( this );
364  layout->setResizeMode( TQLayout::Minimum );
365 
366  layout->addWidget( drag );
367  layout->addWidget( dockbackButton );
368  layout->addWidget( d->toDesktopButton );
369  layout->addWidget( d->dummy);
370  layout->addWidget( stayButton );
371  bool dontShowDummy=drag->isVisibleTo(this) || dockbackButton->isVisibleTo(this) ||
372  d->toDesktopButton->isVisibleTo(this) || stayButton->isVisibleTo(this) ||
373  closeButton->isVisibleTo(this);
374  for (TQPtrListIterator<KDockButton_Private> it( d->btns );it.current();++it) {
375  layout->addWidget(it.current());
376  dontShowDummy=dontShowDummy || (it.current()->isVisibleTo(this));
377  }
378  if (dontShowDummy) d->dummy->hide(); else d->dummy->show();
379  layout->addWidget( closeButton );
380  layout->activate();
381  drag->setFixedHeight( layout->minimumSize().height() );
382 }
383 
384 void KDockWidgetHeader::removeButton(KDockButton_Private* btn) {
385  if (btn->parentWidget()==this) {
386  if (d->btns.containsRef(btn)) d->btns.removeRef(btn);
387  delete btn;
388  }
389 }
390 
391 
392 void KDockWidgetHeader::slotStayClicked()
393 {
394  setDragEnabled(!stayButton->isOn());
395 }
396 
397 bool KDockWidgetHeader::dragEnabled() const
398 {
399  return drag->isEnabled();
400 }
401 
402 void KDockWidgetHeader::showUndockButton(bool show)
403 {
404  kdDebug(282)<<"KDockWidgetHeader::showUndockButton("<<show<<")"<<endl;
405  if( d->showToDesktopButton == show )
406  return;
407 
408  d->showToDesktopButton = show;
409  if( !show || d->topLevel )
410  d->toDesktopButton->hide( );
411  else
412  d->toDesktopButton->show( );
413 }
414 
415 void KDockWidgetHeader::setDragEnabled(bool b)
416 {
417  stayButton->setOn(!b);
418  closeButton->setEnabled(b);
419  drag->setEnabled(b);
420 }
421 
422 #ifndef NO_KDE2
423 void KDockWidgetHeader::saveConfig( TDEConfig* c )
424 {
425  c->writeEntry( TQString("%1%2").arg(parent()->name()).arg(":stayButton"), stayButton->isOn() );
426 }
427 
428 void KDockWidgetHeader::loadConfig( TDEConfig* c )
429 {
430  setDragEnabled( !c->readBoolEntry( TQString("%1%2").arg(parent()->name()).arg(":stayButton"), false ) );
431 }
432 #endif
433 
434 /*************************************************************************/
435 
436 class KDockManager::KDockManagerPrivate
437 {
438 public:
442  TQRect dragRect;
443 
447  TQRect oldDragRect;
448 
452  bool readyToDrag;
453 
457  TQPoint dragOffset;
458 
462  bool splitterOpaqueResize;
463  bool splitterKeepSize;
464  bool splitterHighResolution;
465 
466  TQGuardedPtr<KDockWidget> mainDockWidget;
467 
468  TQObjectList containerDocks;
469 
470  TQGuardedPtr<KDockWidget> leftContainer;
471  TQGuardedPtr<KDockWidget> topContainer;
472  TQGuardedPtr<KDockWidget> rightContainer;
473  TQGuardedPtr<KDockWidget> bottomContainer;
474  int m_readDockConfigMode;
475 };
476 
477 
478 /*************************************************************************/
479 KDockWidget::KDockWidget( KDockManager* dockManager, const char* name, const TQPixmap &pixmap, TQWidget* parent, const TQString& strCaption, const TQString& strTabPageLabel, WFlags f)
480 #ifdef BORDERLESS_WINDOWS
481 : TQWidget( parent, name, f )//| WType_Dialog | WStyle_Customize | WStyle_NoBorder )
482 #else
483 : TQWidget( parent, name, f )
484 #endif
485  ,formerBrotherDockWidget(0L)
486  ,currentDockPos(DockNone)
487  ,formerDockPos(DockNone)
488  ,widget(0L)
489  ,pix(new TQPixmap(pixmap))
490  ,prevSideDockPosBeforeDrag(DockNone)
491  ,isGroup(false)
492 {
493  d = new KDockWidgetPrivate(); // create private data
494 
495  d->_parent = parent;
496 
497  layout = new TQVBoxLayout( this );
498  layout->setResizeMode( TQLayout::Minimum );
499 
500  manager = dockManager;
501  manager->childDock->append( TQT_TQOBJECT(this) );
502  installEventFilter( manager );
503 
504  eDocking = DockFullDocking;
505  sDocking = DockFullSite;
506 
507  header = 0L;
508  setHeader( new KDockWidgetHeader( this, "AutoCreatedDockHeader" ) );
509 
510  if( strCaption.isNull() )
511  setCaption( name );
512  else
513  setCaption( strCaption);
514 
515  if( strTabPageLabel == " ")
516  setTabPageLabel( caption());
517  else
518  setTabPageLabel( strTabPageLabel);
519 
520  isTabGroup = false;
521  d->isContainer =false;
522  setIcon( pixmap);
523  widget = 0L;
524 
525  TQObject::connect(this, TQT_SIGNAL(hasUndocked()), manager->main, TQT_SLOT(slotDockWidgetUndocked()) );
526  applyToWidget( parent, TQPoint(0,0) );
527 }
528 
529 void KDockWidget::setPixmap(const TQPixmap& pixmap) {
530  delete pix;
531  pix=new TQPixmap(pixmap);
532  setIcon(*pix);
533  KDockTabGroup *dtg=parentDockTabGroup();
534  if (dtg)
535  dtg->changeTab(this,pixmap,dtg->tabLabel(this));
536  TQWidget *contWid=parentDockContainer();
537  if (contWid) {
538  KDockContainer *x = tqt_dynamic_cast<KDockContainer*>(contWid);
539  if (x) {
540  x->setPixmap(this,pixmap);
541  }
542  }
543 }
544 
545 const TQPixmap& KDockWidget::pixmap() const {
546  return *pix;
547 }
548 
549 KDockWidget::~KDockWidget()
550 {
551  d->pendingDtor = true;
552  if ( !manager->undockProcess ){
553  d->blockHasUndockedSignal = true;
554  undock();
555  d->blockHasUndockedSignal = false;
556  }
557 
558  if (latestKDockContainer()) {
559  KDockContainer *x = tqt_dynamic_cast<KDockContainer*>(latestKDockContainer());
560  if (x) {
561  x->removeWidget(this);
562  }
563  }
564  emit iMBeingClosed();
565  if (manager->d) manager->d->containerDocks.remove(TQT_TQOBJECT(this));
566  manager->childDock->remove(TQT_TQOBJECT(this));
567  delete pix;
568  delete d; // destroy private data
569  d=0;
570 }
571 
572 void KDockWidget::paintEvent(TQPaintEvent* pe)
573 {
574  TQWidget::paintEvent(pe);
575  TQPainter paint;
576  paint.begin( this );
577  style().tqdrawPrimitive (TQStyle::PE_Panel, &paint, TQRect(0,0,width(), height()), colorGroup());
578  paint.end();
579 }
580 
581 void KDockWidget::leaveEvent(TQEvent *e)
582 {
583  TQWidget::leaveEvent(e);
584 #ifdef BORDERLESS_WINDOWS
585  if (parent()) return;
586 // setCursor(TQCursor(ArrowCursor));
587 #endif
588 }
589 
590 void KDockWidget::mousePressEvent(TQMouseEvent* mme)
591 {
592 #ifdef BORDERLESS_WINDOWS
593  if (!parent())
594  {
595  kdDebug(282)<<"KDockWidget::mousePressEvent"<<endl;
596 
597  bool bbottom;
598  bool bleft;
599  bool bright;
600  bool btop;
601  int styleheight;
602  TQPoint mp;
603  mp=mme->pos();
604  styleheight=2*style().pixelMetric(TQStyle::PM_DefaultFrameWidth,this);
605  bbottom=mp.y()>=height()-styleheight;
606  btop=mp.y()<=styleheight;
607  bleft=mp.x()<=styleheight;
608  bright=mp.x()>=width()-styleheight;
609  kdDebug(282)<<"mousemovevent"<<endl;
610  d->resizing=true;
611  if (bright)
612  {
613  if (btop)
614  {
615  d->resizeMode=KDockWidgetPrivate::ResizeTopRight;
616  d->resizePos=TQPoint(width(),0)-mme->pos();
617 
618  }
619  else
620  {
621  d->resizePos=TQPoint(width(),height())-mme->pos();
622  if (bbottom) d->resizeMode=KDockWidgetPrivate::ResizeBottomRight;
623  else d->resizeMode=KDockWidgetPrivate::ResizeRight;
624  }
625  }
626  else if (bleft)
627  {
628  if (btop) setCursor(TQCursor(SizeFDiagCursor));
629  else
630  if (bbottom) setCursor(TQCursor(SizeBDiagCursor));
631  else setCursor(TQCursor(SizeHorCursor));
632  }
633  else
634  if (bbottom)
635  {
636  d->resizeMode=KDockWidgetPrivate::ResizeBottom;
637  d->resizePos=TQPoint(0,height())-mme->pos();
638  }
639  else
640  if (btop) setCursor(TQCursor(SizeVerCursor));
641  else d->resizing=false;
642 
643  if (d->resizing) grabMouse(cursor());
644 
645  }
646 #endif
647  TQWidget::mousePressEvent(mme);
648 }
649 
650 void KDockWidget::mouseReleaseEvent(TQMouseEvent* ev)
651 {
652 #ifdef BORDERLESS_WINDOWS
653  d->resizing=false;
654  releaseMouse();
655 #endif
656  TQWidget::mouseReleaseEvent(ev);
657 }
658 
659 void KDockWidget::mouseMoveEvent(TQMouseEvent* mme)
660 {
661  TQWidget::mouseMoveEvent(mme);
662 #ifdef BORDERLESS_WINDOWS
663  if (parent()) return;
664 
665  if (d->resizing)
666  {
667  switch (d->resizeMode)
668  {
669  case KDockWidgetPrivate::ResizeRight:
670  resize(mme->pos().x()+d->resizePos.x(),height());
671  break;
672  case KDockWidgetPrivate::ResizeBottomRight:
673  resize(mme->pos().x()+d->resizePos.x(),mme->pos().y()+d->resizePos.y());
674  break;
675  case KDockWidgetPrivate::ResizeBottom:
676  resize(width(),mme->pos().y()+d->resizePos.y());
677  break;
678  default:
679  break;
680  }
681  return;
682  }
683 
684 
685  bool bbottom;
686  bool bleft;
687  bool bright;
688  bool btop;
689  int styleheight;
690  TQPoint mp;
691  mp=mme->pos();
692  styleheight=2*style().pixelMetric(TQStyle::PM_DefaultFrameWidth,this);
693  bbottom=mp.y()>=height()-styleheight;
694  btop=mp.y()<=styleheight;
695  bleft=mp.x()<=styleheight;
696  bright=mp.x()>=width()-styleheight;
697  kdDebug(282)<<"mousemovevent"<<endl;
698  if (bright)
699  {
700  if (btop) setCursor(TQCursor(SizeBDiagCursor));
701  else
702  if (bbottom) setCursor(TQCursor(SizeFDiagCursor));
703  else setCursor(TQCursor(SizeHorCursor));
704  }
705  else if (bleft)
706  {
707  if (btop) setCursor(TQCursor(SizeFDiagCursor));
708  else
709  if (bbottom) setCursor(TQCursor(SizeBDiagCursor));
710  else setCursor(TQCursor(SizeHorCursor));
711  }
712  else
713  if (bbottom || btop) setCursor(TQCursor(SizeVerCursor));
714  else setCursor(TQCursor(ArrowCursor));
715 #endif
716 }
717 
718 void KDockWidget::setLatestKDockContainer(TQWidget* container)
719 {
720  if (container)
721  {
722  if (tqt_dynamic_cast<KDockContainer*>(container))
723  d->container=container;
724  else
725  d->container=0;
726  }
727 }
728 
729 TQWidget* KDockWidget::latestKDockContainer()
730 {
731  if (!(d->container)) return 0;
732  if (tqt_dynamic_cast<KDockContainer*>(d->container.operator->())) return d->container;
733  return 0;
734 }
735 
736 
737 
738 KDockWidgetAbstractHeader *KDockWidget::getHeader() {
739  return header;
740 }
741 
742 void KDockWidget::setHeader( KDockWidgetAbstractHeader* h )
743 {
744  if ( !h ) return;
745 
746  if ( header ){
747  delete header;
748  delete layout;
749  header = h;
750  layout = new TQVBoxLayout( this );
751  layout->setResizeMode( TQLayout::Minimum );
752  layout->addWidget( header );
753  setWidget( widget );
754  } else {
755  header = h;
756  layout->addWidget( header );
757  }
758  kdDebug(282)<<caption()<<": KDockWidget::setHeader"<<endl;
759  setEnableDocking(eDocking);
760 }
761 
762 void KDockWidget::setEnableDocking( int pos )
763 {
764  eDocking = pos;
765  if( header ) {
766  if (header->inherits( "KDockWidgetHeader" ) )
767  ( ( KDockWidgetHeader* ) header )->showUndockButton( pos & DockDesktop );
768  updateHeader();
769  }
770 }
771 
772 void KDockWidget::updateHeader()
773 {
774  if ( parent() ){
775 #ifdef BORDERLESS_WINDOWS
776  layout->setMargin(0);
777  setMouseTracking(false);
778  setCursor(TQCursor(ArrowCursor));
779 #endif
780 
781  if ( (TQT_BASE_OBJECT(parent()) == TQT_BASE_OBJECT(manager->main)) || isGroup || (eDocking == KDockWidget::DockNone) ){
782  header->hide();
783  } else {
784  header->setTopLevel( false );
785  if (widget && tqt_dynamic_cast<KDockContainer*>(widget))
786  header->hide();
787  else
788  header->show();
789  }
790  } else {
791  header->setTopLevel( true );
792  header->show();
793 #ifdef BORDERLESS_WINDOWS
794  layout->setMargin(2*style().pixelMetric(TQStyle::PM_DefaultFrameWidth,this));
795  setMouseTracking(true);
796 #endif
797  }
798 }
799 
800 void KDockWidget::applyToWidget( TQWidget* s, const TQPoint& p )
801 {
802  if ( TQT_BASE_OBJECT(parent()) != TQT_BASE_OBJECT(s) )
803  {
804  hide();
805  reparent(s, 0, TQPoint(0,0), false);
806  }
807 
808  if ( s && s->inherits("KDockMainWindow") ){
809  ((KDockMainWindow*)s)->setView( this );
810  }
811 
812  if ( manager && s == manager->main ){
813  setGeometry( TQRect(TQPoint(0,0), manager->main->geometry().size()) );
814  }
815 
816  if ( !s )
817  {
818  move(p);
819 
820 #ifndef NO_KDE2
821 #ifdef Q_WS_X11
822  if (d->transient && d->_parent)
823  XSetTransientForHint( tqt_xdisplay(), winId(), d->_parent->winId() );
824 
825 #ifdef BORDERLESS_WINDOWS
826  KWin::setType( winId(), NET::Override); //d->windowType );
827 // setWFlags(WStyle_Customize | WStyle_NoBorder | WStyle_Tool);
828 #else
829  KWin::setType( winId(), d->windowType );
830 #endif // BORDERLESS_WINDOW
831 #endif // Q_WS_X11
832 #endif
833 
834  }
835  updateHeader();
836 
837  setIcon(*pix);
838 }
839 
840 void KDockWidget::show()
841 {
842  if ( parent() || manager->main->isVisible() )
843  if ( !parent() ){
844  emit manager->setDockDefaultPos( this );
845  emit setDockDefaultPos();
846  if ( parent() ){
847  makeDockVisible();
848  } else {
849  TQWidget::show();
850  }
851  } else {
852  TQWidget::show();
853  }
854 }
855 
856 #ifndef NO_KDE2
857 
858 void KDockWidget::setDockWindowType (NET::WindowType windowType)
859 {
860  d->windowType = windowType;
861  applyToWidget( parentWidget(), TQPoint(0,0) );
862 }
863 
864 #endif
865 
866 void KDockWidget::setDockWindowTransient (TQWidget *parent, bool transientEnabled)
867 {
868  d->_parent = parent;
869  d->transient = transientEnabled;
870  applyToWidget( parentWidget(), TQPoint(0,0) );
871 }
872 
873 TQWidget *KDockWidget::transientTo() {
874  if (d->transient && d->_parent) return d->_parent; else return 0;
875 }
876 
877 bool KDockWidget::event( TQEvent *event )
878 {
879  switch ( event->type() )
880  {
881  #undef FocusIn
882  case TQEvent::FocusIn:
883  if (widget && !d->pendingFocusInEvent) {
884  d->pendingFocusInEvent = true;
885  widget->setFocus();
886  }
887  d->pendingFocusInEvent = false;
888  break;
889  case TQEvent::ChildRemoved:
890  if ( widget == ((TQChildEvent*)event)->child() ) widget = 0L;
891  break;
892  case TQEvent::Show:
893  if ( widget ) widget->show();
894  emit manager->change();
895  break;
896  case TQEvent::Hide:
897  if ( widget ) widget->hide();
898  emit manager->change();
899  break;
900  case TQEvent::CaptionChange:
901  if ( parentWidget() ){
902  if ( parent()->inherits("KDockSplitter") ){
903  ((KDockSplitter*)(parent()))->updateName();
904  }
905  if ( parentDockTabGroup() ){
906  setDockTabName( parentDockTabGroup() );
907  parentDockTabGroup()->setTabLabel( this, tabPageLabel() );
908  }
909  }
910  break;
911  case TQEvent::Close:
912  emit iMBeingClosed();
913  break;
914  default:
915  break;
916  }
917  return TQWidget::event( event );
918 }
919 
920 KDockWidget *KDockWidget::findNearestDockWidget(DockPosition pos)
921 {
922  if (!parent()) return 0;
923  if (!parent()->inherits("KDockSplitter")) return 0;
924  Orientation orientation=((pos==DockLeft) || (pos==DockRight)) ? Qt::Vertical:Qt::Horizontal;
925  if (((KDockSplitter*)(parent()))->orientation()==orientation)
926  {
927  KDockWidget *neighbor=
928  ((pos==DockLeft)||(pos==DockTop))?
929  static_cast<KDockWidget*>(((KDockSplitter*)(parent()))->getFirst()):
930  static_cast<KDockWidget*>(((KDockSplitter*)(parent()))->getLast());
931 
932  if (neighbor==this)
933  return (static_cast<KDockWidget*>(TQT_TQWIDGET(parent()->parent()))->findNearestDockWidget(pos));
934  else
935  if (neighbor->getWidget() && (::tqqt_cast<KDockTabGroup*>(neighbor->getWidget())))
936  return (KDockWidget*)(((KDockTabGroup*)neighbor->getWidget())->page(0));
937  else
938  return neighbor;
939  }
940  else
941  return (static_cast<KDockWidget*>(TQT_TQWIDGET(parent()->parent()))->findNearestDockWidget(pos));
942 
943  return 0;
944 }
945 
946 
947 KDockWidget* KDockWidget::manualDock( KDockWidget* target, DockPosition dockPos, int spliPos, TQPoint pos, bool check, int tabIndex )
948 {
949  if (this == target)
950  return 0L; // docking to itself not possible
951 
952 // kdDebug(282)<<"manualDock called "<<endl;
953  bool success = true; // tested flag
954 
955  // Check to make sure that we can dock in to the position wee
956  // were told to dock in to
957  if ( !(eDocking & (int)dockPos) ){
958  success = false;
959 // kdDebug(282)<<"KDockWidget::manualDock(): success = false (1)"<<endl;
960  }
961 
962  // fix for apps which use a value > 100%. The splitter position must be between 0..100
963  // The old behavior on high resolution was 0..10000. So likely the value is >100.
964  if (spliPos > 100) {
965  spliPos = spliPos / 100;
966  kdDebug(282) << "KDockWidget::manualDock(): fix splitter position: " << spliPos << endl;
967  }
968 
969  KDockWidget *tmpTarget = 0;
970  switch (dockPos) {
971  case DockLeft:
972  tmpTarget=dockManager()->d->leftContainer;
973  break;
974  case DockRight:
975  tmpTarget=dockManager()->d->rightContainer;
976  break;
977  case DockBottom:
978  tmpTarget=dockManager()->d->bottomContainer;
979  break;
980  case DockTop:
981  tmpTarget=dockManager()->d->topContainer;
982  break;
983  default:
984  tmpTarget = 0;
985  }
986 
987  //If we're not the target, and the target is our dock manager's main window
988  //dock into the temp target as chosen above
989  if ( tmpTarget && target && this != tmpTarget && target == dockManager()->d->mainDockWidget )
990  return manualDock(tmpTarget,DockCenter,spliPos,pos,check,tabIndex);
991 
992  // check if the target allows us to oock into the requested position
993  if ( target && !(target->sDocking & (int)dockPos) ){
994  success = false;
995 // kdDebug(282)<<"KDockWidget::manualDock(): success = false (2)"<<endl;
996  }
997 
998  /* if we have a parent, and it's not a KDockSplitter, and we don't have a parent
999  * dock tab group, and our parent isn't a KDockContainer, and we have no explicit
1000  * parent dock container...we can't do much yet */
1001  if ( parent() && !parent()->inherits("KDockSplitter") && !parentDockTabGroup() &&
1002  !(tqt_dynamic_cast<KDockContainer*>(parent())) && !parentDockContainer()){
1003 // kdDebug(282)<<"KDockWidget::manualDock(): success = false (3)"<<endl;
1004 // kdDebug(282)<<parent()->name()<<endl;
1005  success = false;
1006  }
1007 
1008  /* If all of our attempts to dock back so far have failed and we have a target
1009  * and we're not being called recursively (i guess that's what check is for)
1010  * then attempt to dock back to ourselves. */
1011  if ( !success ){
1012  // try to make another manualDock
1013  KDockWidget* dock_result = 0L;
1014  if ( target && !check ){
1015  KDockWidget::DockPosition another__dockPos = KDockWidget::DockNone;
1016  switch ( dockPos ){
1017  case KDockWidget::DockLeft : another__dockPos = KDockWidget::DockRight ; break;
1018  case KDockWidget::DockRight : another__dockPos = KDockWidget::DockLeft ; break;
1019  case KDockWidget::DockTop : another__dockPos = KDockWidget::DockBottom; break;
1020  case KDockWidget::DockBottom: another__dockPos = KDockWidget::DockTop ; break;
1021  default: break;
1022  }
1023  dock_result = target->manualDock( this, another__dockPos, spliPos, pos, true, tabIndex );
1024  }
1025  return dock_result;
1026  }
1027  // end check block
1028 
1029  d->blockHasUndockedSignal = true;
1030  undock();
1031  d->blockHasUndockedSignal = false;
1032 
1033  //we have no docking target, so we're undocking
1034  if ( !target ){
1035  move( pos );
1036  show();
1037  emit manager->change();
1038  return this;
1039  }
1040 
1041 // kdDebug(282)<<"Looking for KDockTabGroup"<<endl;
1042  KDockTabGroup* parentTab = target->parentDockTabGroup();
1043  if ( parentTab ){
1044  // add to existing TabGroup
1045  applyToWidget( parentTab );
1046  parentTab->insertTab( this, icon() ? *icon() : TQPixmap(),
1047  tabPageLabel(), tabIndex );
1048 
1049  TQWidget *wantTransient=parentTab->transientTo();
1050  target->setDockWindowTransient(wantTransient,wantTransient);
1051 
1052  setDockTabName( parentTab );
1053  if( !toolTipStr.isEmpty())
1054  parentTab->setTabToolTip( this, toolTipStr);
1055 
1056  currentDockPos = KDockWidget::DockCenter;
1057  emit manager->change();
1058  return (KDockWidget*)parentTab->parent();
1059  }
1060  else
1061  {
1062 // kdDebug(282)<<"Looking for KDockContainer"<<endl;
1063  TQWidget *contWid=target->parentDockContainer();
1064  if (!contWid) contWid=target->widget;
1065  if (contWid)
1066  {
1067  KDockContainer *cont=tqt_dynamic_cast<KDockContainer*>(contWid);
1068  if (cont)
1069  {
1070  if (latestKDockContainer() && (latestKDockContainer()!=contWid)) {
1071  KDockContainer* dc = tqt_dynamic_cast<KDockContainer*>(latestKDockContainer());
1072  if (dc) {
1073  dc->removeWidget(this);
1074  }
1075  }
1076 // kdDebug(282)<<"KDockContainerFound"<<endl;
1077  applyToWidget( contWid );
1078  cont->insertWidget( this, icon() ? *icon() : TQPixmap(),
1079  tabPageLabel(), tabIndex );
1080  setLatestKDockContainer(contWid);
1081 // setDockTabName( parentTab );
1082  if( !toolTipStr.isEmpty())
1083  cont->setToolTip( this, toolTipStr);
1084 
1085  currentDockPos = KDockWidget::DockCenter;
1086  emit manager->change();
1087  return (KDockWidget*)(cont->parentDockWidget());
1088 
1089  }
1090  }
1091  }
1092 
1093  // create a new dockwidget that will contain the target and this
1094  TQWidget* parentDock = target->parentWidget();
1095  KDockWidget* newDock = new KDockWidget( manager, "tempName", TQPixmap(TQString("")), parentDock );
1096  newDock->currentDockPos = target->currentDockPos;
1097 
1098  if ( dockPos == KDockWidget::DockCenter ){
1099  newDock->isTabGroup = true;
1100  } else {
1101  newDock->isGroup = true;
1102  }
1103  newDock->eDocking = (target->eDocking & eDocking) & (~(int)KDockWidget::DockCenter);
1104 
1105  newDock->applyToWidget( parentDock );
1106 
1107  if ( !parentDock ){
1108  // dock to a toplevel dockwidget means newDock is toplevel now
1109  newDock->move( target->frameGeometry().topLeft() );
1110  newDock->resize( target->geometry().size() );
1111  if ( target->isVisibleToTLW() ) newDock->show();
1112  }
1113 
1114  // redirect the dockback button to the new dockwidget
1115  if( target->formerBrotherDockWidget ) {
1116  newDock->setFormerBrotherDockWidget(target->formerBrotherDockWidget);
1117  if( formerBrotherDockWidget )
1118  target->loseFormerBrotherDockWidget();
1119  }
1120  newDock->formerDockPos = target->formerDockPos;
1121 
1122 
1123  // HERE SOMETING CREATING CONTAINERS SHOULD BE ADDED !!!!!
1124  if ( dockPos == KDockWidget::DockCenter )
1125  {
1126  KDockTabGroup* tab = new KDockTabGroup( newDock, "_dock_tab");
1127  TQObject::connect(tab, TQT_SIGNAL(currentChanged(TQWidget*)), d, TQT_SLOT(slotFocusEmbeddedWidget(TQWidget*)));
1128  newDock->setWidget( tab );
1129 
1130  target->applyToWidget( tab );
1131  applyToWidget( tab );
1132 
1133 
1134  tab->insertTab( target, target->icon() ? *(target->icon()) : TQPixmap(),
1135  target->tabPageLabel() );
1136 
1137 
1138 
1139  if( !target->toolTipString().isEmpty())
1140  tab->setTabToolTip( target, target->toolTipString());
1141 
1142  tab->insertTab( this, icon() ? *icon() : TQPixmap(),
1143  tabPageLabel(), tabIndex );
1144 
1145  TQRect geom=newDock->geometry();
1146  TQWidget *wantTransient=tab->transientTo();
1147  newDock->setDockWindowTransient(wantTransient,wantTransient);
1148  newDock->setGeometry(geom);
1149 
1150  if( !toolTipString().isEmpty())
1151  tab->setTabToolTip( this, toolTipString());
1152 
1153  setDockTabName( tab );
1154  tab->show();
1155 
1156  currentDockPos = DockCenter;
1157  target->formerDockPos = target->currentDockPos;
1158  target->currentDockPos = DockCenter;
1159  }
1160  else {
1161  // if to dock not to the center of the target dockwidget,
1162  // dock to newDock
1163  KDockSplitter* panner = 0L;
1164  if ( dockPos == KDockWidget::DockTop || dockPos == KDockWidget::DockBottom ) panner = new KDockSplitter( newDock, "_dock_split_", Qt::Horizontal, spliPos );
1165  if ( dockPos == KDockWidget::DockLeft || dockPos == KDockWidget::DockRight ) panner = new KDockSplitter( newDock, "_dock_split_", Qt::Vertical , spliPos );
1166  newDock->setWidget( panner );
1167 
1168  panner->setOpaqueResize(manager->splitterOpaqueResize());
1169  panner->setKeepSize(manager->splitterKeepSize());
1170  panner->setFocusPolicy( TQ_NoFocus );
1171  target->applyToWidget( panner );
1172  applyToWidget( panner );
1173  target->formerDockPos = target->currentDockPos;
1174  if ( dockPos == KDockWidget::DockRight) {
1175  panner->activate( target, this );
1176  currentDockPos = KDockWidget::DockRight;
1177  target->currentDockPos = KDockWidget::DockLeft;
1178  }
1179  else if( dockPos == KDockWidget::DockBottom) {
1180  panner->activate( target, this );
1181  currentDockPos = KDockWidget::DockBottom;
1182  target->currentDockPos = KDockWidget::DockTop;
1183  }
1184  else if( dockPos == KDockWidget::DockTop) {
1185  panner->activate( this, target );
1186  currentDockPos = KDockWidget::DockTop;
1187  target->currentDockPos = KDockWidget::DockBottom;
1188  }
1189  else if( dockPos == KDockWidget::DockLeft) {
1190  panner->activate( this, target );
1191  currentDockPos = KDockWidget::DockLeft;
1192  target->currentDockPos = KDockWidget::DockRight;
1193  }
1194  target->show();
1195  show();
1196  panner->show();
1197  }
1198 
1199  if ( parentDock ){
1200  if ( parentDock->inherits("KDockSplitter") ){
1201  KDockSplitter* sp = (KDockSplitter*)parentDock;
1202  sp->deactivate();
1203  if ( sp->getFirst() == target )
1204  sp->activate( newDock, 0L );
1205  else
1206  sp->activate( 0L, newDock );
1207  }
1208  }
1209 
1210  newDock->show();
1211  emit target->docking( this, dockPos );
1212  emit manager->replaceDock( target, newDock );
1213  emit manager->change();
1214 
1215  return newDock;
1216 }
1217 
1218 KDockTabGroup* KDockWidget::parentDockTabGroup() const
1219 {
1220  if ( !parent() ) return 0L;
1221  TQWidget* candidate = parentWidget()->parentWidget();
1222  if ( candidate && candidate->inherits("KDockTabGroup") ) return (KDockTabGroup*)candidate;
1223  return 0L;
1224 }
1225 
1226 TQWidget *KDockWidget::parentDockContainer() const
1227 {
1228  if (!parent()) return 0L;
1229  TQWidget* candidate = parentWidget()->parentWidget();
1230  if (candidate && tqt_dynamic_cast<KDockContainer*>(candidate)) return candidate;
1231  return 0L;
1232 }
1233 
1234 
1235 void KDockWidget::setForcedFixedWidth(int w)
1236 {
1237  d->forcedWidth=w;
1238  setFixedWidth(w);
1239  if (!parent()) return;
1240  if (parent()->inherits("KDockSplitter"))
1241  ::tqqt_cast<KDockSplitter*>(parent())->setForcedFixedWidth(this,w);
1242 }
1243 
1244 void KDockWidget::setForcedFixedHeight(int h)
1245 {
1246  d->forcedHeight=h;
1247  setFixedHeight(h);
1248  if (!parent()) return;
1249  if (parent()->inherits("KDockSplitter"))
1250  ::tqqt_cast<KDockSplitter*>(parent())->setForcedFixedHeight(this,h);
1251 }
1252 
1253 int KDockWidget::forcedFixedWidth()
1254 {
1255  return d->forcedWidth;
1256 }
1257 
1258 int KDockWidget::forcedFixedHeight()
1259 {
1260  return d->forcedHeight;
1261 }
1262 
1263 void KDockWidget::restoreFromForcedFixedSize()
1264 {
1265  d->forcedWidth=-1;
1266  d->forcedHeight=-1;
1267  setMinimumWidth(0);
1268  setMaximumWidth(32000);
1269  setMinimumHeight(0);
1270  setMaximumHeight(32000);
1271  if (!parent()) return;
1272  if (parent()->inherits("KDockSplitter"))
1273  ::tqqt_cast<KDockSplitter*>(parent())->restoreFromForcedFixedSize(this);
1274 }
1275 
1276 void KDockWidget::toDesktop()
1277 {
1278  TQPoint p = mapToGlobal( TQPoint( -30, -30 ) );
1279  if( p.x( ) < 0 )
1280  p.setX( 0 );
1281  if( p.y( ) < 0 )
1282  p.setY( 0 );
1283  manualDock( 0, DockDesktop, 50, p );
1284 }
1285 
1286 KDockWidget::DockPosition KDockWidget::currentDockPosition() const
1287 {
1288  return currentDockPos;
1289 }
1290 
1291 void KDockWidget::undock()
1292 {
1293 // kdDebug(282)<<"KDockWidget::undock()"<<endl;
1294 
1295  manager->d->dragRect = TQRect ();
1296  manager->drawDragRectangle ();
1297 
1298  TQWidget* parentW = parentWidget();
1299  if ( !parentW ){
1300  hide();
1301  if (!d->blockHasUndockedSignal)
1302  emit hasUndocked();
1303  return;
1304  }
1305 
1306  formerDockPos = currentDockPos;
1307  currentDockPos = KDockWidget::DockDesktop;
1308 
1309  manager->blockSignals(true);
1310  manager->undockProcess = true;
1311 
1312  bool isV = parentW->isVisibleToTLW();
1313 
1314  //UNDOCK HAS TO BE IMPLEMENTED CORRECTLY :)
1315  KDockTabGroup* parentTab = parentDockTabGroup();
1316  if ( parentTab ){
1317  d->index = parentTab->indexOf( this); // memorize the page position in the tab widget
1318  parentTab->removePage( this );
1319 /*
1320  TQWidget *wantTransient=parentTab->transientTo();
1321  target->setDockWindowTransient(wantTransient,wantTransient);
1322  */
1323  setFormerBrotherDockWidget((KDockWidget*)parentTab->page(0));
1324  applyToWidget( 0L );
1325  if ( parentTab->count() == 1 ){
1326 
1327  // last subdock widget in the tab control
1328  KDockWidget* lastTab = (KDockWidget*)parentTab->page(0);
1329  parentTab->removePage( lastTab );
1330 /* TQWidget *wantTransient=parentTab->transientTo();
1331  target->setDockWindowTransient(wantTransient,wantTransient);*/
1332 
1333  lastTab->applyToWidget( 0L );
1334  lastTab->move( parentTab->mapToGlobal(parentTab->frameGeometry().topLeft()) );
1335 
1336  // KDockTabGroup always have a parent that is a KDockWidget
1337  KDockWidget* parentOfTab = (KDockWidget*)parentTab->parent();
1338  delete parentTab; // KDockTabGroup
1339 
1340  TQWidget* parentOfDockWidget = parentOfTab->parentWidget();
1341  if ( !parentOfDockWidget ){
1342  if ( isV ) lastTab->show();
1343  } else {
1344  if ( parentOfDockWidget->inherits("KDockSplitter") ){
1345  KDockSplitter* split = (KDockSplitter*)parentOfDockWidget;
1346  lastTab->applyToWidget( split );
1347  split->deactivate();
1348  if ( split->getFirst() == parentOfTab ){
1349  split->activate( lastTab );
1350  if ( ((KDockWidget*)split->parent())->splitterOrientation == Qt::Vertical )
1351  emit ((KDockWidget*)split->getAnother(parentOfTab))->docking( parentOfTab, KDockWidget::DockLeft );
1352  else
1353  emit ((KDockWidget*)split->getAnother(parentOfTab))->docking( parentOfTab, KDockWidget::DockTop );
1354  } else {
1355  split->activate( 0L, lastTab );
1356  if ( ((KDockWidget*)split->parent())->splitterOrientation == Qt::Vertical )
1357  emit ((KDockWidget*)split->getAnother(parentOfTab))->docking( parentOfTab, KDockWidget::DockRight );
1358  else
1359  emit ((KDockWidget*)split->getAnother(parentOfTab))->docking( parentOfTab, KDockWidget::DockBottom );
1360  }
1361  split->show();
1362  } else {
1363  lastTab->applyToWidget( parentOfDockWidget );
1364  }
1365  lastTab->show();
1366  }
1367  manager->blockSignals(false);
1368  emit manager->replaceDock( parentOfTab, lastTab );
1369  lastTab->currentDockPos = parentOfTab->currentDockPos;
1370  emit parentOfTab->iMBeingClosed();
1371  manager->blockSignals(true);
1372  delete parentOfTab;
1373 
1374  } else {
1375  setDockTabName( parentTab );
1376  }
1377  } else {
1378  /*********************************************************************************************/
1379  //TQWidget* containerWidget = (TQWidget*)parent();
1380  bool undockedFromContainer=false;
1381  if (d->container)
1382  {
1383 // kdDebug(282)<<"undocked from dockcontainer"<<endl;
1384  undockedFromContainer=true;
1385  KDockContainer* dc = tqt_dynamic_cast<KDockContainer*>(d->container.operator->());
1386  if (dc) {
1387  dc->undockWidget(this);
1388  setFormerBrotherDockWidget(dc->parentDockWidget());
1389  }
1390  applyToWidget( 0L );
1391  }
1392  if (!undockedFromContainer) {
1393 /*********************************************************************************************/
1394  if ( parentW->inherits("KDockSplitter") ){
1395  KDockSplitter* parentSplitterOfDockWidget = (KDockSplitter*)parentW;
1396  d->splitPosInPercent = parentSplitterOfDockWidget->separatorPosInPercent();
1397 
1398  KDockWidget* secondWidget = (KDockWidget*)parentSplitterOfDockWidget->getAnother( this );
1399  KDockWidget* group = (KDockWidget*)parentSplitterOfDockWidget->parentWidget();
1400  setFormerBrotherDockWidget(secondWidget);
1401  applyToWidget( 0L );
1402  group->hide();
1403 
1404  if ( !group->parentWidget() ){
1405  secondWidget->applyToWidget( 0L, group->frameGeometry().topLeft() );
1406  secondWidget->resize( group->width(), group->height() );
1407  } else {
1408  TQWidget* obj = group->parentWidget();
1409  secondWidget->applyToWidget( obj );
1410  if ( obj->inherits("KDockSplitter") ){
1411  KDockSplitter* parentOfGroup = (KDockSplitter*)obj;
1412  parentOfGroup->deactivate();
1413 
1414  if ( parentOfGroup->getFirst() == group )
1415  parentOfGroup->activate( secondWidget );
1416  else
1417  parentOfGroup->activate( 0L, secondWidget );
1418  }
1419  }
1420  secondWidget->currentDockPos = group->currentDockPos;
1421  secondWidget->formerDockPos = group->formerDockPos;
1422  delete parentSplitterOfDockWidget;
1423  manager->blockSignals(false);
1424  emit manager->replaceDock( group, secondWidget );
1425  emit group->iMBeingClosed();
1426  manager->blockSignals(true);
1427  delete group;
1428 
1429  if ( isV ) secondWidget->show();
1430  } else {
1431  if (!d->pendingDtor) {
1432  // don't reparent in the dtor of this
1433  applyToWidget( 0L );
1434  }
1435  }
1436 /*********************************************************************************************/
1437  }
1438  }
1439  manager->blockSignals(false);
1440  if (!d->blockHasUndockedSignal)
1441  emit manager->change();
1442  manager->undockProcess = false;
1443 
1444  if (!d->blockHasUndockedSignal)
1445  emit hasUndocked();
1446 }
1447 
1448 void KDockWidget::setWidget( TQWidget* mw )
1449 {
1450  if ( !mw ) return;
1451 
1452  if ( TQT_BASE_OBJECT(mw->parent()) != TQT_BASE_OBJECT(this) ){
1453  mw->reparent(this, 0, TQPoint(0,0), false);
1454  }
1455 
1456 #ifdef BORDERLESS_WINDOWS
1457  if (!mw->ownCursor()) mw->setCursor(TQCursor(ArrowCursor));
1458 #endif
1459  widget = mw;
1460  delete layout;
1461 
1462  layout = new TQVBoxLayout( this );
1463  layout->setResizeMode( TQLayout::Minimum );
1464 
1465  KDockContainer* dc = tqt_dynamic_cast<KDockContainer*>(widget);
1466  if (dc)
1467  {
1468  d->isContainer=true;
1469  manager->d->containerDocks.append(TQT_TQOBJECT(this));
1470  }
1471  else
1472  {
1473  d->isContainer=false;
1474  }
1475 
1476  {
1477  header->show();
1478  layout->addWidget( header );
1479  layout->addWidget( widget,1 );
1480  }
1481  updateHeader();
1482  emit widgetSet(mw);
1483 }
1484 
1485 void KDockWidget::setDockTabName( KDockTabGroup* tab )
1486 {
1487  TQString listOfName;
1488  TQString listOfCaption;
1489  for ( int i = 0; i < tab->count(); ++i ) {
1490  TQWidget *w = tab->page( i );
1491  listOfCaption.append( w->caption() ).append(",");
1492  listOfName.append( w->name() ).append(",");
1493  }
1494  listOfCaption.remove( listOfCaption.length()-1, 1 );
1495  listOfName.remove( listOfName.length()-1, 1 );
1496 
1497  tab->parentWidget()->setName( listOfName.utf8() );
1498  tab->parentWidget()->setCaption( listOfCaption );
1499 
1500  tab->parentWidget()->repaint( false ); // KDockWidget->repaint
1501  if ( tab->parentWidget()->parent() )
1502  if ( tab->parentWidget()->parent()->inherits("KDockSplitter") )
1503  ((KDockSplitter*)(tab->parentWidget()->parent()))->updateName();
1504 }
1505 
1506 bool KDockWidget::mayBeHide() const
1507 {
1508  bool f = (TQT_BASE_OBJECT(parent()) != TQT_BASE_OBJECT(manager->main));
1509  return ( !isGroup && !isTabGroup && f && isVisible() && ( eDocking != (int)KDockWidget::DockNone ) );
1510 }
1511 
1512 bool KDockWidget::mayBeShow() const
1513 {
1514  bool f = (TQT_BASE_OBJECT(parent()) != TQT_BASE_OBJECT(manager->main));
1515  return ( !isGroup && !isTabGroup && f && !isVisible() );
1516 }
1517 
1518 void KDockWidget::changeHideShowState()
1519 {
1520  if ( mayBeHide() ){
1521  undock();
1522  return;
1523  }
1524 
1525  if ( mayBeShow() ){
1526  if ( manager->main->inherits("KDockMainWindow") ){
1527  ((KDockMainWindow*)manager->main)->makeDockVisible(this);
1528  } else {
1529  makeDockVisible();
1530  }
1531  }
1532 }
1533 
1534 void KDockWidget::makeDockVisible()
1535 {
1536  if ( parentDockTabGroup() ){
1537  parentDockTabGroup()->showPage( this );
1538  }
1539  if (parentDockContainer()) {
1540  TQWidget *contWid=parentDockContainer();
1541  KDockContainer *x = tqt_dynamic_cast<KDockContainer*>(contWid);
1542  if (x) {
1543  x->showWidget(this);
1544  }
1545  }
1546  if ( isVisible() ) return;
1547 
1548  TQWidget* p = parentWidget();
1549  while ( p ){
1550  if ( !p->isVisible() )
1551  p->show();
1552  p = p->parentWidget();
1553  }
1554  if( !parent() ) // is undocked
1555  dockBack();
1556  show();
1557 }
1558 
1559 void KDockWidget::setFormerBrotherDockWidget(KDockWidget *dockWidget)
1560 {
1561  formerBrotherDockWidget = dockWidget;
1562  if( formerBrotherDockWidget )
1563  TQObject::connect( formerBrotherDockWidget, TQT_SIGNAL(iMBeingClosed()),
1564  this, TQT_SLOT(loseFormerBrotherDockWidget()) );
1565 }
1566 
1567 void KDockWidget::loseFormerBrotherDockWidget()
1568 {
1569  if( formerBrotherDockWidget )
1570  TQObject::disconnect( formerBrotherDockWidget, TQT_SIGNAL(iMBeingClosed()),
1571  this, TQT_SLOT(loseFormerBrotherDockWidget()) );
1572  formerBrotherDockWidget = 0L;
1573  repaint();
1574 }
1575 
1576 void KDockWidget::dockBack()
1577 {
1578  if( formerBrotherDockWidget) {
1579  // search all children if it tries to dock back to a child
1580  bool found = false;
1581  TQObjectList* cl = queryList("KDockWidget");
1582  TQObjectListIt it( *cl );
1583  TQObject * obj;
1584  while ( !found && (obj=it.current()) != 0 ) {
1585  ++it;
1586  TQWidget* widg = (TQWidget*)obj;
1587  if( widg == formerBrotherDockWidget)
1588  found = true;
1589  }
1590  delete cl;
1591 
1592  if( !found) {
1593  // can dock back to the former brother dockwidget
1594  manualDock( formerBrotherDockWidget, formerDockPos, d->splitPosInPercent, TQPoint(0,0), false, d->index);
1595  formerBrotherDockWidget = 0L;
1596  makeDockVisible();
1597  return;
1598  }
1599  }
1600 
1601  // else dockback to the dockmainwindow (default behavior)
1602  manualDock( ((KDockMainWindow*)manager->main)->getMainDockWidget(), formerDockPos, d->splitPosInPercent, TQPoint(0,0), false, d->index);
1603  formerBrotherDockWidget = 0L;
1604  if (parent())
1605  makeDockVisible();
1606 }
1607 
1608 bool KDockWidget::isDockBackPossible() const
1609 {
1610  if( !(formerBrotherDockWidget) || !(formerBrotherDockWidget->dockSite() & formerDockPos))
1611  return false;
1612  else
1613  return true;
1614 }
1615 
1616 /**************************************************************************************/
1617 
1618 
1619 KDockManager::KDockManager( TQWidget* mainWindow , const char* name )
1620 :TQObject( mainWindow, name )
1621  ,main(mainWindow)
1622  ,currentDragWidget(0L)
1623  ,currentMoveWidget(0L)
1624  ,childDockWidgetList(0L)
1625  ,autoCreateDock(0L)
1626  ,storeW(0)
1627  ,storeH(0)
1628  ,dragging(false)
1629  ,undockProcess(false)
1630  ,dropCancel(true)
1631 {
1632  d = new KDockManagerPrivate;
1633 
1634  d->readyToDrag = false;
1635  d->mainDockWidget=0;
1636 
1637 #ifndef NO_KDE2
1638  d->splitterOpaqueResize = TDEGlobalSettings::opaqueResize();
1639 #else
1640  d->splitterOpaqueResize = false;
1641 #endif
1642 
1643  d->splitterKeepSize = false;
1644  d->splitterHighResolution = false;
1645  d->m_readDockConfigMode = WrapExistingWidgetsOnly; // default as before
1646 
1647  main->installEventFilter( this );
1648 
1649  undockProcess = false;
1650 
1651  menuData = new TQPtrList<MenuDockData>;
1652  menuData->setAutoDelete( true );
1653  menuData->setAutoDelete( true );
1654 
1655 #ifndef NO_KDE2
1656  menu = new TDEPopupMenu();
1657 #else
1658  menu = new TQPopupMenu();
1659 #endif
1660 
1661  connect( menu, TQT_SIGNAL(aboutToShow()), TQT_SLOT(slotMenuPopup()) );
1662  connect( menu, TQT_SIGNAL(activated(int)), TQT_SLOT(slotMenuActivated(int)) );
1663 
1664  childDock = new TQObjectList();
1665  childDock->setAutoDelete( false );
1666 }
1667 
1668 
1669 void KDockManager::setMainDockWidget2(KDockWidget *w)
1670 {
1671  d->mainDockWidget=w;
1672 }
1673 
1674 KDockManager::~KDockManager()
1675 {
1676  delete menuData;
1677  delete menu;
1678 
1679  TQObjectListIt it( *childDock );
1680  KDockWidget * obj;
1681 
1682  while ( (obj=(KDockWidget*)it.current()) ) {
1683  delete obj;
1684  }
1685  delete childDock;
1686  delete d;
1687  d=0;
1688 }
1689 
1690 void KDockManager::activate()
1691 {
1692  TQObjectListIt it( *childDock );
1693  KDockWidget * obj;
1694 
1695  while ( (obj=(KDockWidget*)it.current()) ) {
1696  ++it;
1697  if ( obj->widget ) obj->widget->show();
1698  if ( !obj->parentDockTabGroup() ){
1699  obj->show();
1700  }
1701  }
1702  if ( !main->inherits(TQDIALOG_OBJECT_NAME_STRING) ) main->show();
1703 }
1704 
1705 bool KDockManager::eventFilter( TQObject *obj, TQEvent *event )
1706 {
1707 
1708  if ( obj->inherits("KDockWidgetAbstractHeaderDrag") ){
1709  KDockWidget* pDockWdgAtCursor = 0L;
1710  KDockWidget* curdw = ((KDockWidgetAbstractHeaderDrag*)obj)->dockWidget();
1711  switch ( event->type() ){
1712  case TQEvent::MouseButtonDblClick:
1713  if (curdw->currentDockPos == KDockWidget::DockDesktop) curdw->dockBack();
1714  else
1715  {
1716  curdw->toDesktop();
1717  // curdw->manualDock (0, KDockWidget::DockDesktop);
1718  }
1719  break;
1720 
1721  case TQEvent::MouseButtonPress:
1722  if ( ((TQMouseEvent*)event)->button() == Qt::LeftButton ){
1723  if ( curdw->eDocking != (int)KDockWidget::DockNone ){
1724  dropCancel = true;
1725  curdw->setFocus();
1726  tqApp->processOneEvent();
1727 
1728  currentDragWidget = curdw;
1729  currentMoveWidget = 0L;
1730  childDockWidgetList = new TQWidgetList();
1731  childDockWidgetList->append( curdw );
1732  findChildDockWidget( curdw, childDockWidgetList );
1733 
1734  //d->oldDragRect = TQRect(); should fix rectangle not erased problem
1735  d->dragRect = TQRect(curdw->geometry());
1736  TQPoint p = curdw->mapToGlobal(TQPoint(0,0));
1737  d->dragRect.moveTopLeft(p);
1738  drawDragRectangle();
1739  d->readyToDrag = true;
1740 
1741  d->dragOffset = TQCursor::pos()-currentDragWidget->mapToGlobal(TQPoint(0,0));
1742  }
1743 
1744  }
1745  break;
1746  case TQEvent::MouseButtonRelease:
1747  if ( ((TQMouseEvent*)event)->button() == Qt::LeftButton ){
1748  if ( dragging ){
1749  if ( !dropCancel )
1750  drop();
1751  else
1752  cancelDrop();
1753  }
1754  if (d->readyToDrag) {
1755  d->readyToDrag = false;
1756  //d->oldDragRect = TQRect(); should fix rectangle not erased problem
1757  d->dragRect = TQRect(curdw->geometry());
1758  TQPoint p = curdw->mapToGlobal(TQPoint(0,0));
1759  d->dragRect.moveTopLeft(p);
1760  drawDragRectangle();
1761  currentDragWidget = 0L;
1762  delete childDockWidgetList;
1763  childDockWidgetList = 0L;
1764  }
1765  dragging = false;
1766  dropCancel = true;
1767  }
1768  break;
1769  case TQEvent::MouseMove:
1770  if ( dragging ) {
1771 
1772 #ifdef BORDERLESS_WINDOWS
1773 //BEGIN TEST
1774  KDockWidget *oldMoveWidget;
1775  if (!curdw->parent())
1776  {
1777  curdw->move(TQCursor::pos()-d->dragOffset);
1778  pDockWdgAtCursor = findDockWidgetAt( TQCursor::pos()-TQPoint(0,d->dragOffset.y()+3) );
1779  oldMoveWidget = currentMoveWidget;
1780  }
1781  else
1782  {
1783  pDockWdgAtCursor = findDockWidgetAt( TQCursor::pos() );
1784  oldMoveWidget = currentMoveWidget;
1785  }
1786 //END TEST
1787 #else
1788  pDockWdgAtCursor = findDockWidgetAt( TQCursor::pos() );
1789  KDockWidget* oldMoveWidget = currentMoveWidget;
1790 #endif
1791 
1792  if ( currentMoveWidget && pDockWdgAtCursor == currentMoveWidget ) { //move
1793  dragMove( currentMoveWidget, currentMoveWidget->mapFromGlobal( TQCursor::pos() ) );
1794  break;
1795  } else {
1796  if (dropCancel && curdw) {
1797  d->dragRect = TQRect(curdw->geometry());
1798  TQPoint p = curdw->mapToGlobal(TQPoint(0,0));
1799  d->dragRect.moveTopLeft(p);
1800  }else
1801  d->dragRect = TQRect();
1802 
1803  drawDragRectangle();
1804  }
1805 
1806  if ( !pDockWdgAtCursor && !(curdw->eDocking & (int)KDockWidget::DockDesktop) ){
1807  // just moving at the desktop
1808  currentMoveWidget = pDockWdgAtCursor;
1809  curPos = KDockWidget::DockDesktop;
1810  } else {
1811  if ( oldMoveWidget && pDockWdgAtCursor != currentMoveWidget ) { //leave
1812  currentMoveWidget = pDockWdgAtCursor;
1813  curPos = KDockWidget::DockDesktop;
1814  }
1815  }
1816 
1817  if ( oldMoveWidget != pDockWdgAtCursor && pDockWdgAtCursor ) { //enter pDockWdgAtCursor
1818  currentMoveWidget = pDockWdgAtCursor;
1819  curPos = KDockWidget::DockDesktop;
1820  }
1821  } else {
1822  if (d->readyToDrag) {
1823  d->readyToDrag = false;
1824  }
1825  if ( (((TQMouseEvent*)event)->state() == Qt::LeftButton) &&
1826  (curdw->eDocking != (int)KDockWidget::DockNone) ) {
1827  startDrag( curdw);
1828  }
1829  }
1830  break;
1831  default:
1832  break;
1833  }
1834  }
1835  return TQObject::eventFilter( obj, event );
1836 }
1837 
1838 KDockWidget* KDockManager::findDockWidgetAt( const TQPoint& pos )
1839 {
1840  dropCancel = true;
1841 
1842  if (!currentDragWidget)
1843  return 0L; // pointer access safety
1844 
1845  if (currentDragWidget->eDocking == (int)KDockWidget::DockNone ) return 0L;
1846 
1847  TQWidget* p = TQApplication::widgetAt( pos );
1848  if ( !p ) {
1849  dropCancel = false;
1850  return 0L;
1851  }
1852 #if defined(_OS_WIN32_) || defined(Q_OS_WIN32)
1853  p = p->topLevelWidget();
1854 #endif
1855  TQWidget* w = 0L;
1856  findChildDockWidget( w, p, p->mapFromGlobal(pos) );
1857  if ( !w ){
1858  if ( !p->inherits("KDockWidget") ) {
1859  return 0L;
1860  }
1861  w = p;
1862  }
1863  if ( tqt_find_obj_child( TQT_TQOBJECT(w), "KDockSplitter", "_dock_split_" ) ) return 0L;
1864  if ( tqt_find_obj_child( TQT_TQOBJECT(w), "KDockTabGroup", "_dock_tab" ) ) return 0L;
1865  if (tqt_dynamic_cast<KDockContainer*>(w)) return 0L;
1866 
1867  if (!childDockWidgetList) return 0L;
1868  if ( childDockWidgetList->find(w) != -1 ) return 0L;
1869  if ( currentDragWidget->isGroup && ((KDockWidget*)w)->parentDockTabGroup() ) return 0L;
1870 
1871  KDockWidget* www = (KDockWidget*)w;
1872  if ( www->sDocking == (int)KDockWidget::DockNone ) return 0L;
1873  if( !www->widget )
1874  return 0L;
1875 
1876  KDockWidget::DockPosition curPos = KDockWidget::DockDesktop;
1877  TQPoint cpos = www->mapFromGlobal( pos );
1878 
1879  int ww = www->widget->width() / 3;
1880  int hh = www->widget->height() / 3;
1881 
1882  if ( cpos.y() <= hh ){
1883  curPos = KDockWidget::DockTop;
1884  } else
1885  if ( cpos.y() >= 2*hh ){
1886  curPos = KDockWidget::DockBottom;
1887  } else
1888  if ( cpos.x() <= ww ){
1889  curPos = KDockWidget::DockLeft;
1890  } else
1891  if ( cpos.x() >= 2*ww ){
1892  curPos = KDockWidget::DockRight;
1893  } else
1894  curPos = KDockWidget::DockCenter;
1895 
1896  if ( !(www->sDocking & (int)curPos) ) return 0L;
1897  if ( !(currentDragWidget->eDocking & (int)curPos) ) return 0L;
1898  if ( www->manager != this ) return 0L;
1899 
1900  dropCancel = false;
1901  return www;
1902 }
1903 
1904 void KDockManager::findChildDockWidget( TQWidget*& ww, const TQWidget* p, const TQPoint& pos )
1905 {
1906  if ( !p->childrenListObject().isEmpty() ) {
1907  TQWidget *w;
1908  TQObjectListIt it( p->childrenListObject() );
1909  it.toLast();
1910  while ( it.current() ) {
1911  if ( it.current()->isWidgetType() ) {
1912  w = (TQWidget*)it.current();
1913  if ( w->isVisible() && w->geometry().contains(pos) ) {
1914  if ( w->inherits("KDockWidget") ) ww = w;
1915  findChildDockWidget( ww, w, w->mapFromParent(pos) );
1916  return;
1917  }
1918  }
1919  --it;
1920  }
1921  }
1922  return;
1923 }
1924 
1925 void KDockManager::findChildDockWidget( const TQWidget* p, TQWidgetList*& list )
1926 {
1927  if ( !p->childrenListObject().isEmpty() ) {
1928  TQWidget *w;
1929  TQObjectListIt it( p->childrenListObject() );
1930  it.toLast();
1931  while ( it.current() ) {
1932  if ( it.current()->isWidgetType() ) {
1933  w = (TQWidget*)it.current();
1934  if ( w->isVisible() ) {
1935  if ( w->inherits("KDockWidget") ) list->append( w );
1936  findChildDockWidget( w, list );
1937  }
1938  }
1939  --it;
1940  }
1941  }
1942  return;
1943 }
1944 
1945 void KDockManager::startDrag( KDockWidget* w )
1946 {
1947  if(( w->currentDockPos == KDockWidget::DockLeft) || ( w->currentDockPos == KDockWidget::DockRight)
1948  || ( w->currentDockPos == KDockWidget::DockTop) || ( w->currentDockPos == KDockWidget::DockBottom)) {
1949  w->prevSideDockPosBeforeDrag = w->currentDockPos;
1950 
1951  if ( w->parentWidget()->inherits("KDockSplitter") ){
1952  KDockSplitter* parentSplitterOfDockWidget = (KDockSplitter*)(w->parentWidget());
1953  w->d->splitPosInPercent = parentSplitterOfDockWidget->separatorPosInPercent();
1954  }
1955  }
1956 
1957  curPos = KDockWidget::DockDesktop;
1958  dragging = true;
1959 
1960  TQApplication::setOverrideCursor(TQCursor(tqsizeAllCursor));
1961 }
1962 
1963 void KDockManager::dragMove( KDockWidget* dw, TQPoint pos )
1964 {
1965  TQPoint p = dw->mapToGlobal( dw->widget->pos() );
1966  KDockWidget::DockPosition oldPos = curPos;
1967 
1968  TQSize r = dw->widget->size();
1969  if ( dw->parentDockTabGroup() ){
1970  curPos = KDockWidget::DockCenter;
1971  if ( oldPos != curPos ) {
1972  d->dragRect.setRect( p.x()+2, p.y()+2, r.width()-4, r.height()-4 );
1973  }
1974  return;
1975  }
1976 
1977  int w = r.width() / 3;
1978  int h = r.height() / 3;
1979 
1980  if ( pos.y() <= h ){
1981  curPos = KDockWidget::DockTop;
1982  w = r.width();
1983  } else
1984  if ( pos.y() >= 2*h ){
1985  curPos = KDockWidget::DockBottom;
1986  p.setY( p.y() + 2*h );
1987  w = r.width();
1988  } else
1989  if ( pos.x() <= w ){
1990  curPos = KDockWidget::DockLeft;
1991  h = r.height();
1992  } else
1993  if ( pos.x() >= 2*w ){
1994  curPos = KDockWidget::DockRight;
1995  p.setX( p.x() + 2*w );
1996  h = r.height();
1997  } else
1998  {
1999  curPos = KDockWidget::DockCenter;
2000  p.setX( p.x() + w );
2001  p.setY( p.y() + h );
2002  }
2003 
2004  if ( oldPos != curPos ) {
2005  d->dragRect.setRect( p.x(), p.y(), w, h );
2006  drawDragRectangle();
2007  }
2008 }
2009 
2010 
2011 void KDockManager::cancelDrop()
2012 {
2013  TQApplication::restoreOverrideCursor();
2014 
2015  delete childDockWidgetList;
2016  childDockWidgetList = 0L;
2017 
2018  d->dragRect = TQRect(); // cancel drawing
2019  drawDragRectangle(); // only the old rect will be deleted
2020 }
2021 
2022 
2023 void KDockManager::drop()
2024 {
2025  d->dragRect = TQRect(); // cancel drawing
2026  drawDragRectangle(); // only the old rect will be deleted
2027 
2028  TQApplication::restoreOverrideCursor();
2029 
2030  delete childDockWidgetList;
2031  childDockWidgetList = 0L;
2032 
2033  if ( dropCancel ) return;
2034  if ( !currentMoveWidget && (!(currentDragWidget->eDocking & (int)KDockWidget::DockDesktop)) ) {
2035  d->dragRect = TQRect(); // cancel drawing
2036  drawDragRectangle(); // only the old rect will be deleted
2037  return;
2038  }
2039  if ( !currentMoveWidget && !currentDragWidget->parent() ) {
2040  currentDragWidget->move( TQCursor::pos() - d->dragOffset );
2041  }
2042  else {
2043  // curPos is the current target DockPosition.
2044  // currentDragWidget->prevSideDockPosBeforeDrag is where the dockwidget comes from.
2045  // currentDragWidget->formerDockPos is the position *before* the dockwidget was in
2046  // position currentDragWidget->prevSideDockPosBeforeDrag.
2047  int splitPos = currentDragWidget->d->splitPosInPercent;
2048  KDockWidget::DockPosition previousPosition = currentDragWidget->prevSideDockPosBeforeDrag;
2049 
2050 // kdDebug() << splitPos << endl;
2051 // kdDebug() << "curPos: " << curPos << endl;
2052 // kdDebug() << "formerDockPos: " << currentDragWidget->formerDockPos<< endl;
2053 // kdDebug() << "prevSideDockPosBeforeDrag: " << currentDragWidget->prevSideDockPosBeforeDrag<< endl;
2054 
2055  // Now we *need* to "invert" the procentual value, if the dockwidget moves from top/left
2056  // to bottom/right or vice versa. This keeps the dockwidget's size on its new position.
2057  // A special case is, when the dock position was DockNone, then we have to look for the
2058  // formerDockPos to get things right.
2059  if( (curPos != previousPosition)
2060  && (curPos != KDockWidget::DockCenter) && (curPos != KDockWidget::DockDesktop)) {
2061 
2062  if (previousPosition == KDockWidget::DockNone)
2063  previousPosition = currentDragWidget->formerDockPos;
2064 
2065  switch( previousPosition ) {
2066  case KDockWidget::DockLeft:
2067  if(curPos != KDockWidget::DockTop && curPos != KDockWidget::DockLeft)
2068  splitPos = 100 - splitPos;
2069  break;
2070 
2071  case KDockWidget::DockRight:
2072  if(curPos != KDockWidget::DockBottom && curPos != KDockWidget::DockRight)
2073  splitPos = 100 - splitPos;
2074  break;
2075 
2076  case KDockWidget::DockTop:
2077  if(curPos != KDockWidget::DockLeft && curPos != KDockWidget::DockTop )
2078  splitPos = 100 - splitPos;
2079  break;
2080 
2081  case KDockWidget::DockBottom:
2082  if(curPos != KDockWidget::DockRight && curPos != KDockWidget::DockBottom )
2083  splitPos = 100 - splitPos;
2084  break;
2085 
2086  default: break;
2087  }
2088  }
2089  // set new prevSideDockPosBeforeDrag
2090  currentDragWidget->prevSideDockPosBeforeDrag = curPos;
2091  currentDragWidget->manualDock( currentMoveWidget, curPos , splitPos, TQCursor::pos() - d->dragOffset );
2092  currentDragWidget->makeDockVisible();
2093  }
2094 }
2095 
2096 
2097 static TQDomElement createStringEntry(TQDomDocument &doc, const TQString &tagName, const TQString &str)
2098 {
2099  TQDomElement el = doc.createElement(tagName);
2100 
2101  el.appendChild(doc.createTextNode(str));
2102  return el;
2103 }
2104 
2105 
2106 static TQDomElement createBoolEntry(TQDomDocument &doc, const TQString &tagName, bool b)
2107 {
2108  return createStringEntry(doc, tagName, TQString::fromLatin1(b? "true" : "false"));
2109 }
2110 
2111 
2112 static TQDomElement createNumberEntry(TQDomDocument &doc, const TQString &tagName, int n)
2113 {
2114  return createStringEntry(doc, tagName, TQString::number(n));
2115 }
2116 
2117 
2118 static TQDomElement createRectEntry(TQDomDocument &doc, const TQString &tagName, const TQRect &rect)
2119 {
2120  TQDomElement el = doc.createElement(tagName);
2121 
2122  TQDomElement xel = doc.createElement("x");
2123  xel.appendChild(doc.createTextNode(TQString::number(rect.x())));
2124  el.appendChild(xel);
2125  TQDomElement yel = doc.createElement("y");
2126  yel.appendChild(doc.createTextNode(TQString::number(rect.y())));
2127  el.appendChild(yel);
2128  TQDomElement wel = doc.createElement("width");
2129  wel.appendChild(doc.createTextNode(TQString::number(rect.width())));
2130  el.appendChild(wel);
2131  TQDomElement hel = doc.createElement("height");
2132  hel.appendChild(doc.createTextNode(TQString::number(rect.height())));
2133  el.appendChild(hel);
2134 
2135  return el;
2136 }
2137 
2138 
2139 static TQDomElement createListEntry(TQDomDocument &doc, const TQString &tagName,
2140  const TQString &subTagName, const TQStrList &list)
2141 {
2142  TQDomElement el = doc.createElement(tagName);
2143 
2144  TQStrListIterator it(list);
2145  for (; it.current(); ++it) {
2146  TQDomElement subel = doc.createElement(subTagName);
2147  subel.appendChild(doc.createTextNode(TQString::fromLatin1(it.current())));
2148  el.appendChild(subel);
2149  }
2150 
2151  return el;
2152 }
2153 
2154 
2155 static TQString stringEntry(TQDomElement &base, const TQString &tagName)
2156 {
2157  return base.namedItem(tagName).firstChild().toText().data();
2158 }
2159 
2160 
2161 static bool boolEntry(TQDomElement &base, const TQString &tagName)
2162 {
2163  return base.namedItem(tagName).firstChild().toText().data() == "true";
2164 }
2165 
2166 
2167 static int numberEntry(TQDomElement &base, const TQString &tagName)
2168 {
2169  return stringEntry(base, tagName).toInt();
2170 }
2171 
2172 
2173 static TQRect rectEntry(TQDomElement &base, const TQString &tagName)
2174 {
2175  TQDomElement el = base.namedItem(tagName).toElement();
2176 
2177  int x = numberEntry(el, "x");
2178  int y = numberEntry(el, "y");
2179  int width = numberEntry(el, "width");
2180  int height = numberEntry(el, "height");
2181 
2182  return TQRect(x, y, width, height);
2183 }
2184 
2185 
2186 static TQStrList listEntry(TQDomElement &base, const TQString &tagName, const TQString &subTagName)
2187 {
2188  TQStrList list;
2189 
2190  for( TQDomNode n = base.namedItem(tagName).firstChild(); !n.isNull(); n = n.nextSibling() )
2191  {
2192  TQDomElement subel = n.toElement();
2193  if (subel.tagName() == subTagName)
2194  list.append(subel.firstChild().toText().data().latin1());
2195  }
2196 
2197  return list;
2198 }
2199 
2200 
2201 void KDockManager::writeConfig(TQDomElement &base)
2202 {
2203  // First of all, clear the tree under base
2204  while (!base.firstChild().isNull())
2205  base.removeChild(base.firstChild());
2206  TQDomDocument doc = base.ownerDocument();
2207 
2208  TQStrList nameList;
2209  TQString mainWidgetStr;
2210 
2211  // collect widget names
2212  TQStringList nList;
2213  TQObjectListIt it(*childDock);
2214  KDockWidget *obj1;
2215  while ( (obj1=(KDockWidget*)it.current()) ) {
2216  if ( TQT_BASE_OBJECT(obj1->parent()) == TQT_BASE_OBJECT(main) )
2217  mainWidgetStr = TQString::fromLatin1(obj1->name());
2218  nList.append(obj1->name());
2219  ++it;
2220  }
2221 
2222  for (TQObjectListIt it(d->containerDocks);it.current();++it)
2223  {
2224  KDockContainer* dc = tqt_dynamic_cast<KDockContainer*>(((KDockWidget*)it.current())->widget);
2225  if (dc) {
2226  dc->prepareSave(nList);
2227  }
2228  }
2229 
2230  TQStringList::Iterator nListIt=nList.begin();
2231  while ( nListIt!=nList.end() ) {
2232  KDockWidget *obj = getDockWidgetFromName( *nListIt);
2233  if ((obj->isGroup && (!obj->d->isContainer)) && (nameList.find( obj->firstName.latin1() ) == -1
2234  || nameList.find(obj->lastName.latin1()) == -1)) {
2235  // Skip until children are saved (why?)
2236  ++nListIt;
2237 // nList.next();
2238 //falk? if ( !nList.current() ) nList.first();
2239  continue;
2240  }
2241 
2242  TQDomElement groupEl;
2243  if (obj->d->isContainer) {
2244  KDockContainer* x = tqt_dynamic_cast<KDockContainer*>(obj->widget);
2245  if (x) {
2246  groupEl=doc.createElement("dockContainer");
2247  x->save(groupEl);
2248  }
2249  } else
2250  if (obj->isGroup) {
2252  groupEl = doc.createElement("splitGroup");
2253 
2254  groupEl.appendChild(createStringEntry(doc, "firstName", obj->firstName));
2255  groupEl.appendChild(createStringEntry(doc, "secondName", obj->lastName));
2256  groupEl.appendChild(createNumberEntry(doc, "orientation", (int)obj->splitterOrientation));
2257  groupEl.appendChild(createNumberEntry(doc, "separatorPos", ((KDockSplitter*)obj->widget)->separatorPosInPercent()));
2258  } else if (obj->isTabGroup) {
2260  groupEl = doc.createElement("tabGroup");
2261 
2262  TQStrList list;
2263  for ( int i = 0; i < ((KDockTabGroup*)obj->widget)->count(); ++i )
2264  list.append( ((KDockTabGroup*)obj->widget)->page( i )->name() );
2265  groupEl.appendChild(createListEntry(doc, "tabs", "tab", list));
2266  groupEl.appendChild(createNumberEntry(doc, "currentTab", ((KDockTabGroup*)obj->widget)->currentPageIndex()));
2267  if (!obj->parent()) {
2268  groupEl.appendChild(createStringEntry(doc, "dockBackTo", obj->formerBrotherDockWidget ? obj->formerBrotherDockWidget->name() : ""));
2269  groupEl.appendChild(createNumberEntry(doc, "dockBackToPos", obj->formerDockPos));
2270  }
2271  } else {
2273  groupEl = doc.createElement("dock");
2274  groupEl.appendChild(createStringEntry(doc, "tabCaption", obj->tabPageLabel()));
2275  groupEl.appendChild(createStringEntry(doc, "tabToolTip", obj->toolTipString()));
2276  if (!obj->parent()) {
2277  groupEl.appendChild(createStringEntry(doc, "dockBackTo", obj->formerBrotherDockWidget ? obj->formerBrotherDockWidget->name() : ""));
2278  groupEl.appendChild(createNumberEntry(doc, "dockBackToPos", obj->formerDockPos));
2279  }
2280  }
2281 
2282  groupEl.appendChild(createStringEntry(doc, "name", TQString::fromLatin1(obj->name())));
2283  groupEl.appendChild(createBoolEntry(doc, "hasParent", obj->parent()));
2284  if ( !obj->parent() ) {
2285  groupEl.appendChild(createRectEntry(doc, "geometry", TQRect(main->frameGeometry().topLeft(), main->size())));
2286  groupEl.appendChild(createBoolEntry(doc, "visible", obj->isVisible()));
2287  }
2288  if (obj->header && obj->header->inherits("KDockWidgetHeader")) {
2289  KDockWidgetHeader *h = static_cast<KDockWidgetHeader*>(obj->header);
2290  groupEl.appendChild(createBoolEntry(doc, "dragEnabled", h->dragEnabled()));
2291  }
2292 
2293  base.appendChild(groupEl);
2294  nameList.append(obj->name());
2295  nList.remove(nListIt);
2296  nListIt=nList.begin();
2297  }
2298 
2299  if (main->inherits("KDockMainWindow")) {
2300  KDockMainWindow *dmain = (KDockMainWindow*)main;
2301  TQString centralWidgetStr = TQString(dmain->centralWidget()? dmain->centralWidget()->name() : "");
2302  base.appendChild(createStringEntry(doc, "centralWidget", centralWidgetStr));
2303  TQString mainDockWidgetStr = TQString(dmain->getMainDockWidget()? dmain->getMainDockWidget()->name() : "");
2304  base.appendChild(createStringEntry(doc, "mainDockWidget", mainDockWidgetStr));
2305  } else {
2306  base.appendChild(createStringEntry(doc, "mainWidget", mainWidgetStr));
2307  }
2308 
2309  base.appendChild(createRectEntry(doc, "geometry", TQRect(main->frameGeometry().topLeft(), main->size())));
2310 }
2311 
2312 
2313 void KDockManager::readConfig(TQDomElement &base)
2314 {
2315  if (base.namedItem("group").isNull()
2316  && base.namedItem("tabgroup").isNull()
2317  && base.namedItem("dock").isNull()
2318  && base.namedItem("dockContainer").isNull()) {
2319  activate();
2320  return;
2321  }
2322 
2323  autoCreateDock = new TQObjectList();
2324  autoCreateDock->setAutoDelete( true );
2325 
2326  bool isMainVisible = main->isVisible();
2327  main->hide();
2328 
2329  TQObjectListIt it(*childDock);
2330  KDockWidget *obj1;
2331  while ( (obj1=(KDockWidget*)it.current()) ) {
2332  if ( !obj1->isGroup && !obj1->isTabGroup ) {
2333  if ( obj1->parent() )
2334  obj1->undock();
2335  else
2336  obj1->hide();
2337  }
2338  ++it;
2339  }
2340 
2341  // firstly, recreate all common dockwidgets
2342  for( TQDomNode n = base.firstChild(); !n.isNull(); n = n.nextSibling() )
2343  {
2344  TQDomElement childEl = n.toElement();
2345  if (childEl.tagName() != "dock") continue;
2346 
2347  // Read an ordinary dock widget
2348  KDockWidget *obj = getDockWidgetFromName(stringEntry(childEl, "name"));
2349  obj->setTabPageLabel(stringEntry(childEl, "tabCaption"));
2350  obj->setToolTipString(stringEntry(childEl, "tabToolTip"));
2351 
2352  if (!boolEntry(childEl, "hasParent")) {
2353  TQRect r = rectEntry(childEl, "geometry");
2354  obj = getDockWidgetFromName(stringEntry(childEl, "name"));
2355  obj->applyToWidget(0);
2356  obj->setGeometry(r);
2357  if (boolEntry(childEl, "visible"))
2358  obj->TQWidget::show();
2359  }
2360 
2361  if (obj && obj->header && obj->header->inherits("KDockWidgetHeader")) {
2362  KDockWidgetHeader *h = static_cast<KDockWidgetHeader*>(obj->header);
2363  h->setDragEnabled(boolEntry(childEl, "dragEnabled"));
2364  }
2365  }
2366 
2367  // secondly, now iterate again and create the groups and tabwidgets, apply the dockwidgets to them
2368  for( TQDomNode n = base.firstChild(); !n.isNull(); n = n.nextSibling() )
2369  {
2370  TQDomElement childEl = n.toElement();
2371  if (childEl.isNull()) continue;
2372 
2373  KDockWidget *obj = 0;
2374 
2375  if (childEl.tagName() == "dockContainer") {
2376 
2377  KDockWidget *cont=getDockWidgetFromName(stringEntry(childEl, "name"));
2378  kdDebug(282)<<"dockContainer: "<<stringEntry(childEl,"name")<<endl;
2379  if (!(cont->d->isContainer)) {
2380  kdDebug(282)<<"restoration of dockContainer is only supported for already existing dock containers"<<endl;
2381  } else {
2382  KDockContainer *dc=tqt_dynamic_cast<KDockContainer*>(cont->getWidget());
2383  if (!dc) kdDebug(282)<<"Error while trying to handle dockcontainer configuration restoration"<<endl;
2384  else {
2385  dc->load(childEl);
2386  removeFromAutoCreateList(cont);
2387  }
2388 
2389  }
2390  }
2391  else
2392  if (childEl.tagName() == "splitGroup") {
2393  // Read a group
2394  TQString name = stringEntry(childEl, "name");
2395  TQString firstName = stringEntry(childEl, "firstName");
2396  TQString secondName = stringEntry(childEl, "secondName");
2397  int orientation = numberEntry(childEl, "orientation");
2398  int separatorPos = numberEntry(childEl, "separatorPos");
2399 
2400  KDockWidget *first = getDockWidgetFromName(firstName);
2401  KDockWidget *second = getDockWidgetFromName(secondName);
2402  if (first && second) {
2403  obj = first->manualDock(second,
2404  (orientation == (int)Qt::Vertical)? KDockWidget::DockLeft : KDockWidget::DockTop,
2405  separatorPos);
2406  if (obj)
2407  obj->setName(name.latin1());
2408  }
2409  } else if (childEl.tagName() == "tabGroup") {
2410  // Read a tab group
2411  TQString name = stringEntry(childEl, "name");
2412  TQStrList list = listEntry(childEl, "tabs", "tab");
2413 
2414  KDockWidget *d1 = getDockWidgetFromName( list.first() );
2415  list.next();
2416  KDockWidget *d2 = getDockWidgetFromName( list.current() );
2417 
2418  KDockWidget *obj = d2->manualDock( d1, KDockWidget::DockCenter );
2419  if (obj) {
2420  KDockTabGroup *tab = (KDockTabGroup*)obj->widget;
2421  list.next();
2422  while (list.current() && obj) {
2423  KDockWidget *tabDock = getDockWidgetFromName(list.current());
2424  obj = tabDock->manualDock(d1, KDockWidget::DockCenter);
2425  list.next();
2426  }
2427  if (obj) {
2428  obj->setName(name.latin1());
2429  tab->showPage(tab->page(numberEntry(childEl, "currentTab")));
2430  }
2431  }
2432  } else {
2433  continue;
2434  }
2435 
2436  if (!boolEntry(childEl, "hasParent")) {
2437  TQRect r = rectEntry(childEl, "geometry");
2438  obj = getDockWidgetFromName(stringEntry(childEl, "name"));
2439  obj->applyToWidget(0);
2440  obj->setGeometry(r);
2441  if (boolEntry(childEl, "visible"))
2442  obj->TQWidget::show();
2443  }
2444 
2445  if (obj && obj->header && obj->header->inherits("KDockWidgetHeader")) {
2446  KDockWidgetHeader *h = static_cast<KDockWidgetHeader*>(obj->header);
2447  h->setDragEnabled(boolEntry(childEl, "dragEnabled"));
2448  }
2449  }
2450 
2451  // thirdly, now that all ordinary dockwidgets are created,
2452  // iterate them again and link them with their corresponding dockwidget for the dockback action
2453  for( TQDomNode n = base.firstChild(); !n.isNull(); n = n.nextSibling() )
2454  {
2455  TQDomElement childEl = n.toElement();
2456 
2457  if (childEl.tagName() != "dock" && childEl.tagName() != "tabGroup")
2458  continue;
2459 
2460  KDockWidget *obj = 0;
2461 
2462  if (!boolEntry(childEl, "hasParent")) {
2463  // Read a common toplevel dock widget
2464  obj = getDockWidgetFromName(stringEntry(childEl, "name"));
2465  TQString name = stringEntry(childEl, "dockBackTo");
2466  if (!name.isEmpty()) {
2467  obj->setFormerBrotherDockWidget(getDockWidgetFromName(name));
2468  }
2469  obj->formerDockPos = KDockWidget::DockPosition(numberEntry(childEl, "dockBackToPos"));
2470  obj->updateHeader();
2471  }
2472  }
2473 
2474  if (main->inherits("KDockMainWindow")) {
2475  KDockMainWindow *dmain = (KDockMainWindow*)main;
2476 
2477  TQString mv = stringEntry(base, "centralWidget");
2478  if (!mv.isEmpty() && getDockWidgetFromName(mv) ) {
2479  KDockWidget *mvd = getDockWidgetFromName(mv);
2480  mvd->applyToWidget(dmain);
2481  mvd->show();
2482  dmain->setCentralWidget(mvd);
2483  }
2484  TQString md = stringEntry(base, "mainDockWidget");
2485  if (!md.isEmpty() && getDockWidgetFromName(md)) {
2486  KDockWidget *mvd = getDockWidgetFromName(md);
2487  dmain->setMainDockWidget(mvd);
2488  }
2489  } else {
2490  TQString mv = stringEntry(base, "mainWidget");
2491  if (!mv.isEmpty() && getDockWidgetFromName(mv)) {
2492  KDockWidget *mvd = getDockWidgetFromName(mv);
2493  mvd->applyToWidget(main);
2494  mvd->show();
2495  }
2496 
2497  // only resize + move non-mainwindows
2498  TQRect mr = rectEntry(base, "geometry");
2499  main->move(mr.topLeft());
2500  main->resize(mr.size());
2501  }
2502 
2503  if (isMainVisible)
2504  main->show();
2505 
2506  if (d->m_readDockConfigMode == WrapExistingWidgetsOnly) {
2507  finishReadDockConfig(); // remove empty dockwidgets
2508  }
2509 }
2510 
2511 void KDockManager::removeFromAutoCreateList(KDockWidget* pDockWidget)
2512 {
2513  if (!autoCreateDock) return;
2514  autoCreateDock->setAutoDelete(false);
2515  autoCreateDock->removeRef(TQT_TQOBJECT(pDockWidget));
2516  autoCreateDock->setAutoDelete(true);
2517 }
2518 
2519 void KDockManager::finishReadDockConfig()
2520 {
2521  delete autoCreateDock;
2522  autoCreateDock = 0;
2523 }
2524 
2525 void KDockManager::setReadDockConfigMode(int mode)
2526 {
2527  d->m_readDockConfigMode = mode;
2528 }
2529 
2530 #ifndef NO_KDE2
2531 void KDockManager::writeConfig( TDEConfig* c, TQString group )
2532 {
2533  //debug("BEGIN Write Config");
2534  if ( !c ) c = TDEGlobal::config();
2535  if ( group.isEmpty() ) group = "dock_setting_default";
2536 
2537  c->setGroup( group );
2538  c->writeEntry( "Version", DOCK_CONFIG_VERSION );
2539 
2540  TQStringList nameList;
2541  TQStringList findList;
2542  TQObjectListIt it( *childDock );
2543  KDockWidget * obj;
2544 
2545  // collect KDockWidget's name
2546  TQStringList nList;
2547  while ( (obj=(KDockWidget*)it.current()) ) {
2548  ++it;
2549  //debug(" +Add subdock %s", obj->name());
2550  nList.append( obj->name() );
2551  if ( TQT_BASE_OBJECT(obj->parent()) == TQT_BASE_OBJECT(main) )
2552  c->writeEntry( "Main:view", obj->name() );
2553  }
2554 
2555 // kdDebug(282)<<TQString("list size: %1").arg(nList.count())<<endl;
2556  for (TQObjectListIt it(d->containerDocks);it.current();++it)
2557  {
2558  KDockContainer* dc = tqt_dynamic_cast<KDockContainer*>(((KDockWidget*)it.current())->widget);
2559  if (dc) {
2560  dc->prepareSave(nList);
2561  }
2562  }
2563 // kdDebug(282)<<TQString("new list size: %1").arg(nList.count())<<endl;
2564 
2565  TQStringList::Iterator nListIt=nList.begin();
2566  while ( nListIt!=nList.end() ){
2567  //debug(" -Try to save %s", nList.current());
2568  obj = getDockWidgetFromName( *nListIt );
2569  TQString cname = obj->name();
2570  if ( obj->header ){
2571  obj->header->saveConfig( c );
2572  }
2573  if (obj->d->isContainer) {
2574  KDockContainer* x = tqt_dynamic_cast<KDockContainer*>(obj->widget);
2575  if (x) {
2576  x->save(c,group);
2577  }
2578  }
2579 /*************************************************************************************************/
2580  if ( obj->isGroup ){
2581  if ( (findList.find( obj->firstName ) != findList.end()) && (findList.find( obj->lastName ) != findList.end() )){
2582 
2583  c->writeEntry( cname+":type", "GROUP");
2584  if ( !obj->parent() ){
2585  c->writeEntry( cname+":parent", "___null___");
2586  c->writeEntry( cname+":geometry", TQRect(obj->frameGeometry().topLeft(), obj->size()) );
2587  c->writeEntry( cname+":visible", obj->isVisible());
2588  } else {
2589  c->writeEntry( cname+":parent", "yes");
2590  }
2591  c->writeEntry( cname+":first_name", obj->firstName );
2592  c->writeEntry( cname+":last_name", obj->lastName );
2593  c->writeEntry( cname+":orientation", (int)obj->splitterOrientation );
2594  c->writeEntry( cname+":sepPos", ((KDockSplitter*)obj->widget)->separatorPosInPercent() );
2595 
2596  nameList.append( obj->name() );
2597  findList.append( obj->name() );
2598  //debug(" Save %s", nList.current());
2599  nList.remove(nListIt);
2600  nListIt=nList.begin(); //nList.first();
2601  } else {
2602 /*************************************************************************************************/
2603  //debug(" Skip %s", nList.current());
2604  //if ( findList.find( obj->firstName ) == -1 )
2605  // debug(" ? Not found %s", obj->firstName);
2606  //if ( findList.find( obj->lastName ) == -1 )
2607  // debug(" ? Not found %s", obj->lastName);
2608  ++nListIt;
2609  // if ( !nList.current() ) nList.first();
2610  if (nListIt==nList.end()) nListIt=nList.begin();
2611  }
2612  } else {
2613 /*************************************************************************************************/
2614  if ( obj->isTabGroup){
2615  c->writeEntry( cname+":type", "TAB_GROUP");
2616  if ( !obj->parent() ){
2617  c->writeEntry( cname+":parent", "___null___");
2618  c->writeEntry( cname+":geometry", TQRect(obj->frameGeometry().topLeft(), obj->size()) );
2619  c->writeEntry( cname+":visible", obj->isVisible());
2620  c->writeEntry( cname+":dockBackTo", obj->formerBrotherDockWidget ? obj->formerBrotherDockWidget->name() : "");
2621  c->writeEntry( cname+":dockBackToPos", obj->formerDockPos);
2622  } else {
2623  c->writeEntry( cname+":parent", "yes");
2624  }
2625  TQStrList list;
2626  for ( int i = 0; i < ((KDockTabGroup*)obj->widget)->count(); ++i )
2627  list.append( ((KDockTabGroup*)obj->widget)->page( i )->name() );
2628  c->writeEntry( cname+":tabNames", list );
2629  c->writeEntry( cname+":curTab", ((KDockTabGroup*)obj->widget)->currentPageIndex() );
2630 
2631  nameList.append( obj->name() );
2632  findList.append( obj->name() ); // not really need !!!
2633  //debug(" Save %s", nList.current());
2634  nList.remove(nListIt);
2635  nListIt=nList.begin();
2636  } else {
2637 /*************************************************************************************************/
2638  c->writeEntry( cname+":tabCaption", obj->tabPageLabel());
2639  c->writeEntry( cname+":tabToolTip", obj->toolTipString());
2640  if ( !obj->parent() ){
2641  c->writeEntry( cname+":type", "NULL_DOCK");
2642  c->writeEntry( cname+":geometry", TQRect(obj->frameGeometry().topLeft(), obj->size()) );
2643  c->writeEntry( cname+":visible", obj->isVisible());
2644  c->writeEntry( cname+":dockBackTo", obj->formerBrotherDockWidget ? obj->formerBrotherDockWidget->name() : "");
2645  c->writeEntry( cname+":dockBackToPos", obj->formerDockPos);
2646  } else {
2647  c->writeEntry( cname+":type", "DOCK");
2648  }
2649  nameList.append( cname.latin1() );
2650  //debug(" Save %s", nList.current());
2651  findList.append( obj->name() );
2652  nList.remove(nListIt);
2653  nListIt=nList.begin();
2654  }
2655  }
2656  }
2657  c->writeEntry( "NameList", nameList );
2658 
2659  c->writeEntry( "Main:Geometry", TQRect(main->frameGeometry().topLeft(), main->size()) );
2660  c->writeEntry( "Main:visible", main->isVisible()); // curently nou use
2661 
2662  if ( main->inherits("KDockMainWindow") ){
2663  KDockMainWindow* dmain = (KDockMainWindow*)main;
2664  // for KDockMainWindow->setView() in readConfig()
2665  c->writeEntry( "Main:view", dmain->centralWidget() ? dmain->centralWidget()->name():"" );
2666  c->writeEntry( "Main:dock", dmain->getMainDockWidget() ? dmain->getMainDockWidget()->name() :"" );
2667  }
2668 
2669  c->sync();
2670  //debug("END Write Config");
2671 }
2672 #include <tqmessagebox.h>
2673 void KDockManager::readConfig( TDEConfig* c, TQString group )
2674 {
2675  if ( !c ) c = TDEGlobal::config();
2676  if ( group.isEmpty() ) group = "dock_setting_default";
2677 
2678  c->setGroup( group );
2679  TQStrList nameList;
2680  c->readListEntry( "NameList", nameList );
2681  TQString ver = c->readEntry( "Version", "0.0.1" );
2682  nameList.first();
2683  if ( !nameList.current() || ver != DOCK_CONFIG_VERSION ){
2684  activate();
2685  return;
2686  }
2687 
2688  autoCreateDock = new TQObjectList();
2689  autoCreateDock->setAutoDelete( true );
2690 
2691  bool isMainVisible = main->isVisible();
2692  // if (isMainVisible) // CCC
2693  //TQMessageBox::information(0,"","hallo");
2694 //COMMENTED4TESTING main->hide();
2695 
2696  TQObjectListIt it( *childDock );
2697  KDockWidget * obj;
2698 
2699  while ( (obj=(KDockWidget*)it.current()) ){
2700  ++it;
2701  if ( !obj->isGroup && !obj->isTabGroup )
2702  {
2703  if ( obj->parent() ) obj->undock(); else obj->hide();
2704  }
2705  }
2706 
2707  // firstly, only the common dockwidgets,
2708  // they must be restored before e.g. tabgroups are restored
2709  nameList.first();
2710  while ( nameList.current() ){
2711  TQString oname = nameList.current();
2712  c->setGroup( group );
2713  TQString type = c->readEntry( oname + ":type" );
2714  obj = 0L;
2715 
2716  if ( type == "NULL_DOCK" || c->readEntry( oname + ":parent") == "___null___" ){
2717  TQRect r = c->readRectEntry( oname + ":geometry" );
2718  obj = getDockWidgetFromName( oname );
2719  obj->applyToWidget( 0L );
2720  obj->setGeometry(r);
2721 
2722  c->setGroup( group );
2723  obj->setTabPageLabel(c->readEntry( oname + ":tabCaption" ));
2724  obj->setToolTipString(c->readEntry( oname + ":tabToolTip" ));
2725  if ( c->readBoolEntry( oname + ":visible" ) ){
2726  obj->TQWidget::show();
2727  }
2728  }
2729 
2730  if ( type == "DOCK" ){
2731  obj = getDockWidgetFromName( oname );
2732  obj->setTabPageLabel(c->readEntry( oname + ":tabCaption" ));
2733  obj->setToolTipString(c->readEntry( oname + ":tabToolTip" ));
2734  }
2735 
2736  if (obj && obj->d->isContainer) {
2737  tqt_dynamic_cast<KDockContainer*>(obj->widget)->load(c,group);
2738  removeFromAutoCreateList(obj);
2739  }
2740  if ( obj && obj->header){
2741  obj->header->loadConfig( c );
2742  }
2743  nameList.next();
2744  }
2745 
2746  // secondly, after the common dockwidgets, restore the groups and tabgroups
2747  nameList.first();
2748  while ( nameList.current() ){
2749  TQString oname = nameList.current();
2750  c->setGroup( group );
2751  TQString type = c->readEntry( oname + ":type" );
2752  obj = 0L;
2753 
2754  if ( type == "GROUP" ){
2755  KDockWidget* first = getDockWidgetFromName( c->readEntry( oname + ":first_name" ) );
2756  KDockWidget* last = getDockWidgetFromName( c->readEntry( oname + ":last_name" ) );
2757  int sepPos = c->readNumEntry( oname + ":sepPos" );
2758 
2759  Orientation p = (Orientation)c->readNumEntry( oname + ":orientation" );
2760  if ( first && last ){
2761  obj = first->manualDock( last, ( p == Qt::Vertical ) ? KDockWidget::DockLeft : KDockWidget::DockTop, sepPos );
2762  if (obj){
2763  obj->setName( oname.latin1() );
2764  }
2765  }
2766  }
2767 
2768  if ( type == "TAB_GROUP" ){
2769  TQStrList list;
2770  KDockWidget* tabDockGroup = 0L;
2771  c->readListEntry( oname+":tabNames", list );
2772  KDockWidget* d1 = getDockWidgetFromName( list.first() );
2773  list.next();
2774  KDockWidget* d2 = getDockWidgetFromName( list.current() );
2775  tabDockGroup = d2->manualDock( d1, KDockWidget::DockCenter );
2776  if ( tabDockGroup ){
2777  KDockTabGroup* tab = tqt_dynamic_cast<KDockTabGroup*>(tabDockGroup->widget);
2778  list.next();
2779  while ( list.current() && tabDockGroup ){
2780  KDockWidget* tabDock = getDockWidgetFromName( list.current() );
2781  tabDockGroup = tabDock->manualDock( d1, KDockWidget::DockCenter );
2782  list.next();
2783  }
2784  if ( tabDockGroup ){
2785  tabDockGroup->setName( oname.latin1() );
2786  c->setGroup( group );
2787  if (tab)
2788  tab->showPage( tab->page( c->readNumEntry( oname+":curTab" ) ) );
2789  }
2790  }
2791  obj = tabDockGroup;
2792  }
2793 
2794  if (obj && obj->d->isContainer) tqt_dynamic_cast<KDockContainer*>(obj->widget)->load(c,group);
2795  if ( obj && obj->header){
2796  obj->header->loadConfig( c );
2797  }
2798  nameList.next();
2799  }
2800 
2801  // thirdly, now that all ordinary dockwidgets are created,
2802  // iterate them again and link the toplevel ones of them with their corresponding dockwidget for the dockback action
2803  nameList.first();
2804  while ( nameList.current() ){
2805  TQString oname = nameList.current();
2806  c->setGroup( group );
2807  TQString type = c->readEntry( oname + ":type" );
2808  obj = 0L;
2809 
2810  if ( type == "NULL_DOCK" || c->readEntry( oname + ":parent") == "___null___" ){
2811  obj = getDockWidgetFromName( oname );
2812  c->setGroup( group );
2813  TQString name = c->readEntry( oname + ":dockBackTo" );
2814  if (!name.isEmpty()) {
2815  obj->setFormerBrotherDockWidget(getDockWidgetFromName( name ));
2816  }
2817  obj->formerDockPos = KDockWidget::DockPosition(c->readNumEntry( oname + ":dockBackToPos" ));
2818  }
2819 
2820  nameList.next();
2821  }
2822 
2823  if ( main->inherits("KDockMainWindow") ){
2824  KDockMainWindow* dmain = (KDockMainWindow*)main;
2825 
2826  c->setGroup( group );
2827  TQString mv = c->readEntry( "Main:view" );
2828  if ( !mv.isEmpty() && getDockWidgetFromName( mv ) ){
2829  KDockWidget* mvd = getDockWidgetFromName( mv );
2830  mvd->applyToWidget( dmain );
2831  mvd->show();
2832  dmain->setView( mvd );
2833  }
2834  c->setGroup( group );
2835  TQString md = c->readEntry( "Main:dock" );
2836  if ( !md.isEmpty() && getDockWidgetFromName( md ) ){
2837  KDockWidget* mvd = getDockWidgetFromName( md );
2838  dmain->setMainDockWidget( mvd );
2839  }
2840  } else {
2841  c->setGroup( group );
2842  TQString mv = c->readEntry( "Main:view" );
2843  if ( !mv.isEmpty() && getDockWidgetFromName( mv ) ){
2844  KDockWidget* mvd = getDockWidgetFromName( mv );
2845  mvd->applyToWidget( main );
2846  mvd->show();
2847  }
2848 
2849  }
2850 
2851  // delete all autocreate dock
2852  if (d->m_readDockConfigMode == WrapExistingWidgetsOnly) {
2853  finishReadDockConfig(); // remove empty dockwidgets
2854  }
2855 
2856  c->setGroup( group );
2857 
2858  TQRect mr = c->readRectEntry("Main:Geometry");
2859 
2860  if (!main->inherits("KDockMainWindow"))
2861  main->move(mr.topLeft());
2862 
2863  main->resize(mr.size());
2864 
2865  if ( isMainVisible ) main->show();
2866 }
2867 #endif
2868 
2869 
2870 void KDockManager::dumpDockWidgets() {
2871  TQObjectListIt it( *childDock );
2872  KDockWidget * obj;
2873  while ( (obj=(KDockWidget*)it.current()) ) {
2874  ++it;
2875  kdDebug(282)<<"KDockManager::dumpDockWidgets:"<<obj->name()<<endl;
2876  }
2877 
2878 }
2879 
2880 KDockWidget* KDockManager::getDockWidgetFromName( const TQString& dockName )
2881 {
2882  TQObjectListIt it( *childDock );
2883  KDockWidget * obj;
2884  while ( (obj=(KDockWidget*)it.current()) ) {
2885  ++it;
2886  if ( TQString(obj->name()) == dockName ) return obj;
2887  }
2888 
2889  KDockWidget* autoCreate = 0L;
2890  if ( autoCreateDock ){
2891  kdDebug(282)<<"Autocreating dock: "<<dockName<<endl;
2892  autoCreate = new KDockWidget( this, dockName.latin1(), TQPixmap(TQString("")) );
2893  autoCreateDock->append( TQT_TQOBJECT(autoCreate) );
2894  }
2895  return autoCreate;
2896 }
2897 void KDockManager::setSplitterOpaqueResize(bool b)
2898 {
2899  d->splitterOpaqueResize = b;
2900 }
2901 
2902 bool KDockManager::splitterOpaqueResize() const
2903 {
2904  return d->splitterOpaqueResize;
2905 }
2906 
2907 void KDockManager::setSplitterKeepSize(bool b)
2908 {
2909  d->splitterKeepSize = b;
2910 }
2911 
2912 bool KDockManager::splitterKeepSize() const
2913 {
2914  return d->splitterKeepSize;
2915 }
2916 
2917 void KDockManager::setSplitterHighResolution(bool b)
2918 {
2919  d->splitterHighResolution = b;
2920 }
2921 
2922 bool KDockManager::splitterHighResolution() const
2923 {
2924  return d->splitterHighResolution;
2925 }
2926 
2927 void KDockManager::slotMenuPopup()
2928 {
2929  menu->clear();
2930  menuData->clear();
2931 
2932  TQObjectListIt it( *childDock );
2933  KDockWidget * obj;
2934  int numerator = 0;
2935  while ( (obj=(KDockWidget*)it.current()) ) {
2936  ++it;
2937  if ( obj->mayBeHide() )
2938  {
2939  menu->insertItem( obj->icon() ? *(obj->icon()) : TQPixmap(), TQString(i18n("Hide %1").arg(obj->caption())), numerator++ );
2940  menuData->append( new MenuDockData( obj, true ) );
2941  }
2942 
2943  if ( obj->mayBeShow() )
2944  {
2945  menu->insertItem( obj->icon() ? *(obj->icon()) : TQPixmap(), TQString(i18n("Show %1").arg(obj->caption())), numerator++ );
2946  menuData->append( new MenuDockData( obj, false ) );
2947  }
2948  }
2949 }
2950 
2951 void KDockManager::slotMenuActivated( int id )
2952 {
2953  MenuDockData* data = menuData->at( id );
2954  data->dock->changeHideShowState();
2955 }
2956 
2957 KDockWidget* KDockManager::findWidgetParentDock( TQWidget* w ) const
2958 {
2959  TQObjectListIt it( *childDock );
2960  KDockWidget * dock;
2961  KDockWidget * found = 0L;
2962 
2963  while ( (dock=(KDockWidget*)it.current()) ) {
2964  ++it;
2965  if ( dock->widget == w ){ found = dock; break; }
2966  }
2967  return found;
2968 }
2969 
2970 void KDockManager::drawDragRectangle()
2971 {
2972 #ifdef BORDERLESS_WINDOWS
2973  return
2974 #endif
2975  if (d->oldDragRect == d->dragRect)
2976  return;
2977 
2978  int i;
2979  TQRect oldAndNewDragRect[2];
2980  oldAndNewDragRect[0] = d->oldDragRect;
2981  oldAndNewDragRect[1] = d->dragRect;
2982 
2983  // 2 calls, one for the old and one for the new drag rectangle
2984  for (i = 0; i <= 1; i++) {
2985  if (oldAndNewDragRect[i].isEmpty())
2986  continue;
2987 
2988  KDockWidget* pDockWdgAtRect = (KDockWidget*) TQApplication::widgetAt( oldAndNewDragRect[i].topLeft(), true );
2989  if (!pDockWdgAtRect)
2990  continue;
2991 
2992  bool isOverMainWdg = false;
2993  bool unclipped;
2994  KDockMainWindow* pMain = 0L;
2995  KDockWidget* pTLDockWdg = 0L;
2996  TQWidget* topWdg;
2997  if (pDockWdgAtRect->topLevelWidget() == main) {
2998  isOverMainWdg = true;
2999  topWdg = pMain = (KDockMainWindow*) main;
3000  unclipped = pMain->testWFlags( WPaintUnclipped );
3001  pMain->setWFlags( WPaintUnclipped );
3002  }
3003  else {
3004  topWdg = pTLDockWdg = (KDockWidget*) pDockWdgAtRect->topLevelWidget();
3005  unclipped = pTLDockWdg->testWFlags( WPaintUnclipped );
3006  pTLDockWdg->setWFlags( WPaintUnclipped );
3007  }
3008 
3009  // draw the rectangle unclipped over the main dock window
3010  TQPainter p;
3011  p.begin( topWdg );
3012  if ( !unclipped ) {
3013  if (isOverMainWdg)
3014  pMain->clearWFlags(WPaintUnclipped);
3015  else
3016  pTLDockWdg->clearWFlags(WPaintUnclipped);
3017  }
3018  // draw the rectangle
3019  p.setRasterOp(TQt::NotXorROP);
3020  TQRect r = oldAndNewDragRect[i];
3021  r.moveTopLeft( r.topLeft() - topWdg->mapToGlobal(TQPoint(0,0)) );
3022  p.drawRect(r.x(), r.y(), r.width(), r.height());
3023  p.end();
3024  }
3025 
3026  // memorize the current rectangle for later removing
3027  d->oldDragRect = d->dragRect;
3028 }
3029 
3030 void KDockManager::setSpecialLeftDockContainer(KDockWidget* container) {
3031  d->leftContainer=container;
3032 }
3033 
3034 void KDockManager::setSpecialTopDockContainer(KDockWidget* container) {
3035  d->topContainer=container;
3036 }
3037 
3038 void KDockManager::setSpecialRightDockContainer(KDockWidget* container) {
3039  d->rightContainer=container;
3040 
3041 }
3042 
3043 void KDockManager::setSpecialBottomDockContainer(KDockWidget* container) {
3044  d->bottomContainer=container;
3045 }
3046 
3047 
3048 KDockArea::KDockArea( TQWidget* parent, const char *name)
3049 :TQWidget( parent, name)
3050 {
3051  TQString new_name = TQString(name) + TQString("_DockManager");
3052  dockManager = new KDockManager( this, new_name.latin1() );
3053  mainDockWidget = 0L;
3054 }
3055 
3056 KDockArea::~KDockArea()
3057 {
3058  delete dockManager;
3059 }
3060 
3061 KDockWidget* KDockArea::createDockWidget( const TQString& name, const TQPixmap &pixmap, TQWidget* parent, const TQString& strCaption, const TQString& strTabPageLabel)
3062 {
3063  return new KDockWidget( dockManager, name.latin1(), pixmap, parent, strCaption, strTabPageLabel );
3064 }
3065 
3066 void KDockArea::makeDockVisible( KDockWidget* dock )
3067 {
3068  if ( dock )
3069  dock->makeDockVisible();
3070 }
3071 
3072 void KDockArea::makeDockInvisible( KDockWidget* dock )
3073 {
3074  if ( dock )
3075  dock->undock();
3076 }
3077 
3078 void KDockArea::makeWidgetDockVisible( TQWidget* widget )
3079 {
3080  makeDockVisible( dockManager->findWidgetParentDock(widget) );
3081 }
3082 
3083 void KDockArea::writeDockConfig(TQDomElement &base)
3084 {
3085  dockManager->writeConfig(base);
3086 }
3087 
3088 void KDockArea::readDockConfig(TQDomElement &base)
3089 {
3090  dockManager->readConfig(base);
3091 }
3092 
3093 void KDockArea::slotDockWidgetUndocked()
3094 {
3095  TQObject* pSender = (TQObject*) sender();
3096  if (!pSender->inherits("KDockWidget")) return;
3097  KDockWidget* pDW = (KDockWidget*) pSender;
3098  emit dockWidgetHasUndocked( pDW);
3099 }
3100 
3101 void KDockArea::resizeEvent(TQResizeEvent *rsize)
3102 {
3103  TQWidget::resizeEvent(rsize);
3104  if (!childrenListObject().isEmpty()){
3105 #ifndef NO_KDE2
3106 // kdDebug(282)<<"KDockArea::resize"<<endl;
3107 #endif
3108  TQObjectList *list=queryList(TQWIDGET_OBJECT_NAME_STRING,0,false);
3109 
3110  TQObjectListIt it( *list ); // iterate over the buttons
3111  TQObject *obj;
3112 
3113  while ( (obj = it.current()) != 0 ) {
3114  // for each found object...
3115  ((TQWidget*)obj)->setGeometry(TQRect(TQPoint(0,0),size()));
3116  break;
3117  }
3118  delete list;
3119 #if 0
3120  KDockSplitter *split;
3121 // for (unsigned int i=0;i<children()->count();i++)
3122  {
3123 // TQPtrList<TQObject> list(children());
3124 // TQObject *obj=((TQPtrList<TQObject*>)children())->at(i);
3125  TQObject *obj=children()->getFirst();
3126  if (split = tqt_dynamic_cast<KDockSplitter*>(obj))
3127  {
3128  split->setGeometry( TQRect(TQPoint(0,0), size() ));
3129 // break;
3130  }
3131  }
3132 #endif
3133  }
3134 }
3135 
3136 #ifndef NO_KDE2
3137 void KDockArea::writeDockConfig( TDEConfig* c, TQString group )
3138 {
3139  dockManager->writeConfig( c, group );
3140 }
3141 
3142 void KDockArea::readDockConfig( TDEConfig* c, TQString group )
3143 {
3144  dockManager->readConfig( c, group );
3145 }
3146 
3147 void KDockArea::setMainDockWidget( KDockWidget* mdw )
3148 {
3149  if ( mainDockWidget == mdw ) return;
3150  mainDockWidget = mdw;
3151  mdw->applyToWidget(this);
3152 }
3153 #endif
3154 
3155 
3156 
3157 // KDOCKCONTAINER - AN ABSTRACTION OF THE KDOCKTABWIDGET
3158 KDockContainer::KDockContainer(){m_overlapMode=false; m_childrenListBegin=0; m_childrenListEnd=0;}
3159 KDockContainer::~KDockContainer(){
3160 
3161  if (m_childrenListBegin)
3162  {
3163  struct ListItem *tmp=m_childrenListBegin;
3164  while (tmp)
3165  {
3166  struct ListItem *tmp2=tmp->next;
3167  free(tmp->data);
3168  delete tmp;
3169  tmp=tmp2;
3170  }
3171  m_childrenListBegin=0;
3172  m_childrenListEnd=0;
3173  }
3174 
3175 }
3176 
3177 void KDockContainer::activateOverlapMode(int nonOverlapSize) {
3178  m_nonOverlapSize=nonOverlapSize;
3179  m_overlapMode=true;
3180  if (parentDockWidget() && parentDockWidget()->parent()) {
3181  kdDebug(282)<<"KDockContainer::activateOverlapMode: recalculating sizes"<<endl;
3182  KDockSplitter *sp= ::tqqt_cast<KDockSplitter*>(parentDockWidget()->
3183  parent());
3184  if (sp)
3185  sp->resizeEvent(0);
3186  }
3187 }
3188 
3189 void KDockContainer::deactivateOverlapMode() {
3190  if (!m_overlapMode) return;
3191  m_overlapMode=false;
3192  if (parentDockWidget() && parentDockWidget()->parent()) {
3193  kdDebug(282)<<"KDockContainer::deactivateOverlapMode: recalculating sizes"<<endl;
3194  KDockSplitter *sp= ::tqqt_cast<KDockSplitter*>(parentDockWidget()->
3195  parent());
3196  if (sp)
3197  sp->resizeEvent(0);
3198  }
3199 }
3200 
3201 bool KDockContainer::isOverlapMode() {
3202  return m_overlapMode;
3203 }
3204 
3205 
3206 bool KDockContainer::dockDragEnter(KDockWidget*, TQMouseEvent *) { return false;}
3207 bool KDockContainer::dockDragMove(KDockWidget*, TQMouseEvent *) { return false;}
3208 bool KDockContainer::dockDragLeave(KDockWidget*, TQMouseEvent *) { return false;}
3209 
3210 
3211 KDockWidget *KDockContainer::parentDockWidget(){return 0;}
3212 
3213 TQStringList KDockContainer::containedWidgets() const {
3214  TQStringList tmp;
3215  for (struct ListItem *it=m_childrenListBegin;it;it=it->next) {
3216  tmp<<TQString(it->data);
3217  }
3218 
3219  return tmp;
3220 }
3221 
3222 void KDockContainer::showWidget(KDockWidget *) {
3223 }
3224 
3225 void KDockContainer::insertWidget (KDockWidget *dw, TQPixmap, const TQString &, int &)
3226  {
3227  struct ListItem *it=new struct ListItem;
3228  it->data=strdup(dw->name());
3229  it->next=0;
3230 
3231  if (m_childrenListEnd)
3232  {
3233  m_childrenListEnd->next=it;
3234  it->prev=m_childrenListEnd;
3235  m_childrenListEnd=it;
3236  }
3237  else
3238  {
3239  it->prev=0;
3240  m_childrenListEnd=it;
3241  m_childrenListBegin=it;
3242  }
3243  }
3244 void KDockContainer::removeWidget (KDockWidget *dw){
3245  for (struct ListItem *tmp=m_childrenListBegin;tmp;tmp=tmp->next)
3246  {
3247  if (!strcmp(tmp->data,dw->name()))
3248  {
3249  free(tmp->data);
3250  if (tmp->next) tmp->next->prev=tmp->prev;
3251  if (tmp->prev) tmp->prev->next=tmp->next;
3252  if (tmp==m_childrenListBegin) m_childrenListBegin=tmp->next;
3253  if (tmp==m_childrenListEnd) m_childrenListEnd=tmp->prev;
3254  delete tmp;
3255  break;
3256  }
3257  }
3258 }
3259 
3260 //m_children.remove(dw->name());}
3261 void KDockContainer::undockWidget (KDockWidget *){;}
3262 void KDockContainer::setToolTip(KDockWidget *, TQString &){;}
3263 void KDockContainer::setPixmap(KDockWidget*,const TQPixmap&){;}
3264 void KDockContainer::load (TDEConfig*, const TQString&){;}
3265 void KDockContainer::save (TDEConfig*, const TQString&){;}
3266 void KDockContainer::load (TQDomElement&){;}
3267 void KDockContainer::save (TQDomElement&){;}
3268 void KDockContainer::prepareSave(TQStringList &names)
3269 {
3270 
3271  for (struct ListItem *tmp=m_childrenListBegin;tmp; tmp=tmp->next)
3272  names.remove(tmp->data);
3273 // for (uint i=0;i<m_children.count();i++)
3274 // {
3275 // names.remove(m_children.at(i));
3276 // }
3277 }
3278 
3279 
3280 TQWidget *KDockTabGroup::transientTo() {
3281  TQWidget *tT=0;
3282  for (int i=0;i<count();i++) {
3283  KDockWidget *dw=::tqqt_cast<KDockWidget*>(page(i));
3284  TQWidget *tmp;
3285  if ((tmp=dw->transientTo())) {
3286  if (!tT) tT=tmp;
3287  else {
3288  if (tT!=tmp) {
3289  kdDebug(282)<<"KDockTabGroup::transientTo: widget mismatch"<<endl;
3290  return 0;
3291  }
3292  }
3293  }
3294  }
3295 
3296  kdDebug(282)<<"KDockTabGroup::transientTo: "<<(tT?"YES":"NO")<<endl;
3297 
3298  return tT;
3299 }
3300 
3301 void KDockWidgetAbstractHeader::virtual_hook( int, void* )
3302 { /*BASE::virtual_hook( id, data );*/ }
3303 
3304 void KDockWidgetAbstractHeaderDrag::virtual_hook( int, void* )
3305 { /*BASE::virtual_hook( id, data );*/ }
3306 
3307 void KDockWidgetHeaderDrag::virtual_hook( int id, void* data )
3308 { KDockWidgetAbstractHeaderDrag::virtual_hook( id, data ); }
3309 
3310 void KDockWidgetHeader::virtual_hook( int id, void* data )
3311 { KDockWidgetAbstractHeader::virtual_hook( id, data ); }
3312 
3313 void KDockTabGroup::virtual_hook( int, void* )
3314 { /*BASE::virtual_hook( id, data );*/ }
3315 
3316 void KDockWidget::virtual_hook( int, void* )
3317 { /*BASE::virtual_hook( id, data );*/ }
3318 
3319 void KDockManager::virtual_hook( int, void* )
3320 { /*BASE::virtual_hook( id, data );*/ }
3321 
3322 void KDockMainWindow::virtual_hook( int id, void* data )
3323 { TDEMainWindow::virtual_hook( id, data ); }
3324 
3325 void KDockArea::virtual_hook( int, void* )
3326 { /*TDEMainWindow::virtual_hook( id, data );*/ }
3327 
3328 
3329 #ifndef NO_INCLUDE_MOCFILES // for Qt-only projects, because tmake doesn't take this name
3330 #include "kdockwidget.moc"
3331 #endif
KDockWidget::tabPageLabel
const TQString & tabPageLabel() const
Definition: kdockwidget.h:624
KDockSplitter::deactivate
void deactivate()
Disables the splitter.
Definition: kdockwidget_private.cpp:204
TDEConfig
KDockWidget::formerDockPos
DockPosition formerDockPos
the former dock position when it really was at another position before.
Definition: kdockwidget.h:824
KDockWidget::restoreFromForcedFixedSize
void restoreFromForcedFixedSize()
Definition: kdockwidget.cpp:1263
KDockWidget::latestKDockContainer
TQWidget * latestKDockContainer()
Definition: kdockwidget.cpp:729
KDockWidget::setHeader
void setHeader(KDockWidgetAbstractHeader *ah)
Sets the header of this dockwidget.
Definition: kdockwidget.cpp:742
KDockWidget::transientTo
TQWidget * transientTo()
Returns the widget this dockwidget is set transient to, otherwise 0.
Definition: kdockwidget.cpp:873
KDockMainWindow::slotDockWidgetUndocked
void slotDockWidgetUndocked()
Called whenever one of the dockwidgets of this has been undocked.
Definition: kdockwidget.cpp:179
KDockWidget::KDockWidget
KDockWidget(KDockManager *dockManager, const char *name, const TQPixmap &pixmap, TQWidget *parent=0L, const TQString &strCaption=TQString::null, const TQString &strTabPageLabel=TQString::fromLatin1(" "), WFlags f=0)
Construct a dockwidget.
Definition: kdockwidget.cpp:479
KDockWidgetHeader::dragPanel
KDockWidgetHeaderDrag * dragPanel()
Get the drag panel of this header.
Definition: kdockwidget.cpp:312
KDockWidget::loseFormerBrotherDockWidget
void loseFormerBrotherDockWidget()
Does several things here when it has noticed that the former brother widget (closest neighbor) gets l...
Definition: kdockwidget.cpp:1567
KDockWidget::mayBeHide
bool mayBeHide() const
Definition: kdockwidget.cpp:1506
KDockWidgetHeader::dockbackButton
KDockButton_Private * dockbackButton
a little button for dock back the dockwidget to it's previous dockwidget
Definition: kdockwidget.h:346
KDockWidget::currentDockPos
DockPosition currentDockPos
the current dock position.
Definition: kdockwidget.h:820
KDockMainWindow::readDockConfig
void readDockConfig(TQDomElement &base)
Reads the current dock window layout from a DOM tree below the given element.
Definition: kdockwidget.cpp:162
KDockManager::change
void change()
Signals changes of the docking state of a dockwidget.
KDockWidgetHeader::drag
KDockWidgetHeaderDrag * drag
the drag panel (double line)
Definition: kdockwidget.h:351
KDockWidget::setForcedFixedHeight
void setForcedFixedHeight(int)
subject to changes.
Definition: kdockwidget.cpp:1244
KDockWidget::mayBeShow
bool mayBeShow() const
Definition: kdockwidget.cpp:1512
KDockManager::setSpecialLeftDockContainer
void setSpecialLeftDockContainer(KDockWidget *container)
Definition: kdockwidget.cpp:3030
KDockWidget::pixmap
const TQPixmap & pixmap() const
Returns the dockwidget's associated caption/dock tab pixmap.
Definition: kdockwidget.cpp:545
KDockWidgetHeader::forceCloseButtonHidden
void forceCloseButtonHidden(bool enable=true)
Definition: kdockwidget.cpp:306
KDockWidget::DockPosition
DockPosition
The possible positions where a dockwidget can dock to another dockwidget.
Definition: kdockwidget.h:465
TDEGlobalSettings::opaqueResize
static bool opaqueResize()
KDockManager::splitterOpaqueResize
bool splitterOpaqueResize() const
Returns true if opaque resizing is enabled, false otherwise.
Definition: kdockwidget.cpp:2902
KDockWidget::show
virtual void show()
Add dockwidget management actions to TQWidget::show.
Definition: kdockwidget.cpp:840
KDockMainWindow::makeDockInvisible
void makeDockInvisible(KDockWidget *dock)
This method hides the given dockwidget.
Definition: kdockwidget.cpp:146
KDockSplitter::getAnother
TQWidget * getAnother(TQWidget *w) const
If w is child0, return child1, otherwise child0.
Definition: kdockwidget_private.cpp:578
KDockManager::splitterKeepSize
bool splitterKeepSize() const
Returns true if the KeepSize is enabled, false otherwise.
Definition: kdockwidget.cpp:2912
KDockWidget::hasUndocked
void hasUndocked()
Emitted when the widget has undocked.
Vertical
KDockManager::setSplitterKeepSize
void setSplitterKeepSize(bool b=true)
Try to preserve the widget's size.
Definition: kdockwidget.cpp:2907
KDockWidget::setPixmap
void setPixmap(const TQPixmap &pixmap=TQPixmap())
Allows changing the pixmap which is used for the caption or dock tabs.
Definition: kdockwidget.cpp:529
KDockWidget::formerBrotherDockWidget
KDockWidget * formerBrotherDockWidget
earlier closest neighbor widget, so it's possible to dock back to it.
Definition: kdockwidget.h:816
KDockWidgetAbstractHeaderDrag
An abstract class for all dockwidget drag-panels of a dockwidgets (and member of the dockwidget class...
Definition: kdockwidget.h:153
KDockManager::eventFilter
virtual bool eventFilter(TQObject *object, TQEvent *event)
It's more or less a method that catches several events which are interesting for the dockmanager...
Definition: kdockwidget.cpp:1705
kdDebug
kdbgstream kdDebug(int area=0)
KDockWidget::makeDockVisible
void makeDockVisible()
Normally it simply shows the dockwidget.
Definition: kdockwidget.cpp:1534
KDockMainWindow
A special kind of TDEMainWindow that is able to have dockwidget child widgets (and member of the dock...
Definition: kdockwidget.h:1314
KDockManager::replaceDock
void replaceDock(KDockWidget *oldDock, KDockWidget *newDock)
Signals a dockwidget is replaced with another one.
KDockWidget::dockBack
void dockBack()
Docks a dockwidget back to the dockwidget that was the neighbor widget before the current dock positi...
Definition: kdockwidget.cpp:1576
KDockWidgetHeaderDrag::KDockWidgetHeaderDrag
KDockWidgetHeaderDrag(KDockWidgetAbstractHeader *parent, KDockWidget *dock, const char *name=0L)
Constructs this.
Definition: kdockwidget.cpp:195
KDockSplitter
Like TQSplitter but specially designed for dockwidgets stuff.
Definition: kdockwidget_private.h:44
KDockManager::setDockDefaultPos
void setDockDefaultPos(KDockWidget *)
Signals a dockwidget without parent (toplevel) is shown.
KDockWidgetAbstractHeaderDrag::KDockWidgetAbstractHeaderDrag
KDockWidgetAbstractHeaderDrag(KDockWidgetAbstractHeader *parent, KDockWidget *dock, const char *name=0L)
Constructs this.
Definition: kdockwidget.cpp:188
KDockWidget::setToolTipString
void setToolTipString(const TQString &ttStr)
Stores a string for a tooltip.
Definition: kdockwidget.h:603
KDockMainWindow::mainDockWidget
KDockWidget * mainDockWidget
A pointer to the main dockwidget (where one can manualDock() to.
Definition: kdockwidget.h:1465
KDockMainWindow::makeWidgetDockVisible
void makeWidgetDockVisible(TQWidget *widget)
This is an overloaded member function, provided for convenience.
Definition: kdockwidget.cpp:152
KDockWidget::findNearestDockWidget
KDockWidget * findNearestDockWidget(DockPosition pos)
Lookup the nearest dockwidget docked left/right/top/bottom to this one or return 0.
Definition: kdockwidget.cpp:920
KDockSplitter::setOpaqueResize
void setOpaqueResize(bool b=true)
Set opaque flag.
Definition: kdockwidget_private.cpp:601
KDockWidgetHeader
The header (additional bar) for a KDockWidget s (and member of the dockwidget class set)...
Definition: kdockwidget.h:241
KDockWidget::isDockBackPossible
bool isDockBackPossible() const
Definition: kdockwidget.cpp:1608
KDockWidgetHeader::stayButton
KDockButton_Private * stayButton
a little button for enabling/disabling dragging the dockwidget with the mouse
Definition: kdockwidget.h:341
KDockWidget::setFormerBrotherDockWidget
void setFormerBrotherDockWidget(KDockWidget *)
Definition: kdockwidget.cpp:1559
KWin::setType
static void setType(WId win, NET::WindowType windowType)
KDockWidgetHeader::saveConfig
virtual void saveConfig(TDEConfig *c)
Saves the current button state to a KDE config container object.
Definition: kdockwidget.cpp:423
KDockWidgetHeader::loadConfig
virtual void loadConfig(TDEConfig *c)
Loads the current button state from a KDE config container object.
Definition: kdockwidget.cpp:428
TDEMainWindow
KDE top level main window
Definition: tdemainwindow.h:98
NET::Override
KDockSplitter::getFirst
TQWidget * getFirst() const
Definition: kdockwidget_private.h:124
KDockMainWindow::createDockWidget
KDockWidget * createDockWidget(const TQString &name, const TQPixmap &pixmap, TQWidget *parent=0L, const TQString &strCaption=TQString::null, const TQString &strTabPageLabel=TQString::fromLatin1(" "))
This is one of the most important methods! The KDockMainWindow creates a new dockwidget object here t...
Definition: kdockwidget.cpp:135
KDockWidget::forcedFixedWidth
int forcedFixedWidth()
Definition: kdockwidget.cpp:1253
KDockWidget::manualDock
KDockWidget * manualDock(KDockWidget *target, DockPosition dockPos, int spliPos=50, TQPoint pos=TQPoint(0, 0), bool check=false, int tabIndex=-1)
This is a key method of this class! Use it to dock dockwidgets to another dockwidget at the right pos...
Definition: kdockwidget.cpp:947
NET::WindowType
WindowType
tdelocale.h
KDockWidget::undock
void undock()
Undocks this.
Definition: kdockwidget.cpp:1291
KDockWidgetHeader::showUndockButton
void showUndockButton(bool show)
Definition: kdockwidget.cpp:402
KDockManager::setSplitterOpaqueResize
void setSplitterOpaqueResize(bool b=true)
Enables opaque resizing.
Definition: kdockwidget.cpp:2897
KDockManager::setSplitterHighResolution
void setSplitterHighResolution(bool b=true)
Operate the splitter with a higher resolution.
Definition: kdockwidget.cpp:2917
KDockWidget::setEnableDocking
void setEnableDocking(int pos)
Specify where it is either possible or impossible for this to dock to another dockwidget.
Definition: kdockwidget.cpp:762
KDockSplitter::resizeEvent
virtual void resizeEvent(TQResizeEvent *ev)
The resize event resizes child0, child1 and the divider.
Definition: kdockwidget_private.cpp:239
KDockWidgetHeader::layout
TQHBoxLayout * layout
A layout manager for placing the embedded buttons (close and stay)
Definition: kdockwidget.h:331
KDockWidget::toolTipStr
TQString toolTipStr
a string used as tooltip for the tab page header when in dock-centered mode.
Definition: kdockwidget.h:828
KDockWidget::docking
void docking(KDockWidget *dw, KDockWidget::DockPosition dp)
Emitted when another dock widget is docking to this.
KDockMainWindow::~KDockMainWindow
virtual ~KDockMainWindow()
Destructs a dockmainwindow.
Definition: kdockwidget.cpp:110
KDockWidget::setWidget
void setWidget(TQWidget *w)
Sets the embedded widget.
Definition: kdockwidget.cpp:1448
KDockManager::writeConfig
void writeConfig(TDEConfig *c=0L, TQString group=TQString::null)
Saves the current state of the dockmanager and of all controlled widgets.
Definition: kdockwidget.cpp:2531
KDockManager::~KDockManager
virtual ~KDockManager()
Destructs a dockmanager.
Definition: kdockwidget.cpp:1674
KDockWidget::iMBeingClosed
void iMBeingClosed()
Emitted when the widget processes a close event.
KDockWidget::getHeader
KDockWidgetAbstractHeader * getHeader()
Definition: kdockwidget.cpp:738
KDockManager
The manager that knows all dockwidgets and handles the dock process (and member of the dockwidget cla...
Definition: kdockwidget.h:915
KDockMainWindow::KDockMainWindow
KDockMainWindow(TQWidget *parent=0L, const char *name=0L, WFlags f=(WFlags)(WType_TopLevel|WDestructiveClose))
Constructs a dockmainwindow.
Definition: kdockwidget.cpp:102
KDockManager::setMainDockWidget2
void setMainDockWidget2(KDockWidget *)
Definition: kdockwidget.cpp:1669
KDockManager::activate
void activate()
Shows all encapsulated widgets of all controlled dockwidgets and shows all dockwidgets which are pare...
Definition: kdockwidget.cpp:1690
KDockWidget::setLatestKDockContainer
void setLatestKDockContainer(TQWidget *)
Definition: kdockwidget.cpp:718
KDockMainWindow::writeDockConfig
void writeDockConfig(TQDomElement &base)
Saves the current dock window layout into a DOM tree below the given element.
Definition: kdockwidget.cpp:157
KDockMainWindow::dockManager
KDockManager * dockManager
A pointer to the manager for the dock process.
Definition: kdockwidget.h:1470
KDockWidget::toolTipString
const TQString & toolTipString() const
Definition: kdockwidget.h:608
KDockButton_Private
A mini-button usually placed in the dockpanel.
Definition: kdockwidget_private.h:248
KDockWidget::setDockWindowType
void setDockWindowType(NET::WindowType windowType)
Sets the type of the dock window.
Definition: kdockwidget.cpp:858
KDockMainWindow::setMainDockWidget
void setMainDockWidget(KDockWidget *dockwidget)
Sets a new main dockwidget.
Definition: kdockwidget.cpp:115
KDockSplitter::setKeepSize
void setKeepSize(bool b=true)
If b is true, the splitter will keep its size on resize events.
Definition: kdockwidget_private.cpp:611
KDockWidget::setTabPageLabel
void setTabPageLabel(const TQString &label)
Sets a string that is used for the label of the tab page when in tab page mode.
Definition: kdockwidget.h:619
KDockManager::KDockManager
KDockManager(TQWidget *mainWindow, const char *name=0L)
Constructs a dockmanager.
Definition: kdockwidget.cpp:1619
KDockTabGroup
It just hides the special implementation of a dockwidget tab groups (and is member of the dockwidget ...
Definition: kdockwidget.h:367
KDockMainWindow::makeDockVisible
void makeDockVisible(KDockWidget *dock)
This method shows the given dockwidget.
Definition: kdockwidget.cpp:140
KDockWidget::dockManager
KDockManager * dockManager() const
Definition: kdockwidget.h:591
KDockWidget::dockSite
int dockSite() const
Definition: kdockwidget.h:528
KDockWidget::setDockDefaultPos
void setDockDefaultPos()
Signals that the dock default position is set.
KDockWidget::updateHeader
void updateHeader()
Checks some conditions and shows or hides the dockwidget header (drag panel).
Definition: kdockwidget.cpp:772
KDockWidget::parentDockContainer
TQWidget * parentDockContainer() const
Definition: kdockwidget.cpp:1226
KDockWidgetHeader::closeButton
KDockButton_Private * closeButton
a little button for closing (undocking and hiding) the dockwidget
Definition: kdockwidget.h:336
KDockWidget::changeHideShowState
void changeHideShowState()
Toggles the visibility state of the dockwidget if it is able to be shown or to be hidden...
Definition: kdockwidget.cpp:1518
KDockManager::readConfig
void readConfig(TDEConfig *c=0L, TQString group=TQString::null)
Like writeConfig but reads the whole stuff in.
Definition: kdockwidget.cpp:2673
KDockWidgetAbstractHeader::setTopLevel
virtual void setTopLevel(bool)
Provides things concerning to switching to toplevel mode.
Definition: kdockwidget.h:125
KDockWidgetPrivate
resizing enum
Definition: kdockwidget_private.h:273
KDockWidgetAbstractHeader
An abstract base clase for all dockwidget headers (and member of the dockwidget class set)...
Definition: kdockwidget.h:103
KDockWidget::setForcedFixedWidth
void setForcedFixedWidth(int)
subject to changes.
Definition: kdockwidget.cpp:1235
KDockWidget::event
virtual bool event(TQEvent *)
Catches and processes some TQWidget events that are interesting for dockwidgets.
Definition: kdockwidget.cpp:877
Horizontal
KDockWidgetHeaderDrag
This special widget is the panel one can grip with the mouses (and member of the dockwidget class set...
Definition: kdockwidget.h:199
KDockWidgetHeader::KDockWidgetHeader
KDockWidgetHeader(KDockWidget *parent, const char *name=0L)
Constructs this.
Definition: kdockwidget.cpp:216
KDockManager::splitterHighResolution
bool splitterHighResolution() const
Returns true if the splitter uses the high resolution, false otherwise.
Definition: kdockwidget.cpp:2922
KDockWidgetAbstractHeader::loadConfig
virtual void loadConfig(TDEConfig *)
Provides loading the current configuration.
Definition: kdockwidget.h:136
KDockWidget::~KDockWidget
virtual ~KDockWidget()
Destructs a dockwidget.
Definition: kdockwidget.cpp:549
KDockWidgetHeader::setTopLevel
virtual void setTopLevel(bool t)
Hides the close button and stay button when switching to toplevel or vice versa shows them...
Definition: kdockwidget.cpp:272
KDockWidget
Floatable widget that can be dragged around with the mouse and encapsulate the actual widgets (and me...
Definition: kdockwidget.h:428
KDockMainWindow::getMainDockWidget
KDockWidget * getMainDockWidget() const
Returns the main dockwidget.
Definition: kdockwidget.h:1365
KDockSplitter::activate
void activate(TQWidget *c0, TQWidget *c1=0L)
Initialize the splitter.
Definition: kdockwidget_private.cpp:51
KDockMainWindow::dockWidgetHasUndocked
void dockWidgetHasUndocked(KDockWidget *)
Signals a certain dockwidget is undocked now.
TDEPopupMenu
A menu with title items.
Definition: tdepopupmenu.h:123
KDockMainWindow::setView
void setView(TQWidget *widget)
This method calls the base class method.
Definition: kdockwidget.cpp:122
KDockWidget::currentDockPosition
KDockWidget::DockPosition currentDockPosition() const
Definition: kdockwidget.cpp:1286
KDockWidgetAbstractHeader::saveConfig
virtual void saveConfig(TDEConfig *)
Provides saving the current configuration.
Definition: kdockwidget.h:131
KDockSplitter::separatorPosInPercent
int separatorPosInPercent()
Return the separator position in percent (%), so the range is [0..100].
Definition: kdockwidget_private.cpp:211
KDockWidgetHeaderDrag::paintEvent
virtual void paintEvent(TQPaintEvent *)
Draws the drag panel (a double line)
Definition: kdockwidget.cpp:200
KDockWidget::forcedFixedHeight
int forcedFixedHeight()
Definition: kdockwidget.cpp:1258
TDEGlobal::config
static TDEConfig * config()
endl
kndbgstream & endl(kndbgstream &s)
KDockWidgetHeader::slotStayClicked
void slotStayClicked()
Sets dragging the dockwidget off when the stay button is pressed down and vice versa.
Definition: kdockwidget.cpp:392
KDockWidget::widgetSet
void widgetSet(TQWidget *)
KDockWidgetHeader::setDragPanel
void setDragPanel(KDockWidgetHeaderDrag *nd)
Sets the drag panel of this header.
Definition: kdockwidget.cpp:316
KDockWidget::toDesktop
void toDesktop()
Docks the widget to the desktop (as a toplevel widget)
Definition: kdockwidget.cpp:1276
KDockWidget::getWidget
TQWidget * getWidget() const
Get the embedded widget.
Definition: kdockwidget.h:544
KDockWidget::parentDockTabGroup
KDockTabGroup * parentDockTabGroup() const
Definition: kdockwidget.cpp:1218
KDockManager::findWidgetParentDock
KDockWidget * findWidgetParentDock(TQWidget *w) const
This method finds out what a widgets' dockwidget is.
Definition: kdockwidget.cpp:2957
KDockManager::getDockWidgetFromName
KDockWidget * getDockWidgetFromName(const TQString &dockName)
Definition: kdockwidget.cpp:2880
KDockWidgetAbstractHeader::KDockWidgetAbstractHeader
KDockWidgetAbstractHeader(KDockWidget *parent, const char *name=0L)
Constructs this.
Definition: kdockwidget.cpp:211

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.8.8
This website is maintained by Timothy Pearson.