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

tdeui

  • tdeui
kdockwidget_private.cpp
1 /* This file is part of the KDE libraries
2  Copyright (C) 2000 Max Judin <novaprint@mtu-net.ru>
3  Copyright (C) 2002,2003 Joseph Wenninger <jowenn@kde.org>
4  Copyright (C) 2005 Dominik Haumann <dhdev@gmx.de>
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_p.h"
22 #include "kdockwidget_private.h"
23 
24 #include <tqpainter.h>
25 #include <tqcursor.h>
26 #include <kdebug.h>
27 #include <tqtimer.h>
28 #include <tqapplication.h>
29 
30 #include <math.h> // need ceil
31 
32 KDockSplitter::KDockSplitter(TQWidget *parent, const char *name, Orientation orient, int pos)
33 : TQWidget(parent, name)
34 {
35  m_dontRecalc=false;
36  divider = 0L;
37  child0 = 0L;
38  child1 = 0L;
39  fixedWidth0=-1;
40  fixedWidth1=-1;
41  fixedHeight0=-1;
42  fixedHeight1=-1;
43 
44  m_orientation = orient;
45  mOpaqueResize = false;
46  mKeepSize = false;
47  setSeparatorPosInPercent( pos );
48  initialised = false;
49 }
50 
51 void KDockSplitter::activate(TQWidget *c0, TQWidget *c1)
52 {
53  if ( c0 ) child0 = c0;
54  if ( c1 ) child1 = c1;
55 
56  setupMinMaxSize();
57 
58  if (divider) delete divider;
59  divider = new TQFrame(this, "pannerdivider");
60  divider->setFrameStyle(TQFrame::Panel | TQFrame::Raised);
61  divider->setLineWidth(1);
62  divider->raise();
63 
64  if (m_orientation == TQt::Horizontal)
65  divider->setCursor(TQCursor(TQt::sizeVerCursor));
66  else
67  divider->setCursor(TQCursor(TQt::sizeHorCursor));
68  divider->installEventFilter(this);
69 
70  initialised= true;
71 
72  updateName();
73  divider->show();
74 
75  // without this resize event, things will not work. why exactly? :(
76  resizeEvent(0);
77 
78 
79  KDockWidget* dw0 = (KDockWidget*) child0;
80  KDockWidget* dw1 = (KDockWidget*) child1;
81 
82  // if fixed size is set, restore first, to restore xpos correctly
83  if( fixedWidth0 != -1 || fixedHeight0 != -1 ) restoreFromForcedFixedSize( dw0 );
84  if( fixedWidth1 != -1 || fixedHeight1 != -1 ) restoreFromForcedFixedSize( dw1 );
85 
86 
87  // now force fixed sizes, if they are set.
88  if( dw0->forcedFixedWidth() != -1 ) {
89  setForcedFixedWidth( dw0, dw0->forcedFixedWidth() );
90  }
91  else if( dw1->forcedFixedWidth() != -1 ) {
92  setForcedFixedWidth( dw1, dw1->forcedFixedWidth() );
93  }
94 
95  if( dw0->forcedFixedHeight() != -1 ) {
96  setForcedFixedHeight (dw0, dw0->forcedFixedHeight() );
97  }
98  else if( dw1->forcedFixedHeight() != -1 ) {
99  setForcedFixedHeight( dw1, dw1->forcedFixedHeight() );
100  }
101 }
102 
103 /*
104 void KDockSplitter::delayedResize()
105 {
106  kdDebug(282)<<"*********************** DELAYED RESIZE !!!!!!!!!!!!!!!"<<endl;
107  resizeEvent(0);
108 }*/
109 
110 void KDockSplitter::setForcedFixedWidth(KDockWidget *dw,int w)
111 {
112  if (dw==child0)
113  {
114  if (fixedWidth0==-1) savedXPos=xpos;
115  if (w==fixedWidth0) return;
116  fixedWidth0=w;
117  setSeparatorPos(w*factor/width(),true);
118 // kdDebug(282)<<"Set forced fixed width for widget 0 :"<<w<<endl;
119  }
120  else
121  {
122  if (fixedWidth1==-1) savedXPos=xpos;
123  if (w==fixedWidth1) return;
124  fixedWidth1=w;
125  setSeparatorPos((width()-w)*factor/width(),true);
126 // kdDebug(282)<<"Set forced fixed width for widget 1 :"<<w<<endl;
127  }
128  setupMinMaxSize();
129  if (divider) divider->hide();
130 }
131 
132 void KDockSplitter::setForcedFixedHeight(KDockWidget *dw,int h)
133 {
134  if (dw==child0)
135  {
136  if (fixedHeight0==-1) savedXPos=xpos;
137  if (h==fixedHeight0) return;
138  fixedHeight0=h;
139  setSeparatorPos(h*factor/height(),true);
140 // // kdDebug(282)<<"Set forced fixed width for widget 0 :"<<h<<endl;
141  }
142  else
143  {
144  if (fixedHeight1==-1) savedXPos=xpos;
145  if (h==fixedHeight1) return;
146  fixedHeight1=h;
147  setSeparatorPos((height()-h)*factor/height(),true);
148 // kdDebug(282)<<"Set forced fixed height for widget 1 :"<<h<<endl;
149  }
150  setupMinMaxSize();
151  if (divider) divider->hide();
152 }
153 
154 void KDockSplitter::restoreFromForcedFixedSize(KDockWidget *dw)
155 {
156  if (divider) divider->show();
157  if (dw==child0)
158  {
159  fixedWidth0=-1;
160  fixedHeight0=-1;
161  setSeparatorPos(savedXPos,true);
162  }
163  else
164  {
165  fixedWidth1=-1;
166  fixedHeight1=-1;
167  setSeparatorPos(savedXPos,true);
168  }
169 }
170 
171 
172 void KDockSplitter::setupMinMaxSize()
173 {
174  // Set the minimum and maximum sizes for the KDockSplitter (this)
175  int minx, maxx, miny, maxy;
176  if (m_orientation == TQt::Horizontal) {
177  miny = child0->minimumHeight() + child1->minimumHeight() + 4;
178  maxy = child0->maximumHeight() + child1->maximumHeight() + 4;
179  minx = (child0->minimumWidth() > child1->minimumWidth()) ? child0->minimumWidth() : child1->minimumWidth();
180  maxx = (child0->maximumWidth() > child1->maximumWidth()) ? child0->maximumWidth() : child1->maximumWidth();
181 
182  if (miny < 4) miny = 4;
183  if (maxy > 32000) maxy = 32000;
184  if (minx < 2) minx = 2;
185  if (maxx > 32000) maxx = 32000;
186  }
187  else
188  {
189  minx = child0->minimumWidth() + child1->minimumWidth() + 4;
190  maxx = child0->maximumWidth() + child1->maximumWidth() + 4;
191  miny = (child0->minimumHeight() > child1->minimumHeight()) ? child0->minimumHeight() : child1->minimumHeight();
192  maxy = (child0->maximumHeight() > child1->maximumHeight()) ? child0->maximumHeight() : child1->maximumHeight();
193 
194  if (miny < 2) miny = 2;
195  if (maxy > 32000) maxy = 32000;
196  if (minx < 4) minx = 4;
197  if (maxx > 32000) maxx = 32000;
198  }
199 
200  setMinimumSize(minx, miny);
201  setMaximumSize(maxx, maxy);
202 }
203 
204 void KDockSplitter::deactivate()
205 {
206  if (divider) delete divider;
207  divider = 0L;
208  initialised= false;
209 }
210 
211 int KDockSplitter::separatorPosInPercent()
212 {
213  return xpos / (factor/100);
214 }
215 
216 void KDockSplitter::setSeparatorPosInPercent(int percent)
217 {
218  xpos = percent * (factor/100);
219 }
220 
221 void KDockSplitter::setSeparatorPos(int pos, bool do_resize)
222 {
223  xpos = pos;
224  if (do_resize)
225  resizeEvent(0);
226 }
227 
228 void KDockSplitter::setSeparatorPosX(int pos, bool do_resize)
229 {
230  savedXPos = pos;
231  setSeparatorPos( pos, do_resize );
232 }
233 
234 int KDockSplitter::separatorPos() const
235 {
236  return xpos;
237 }
238 
239 void KDockSplitter::resizeEvent(TQResizeEvent *ev)
240 {
241  //
242  // As already stated in the .h file we always have to differentiate
243  // between 6 modes.
244  // If we can cast child0->getWidget() or child1.getWidget() to
245  // KDockContainer* we *do* have a dockwidget around. For dockwidgets
246  // we have to take special care in the resizing routines, for example
247  // if mKeepSize is true and the dockcontainer is on the bottom or right,
248  // we always have to move the xpos splitter position. If there are no
249  // dockcontainers around, resizing is handeled like if child0 would
250  // be a dockcontainer.
251  //
252 
253 // kdDebug(282)<<"ResizeEvent :"<< ((initialised) ? "initialised":"not initialised")<<", "<< ((ev) ? "real event":"")<<", "<<(isVisible() ?"visible":"")<<endl;
254 
255  if (initialised) {
256  KDockContainer *dc = 0L;
257  KDockWidget *c0 = (KDockWidget*)child0;
258  KDockWidget *c1 = (KDockWidget*)child1;
259  bool stdHandling=false; // true: if closed or nonoverlap mode. false: overlap mode
260 
261  //
262  // Check whether this is a real resize event or a pseudo resize event
263  // Real resize events occure if the width() or height() changes. ev != 0L.
264  // Pseudo resize events occure if the dockwidget mode changes (overlaped,
265  // sticky or closed). ev == 0L.
266  //
267  if (ev && isVisible() && divider->isVisible()) {
268  // real resize event.
269 // kdDebug(282)<<"mKeepSize : "<< ((m_orientation == TQt::Horizontal) ? "Horizontal":"Vertical") <<endl;
270 
271  if (mKeepSize) {
272  // keep the splitter on a fixed position. This may be a bit inaccurate, because
273  // xpos saves a proportional value, which means there might occur rounding errors.
274  // However, this works surprising well!
275  if (m_orientation == TQt::Horizontal) {
276  if (ev->oldSize().height() != ev->size().height()) {
277  if( (c1->getWidget()) && (dc=dynamic_cast<KDockContainer*>(c1->getWidget()))) {
278  // dockwidget is on the bottom. move xpos so that the size from child1 stays
279  xpos = (int)ceil(((double)factor) * checkValue(height() - child1->height() - 4) / height());
280  } else {
281  // xpos should not change, the docking is on the top
282  // checkValue is *fuzzy* here, it leads to ugly rounding bugs
283  // In truth, it is not needed, because it is called when calculating the "position".
284  xpos = tqRound(((double)xpos) * ev->oldSize().height() / height());
285  }
286  }
287  } else {
288  if (ev->oldSize().width() != width()) {
289  if( (c1->getWidget()) && (dc=dynamic_cast<KDockContainer*>(c1->getWidget()))) {
290  xpos = (int)ceil(((double)factor) * checkValue(width() - child1->width() - 4) / width());
291  } else {
292  // xpos should not change
293  // checkValue is *fuzzy* here, it leads to ugly rounding bugs
294  xpos = tqRound(((double)xpos) * ev->oldSize().width() / width());
295  }
296  }
297  }
298  } else {
299  // dockwidget size proportional!
300  // Which means, xpos is always right (ratio value). Do nothing! :)
301  }
302  }
303  else
304  {
305  //
306  // Maybe a multitabbartab was clicked, so force an update of the fixed
307  // values.
308  //
309  if ( isVisible()) {
310  if (m_orientation == TQt::Horizontal) {
311  if (fixedHeight0!=-1)
312  xpos = checkValue(fixedHeight0) * factor / height();
313  else if (fixedHeight1!=-1)
314  xpos = checkValue(height()-fixedHeight1) * factor / height();
315  }
316  else
317  {
318  if (fixedWidth0!=-1)
319  xpos = checkValue(fixedWidth0) * factor / width();
320  else if (fixedWidth1!=-1)
321  xpos = checkValue(width()-fixedWidth1) * factor / width();
322  }
323  }
324 // else kdDebug(282)<<"Something else happened"<<endl;
325  }
326 
327 /*
328  // --- debugging information ---
329  kdDebug(282) << "isVisible() is : " << isVisible() << endl;
330  kdDebug(282) << "Orientation : " << (m_orientation==TQt::Horizontal?"Horizontal":"Vertical")
331  << endl;
332  kdDebug(282) << "Splitter visibility : " << divider->isVisible() << endl;;
333  kdDebug(282) << "Splitter procentual pos: " << xpos << endl;
334  if (c0->getWidget()) {
335  dc=dynamic_cast<KDockContainer*>(c0->getWidget());
336  kdDebug(282) << "Child 0 KDockContainer?: " << dc << endl;
337  }
338  if (c1->getWidget()) {
339  dc=dynamic_cast<KDockContainer*>(c1->getWidget());
340  kdDebug(282) << "Child 1 KDockContainer?: " << dc << endl;
341  }
342  kdDebug(282) << "Child0 : " << child0 << endl;
343  kdDebug(282) << "child1 : " << child1 << endl;
344 */
345 
346  //
347  // handle overlapped widgets only.
348  //
349  if( ( (m_orientation==TQt::Vertical) &&((fixedWidth0==-1) && (fixedWidth1==-1)) ) ||
350  ( (m_orientation==TQt::Horizontal) &&((fixedHeight0==-1) && (fixedHeight1==-1)) ) ) {
351  if ((c0->getWidget()) && (dc=dynamic_cast<KDockContainer*>(c0->getWidget()))
352  && (dc->isOverlapMode())) {
353  // child0 ist a KDockContainer
354  int position;
355  child0->show();
356  child0->raise();
357  divider->raise();
358  if (m_orientation == TQt::Horizontal) {
359  position = checkValueOverlapped( height() * xpos / factor, child0 );
360  child0->setGeometry(0, 0, width(), position);
361  child1->setGeometry(0, dc->m_nonOverlapSize, width(), height()-dc->m_nonOverlapSize);
362  divider->setGeometry(0, position, width(), 4);
363  } else {
364  position = checkValueOverlapped( width() * xpos / factor, child0 );
365  child0->setGeometry(0, 0, position, height());
366  child1->setGeometry(dc->m_nonOverlapSize, 0, width()-dc->m_nonOverlapSize, height());
367  divider->setGeometry(position, 0, 4, height());
368  }
369  } else {
370  if ((c1->getWidget()) && (dc=dynamic_cast<KDockContainer*>(c1->getWidget()))
371  && (dc->isOverlapMode())) {
372  // child1 ist a KDockContainer
373  int position;
374  child1->show();
375  child1->raise();
376  divider->raise();
377  if (m_orientation == TQt::Horizontal) {
378  position = checkValueOverlapped( height() * xpos / factor, child1 );
379  child0->setGeometry(0, 0, width(), height()-dc->m_nonOverlapSize);
380  child1->setGeometry(0, position+4, width(), height()-position-4);
381  divider->setGeometry(0, position, width(), 4);
382  } else {
383  position = checkValueOverlapped( width() * xpos / factor, child1 );
384  child0->setGeometry(0, 0, width()-dc->m_nonOverlapSize, height());
385  child1->setGeometry(position+4, 0, width()-position-4, height());
386  divider->setGeometry(position, 0, 4, height());
387  }
388  }
389  else // no KDockContainer available, this means the mode cannot be overlapped
390  stdHandling=true;
391  }
392  }
393  else // no KDockContainer available
394  stdHandling=true;
395 
396  //
397  // stdHandling == true means either sticky mode (=nonoverlap mode) or
398  // closed mode. In both modes the widgets do *not* overlap, so we know
399  // the child0 and child1 adjoin.
400  //
401  if (stdHandling) {
402  int position = checkValue( (m_orientation == TQt::Vertical ? width() : height()) * xpos / factor );
403  int diff = 0;
404 
405  if (m_orientation == TQt::Horizontal) {
406  if ((c1->getWidget()) && (dc=dynamic_cast<KDockContainer*>(c1->getWidget()))) {
407  // bottom is dockcontainer
408  if( divider->isVisible() ) {
409  child0->setGeometry(0, 0, width(), position);
410  child1->setGeometry(0, position+4, width(), height()-position-4);
411  } else {
412  child0->setGeometry(0, 0, width(), height()-dc->m_nonOverlapSize);
413  child1->setGeometry(0, height()-dc->m_nonOverlapSize, width(), height());
414  }
415  } else {
416  if( divider->isVisible() ) diff = 4;
417  child0->setGeometry(0, 0, width(), position);
418  child1->setGeometry(0, position+diff, width(), height()-position-diff);
419  }
420  divider->setGeometry(0, position, width(), 4);
421  } else {
422  if ((c1->getWidget()) && (dc=dynamic_cast<KDockContainer*>(c1->getWidget()))) {
423  // right is dockcontainer
424  if( divider->isVisible() ) {
425  child0->setGeometry(0, 0, position, height());
426  child1->setGeometry(position+4, 0, width()-position-4, height());
427  } else {
428  child0->setGeometry(0, 0, width()-dc->m_nonOverlapSize, height());
429  child1->setGeometry(width()-dc->m_nonOverlapSize, 0, width(), height());
430  }
431  } else {
432  if( divider->isVisible() ) diff = 4;
433  child0->setGeometry(0, 0, position, height());
434  child1->setGeometry(position+diff, 0, width()-position-diff, height());
435  }
436  divider->setGeometry(position, 0, 4, height());
437  }
438  }
439  }
440 }
441 
442 int KDockSplitter::checkValueOverlapped(int position, TQWidget *overlappingWidget) const
443 {
444  if (initialised) {
445  if (m_orientation == TQt::Vertical) {
446  if (child0==overlappingWidget) {
447  if (position < child0->minimumWidth() || position > width())
448  position = child0->minimumWidth();
449  } else {
450  if (position > (width()-child1->minimumWidth()-4) || position < 0)
451  position = width()-child1->minimumWidth()-4;
452  }
453  } else {// orientation == TQt::Horizontal
454  if (child0==overlappingWidget) {
455  if (position < (child0->minimumHeight()) || position > height())
456  position = child0->minimumHeight();
457  } else {
458  if (position>(height()-child1->minimumHeight()-4) || position < 0)
459  position = height()-child1->minimumHeight()-4;
460  }
461  }
462  }
463  return position;
464 }
465 
466 int KDockSplitter::checkValue( int position ) const
467 {
468  if (initialised) {
469  if (m_orientation == TQt::Vertical) {
470  if (position < child0->minimumWidth())
471  position = child0->minimumWidth();
472  if ((width()-4-position) < (child1->minimumWidth()))
473  position = width() - (child1->minimumWidth()) - 4;
474  } else {
475  if (position < (child0->minimumHeight()))
476  position = child0->minimumHeight();
477  if ((height()-4-position) < child1->minimumHeight())
478  position = height() - (child1->minimumHeight()) - 4;
479  }
480  }
481 
482  if (position < 0) position = 0;
483 
484  if ((m_orientation == TQt::Vertical) && (position > width()))
485  position = width();
486  if ((m_orientation == TQt::Horizontal) && (position > height()))
487  position = height();
488 
489  return position;
490 }
491 
492 bool KDockSplitter::eventFilter(TQObject *o, TQEvent *e)
493 {
494  TQMouseEvent *mev;
495  bool handled = false;
496 
497  switch (e->type()) {
498  case TQEvent::MouseMove:
499  mev= (TQMouseEvent*)e;
500  child0->setUpdatesEnabled(mOpaqueResize);
501  child1->setUpdatesEnabled(mOpaqueResize);
502  if (m_orientation == TQt::Horizontal) {
503  if ((fixedHeight0!=-1) || (fixedHeight1!=-1))
504  {
505  handled=true; break;
506  }
507 
508  if (!mOpaqueResize) {
509  int position = checkValue( mapFromGlobal(mev->globalPos()).y() );
510  divider->move( 0, position );
511  } else {
512  int tmp_xpos = factor * checkValue( mapFromGlobal(mev->globalPos()).y() ) / height();
513  if (tmp_xpos != xpos) {
514  xpos = tmp_xpos;
515  resizeEvent(0);
516  divider->repaint(true);
517  }
518  }
519  } else {
520  if ((fixedWidth0!=-1) || (fixedWidth1!=-1))
521  {
522  handled=true; break;
523  }
524  if (!mOpaqueResize) {
525  int position = checkValue( mapFromGlobal(TQCursor::pos()).x() );
526  divider->move( position, 0 );
527  } else {
528  int tmp_xpos = factor * checkValue( mapFromGlobal( mev->globalPos()).x() ) / width();
529  if (tmp_xpos != xpos) {
530  xpos = tmp_xpos;
531  resizeEvent(0);
532  divider->repaint(true);
533  }
534  }
535  }
536  handled= true;
537  break;
538  case TQEvent::MouseButtonRelease:
539  child0->setUpdatesEnabled(true);
540  child1->setUpdatesEnabled(true);
541  mev= (TQMouseEvent*)e;
542  if (m_orientation == TQt::Horizontal){
543  if ((fixedHeight0!=-1) || (fixedHeight1!=-1))
544  {
545  handled=true; break;
546  }
547  xpos = factor* checkValue( mapFromGlobal(mev->globalPos()).y() ) / height();
548  resizeEvent(0);
549  divider->repaint(true);
550  } else {
551  if ((fixedWidth0!=-1) || (fixedWidth1!=-1))
552  {
553  handled=true; break;
554  }
555  xpos = factor* checkValue( mapFromGlobal(mev->globalPos()).x() ) / width();
556  resizeEvent(0);
557  divider->repaint(true);
558  }
559  handled= true;
560  break;
561  default:
562  break;
563  }
564  return (handled) ? true : TQWidget::eventFilter( o, e );
565 }
566 
567 bool KDockSplitter::event( TQEvent* e )
568 {
569  if ( e->type() == TQEvent::LayoutHint ){
570  // change children min/max size. This is needed, otherwise
571  // it is possible the divider get's out of bounds.
572  setupMinMaxSize();
573  resizeEvent(0);
574  }
575  return TQWidget::event(e);
576 }
577 
578 TQWidget* KDockSplitter::getAnother( TQWidget* w ) const
579 {
580  return ( w == child0 ) ? child1 : child0;
581 }
582 
583 void KDockSplitter::updateName()
584 {
585  if ( !initialised ) return;
586 
587  TQString new_name = TQString( child0->name() ) + "," + child1->name();
588  parentWidget()->setName( new_name.latin1() );
589  parentWidget()->setCaption( child0->caption() + "," + child1->caption() );
590  parentWidget()->repaint( false );
591 
592  ((KDockWidget*)parentWidget())->firstName = child0->name();
593  ((KDockWidget*)parentWidget())->lastName = child1->name();
594  ((KDockWidget*)parentWidget())->splitterOrientation = m_orientation;
595 
596  TQWidget* p = parentWidget()->parentWidget();
597  if ( p && p->inherits("KDockSplitter" ) )
598  ((KDockSplitter*)p)->updateName();
599 }
600 
601 void KDockSplitter::setOpaqueResize(bool b)
602 {
603  mOpaqueResize = b;
604 }
605 
606 bool KDockSplitter::opaqueResize() const
607 {
608  return mOpaqueResize;
609 }
610 
611 void KDockSplitter::setKeepSize(bool b)
612 {
613  mKeepSize = b;
614 }
615 
616 bool KDockSplitter::keepSize() const
617 {
618  return mKeepSize;
619 }
620 
621 
622 
623 /*************************************************************************/
624 KDockButton_Private::KDockButton_Private( TQWidget *parent, const char * name )
625 :TQPushButton( parent, name )
626 {
627  moveMouse = false;
628  setFocusPolicy( TQWidget::NoFocus );
629 }
630 
631 KDockButton_Private::~KDockButton_Private()
632 {
633 }
634 
635 void KDockButton_Private::drawButton( TQPainter* p )
636 {
637  p->fillRect( 0,0, width(), height(), TQBrush(colorGroup().brush(TQColorGroup::Background)) );
638  p->drawPixmap( (width() - pixmap()->width()) / 2, (height() - pixmap()->height()) / 2, *pixmap() );
639  if ( moveMouse && !isDown() ){
640  p->setPen( white );
641  p->moveTo( 0, height() - 1 );
642  p->lineTo( 0, 0 );
643  p->lineTo( width() - 1, 0 );
644 
645  p->setPen( colorGroup().dark() );
646  p->lineTo( width() - 1, height() - 1 );
647  p->lineTo( 0, height() - 1 );
648  }
649  if ( isOn() || isDown() ){
650  p->setPen( colorGroup().dark() );
651  p->moveTo( 0, height() - 1 );
652  p->lineTo( 0, 0 );
653  p->lineTo( width() - 1, 0 );
654 
655  p->setPen( white );
656  p->lineTo( width() - 1, height() - 1 );
657  p->lineTo( 0, height() - 1 );
658  }
659 }
660 
661 void KDockButton_Private::enterEvent( TQEvent * )
662 {
663  moveMouse = true;
664  repaint();
665 }
666 
667 void KDockButton_Private::leaveEvent( TQEvent * )
668 {
669  moveMouse = false;
670  repaint();
671 }
672 
673 /*************************************************************************/
674 KDockWidgetPrivate::KDockWidgetPrivate()
675  : TQObject()
676  ,index(-1)
677  ,splitPosInPercent(50)
678  ,pendingFocusInEvent(false)
679  ,blockHasUndockedSignal(false)
680  ,pendingDtor(false)
681  ,forcedWidth(-1)
682  ,forcedHeight(-1)
683  ,isContainer(false)
684  ,container(0)
685  ,resizePos(0,0)
686  ,resizing(false)
687 {
688 #ifndef NO_KDE2
689  windowType = NET::Normal;
690 #endif
691 
692  _parent = 0L;
693  transient = false;
694 }
695 
696 KDockWidgetPrivate::~KDockWidgetPrivate()
697 {
698 }
699 
700 void KDockWidgetPrivate::slotFocusEmbeddedWidget(TQWidget* w)
701 {
702  if (w) {
703  TQWidget* embeddedWdg = ((KDockWidget*)w)->getWidget();
704  if (embeddedWdg && ((embeddedWdg->focusPolicy() == TQWidget::ClickFocus) || (embeddedWdg->focusPolicy() == TQWidget::StrongFocus))) {
705  embeddedWdg->setFocus();
706  }
707  }
708 }
709 
710 #ifndef NO_INCLUDE_MOCFILES // for Qt-only projects, because tmake doesn't take this name
711 #include "kdockwidget_private.moc"
712 #endif
KDockSplitter
Like TQSplitter but specially designed for dockwidgets stuff.
Definition: kdockwidget_private.h:45
KDockSplitter::deactivate
void deactivate()
Disables the splitter.
Definition: kdockwidget_private.cpp:204
KDockSplitter::getAnother
TQWidget * getAnother(TQWidget *w) const
If w is child0, return child1, otherwise child0.
Definition: kdockwidget_private.cpp:578
KDockSplitter::KDockSplitter
KDockSplitter(TQWidget *parent=0, const char *name=0, Orientation orient=TQt::Vertical, int pos=50)
Constructor.
Definition: kdockwidget_private.cpp:32
KDockSplitter::setSeparatorPos
void setSeparatorPos(int pos, bool do_resize=true)
set separator position.
Definition: kdockwidget_private.cpp:221
KDockSplitter::separatorPos
int separatorPos() const
Return the separator position in the range [0..100000] To get the separator position in procent (%),...
Definition: kdockwidget_private.cpp:234
KDockSplitter::setOpaqueResize
void setOpaqueResize(bool b=true)
Set opaque flag.
Definition: kdockwidget_private.cpp:601
KDockSplitter::checkValueOverlapped
int checkValueOverlapped(int position, TQWidget *child) const
Make sure the splitter position is not out of bounds.
Definition: kdockwidget_private.cpp:442
KDockSplitter::setSeparatorPosInPercent
void setSeparatorPosInPercent(int percent)
Set the separator position in percent (%), so the range must be [0..100].
Definition: kdockwidget_private.cpp:216
KDockSplitter::activate
void activate(TQWidget *c0, TQWidget *c1=0L)
Initialize the splitter.
Definition: kdockwidget_private.cpp:51
KDockSplitter::checkValue
int checkValue(int position) const
Make sure the splitter position is not out of bounds.
Definition: kdockwidget_private.cpp:466
KDockSplitter::separatorPosInPercent
int separatorPosInPercent()
Return the separator position in percent (%), so the range is [0..100].
Definition: kdockwidget_private.cpp:211
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
KDockSplitter::resizeEvent
virtual void resizeEvent(TQResizeEvent *ev)
The resize event resizes child0, child1 and the divider.
Definition: kdockwidget_private.cpp:239
KDockSplitter::eventFilter
virtual bool eventFilter(TQObject *, TQEvent *)
The eventfilter installed on the divider processes all splitter resizing events.
Definition: kdockwidget_private.cpp:492
KDockSplitter::setSeparatorPosX
void setSeparatorPosX(int pos, bool do_resize=false)
For usage from outside.
Definition: kdockwidget_private.cpp:228
KDockWidgetPrivate::slotFocusEmbeddedWidget
void slotFocusEmbeddedWidget(TQWidget *w=0L)
Especially used for Tab page docking.
Definition: kdockwidget_private.cpp:700
KDockWidget
Floatable widget that can be dragged around with the mouse and encapsulate the actual widgets (and me...
Definition: kdockwidget.h:429
KDockWidget::forcedFixedHeight
int forcedFixedHeight()
Definition: kdockwidget.cpp:1258
KDockWidget::getWidget
TQWidget * getWidget() const
Get the embedded widget.
Definition: kdockwidget.h:544
KDockWidget::forcedFixedWidth
int forcedFixedWidth()
Definition: kdockwidget.cpp:1253
TDEStdAccel::name
TQString name(StdAccel id)

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
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.1
This website is maintained by Timothy Pearson.