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

tdeui

  • tdeui
tdetoolbar.cpp
1/* This file is part of the KDE libraries
2 Copyright
3 (C) 2000 Reginald Stadlbauer (reggie@kde.org)
4 (C) 1997, 1998 Stephan Kulow (coolo@kde.org)
5 (C) 1997, 1998 Mark Donohoe (donohoe@kde.org)
6 (C) 1997, 1998 Sven Radej (radej@kde.org)
7 (C) 1997, 1998 Matthias Ettrich (ettrich@kde.org)
8 (C) 1999 Chris Schlaeger (cs@kde.org)
9 (C) 1999 Kurt Granroth (granroth@kde.org)
10
11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Library General Public
13 License version 2 as published by the Free Software Foundation.
14
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Library General Public License for more details.
19
20 You should have received a copy of the GNU Library General Public License
21 along with this library; see the file COPYING.LIB. If not, write to
22 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 Boston, MA 02110-1301, USA.
24*/
25
26#include <config.h>
27
28#ifdef KDE_USE_FINAL
29#undef Always
30#include <tqdockwindow.h>
31#endif
32
33#include <string.h>
34
35#include <tqpainter.h>
36#include <tqtooltip.h>
37#include <tqdrawutil.h>
38#include <tqstring.h>
39#include <tqrect.h>
40#include <tqobjectlist.h>
41#include <tqtimer.h>
42#include <tqstyle.h>
43#include <tqlayout.h>
44
45#include <tdetoolbar.h>
46#include <tdemainwindow.h>
47#include <klineedit.h>
48#include <kseparator.h>
49#include <tdelocale.h>
50#include <tdeapplication.h>
51#include <tdeaction.h>
52#include <kstdaction.h>
53#include <tdeglobal.h>
54#include <tdeconfig.h>
55#include <kiconloader.h>
56#include <kcombobox.h>
57#include <tdepopupmenu.h>
58#include <kanimwidget.h>
59#include <kedittoolbar.h>
60#include <kipc.h>
61#include <twin.h>
62#include <kdebug.h>
63#include <tdetoolbarbutton.h>
64
65enum {
66 CONTEXT_TOP = 0,
67 CONTEXT_LEFT = 1,
68 CONTEXT_RIGHT = 2,
69 CONTEXT_BOTTOM = 3,
70 CONTEXT_FLOAT = 4,
71 CONTEXT_FLAT = 5,
72 CONTEXT_ICONS = 6,
73 CONTEXT_TEXT = 7,
74 CONTEXT_TEXTRIGHT = 8,
75 CONTEXT_TEXTUNDER = 9,
76 CONTEXT_ICONSIZES = 50 // starting point for the icon size list, put everything else before
77};
78
79class TDEToolBarPrivate
80{
81public:
82 TDEToolBarPrivate() {
83 m_iconSize = 0;
84 m_iconText = TDEToolBar::IconOnly;
85 m_highlight = true;
86 m_transparent = true;
87 m_honorStyle = false;
88
89 m_enableContext = true;
90
91 m_parent = NULL;
92 m_xmlguiClient = 0;
93
94 oldPos = TQt::DockUnmanaged;
95
96 modified = m_isHorizontal = positioned = false;
97
98 IconSizeDefault = 0;
99 IconTextDefault = "IconOnly";
100
101 NewLineDefault = false;
102 OffsetDefault = 0;
103 PositionDefault = "Top";
104 HiddenDefault = false;
105 idleButtons.setAutoDelete(true);
106 }
107
108 int m_iconSize;
109 TDEToolBar::IconText m_iconText;
110 bool m_highlight : 1;
111 bool m_transparent : 1;
112 bool m_honorStyle : 1;
113 bool m_isHorizontal : 1;
114 bool m_enableContext : 1;
115 bool modified : 1;
116 bool positioned : 1;
117
118 TQWidget *m_parent;
119
120 TQMainWindow::ToolBarDock oldPos;
121
122 KXMLGUIClient *m_xmlguiClient;
123
124 struct ToolBarInfo
125 {
126 ToolBarInfo() : index( -1 ), offset( -1 ), newline( false ), dock( TQt::DockTop ) {}
127 ToolBarInfo( TQt::Dock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {}
128 int index, offset;
129 bool newline;
130 TQt::Dock dock;
131 };
132
133 ToolBarInfo toolBarInfo;
134 TQValueList<int> iconSizes;
135 TQTimer repaintTimer;
136
137 // Default Values.
138 bool HiddenDefault;
139 int IconSizeDefault;
140 TQString IconTextDefault;
141 bool NewLineDefault;
142 int OffsetDefault;
143 TQString PositionDefault;
144
145 TQPtrList<TQWidget> idleButtons;
146};
147
148TDEToolBarSeparator::TDEToolBarSeparator(Orientation o , bool l, TQToolBar *parent,
149 const char* name )
150 :TQFrame( parent, name ), line( l )
151{
152 connect( parent, TQ_SIGNAL(orientationChanged(Orientation)),
153 this, TQ_SLOT(setOrientation(Orientation)) );
154 setOrientation( o );
155 setBackgroundMode( parent->backgroundMode() );
156 setBackgroundOrigin( ParentOrigin );
157}
158
159void TDEToolBarSeparator::setOrientation( Orientation o )
160{
161 orient = o;
162 setFrameStyle( NoFrame );
163}
164
165void TDEToolBarSeparator::drawContents( TQPainter* p )
166{
167 if ( line ) {
168 TQStyle::SFlags flags = TQStyle::Style_Default;
169
170 if ( orientation() == TQt::Horizontal )
171 flags = flags | TQStyle::Style_Horizontal;
172
173 style().drawPrimitive(TQStyle::PE_DockWindowSeparator, p,
174 contentsRect(), colorGroup(), flags);
175 } else {
176 TQFrame::drawContents(p);
177 }
178}
179
180void TDEToolBarSeparator::styleChange( TQStyle& )
181{
182 setOrientation( orient );
183}
184
185TQSize TDEToolBarSeparator::sizeHint() const
186{
187 int dim = style().pixelMetric( TQStyle::PM_DockWindowSeparatorExtent, this );
188 return orientation() == TQt::Vertical ? TQSize( 0, dim ) : TQSize( dim, 0 );
189}
190
191TQSizePolicy TDEToolBarSeparator::sizePolicy() const
192{
193 return TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Minimum );
194}
195
196TDEToolBar::TDEToolBar( TQWidget *parent, const char *name, bool honorStyle, bool readConfig )
197 : TQToolBar( TQString::fromLatin1( name ),
198 dynamic_cast<TQMainWindow*>(parent),
199 parent, false,
200 name ? name : "mainToolBar")
201{
202 init( readConfig, honorStyle );
203}
204
205TDEToolBar::TDEToolBar( TQMainWindow *parentWindow, TQMainWindow::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig )
206 : TQToolBar( TQString::fromLatin1( name ),
207 parentWindow, dock, newLine,
208 name ? name : "mainToolBar")
209{
210 init( readConfig, honorStyle );
211}
212
213TDEToolBar::TDEToolBar( TQMainWindow *parentWindow, TQWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig )
214 : TQToolBar( TQString::fromLatin1( name ),
215 parentWindow, dock, newLine,
216 name ? name : "mainToolBar")
217{
218 init( readConfig, honorStyle );
219}
220
221TDEToolBar::~TDEToolBar()
222{
223 emit toolbarDestroyed();
224 delete d;
225}
226
227void TDEToolBar::init( bool readConfig, bool honorStyle )
228{
229 d = new TDEToolBarPrivate();
230
231 setFullSize( true );
232 d->m_honorStyle = honorStyle;
233 context = 0;
234 layoutTimer = new TQTimer( this );
235 connect( layoutTimer, TQ_SIGNAL( timeout() ),
236 this, TQ_SLOT( rebuildLayout() ) );
237 connect( &(d->repaintTimer), TQ_SIGNAL( timeout() ),
238 this, TQ_SLOT( slotRepaint() ) );
239
240 if ( tdeApp ) { // may be null when started inside designer
241 connect(tdeApp, TQ_SIGNAL(toolbarAppearanceChanged(int)), this, TQ_SLOT(slotAppearanceChanged()));
242 // request notification of changes in icon style
243 tdeApp->addKipcEventMask(KIPC::IconChanged);
244 connect(tdeApp, TQ_SIGNAL(iconChanged(int)), this, TQ_SLOT(slotIconChanged(int)));
245 }
246
247 // finally, read in our configurable settings
248 if ( readConfig )
249 slotReadConfig();
250
251 if ( mainWindow() )
252 connect( mainWindow(), TQ_SIGNAL( toolBarPositionChanged( TQToolBar * ) ),
253 this, TQ_SLOT( toolBarPosChanged( TQToolBar * ) ) );
254
255 // Hack to make sure we recalculate our size when we dock.
256 connect( this, TQ_SIGNAL(placeChanged(TQDockWindow::Place)), TQ_SLOT(rebuildLayout()) );
257}
258
259int TDEToolBar::insertButton(const TQString& icon, int id, bool enabled,
260 const TQString& text, int index, TDEInstance *_instance )
261{
262 TDEToolBarButton *button = new TDEToolBarButton( icon, id, this, 0, text, _instance );
263
264 insertWidgetInternal( button, index, id );
265 button->setEnabled( enabled );
266 doConnections( button );
267 return index;
268}
269
270
271int TDEToolBar::insertButton(const TQString& icon, int id, const char *signal,
272 const TQObject *receiver, const char *slot,
273 bool enabled, const TQString& text, int index, TDEInstance *_instance )
274{
275 TDEToolBarButton *button = new TDEToolBarButton( icon, id, this, 0, text, _instance);
276 insertWidgetInternal( button, index, id );
277 button->setEnabled( enabled );
278 connect( button, signal, receiver, slot );
279 doConnections( button );
280 return index;
281}
282
283
284int TDEToolBar::insertButton(const TQPixmap& pixmap, int id, bool enabled,
285 const TQString& text, int index )
286{
287 TDEToolBarButton *button = new TDEToolBarButton( pixmap, id, this, 0, text);
288 insertWidgetInternal( button, index, id );
289 button->setEnabled( enabled );
290 doConnections( button );
291 return index;
292}
293
294
295int TDEToolBar::insertButton(const TQPixmap& pixmap, int id, const char *signal,
296 const TQObject *receiver, const char *slot,
297 bool enabled, const TQString& text,
298 int index )
299{
300 TDEToolBarButton *button = new TDEToolBarButton( pixmap, id, this, 0, text);
301 insertWidgetInternal( button, index, id );
302 button->setEnabled( enabled );
303 connect( button, signal, receiver, slot );
304 doConnections( button );
305 return index;
306}
307
308
309int TDEToolBar::insertButton(const TQString& icon, int id, TQPopupMenu *popup,
310 bool enabled, const TQString &text, int index )
311{
312 TDEToolBarButton *button = new TDEToolBarButton( icon, id, this, 0, text );
313 insertWidgetInternal( button, index, id );
314 button->setEnabled( enabled );
315 button->setPopup( popup );
316 doConnections( button );
317 return index;
318}
319
320
321int TDEToolBar::insertButton(const TQPixmap& pixmap, int id, TQPopupMenu *popup,
322 bool enabled, const TQString &text, int index )
323{
324 TDEToolBarButton *button = new TDEToolBarButton( pixmap, id, this, 0, text );
325 insertWidgetInternal( button, index, id );
326 button->setEnabled( enabled );
327 button->setPopup( popup );
328 doConnections( button );
329 return index;
330}
331
332
333int TDEToolBar::insertLined (const TQString& text, int id,
334 const char *signal,
335 const TQObject *receiver, const char *slot,
336 bool enabled ,
337 const TQString& toolTipText,
338 int size, int index )
339{
340 KLineEdit *lined = new KLineEdit ( this, 0 );
341 if ( !toolTipText.isEmpty() )
342 TQToolTip::add( lined, toolTipText );
343 if ( size > 0 )
344 lined->setMinimumWidth( size );
345 insertWidgetInternal( lined, index, id );
346 connect( lined, signal, receiver, slot );
347 lined->setText(text);
348 lined->setEnabled( enabled );
349 return index;
350}
351
352int TDEToolBar::insertCombo (const TQStringList &list, int id, bool writable,
353 const char *signal, const TQObject *receiver,
354 const char *slot, bool enabled,
355 const TQString& tooltiptext,
356 int size, int index,
357 TQComboBox::Policy policy )
358{
359 KComboBox *combo = new KComboBox ( writable, this );
360
361 insertWidgetInternal( combo, index, id );
362 combo->insertStringList (list);
363 combo->setInsertionPolicy(policy);
364 combo->setEnabled( enabled );
365 if ( size > 0 )
366 combo->setMinimumWidth( size );
367 if (!tooltiptext.isNull())
368 TQToolTip::add( combo, tooltiptext );
369
370 if ( signal && receiver && slot )
371 connect ( combo, signal, receiver, slot );
372 return index;
373}
374
375
376int TDEToolBar::insertCombo (const TQString& text, int id, bool writable,
377 const char *signal, TQObject *receiver,
378 const char *slot, bool enabled,
379 const TQString& tooltiptext,
380 int size, int index,
381 TQComboBox::Policy policy )
382{
383 KComboBox *combo = new KComboBox ( writable, this );
384 insertWidgetInternal( combo, index, id );
385 combo->insertItem (text);
386 combo->setInsertionPolicy(policy);
387 combo->setEnabled( enabled );
388 if ( size > 0 )
389 combo->setMinimumWidth( size );
390 if (!tooltiptext.isNull())
391 TQToolTip::add( combo, tooltiptext );
392 connect (combo, signal, receiver, slot);
393 return index;
394}
395
396int TDEToolBar::insertSeparator(int index, int id)
397{
398 TQWidget *w = new TDEToolBarSeparator( orientation(), false, this, "tool bar separator" );
399 insertWidgetInternal( w, index, id );
400 return index;
401}
402
403int TDEToolBar::insertLineSeparator(int index, int id)
404{
405 TQWidget *w = new TDEToolBarSeparator( orientation(), true, this, "tool bar separator" );
406 insertWidgetInternal( w, index, id );
407 return index;
408}
409
410
411int TDEToolBar::insertWidget(int id, int /*width*/, TQWidget *widget, int index)
412{
413 removeWidgetInternal( widget ); // in case we already have it ?
414 insertWidgetInternal( widget, index, id );
415 return index;
416}
417
418int TDEToolBar::insertAnimatedWidget(int id, TQObject *receiver, const char *slot,
419 const TQString& icons, int index )
420{
421 KAnimWidget *anim = new KAnimWidget( icons, d->m_iconSize, this );
422 insertWidgetInternal( anim, index, id );
423
424 if ( receiver )
425 connect( anim, TQ_SIGNAL(clicked()), receiver, slot);
426
427 return index;
428}
429
430KAnimWidget *TDEToolBar::animatedWidget( int id )
431{
432 Id2WidgetMap::Iterator it = id2widget.find( id );
433 if ( it == id2widget.end() )
434 return 0;
435 KAnimWidget *aw = dynamic_cast<KAnimWidget *>(*it);
436 if ( aw )
437 return aw;
438 TQObjectList *l = queryList( "KAnimWidget" );
439 if ( !l || !l->first() ) {
440 delete l;
441 return 0;
442 }
443
444 for ( TQObject *o = l->first(); o; o = l->next() ) {
445 KAnimWidget *aw = dynamic_cast<KAnimWidget *>(o);
446 if ( aw )
447 {
448 delete l;
449 return aw;
450 }
451 }
452
453 delete l;
454 return 0;
455}
456
457
458void TDEToolBar::addConnection (int id, const char *signal,
459 const TQObject *receiver, const char *slot)
460{
461 TQWidget* w = getWidget( id );
462 if ( w )
463 connect( w, signal, receiver, slot );
464}
465
466void TDEToolBar::setItemEnabled( int id, bool enabled )
467{
468 TQWidget* w = getWidget( id );
469 if ( w )
470 w->setEnabled( enabled );
471}
472
473
474void TDEToolBar::setButtonPixmap( int id, const TQPixmap& _pixmap )
475{
476 TDEToolBarButton * button = getButton( id );
477 if ( button )
478 button->setPixmap( _pixmap );
479}
480
481
482void TDEToolBar::setButtonIcon( int id, const TQString& _icon )
483{
484 TDEToolBarButton * button = getButton( id );
485 if ( button )
486 button->setIcon( _icon );
487}
488
489void TDEToolBar::setButtonIconSet( int id, const TQIconSet& iconset )
490{
491 TDEToolBarButton * button = getButton( id );
492 if ( button )
493 button->setIconSet( iconset );
494}
495
496
497void TDEToolBar::setDelayedPopup (int id , TQPopupMenu *_popup, bool toggle )
498{
499 TDEToolBarButton * button = getButton( id );
500 if ( button )
501 button->setDelayedPopup( _popup, toggle );
502}
503
504
505void TDEToolBar::setAutoRepeat (int id, bool flag)
506{
507 TDEToolBarButton * button = getButton( id );
508 if ( button )
509 button->setAutoRepeat( flag );
510}
511
512
513void TDEToolBar::setToggle (int id, bool flag )
514{
515 TDEToolBarButton * button = getButton( id );
516 if ( button )
517 button->setToggle( flag );
518}
519
520
521void TDEToolBar::toggleButton (int id)
522{
523 TDEToolBarButton * button = getButton( id );
524 if ( button )
525 button->toggle();
526}
527
528
529void TDEToolBar::setButton (int id, bool flag)
530{
531 TDEToolBarButton * button = getButton( id );
532 if ( button )
533 button->on( flag );
534}
535
536
537bool TDEToolBar::isButtonOn (int id) const
538{
539 TDEToolBarButton * button = const_cast<TDEToolBar*>( this )->getButton( id );
540 return button ? button->isOn() : false;
541}
542
543
544void TDEToolBar::setLinedText (int id, const TQString& text)
545{
546 KLineEdit * lineEdit = getLined( id );
547 if ( lineEdit )
548 lineEdit->setText( text );
549}
550
551
552TQString TDEToolBar::getLinedText (int id) const
553{
554 KLineEdit * lineEdit = const_cast<TDEToolBar*>( this )->getLined( id );
555 return lineEdit ? lineEdit->text() : TQString::null;
556}
557
558
559void TDEToolBar::insertComboItem (int id, const TQString& text, int index)
560{
561 KComboBox * comboBox = getCombo( id );
562 if (comboBox)
563 comboBox->insertItem( text, index );
564}
565
566void TDEToolBar::insertComboList (int id, const TQStringList &list, int index)
567{
568 KComboBox * comboBox = getCombo( id );
569 if (comboBox)
570 comboBox->insertStringList( list, index );
571}
572
573
574void TDEToolBar::removeComboItem (int id, int index)
575{
576 KComboBox * comboBox = getCombo( id );
577 if (comboBox)
578 comboBox->removeItem( index );
579}
580
581
582void TDEToolBar::setCurrentComboItem (int id, int index)
583{
584 KComboBox * comboBox = getCombo( id );
585 if (comboBox)
586 comboBox->setCurrentItem( index );
587}
588
589
590void TDEToolBar::changeComboItem (int id, const TQString& text, int index)
591{
592 KComboBox * comboBox = getCombo( id );
593 if (comboBox)
594 comboBox->changeItem( text, index );
595}
596
597
598void TDEToolBar::clearCombo (int id)
599{
600 KComboBox * comboBox = getCombo( id );
601 if (comboBox)
602 comboBox->clear();
603}
604
605
606TQString TDEToolBar::getComboItem (int id, int index) const
607{
608 KComboBox * comboBox = const_cast<TDEToolBar*>( this )->getCombo( id );
609 return comboBox ? comboBox->text( index ) : TQString::null;
610}
611
612
613KComboBox * TDEToolBar::getCombo(int id)
614{
615 Id2WidgetMap::Iterator it = id2widget.find( id );
616 if ( it == id2widget.end() )
617 return 0;
618 return dynamic_cast<KComboBox *>( *it );
619}
620
621
622KLineEdit * TDEToolBar::getLined (int id)
623{
624 Id2WidgetMap::Iterator it = id2widget.find( id );
625 if ( it == id2widget.end() )
626 return 0;
627 return dynamic_cast<KLineEdit *>( *it );
628}
629
630
631TDEToolBarButton * TDEToolBar::getButton (int id)
632{
633 Id2WidgetMap::Iterator it = id2widget.find( id );
634 if ( it == id2widget.end() )
635 return 0;
636 return dynamic_cast<TDEToolBarButton *>( *it );
637}
638
639
640void TDEToolBar::alignItemRight (int id, bool right )
641{
642 Id2WidgetMap::Iterator it = id2widget.find( id );
643 if ( it == id2widget.end() )
644 return;
645 if ( rightAligned && !right && (*it) == rightAligned )
646 rightAligned = 0;
647 if ( (*it) && right )
648 rightAligned = (*it);
649}
650
651
652TQWidget *TDEToolBar::getWidget (int id)
653{
654 Id2WidgetMap::Iterator it = id2widget.find( id );
655 return ( it == id2widget.end() ) ? 0 : (*it);
656}
657
658
659void TDEToolBar::setItemAutoSized (int id, bool yes )
660{
661 TQWidget *w = getWidget(id);
662 if ( w && yes )
663 setStretchableWidget( w );
664}
665
666
667void TDEToolBar::clear ()
668{
669 /* Delete any idle buttons, so TQToolBar doesn't delete them itself, making a mess */
670 for(TQWidget *w=d->idleButtons.first(); w; w=d->idleButtons.next())
671 w->blockSignals(false);
672 d->idleButtons.clear();
673
674 TQToolBar::clear();
675 widget2id.clear();
676 id2widget.clear();
677}
678
679
680void TDEToolBar::removeItem(int id)
681{
682 Id2WidgetMap::Iterator it = id2widget.find( id );
683 if ( it == id2widget.end() )
684 {
685 kdDebug(220) << name() << " TDEToolBar::removeItem item " << id << " not found" << endl;
686 return;
687 }
688 TQWidget * w = (*it);
689 id2widget.remove( id );
690 widget2id.remove( w );
691 widgets.removeRef( w );
692 delete w;
693}
694
695
696void TDEToolBar::removeItemDelayed(int id)
697{
698 Id2WidgetMap::Iterator it = id2widget.find( id );
699 if ( it == id2widget.end() )
700 {
701 kdDebug(220) << name() << " TDEToolBar::removeItem item " << id << " not found" << endl;
702 return;
703 }
704 TQWidget * w = (*it);
705 id2widget.remove( id );
706 widget2id.remove( w );
707 widgets.removeRef( w );
708
709 w->blockSignals(true);
710 d->idleButtons.append(w);
711 layoutTimer->start( 50, true );
712}
713
714
715void TDEToolBar::hideItem (int id)
716{
717 TQWidget *w = getWidget(id);
718 if ( w )
719 w->hide();
720}
721
722
723void TDEToolBar::showItem (int id)
724{
725 TQWidget *w = getWidget(id);
726 if ( w )
727 w->show();
728}
729
730
731int TDEToolBar::itemIndex (int id)
732{
733 TQWidget *w = getWidget(id);
734 return w ? widgets.findRef(w) : -1;
735}
736
737int TDEToolBar::idAt (int index)
738{
739 TQWidget *w = widgets.at(index);
740 return widget2id[w];
741}
742
743void TDEToolBar::setFullSize(bool flag )
744{
745 setHorizontalStretchable( flag );
746 setVerticalStretchable( flag );
747}
748
749
750bool TDEToolBar::fullSize() const
751{
752 return isHorizontalStretchable() || isVerticalStretchable();
753}
754
755
756void TDEToolBar::enableMoving(bool flag )
757{
758 setMovingEnabled(flag);
759}
760
761
762void TDEToolBar::setBarPos (BarPosition bpos)
763{
764 if ( !mainWindow() )
765 return;
766 mainWindow()->moveDockWindow( this, (Dock)bpos );
767 //kdDebug(220) << name() << " setBarPos dockWindowIndex=" << dockWindowIndex() << endl;
768}
769
770
771TDEToolBar::BarPosition TDEToolBar::barPos() const
772{
773 if ( !this->mainWindow() )
774 return place() == TQDockWindow::InDock ? TDEToolBar::Top : TDEToolBar::Floating;
775 Dock dock;
776 int dm1, dm2;
777 bool dm3;
778 this->mainWindow()->getLocation( (TQToolBar*)this, dock, dm1, dm3, dm2 );
779 if ( dock == DockUnmanaged ) {
780 return (TDEToolBar::BarPosition)DockTop;
781 }
782 return (BarPosition)dock;
783}
784
785
786bool TDEToolBar::enable(BarStatus stat)
787{
788 bool mystat = isVisible();
789
790 if ( (stat == Toggle && mystat) || stat == Hide )
791 hide();
792 else
793 show();
794
795 return isVisible() == mystat;
796}
797
798
799void TDEToolBar::setMaxHeight ( int h )
800{
801 setMaximumHeight( h );
802}
803
804int TDEToolBar::maxHeight()
805{
806 return maximumHeight();
807}
808
809
810void TDEToolBar::setMaxWidth (int dw)
811{
812 setMaximumWidth( dw );
813}
814
815
816int TDEToolBar::maxWidth()
817{
818 return maximumWidth();
819}
820
821
822void TDEToolBar::setTitle (const TQString& _title)
823{
824 setLabel( _title );
825}
826
827
828void TDEToolBar::enableFloating (bool )
829{
830}
831
832
833void TDEToolBar::setIconText(IconText it)
834{
835 setIconText( it, true );
836}
837
838
839void TDEToolBar::setIconText(IconText icontext, bool update)
840{
841 bool doUpdate=false;
842
843 if (icontext != d->m_iconText) {
844 d->m_iconText = icontext;
845 doUpdate=true;
846 //kdDebug(220) << name() << " icontext has changed, doUpdate=true" << endl;
847 }
848 else {
849 //kdDebug(220) << name() << " icontext hasn't changed, doUpdate=false" << endl;
850 }
851
852 if (!update)
853 return;
854
855 if (doUpdate)
856 doModeChange(); // tell buttons what happened
857
858 // ugly hack to force a TQMainWindow::triggerLayout( true )
859 TQMainWindow *mw = mainWindow();
860 if ( mw ) {
861 mw->setUpdatesEnabled( false );
862 mw->setToolBarsMovable( !mw->toolBarsMovable() );
863 mw->setToolBarsMovable( !mw->toolBarsMovable() );
864 mw->setUpdatesEnabled( true );
865 }
866}
867
868
869TDEToolBar::IconText TDEToolBar::iconText() const
870{
871 return d->m_iconText;
872}
873
874
875void TDEToolBar::setIconSize(int size)
876{
877 setIconSize( size, true );
878}
879
880void TDEToolBar::setIconSize(int size, bool update)
881{
882 bool doUpdate=false;
883
884 if ( size != d->m_iconSize ) {
885 d->m_iconSize = size;
886 doUpdate=true;
887 }
888
889 if (!update)
890 return;
891
892 if (doUpdate)
893 doModeChange(); // tell buttons what happened
894
895 // ugly hack to force a TQMainWindow::triggerLayout( true )
896 if ( mainWindow() ) {
897 TQMainWindow *mw = mainWindow();
898 mw->setUpdatesEnabled( false );
899 mw->setToolBarsMovable( !mw->toolBarsMovable() );
900 mw->setToolBarsMovable( !mw->toolBarsMovable() );
901 mw->setUpdatesEnabled( true );
902 }
903}
904
905int TDEToolBar::iconSize() const
906{
907 if ( !d->m_iconSize ) // default value?
908 return iconSizeDefault();
909
910 return d->m_iconSize;
911}
912
913int TDEToolBar::iconSizeDefault() const
914{
915 if (!::qstrcmp(name(), "mainToolBar"))
916 return TDEGlobal::iconLoader()->currentSize(TDEIcon::MainToolbar);
917
918 return TDEGlobal::iconLoader()->currentSize(TDEIcon::Toolbar);
919}
920
921void TDEToolBar::setEnableContextMenu(bool enable )
922{
923 d->m_enableContext = enable;
924}
925
926
927bool TDEToolBar::contextMenuEnabled() const
928{
929 return d->m_enableContext;
930}
931
932
933void TDEToolBar::setItemNoStyle(int id, bool no_style )
934{
935 TDEToolBarButton * button = getButton( id );
936 if (button)
937 button->setNoStyle( no_style );
938}
939
940
941void TDEToolBar::setFlat (bool flag)
942{
943 if ( !mainWindow() )
944 return;
945 if ( flag )
946 mainWindow()->moveDockWindow( this, DockMinimized );
947 else
948 mainWindow()->moveDockWindow( this, DockTop );
949 // And remember to save the new look later
950 TDEMainWindow *kmw = dynamic_cast<TDEMainWindow *>(mainWindow());
951 if ( kmw )
952 kmw->setSettingsDirty();
953}
954
955
956int TDEToolBar::count() const
957{
958 return id2widget.count();
959}
960
961
962void TDEToolBar::saveState()
963{
964 // first, try to save to the xml file
965 if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() ) {
966 //kdDebug(220) << name() << " saveState: saving to " << d->m_xmlguiClient->xmlFile() << endl;
967 TQString barname(!::qstrcmp(name(), "unnamed") ? "mainToolBar" : name());
968 // try to find our toolbar
969 d->modified = false;
970 // go down one level to get to the right tags
971 TQDomElement current;
972 for( TQDomNode n = d->m_xmlguiClient->domDocument().documentElement().firstChild();
973 !n.isNull(); n = n.nextSibling()) {
974 current = n.toElement();
975
976 if ( current.tagName().lower() != "toolbar" )
977 continue;
978
979 TQString curname(current.attribute( "name" ));
980
981 if ( curname == barname ) {
982 saveState( current );
983 break;
984 }
985 }
986 // if we didn't make changes, then just return
987 if ( !d->modified )
988 return;
989
990 // now we load in the (non-merged) local file
991 TQString local_xml(KXMLGUIFactory::readConfigFile(d->m_xmlguiClient->xmlFile(), true, d->m_xmlguiClient->instance()));
992 TQDomDocument local;
993 local.setContent(local_xml);
994
995 // make sure we don't append if this toolbar already exists locally
996 bool just_append = true;
997
998 for( TQDomNode n = local.documentElement().firstChild();
999 !n.isNull(); n = n.nextSibling()) {
1000 TQDomElement elem = n.toElement();
1001
1002 if ( elem.tagName().lower() != "toolbar" )
1003 continue;
1004
1005 TQString curname(elem.attribute( "name" ));
1006
1007 if ( curname == barname ) {
1008 just_append = false;
1009 local.documentElement().replaceChild( current, elem );
1010 break;
1011 }
1012 }
1013
1014 if (just_append)
1015 local.documentElement().appendChild( current );
1016
1017 KXMLGUIFactory::saveConfigFile(local, d->m_xmlguiClient->localXMLFile(), d->m_xmlguiClient->instance() );
1018
1019 return;
1020 }
1021
1022 // if that didn't work, we save to the config file
1023 TDEConfig *config = TDEGlobal::config();
1024 saveSettings(config, TQString::null);
1025 config->sync();
1026}
1027
1028TQString TDEToolBar::settingsGroup() const
1029{
1030 TQString configGroup;
1031 if (!::qstrcmp(name(), "unnamed") || !::qstrcmp(name(), "mainToolBar"))
1032 configGroup = "Toolbar style";
1033 else
1034 configGroup = TQString(name()) + " Toolbar style";
1035 if ( this->mainWindow() )
1036 {
1037 configGroup.prepend(" ");
1038 configGroup.prepend( this->mainWindow()->name() );
1039 }
1040 return configGroup;
1041}
1042
1043void TDEToolBar::saveSettings(TDEConfig *config, const TQString &_configGroup)
1044{
1045 TQString configGroup = _configGroup;
1046 if (configGroup.isEmpty())
1047 configGroup = settingsGroup();
1048 //kdDebug(220) << name() << " saveSettings() group=" << _configGroup << " -> " << configGroup << endl;
1049
1050 TQString position, icontext;
1051 int index;
1052 getAttributes( position, icontext, index );
1053
1054 //kdDebug(220) << name() << " position=" << position << " index=" << index << " offset=" << offset() << " newLine=" << newLine() << endl;
1055
1056 TDEConfigGroupSaver saver(config, configGroup);
1057
1058 if(!config->hasDefault("Position") && position == d->PositionDefault )
1059 config->revertToDefault("Position");
1060 else
1061 config->writeEntry("Position", position);
1062
1063 //kdDebug(220) << name() << " icontext=" << icontext << " hasDefault:" << config->hasDefault( "IconText" ) << " d->IconTextDefault=" << d->IconTextDefault << endl;
1064
1065 if(d->m_honorStyle && icontext == d->IconTextDefault && !config->hasDefault("IconText") )
1066 {
1067 //kdDebug(220) << name() << " reverting icontext to default" << endl;
1068 config->revertToDefault("IconText");
1069 }
1070 else
1071 {
1072 //kdDebug(220) << name() << " writing icontext " << icontext << endl;
1073 config->writeEntry("IconText", icontext);
1074 }
1075
1076 if(!config->hasDefault("IconSize") && iconSize() == iconSizeDefault() )
1077 config->revertToDefault("IconSize");
1078 else
1079 config->writeEntry("IconSize", iconSize());
1080
1081 if(!config->hasDefault("Hidden") && isHidden() == d->HiddenDefault )
1082 config->revertToDefault("Hidden");
1083 else
1084 config->writeEntry("Hidden", isHidden());
1085
1086 // Note that index, unlike the other settings, depends on the other toolbars
1087 // So on the first run with a clean local config file, even the usual
1088 // hasDefault/==IndexDefault test would save the toolbar indexes
1089 // (IndexDefault was 0, whereas index is the real index in the GUI)
1090 //
1091 // Saving the whole set of indexes is necessary though. When moving only
1092 // one toolbar, if we only saved the changed indexes, the toolbars wouldn't
1093 // reappear at the same position the next time.
1094 // The whole set of indexes has to be saved.
1095 //kdDebug(220) << name() << " writing index " << index << endl;
1096 TDEMainWindow *kmw = dynamic_cast<TDEMainWindow *>(mainWindow());
1097 // don't save if there's only one toolbar
1098
1099 // Don't use kmw->toolBarIterator() because you might
1100 // mess up someone else's iterator. Make the list on your own
1101 TQPtrList<TDEToolBar> toolbarList;
1102 TQPtrList<TQToolBar> lst;
1103 for ( int i = (int)TQMainWindow::DockUnmanaged; i <= (int)DockMinimized; ++i ) {
1104 lst = kmw->toolBars( (ToolBarDock)i );
1105 for ( TQToolBar *tb = lst.first(); tb; tb = lst.next() ) {
1106 if ( !tb->inherits( "TDEToolBar" ) )
1107 continue;
1108 toolbarList.append( (TDEToolBar*)tb );
1109 }
1110 }
1111 TQPtrListIterator<TDEToolBar> toolbarIterator( toolbarList );
1112 if ( !kmw || toolbarIterator.count() > 1 )
1113 config->writeEntry("Index", index);
1114 else
1115 config->revertToDefault("Index");
1116
1117 if(!config->hasDefault("Offset") && offset() == d->OffsetDefault )
1118 config->revertToDefault("Offset");
1119 else
1120 config->writeEntry("Offset", offset());
1121
1122 if(!config->hasDefault("NewLine") && newLine() == d->NewLineDefault )
1123 config->revertToDefault("NewLine");
1124 else
1125 config->writeEntry("NewLine", newLine());
1126}
1127
1128
1129void TDEToolBar::setXMLGUIClient( KXMLGUIClient *client )
1130{
1131 d->m_xmlguiClient = client;
1132}
1133
1134void TDEToolBar::setText( const TQString & txt )
1135{
1136 setLabel( txt + " (" + tdeApp->caption() + ") " );
1137}
1138
1139
1140TQString TDEToolBar::text() const
1141{
1142 return label();
1143}
1144
1145
1146void TDEToolBar::doConnections( TDEToolBarButton *button )
1147{
1148 connect(button, TQ_SIGNAL(clicked(int)), this, TQ_SIGNAL( clicked( int ) ) );
1149 connect(button, TQ_SIGNAL(doubleClicked(int)), this, TQ_SIGNAL( doubleClicked( int ) ) );
1150 connect(button, TQ_SIGNAL(released(int)), this, TQ_SIGNAL( released( int ) ) );
1151 connect(button, TQ_SIGNAL(pressed(int)), this, TQ_SIGNAL( pressed( int ) ) );
1152 connect(button, TQ_SIGNAL(toggled(int)), this, TQ_SIGNAL( toggled( int ) ) );
1153 connect(button, TQ_SIGNAL(highlighted(int, bool)), this, TQ_SIGNAL( highlighted( int, bool ) ) );
1154}
1155
1156void TDEToolBar::mousePressEvent ( TQMouseEvent *m )
1157{
1158 if ( !mainWindow() )
1159 return;
1160 TQMainWindow *mw = mainWindow();
1161 if ( mw->toolBarsMovable() && d->m_enableContext ) {
1162 if ( m->button() == TQt::RightButton ) {
1163 TQGuardedPtr<TDEToolBar> guard( this );
1164 int i = contextMenu()->exec( m->globalPos(), 0 );
1165 // "Configure Toolbars" recreates toolbars, so we might not exist anymore.
1166 if ( guard )
1167 slotContextAboutToHide();
1168 switch ( i ) {
1169 case -1:
1170 return; // popup canceled
1171 case CONTEXT_LEFT:
1172 mw->moveDockWindow( this, DockLeft );
1173 break;
1174 case CONTEXT_RIGHT:
1175 mw->moveDockWindow( this, DockRight );
1176 break;
1177 case CONTEXT_TOP:
1178 mw->moveDockWindow( this, DockTop );
1179 break;
1180 case CONTEXT_BOTTOM:
1181 mw->moveDockWindow( this, DockBottom );
1182 break;
1183 case CONTEXT_FLOAT:
1184 mw->moveDockWindow( this, DockTornOff );
1185 break;
1186 case CONTEXT_FLAT:
1187 mw->moveDockWindow( this, DockMinimized );
1188 break;
1189 case CONTEXT_ICONS:
1190 setIconText( IconOnly );
1191 break;
1192 case CONTEXT_TEXTRIGHT:
1193 setIconText( IconTextRight );
1194 break;
1195 case CONTEXT_TEXT:
1196 setIconText( TextOnly );
1197 break;
1198 case CONTEXT_TEXTUNDER:
1199 setIconText( IconTextBottom );
1200 break;
1201 default:
1202 if ( i >= CONTEXT_ICONSIZES )
1203 setIconSize( i - CONTEXT_ICONSIZES );
1204 else
1205 return; // assume this was an action handled elsewhere, no need for setSettingsDirty()
1206 }
1207 TDEMainWindow *kmw = dynamic_cast<TDEMainWindow *>(mw);
1208 if ( kmw )
1209 kmw->setSettingsDirty();
1210 }
1211 }
1212}
1213
1214void TDEToolBar::doModeChange()
1215{
1216 for(TQWidget *w=d->idleButtons.first(); w; w=d->idleButtons.next())
1217 w->blockSignals(false);
1218 d->idleButtons.clear();
1219
1220 emit modechange();
1221}
1222
1223void TDEToolBar::rebuildLayout()
1224{
1225 for(TQWidget *w=d->idleButtons.first(); w; w=d->idleButtons.next())
1226 w->blockSignals(false);
1227 d->idleButtons.clear();
1228
1229 layoutTimer->stop();
1230 TQApplication::sendPostedEvents( this, TQEvent::ChildInserted );
1231 TQBoxLayout *l = boxLayout();
1232
1233 // clear the old layout
1234 TQLayoutIterator it = l->iterator();
1235 while ( it.current() )
1236 it.deleteCurrent();
1237
1238 for ( TQWidget *w = widgets.first(); w; w = widgets.next() ) {
1239 if ( w == rightAligned )
1240 continue;
1241 TDEToolBarSeparator *ktbs = dynamic_cast<TDEToolBarSeparator *>(w);
1242 if ( ktbs && !ktbs->showLine() ) {
1243 l->addSpacing( orientation() == TQt::Vertical ? w->sizeHint().height() : w->sizeHint().width() );
1244 w->hide();
1245 continue;
1246 }
1247 if ( dynamic_cast<TQPopupMenu *>(w) ) // w is a QPopupMenu?
1248 continue;
1249 l->addWidget( w );
1250 w->show();
1251 if ((orientation() == TQt::Horizontal) && dynamic_cast<TQLineEdit *>(w)) // w is TQLineEdit ?
1252 l->addSpacing(2); // A little bit extra spacing behind it.
1253 }
1254 if ( rightAligned ) {
1255 l->addStretch();
1256 l->addWidget( rightAligned );
1257 rightAligned->show();
1258 }
1259
1260 if ( fullSize() ) {
1261 if ( !rightAligned )
1262 l->addStretch();
1263 if ( stretchableWidget )
1264 l->setStretchFactor( stretchableWidget, 10 );
1265 }
1266 l->invalidate();
1267 TQApplication::postEvent( this, new TQEvent( TQEvent::LayoutHint ) );
1268}
1269
1270void TDEToolBar::childEvent( TQChildEvent *e )
1271{
1272 if ( e->child()->isWidgetType() ) {
1273 TQWidget * w = dynamic_cast<TQWidget *>(e->child());
1274 if (!w || !(::qstrcmp( "qt_dockwidget_internal", w->name())))
1275 {
1276 TQToolBar::childEvent( e );
1277 return;
1278 }
1279 if ( e->type() == TQEvent::ChildInserted ) {
1280 if ( !dynamic_cast<TQPopupMenu *>(w)) { // e->child() is not a QPopupMenu
1281 // prevent items that have been explicitly inserted by insert*() from
1282 // being inserted again
1283 if ( !widget2id.contains( w ) )
1284 {
1285 int dummy = -1;
1286 insertWidgetInternal( w, dummy, -1 );
1287 }
1288 }
1289 } else {
1290 removeWidgetInternal( w );
1291 }
1292 if ( isVisibleTo( 0 ) )
1293 {
1294 layoutTimer->start( 50, true );
1295 TQBoxLayout *l = boxLayout();
1296
1297 // clear the old layout so that we don't get unnecessary layout
1298 // changes until we have rebuilt the thing
1299 TQLayoutIterator it = l->iterator();
1300 while ( it.current() )
1301 it.deleteCurrent();
1302 }
1303 }
1304 TQToolBar::childEvent( e );
1305}
1306
1307void TDEToolBar::insertWidgetInternal( TQWidget *w, int &index, int id )
1308{
1309 // we can't have it in widgets, or something is really wrong
1310 //widgets.removeRef( w );
1311
1312 connect( w, TQ_SIGNAL( destroyed() ),
1313 this, TQ_SLOT( widgetDestroyed() ) );
1314 if ( index == -1 || index > (int)widgets.count() ) {
1315 index = (int)widgets.count();
1316 widgets.append( w );
1317 }
1318 else
1319 widgets.insert( index, w );
1320 if ( id == -1 )
1321 id = id2widget.count();
1322 id2widget.insert( id, w );
1323 widget2id.insert( w, id );
1324}
1325
1326void TDEToolBar::showEvent( TQShowEvent *e )
1327{
1328 TQToolBar::showEvent( e );
1329 rebuildLayout();
1330}
1331
1332void TDEToolBar::setStretchableWidget( TQWidget *w )
1333{
1334 TQToolBar::setStretchableWidget( w );
1335 stretchableWidget = w;
1336}
1337
1338TQSizePolicy TDEToolBar::sizePolicy() const
1339{
1340 if ( orientation() == TQt::Horizontal )
1341 return TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Fixed );
1342 else
1343 return TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Expanding );
1344}
1345
1346TQSize TDEToolBar::sizeHint() const
1347{
1348 TQSize minSize(0,0);
1349 TDEToolBar *ncThis = const_cast<TDEToolBar *>(this);
1350
1351 ncThis->polish();
1352
1353 int margin = ncThis->layout()->margin() + frameWidth();
1354 switch( barPos() )
1355 {
1356 case TDEToolBar::Top:
1357 case TDEToolBar::Bottom:
1358 for ( TQWidget *w = ncThis->widgets.first(); w; w = ncThis->widgets.next() )
1359 {
1360 TQSize sh = w->sizeHint();
1361 if ( w->sizePolicy().horData() == TQSizePolicy::Ignored )
1362 sh.setWidth( 1 );
1363 if ( w->sizePolicy().verData() == TQSizePolicy::Ignored )
1364 sh.setHeight( 1 );
1365 sh = sh.boundedTo( w->maximumSize() )
1366 .expandedTo( w->minimumSize() ).expandedTo( TQSize(1, 1) );
1367
1368 minSize = minSize.expandedTo(TQSize(0, sh.height()));
1369 minSize += TQSize(sh.width()+1, 0);
1370 if (dynamic_cast<TQLineEdit *>(w)) // w is a TQLineEdit ?
1371 minSize += TQSize(2, 0); // A little bit extra spacing behind it.
1372 }
1373
1374 minSize += TQSize(TQApplication::style().pixelMetric( TQStyle::PM_DockWindowHandleExtent ), 0);
1375 minSize += TQSize(margin*2, margin*2);
1376 break;
1377
1378 case TDEToolBar::Left:
1379 case TDEToolBar::Right:
1380 for ( TQWidget *w = ncThis->widgets.first(); w; w = ncThis->widgets.next() )
1381 {
1382 TQSize sh = w->sizeHint();
1383 if ( w->sizePolicy().horData() == TQSizePolicy::Ignored )
1384 sh.setWidth( 1 );
1385 if ( w->sizePolicy().verData() == TQSizePolicy::Ignored )
1386 sh.setHeight( 1 );
1387 sh = sh.boundedTo( w->maximumSize() )
1388 .expandedTo( w->minimumSize() ).expandedTo( TQSize(1, 1) );
1389
1390 minSize = minSize.expandedTo(TQSize(sh.width(), 0));
1391 minSize += TQSize(0, sh.height()+1);
1392 }
1393 minSize += TQSize(0, TQApplication::style().pixelMetric( TQStyle::PM_DockWindowHandleExtent ));
1394 minSize += TQSize(margin*2, margin*2);
1395 break;
1396
1397 default:
1398 minSize = TQToolBar::sizeHint();
1399 break;
1400 }
1401 return minSize;
1402}
1403
1404TQSize TDEToolBar::minimumSize() const
1405{
1406 return minimumSizeHint();
1407}
1408
1409TQSize TDEToolBar::minimumSizeHint() const
1410{
1411 return sizeHint();
1412}
1413
1414bool TDEToolBar::highlight() const
1415{
1416 return d->m_highlight;
1417}
1418
1419void TDEToolBar::hide()
1420{
1421 TQToolBar::hide();
1422}
1423
1424void TDEToolBar::show()
1425{
1426 TQToolBar::show();
1427}
1428
1429void TDEToolBar::resizeEvent( TQResizeEvent *e )
1430{
1431 bool b = isUpdatesEnabled();
1432 setUpdatesEnabled( false );
1433 TQToolBar::resizeEvent( e );
1434 if (b)
1435 {
1436 if (layoutTimer->isActive())
1437 {
1438 // Wait with repainting till layout is complete.
1439 d->repaintTimer.start( 100, true );
1440 }
1441 else
1442 {
1443 // Repaint now
1444 slotRepaint();
1445 }
1446 }
1447// else {
1448// printf("[WARNING] In TDEToolBar::resizeEvent, but this code block should not be executing. Preventing toolbar lockup. [Code 0045]\n");
1449// setUpdatesEnabled( true );
1450// }
1451}
1452
1453void TDEToolBar::slotIconChanged(int group)
1454{
1455 if ((group != TDEIcon::Toolbar) && (group != TDEIcon::MainToolbar))
1456 return;
1457 if ((group == TDEIcon::MainToolbar) != !::qstrcmp(name(), "mainToolBar"))
1458 return;
1459
1460 doModeChange();
1461
1462 if (isVisible())
1463 updateGeometry();
1464}
1465
1466void TDEToolBar::slotReadConfig()
1467{
1468 //kdDebug(220) << name() << " slotReadConfig" << endl;
1469 // Read appearance settings (hmm, we used to do both here,
1470 // but a well behaved application will call applyMainWindowSettings
1471 // anyway, right ?)
1472 applyAppearanceSettings(TDEGlobal::config(), TQString::null );
1473}
1474
1475void TDEToolBar::slotAppearanceChanged()
1476{
1477 // Read appearance settings from global file.
1478 applyAppearanceSettings(TDEGlobal::config(), TQString::null, true /* lose local settings */ );
1479
1480 // And remember to save the new look later
1481 TDEMainWindow *kmw = dynamic_cast<TDEMainWindow *>(mainWindow());
1482 if ( kmw )
1483 kmw->setSettingsDirty();
1484}
1485
1486//static
1487bool TDEToolBar::highlightSetting()
1488{
1489 TQString grpToolbar(TQString::fromLatin1("Toolbar style"));
1490 TDEConfigGroupSaver saver(TDEGlobal::config(), grpToolbar);
1491 return TDEGlobal::config()->readBoolEntry(TQString::fromLatin1("Highlighting"),true);
1492}
1493
1494//static
1495bool TDEToolBar::transparentSetting()
1496{
1497 TQString grpToolbar(TQString::fromLatin1("Toolbar style"));
1498 TDEConfigGroupSaver saver(TDEGlobal::config(), grpToolbar);
1499 return TDEGlobal::config()->readBoolEntry(TQString::fromLatin1("TransparentMoving"),true);
1500}
1501
1502//static
1503TDEToolBar::IconText TDEToolBar::iconTextSetting()
1504{
1505 TQString grpToolbar(TQString::fromLatin1("Toolbar style"));
1506 TDEConfigGroupSaver saver(TDEGlobal::config(), grpToolbar);
1507 TQString icontext = TDEGlobal::config()->readEntry(TQString::fromLatin1("IconText"),TQString::fromLatin1("IconOnly"));
1508 if ( icontext == "IconTextRight" )
1509 return IconTextRight;
1510 else if ( icontext == "IconTextBottom" )
1511 return IconTextBottom;
1512 else if ( icontext == "TextOnly" )
1513 return TextOnly;
1514 else
1515 return IconOnly;
1516}
1517
1518void TDEToolBar::applyAppearanceSettings(TDEConfig *config, const TQString &_configGroup, bool forceGlobal)
1519{
1520 TQString configGroup = _configGroup.isEmpty() ? settingsGroup() : _configGroup;
1521 //kdDebug(220) << name() << " applyAppearanceSettings: configGroup=" << configGroup << " forceGlobal=" << forceGlobal << endl;
1522
1523 // If we have application-specific settings in the XML file,
1524 // and nothing in the application's config file, then
1525 // we don't apply the global defaults, the XML ones are preferred
1526 // (see applySettings for a full explanation)
1527 // This is the reason for the xmlgui tests below.
1528 bool xmlgui = d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty();
1529
1530 TDEConfig *gconfig = TDEGlobal::config();
1531
1532 static const TQString &attrIconText = TDEGlobal::staticQString("IconText");
1533 static const TQString &attrHighlight = TDEGlobal::staticQString("Highlighting");
1534 static const TQString &attrTrans = TDEGlobal::staticQString("TransparentMoving");
1535 static const TQString &attrIconSize = TDEGlobal::staticQString("IconSize");
1536
1537 // we actually do this in two steps.
1538 // First, we read in the global styles [Toolbar style] (from the KControl module).
1539 // Then, if the toolbar is NOT 'mainToolBar', we will also try to read in [barname Toolbar style]
1540 bool highlight;
1541 int transparent;
1542 bool applyIconText = !xmlgui; // if xmlgui is used, global defaults won't apply
1543 bool applyIconSize = !xmlgui;
1544
1545 int iconSize = d->IconSizeDefault;
1546 TQString iconText = d->IconTextDefault;
1547
1548 // this is the first iteration
1549 TQString grpToolbar(TQString::fromLatin1("Toolbar style"));
1550 { // start block for TDEConfigGroupSaver
1551 TDEConfigGroupSaver saver(gconfig, grpToolbar);
1552
1553 // first, get the generic settings
1554 highlight = gconfig->readBoolEntry(attrHighlight, true);
1555 transparent = gconfig->readBoolEntry(attrTrans, true);
1556
1557 // we read in the IconText property *only* if we intend on actually
1558 // honoring it
1559 if (d->m_honorStyle)
1560 d->IconTextDefault = gconfig->readEntry(attrIconText, d->IconTextDefault);
1561 else
1562 d->IconTextDefault = "IconOnly";
1563
1564 // Use the default icon size for toolbar icons.
1565 d->IconSizeDefault = gconfig->readNumEntry(attrIconSize, d->IconSizeDefault);
1566
1567 iconSize = d->IconSizeDefault;
1568 iconText = d->IconTextDefault;
1569
1570 if ( !forceGlobal && config->hasGroup(configGroup) )
1571 {
1572 config->setGroup(configGroup);
1573
1574 // first, get the generic settings
1575 highlight = config->readBoolEntry(attrHighlight, highlight);
1576 transparent = config->readBoolEntry(attrTrans, transparent);
1577
1578 // read in the IconText property
1579 if ( config->hasKey( attrIconText ) ) {
1580 iconText = config->readEntry(attrIconText);
1581 applyIconText = true;
1582 //kdDebug(220) << name() << " read icontext=" << d->IconTextDefault << ", that will be the default" << endl;
1583 }
1584
1585 // now get the size
1586 if ( config->hasKey( attrIconSize ) ) {
1587 iconSize = config->readNumEntry(attrIconSize);
1588 applyIconSize = true;
1589 }
1590 }
1591
1592 // revert back to the old group
1593 } // end block for TDEConfigGroupSaver
1594
1595 bool doUpdate = false;
1596
1597 IconText icon_text;
1598 if ( iconText == "IconTextRight" )
1599 icon_text = IconTextRight;
1600 else if ( iconText == "IconTextBottom" )
1601 icon_text = IconTextBottom;
1602 else if ( iconText == "TextOnly" )
1603 icon_text = TextOnly;
1604 else
1605 icon_text = IconOnly;
1606
1607 // check if the icon/text has changed
1608 if (icon_text != d->m_iconText && applyIconText) {
1609 //kdDebug(220) << name() << " applyAppearanceSettings setIconText " << icon_text << endl;
1610 setIconText(icon_text, false);
1611 doUpdate = true;
1612 }
1613
1614 // ...and check if the icon size has changed
1615 if (iconSize != d->m_iconSize && applyIconSize) {
1616 setIconSize(iconSize, false);
1617 doUpdate = true;
1618 }
1619
1620 TQMainWindow *mw = mainWindow();
1621
1622 // ...and if we should highlight
1623 if ( highlight != d->m_highlight ) {
1624 d->m_highlight = highlight;
1625 doUpdate = true;
1626 }
1627
1628 // ...and if we should move transparently
1629 if ( mw && transparent != (!mw->opaqueMoving()) ) {
1630 mw->setOpaqueMoving( !transparent );
1631 }
1632
1633 if (doUpdate)
1634 doModeChange(); // tell buttons what happened
1635
1636 if (isVisible ())
1637 updateGeometry();
1638}
1639
1640void TDEToolBar::applySettings(TDEConfig *config, const TQString &_configGroup)
1641{
1642 return applySettings(config,_configGroup,false);
1643}
1644
1645void TDEToolBar::applySettings(TDEConfig *config, const TQString &_configGroup, bool force)
1646{
1647 //kdDebug(220) << name() << " applySettings group=" << _configGroup << endl;
1648
1649 TQString configGroup = _configGroup.isEmpty() ? settingsGroup() : _configGroup;
1650
1651 /*
1652 Let's explain this a bit more in details.
1653 The order in which we apply settings is :
1654 Global config / <appnamerc> user settings if no XMLGUI is used
1655 Global config / App-XML attributes / <appnamerc> user settings if XMLGUI is used
1656
1657 So in the first case, we simply read everything from TDEConfig as below,
1658 but in the second case we don't do anything here if there is no app-specific config,
1659 and the XMLGUI-related code (loadState()) uses the static methods of this class
1660 to get the global defaults.
1661
1662 Global config doesn't include position (index, offset, newline and hidden/shown).
1663 */
1664
1665 // First the appearance stuff - the one which has a global config
1666 applyAppearanceSettings( config, configGroup );
1667
1668 // ...and now the position stuff
1669 if ( config->hasGroup(configGroup) || force )
1670 {
1671 TDEConfigGroupSaver cgs(config, configGroup);
1672
1673 static const TQString &attrPosition = TDEGlobal::staticQString("Position");
1674 static const TQString &attrIndex = TDEGlobal::staticQString("Index");
1675 static const TQString &attrOffset = TDEGlobal::staticQString("Offset");
1676 static const TQString &attrNewLine = TDEGlobal::staticQString("NewLine");
1677 static const TQString &attrHidden = TDEGlobal::staticQString("Hidden");
1678
1679 TQString position = config->readEntry(attrPosition, d->PositionDefault);
1680 int index = config->readNumEntry(attrIndex, -1);
1681 int offset = config->readNumEntry(attrOffset, d->OffsetDefault);
1682 bool newLine = config->readBoolEntry(attrNewLine, d->NewLineDefault);
1683 bool hidden = config->readBoolEntry(attrHidden, d->HiddenDefault);
1684
1685 Dock pos(DockTop);
1686 if ( position == "Top" )
1687 pos = DockTop;
1688 else if ( position == "Bottom" )
1689 pos = DockBottom;
1690 else if ( position == "Left" )
1691 pos = DockLeft;
1692 else if ( position == "Right" )
1693 pos = DockRight;
1694 else if ( position == "Floating" )
1695 pos = DockTornOff;
1696 else if ( position == "Flat" )
1697 pos = DockMinimized;
1698
1699 //kdDebug(220) << name() << " applySettings hidden=" << hidden << endl;
1700 if (hidden)
1701 hide();
1702 else
1703 show();
1704
1705 if ( mainWindow() )
1706 {
1707 //kdDebug(220) << name() << " applySettings updating ToolbarInfo" << endl;
1708 d->toolBarInfo = TDEToolBarPrivate::ToolBarInfo( pos, index, newLine, offset );
1709 positionYourself( true );
1710 }
1711 if (isVisible ())
1712 updateGeometry();
1713 }
1714}
1715
1716bool TDEToolBar::event( TQEvent *e )
1717{
1718 if ( (e->type() == TQEvent::LayoutHint) && isUpdatesEnabled() )
1719 d->repaintTimer.start( 100, true );
1720
1721 if (e->type() == TQEvent::ChildInserted )
1722 {
1723 // Bypass TQToolBar::event,
1724 // it will show() the inserted child and we don't want to
1725 // do that until we have rebuilt the layout.
1726 childEvent((TQChildEvent *)e);
1727 return true;
1728 }
1729
1730 return TQToolBar::event( e );
1731}
1732
1733void TDEToolBar::slotRepaint()
1734{
1735 setUpdatesEnabled( false );
1736 // Send a resizeEvent to update the "toolbar extension arrow"
1737 // (The button you get when your toolbar-items don't fit in
1738 // the available space)
1739 TQResizeEvent ev(size(), size());
1740 resizeEvent(&ev);
1741 TQApplication::sendPostedEvents( this, TQEvent::LayoutHint );
1742 setUpdatesEnabled( true );
1743 repaint( true );
1744}
1745
1746void TDEToolBar::toolBarPosChanged( TQToolBar *tb )
1747{
1748 if ( tb != this )
1749 return;
1750 if ( d->oldPos == DockMinimized )
1751 rebuildLayout();
1752 d->oldPos = (TQMainWindow::ToolBarDock)barPos();
1753 TDEMainWindow *kmw = dynamic_cast<TDEMainWindow *>(mainWindow());
1754 if ( kmw )
1755 kmw->setSettingsDirty();
1756}
1757
1758static TDEToolBar::Dock stringToDock( const TQString& attrPosition )
1759{
1760 TDEToolBar::Dock dock = TDEToolBar::DockTop;
1761 if ( !attrPosition.isEmpty() ) {
1762 if ( attrPosition == "top" )
1763 dock = TDEToolBar::DockTop;
1764 else if ( attrPosition == "left" )
1765 dock = TDEToolBar::DockLeft;
1766 else if ( attrPosition == "right" )
1767 dock = TDEToolBar::DockRight;
1768 else if ( attrPosition == "bottom" )
1769 dock = TDEToolBar::DockBottom;
1770 else if ( attrPosition == "floating" )
1771 dock = TDEToolBar::DockTornOff;
1772 else if ( attrPosition == "flat" )
1773 dock = TDEToolBar::DockMinimized;
1774 }
1775 return dock;
1776}
1777
1778
1779void TDEToolBar::loadState( const TQDomElement &element )
1780{
1781 TQMainWindow *mw = mainWindow();
1782
1783 if ( !mw )
1784 return;
1785
1786 {
1787 TQCString text = element.namedItem( "text" ).toElement().text().utf8();
1788 if ( text.isEmpty() )
1789 text = element.namedItem( "Text" ).toElement().text().utf8();
1790 if ( !text.isEmpty() )
1791 setText( i18n( text ) );
1792 }
1793
1794 {
1795 TQCString attrFullWidth = element.attribute( "fullWidth" ).lower().latin1();
1796 if ( !attrFullWidth.isEmpty() )
1797 setFullSize( attrFullWidth == "true" );
1798 }
1799
1800 /*
1801 This method is called in order to load toolbar settings from XML.
1802 However this can be used in two rather different cases:
1803 - for the initial loading of the app's XML. In that case the settings
1804 are only the defaults, the user's TDEConfig settings will override them
1805 (KDE4 TODO: how about saving those user settings into the local XML file instead?
1806 Then this whole thing would be simpler, no TDEConfig settings to apply afterwards.
1807 OTOH we'd have to migrate those settings when the .rc version increases,
1808 like we do for shortcuts)
1809
1810 - for later re-loading when switching between parts in KXMLGUIFactory.
1811 In that case the XML contains the final settings, not the defaults.
1812 We do need the defaults, and the toolbar might have been completely
1813 deleted and recreated meanwhile. So we store the app-default settings
1814 into the XML.
1815 */
1816 bool loadingAppDefaults = true;
1817 if ( element.hasAttribute( "offsetDefault" ) )
1818 {
1819 // this isn't the first time, so the defaults have been saved into the (in-memory) XML
1820 loadingAppDefaults = false;
1821 d->OffsetDefault = element.attribute( "offsetDefault" ).toInt();
1822 d->NewLineDefault = element.attribute( "newlineDefault" ) == "true";
1823 d->HiddenDefault = element.attribute( "hiddenDefault" ) == "true";
1824 d->IconSizeDefault = element.attribute( "iconSizeDefault" ).toInt();
1825 d->PositionDefault = element.attribute( "positionDefault" );
1826 d->IconTextDefault = element.attribute( "iconTextDefault" );
1827 }
1828 //kdDebug(220) << name() << " loadState loadingAppDefaults=" << loadingAppDefaults << endl;
1829
1830 Dock dock = stringToDock( element.attribute( "position" ).lower() );
1831
1832 {
1833 TQCString attrIconText = element.attribute( "iconText" ).lower().latin1();
1834 if ( !attrIconText.isEmpty() ) {
1835 //kdDebug(220) << name() << " loadState attrIconText=" << attrIconText << endl;
1836 if ( attrIconText == "icontextright" )
1837 setIconText( TDEToolBar::IconTextRight );
1838 else if ( attrIconText == "textonly" )
1839 setIconText( TDEToolBar::TextOnly );
1840 else if ( attrIconText == "icontextbottom" )
1841 setIconText( TDEToolBar::IconTextBottom );
1842 else if ( attrIconText == "icononly" )
1843 setIconText( TDEToolBar::IconOnly );
1844 } else
1845 {
1846 //kdDebug(220) << name() << " loadState no iconText attribute in XML, using iconTextSetting=" << iconTextSetting() << endl;
1847 // Use global setting
1848 if (d->m_honorStyle)
1849 setIconText( iconTextSetting() );
1850 else
1851 setIconText( d->IconTextDefault );
1852 }
1853 }
1854
1855 TQString attrIconSize = element.attribute( "iconSize" ).lower();
1856 int iconSize = d->IconSizeDefault;
1857 if ( !attrIconSize.isEmpty() )
1858 iconSize = attrIconSize.toInt();
1859 setIconSize( iconSize );
1860
1861 int index = -1; // append by default. This is very important, otherwise
1862 // with all 0 indexes, we keep reversing the toolbars.
1863 {
1864 TQString attrIndex = element.attribute( "index" ).lower();
1865 if ( !attrIndex.isEmpty() )
1866 index = attrIndex.toInt();
1867 }
1868
1869 int offset = d->OffsetDefault;
1870 bool newLine = d->NewLineDefault;
1871 bool hidden = d->HiddenDefault;
1872
1873 {
1874 TQString attrOffset = element.attribute( "offset" );
1875 if ( !attrOffset.isEmpty() )
1876 offset = attrOffset.toInt();
1877 }
1878
1879 {
1880 TQString attrNewLine = element.attribute( "newline" ).lower();
1881 if ( !attrNewLine.isEmpty() )
1882 newLine = attrNewLine == "true";
1883 }
1884
1885 {
1886 TQString attrHidden = element.attribute( "hidden" ).lower();
1887 if ( !attrHidden.isEmpty() ) {
1888 hidden = attrHidden == "true";
1889 }
1890 }
1891
1892 d->toolBarInfo = TDEToolBarPrivate::ToolBarInfo( dock, index, newLine, offset );
1893 mw->addDockWindow( this, dock, newLine );
1894 mw->moveDockWindow( this, dock, newLine, index, offset );
1895
1896 // Apply the highlight button setting
1897 d->m_highlight = highlightSetting();
1898
1899 if ( hidden )
1900 hide();
1901 else
1902 show();
1903
1904 if ( loadingAppDefaults )
1905 {
1906 getAttributes( d->PositionDefault, d->IconTextDefault, index );
1907 //kdDebug(220) << name() << " loadState IconTextDefault=" << d->IconTextDefault << endl;
1908 d->OffsetDefault = offset;
1909 d->NewLineDefault = newLine;
1910 d->HiddenDefault = hidden;
1911 d->IconSizeDefault = iconSize;
1912 }
1913 //kdDebug(220) << name() << " loadState hidden=" << hidden << endl;
1914
1915 // Apply transparent-toolbar-moving setting (ok, this is global to the mainwindow,
1916 // but we do it only if there are toolbars...)
1917 // KDE4: move to TDEMainWindow
1918 if ( transparentSetting() != !mw->opaqueMoving() ) {
1919 mw->setOpaqueMoving( !transparentSetting() );
1920 }
1921}
1922
1923int TDEToolBar::dockWindowIndex()
1924{
1925 int index = 0;
1926 Q_ASSERT( mainWindow() );
1927 if ( mainWindow() ) {
1928 TQMainWindow::ToolBarDock dock;
1929 bool newLine;
1930 int offset;
1931 mainWindow()->getLocation( this, dock, index, newLine, offset );
1932 }
1933 return index;
1934}
1935
1936void TDEToolBar::getAttributes( TQString &position, TQString &icontext, int &index )
1937{
1938 // get all of the stuff to save
1939 switch ( barPos() ) {
1940 case TDEToolBar::Flat:
1941 position = "Flat";
1942 break;
1943 case TDEToolBar::Bottom:
1944 position = "Bottom";
1945 break;
1946 case TDEToolBar::Left:
1947 position = "Left";
1948 break;
1949 case TDEToolBar::Right:
1950 position = "Right";
1951 break;
1952 case TDEToolBar::Floating:
1953 position = "Floating";
1954 break;
1955 case TDEToolBar::Top:
1956 default:
1957 position = "Top";
1958 break;
1959 }
1960
1961 index = dockWindowIndex();
1962
1963 switch (d->m_iconText) {
1964 case TDEToolBar::IconTextRight:
1965 icontext = "IconTextRight";
1966 break;
1967 case TDEToolBar::IconTextBottom:
1968 icontext = "IconTextBottom";
1969 break;
1970 case TDEToolBar::TextOnly:
1971 icontext = "TextOnly";
1972 break;
1973 case TDEToolBar::IconOnly:
1974 default:
1975 icontext = "IconOnly";
1976 break;
1977 }
1978 //kdDebug(220) << name() << " getAttributes: icontext=" << icontext << endl;
1979}
1980
1981void TDEToolBar::saveState( TQDomElement &current )
1982{
1983 Q_ASSERT( !current.isNull() );
1984 TQString position, icontext;
1985 int index = -1;
1986 getAttributes( position, icontext, index );
1987
1988 current.setAttribute( "noMerge", "1" );
1989 current.setAttribute( "position", position );
1990 current.setAttribute( "iconText", icontext );
1991 current.setAttribute( "index", index );
1992 current.setAttribute( "offset", offset() );
1993 current.setAttribute( "newline", newLine() );
1994 if ( isHidden() )
1995 current.setAttribute( "hidden", "true" );
1996 d->modified = true;
1997
1998 // TODO if this method is used by more than KXMLGUIBuilder, e.g. to save XML settings to *disk*,
1999 // then the stuff below shouldn't always be done.
2000 current.setAttribute( "offsetDefault", d->OffsetDefault );
2001 current.setAttribute( "newlineDefault", d->NewLineDefault );
2002 current.setAttribute( "hiddenDefault", d->HiddenDefault ? "true" : "false" );
2003 current.setAttribute( "iconSizeDefault", d->IconSizeDefault );
2004 current.setAttribute( "positionDefault", d->PositionDefault );
2005 current.setAttribute( "iconTextDefault", d->IconTextDefault );
2006
2007 //kdDebug(220) << name() << " saveState: saving index=" << index << " iconText=" << icontext << " hidden=" << isHidden() << endl;
2008}
2009
2010// Called by TDEMainWindow::finalizeGUI
2011void TDEToolBar::positionYourself( bool force )
2012{
2013 if (force)
2014 d->positioned = false;
2015
2016 if ( d->positioned || !mainWindow() )
2017 {
2018 //kdDebug(220) << name() << " positionYourself d->positioned=true ALREADY DONE" << endl;
2019 return;
2020 }
2021 // we can't test for ForceHide after moveDockWindow because QDockArea
2022 // does a reparent() with showIt == true
2023 bool hidden = isHidden();
2024 //kdDebug(220) << name() << " positionYourself dock=" << d->toolBarInfo.dock << " newLine=" << d->toolBarInfo.newline << " index=" << d->toolBarInfo.index << " offset=" << d->toolBarInfo.offset << endl;
2025 mainWindow()->moveDockWindow( this, d->toolBarInfo.dock,
2026 d->toolBarInfo.newline,
2027 d->toolBarInfo.index,
2028 d->toolBarInfo.offset );
2029
2030 //kdDebug(220) << name() << " positionYourself dockWindowIndex=" << dockWindowIndex() << endl;
2031 if ( hidden )
2032 hide();
2033 else
2034 show();
2035 // This method can only have an effect once - unless force is set
2036 d->positioned = true;
2037}
2038
2039TDEPopupMenu *TDEToolBar::contextMenu()
2040{
2041 if ( context )
2042 return context;
2043 // Construct our context popup menu. Name it qt_dockwidget_internal so it
2044 // won't be deleted by TQToolBar::clear().
2045 context = new TDEPopupMenu( this, "qt_dockwidget_internal" );
2046 context->insertTitle(i18n("Toolbar Menu"));
2047
2048 TDEPopupMenu *orient = new TDEPopupMenu( context, "orient" );
2049 orient->insertItem( i18n("toolbar position string","Top"), CONTEXT_TOP );
2050 orient->insertItem( i18n("toolbar position string","Left"), CONTEXT_LEFT );
2051 orient->insertItem( i18n("toolbar position string","Right"), CONTEXT_RIGHT );
2052 orient->insertItem( i18n("toolbar position string","Bottom"), CONTEXT_BOTTOM );
2053 orient->insertSeparator(-1);
2054 orient->insertItem( i18n("toolbar position string","Floating"), CONTEXT_FLOAT );
2055 orient->insertItem( i18n("min toolbar", "Flat"), CONTEXT_FLAT );
2056
2057 TDEPopupMenu *mode = new TDEPopupMenu( context, "mode" );
2058 mode->insertItem( i18n("Icons Only"), CONTEXT_ICONS );
2059 mode->insertItem( i18n("Text Only"), CONTEXT_TEXT );
2060 mode->insertItem( i18n("Text Alongside Icons"), CONTEXT_TEXTRIGHT );
2061 mode->insertItem( i18n("Text Under Icons"), CONTEXT_TEXTUNDER );
2062
2063 TDEPopupMenu *size = new TDEPopupMenu( context, "size" );
2064 size->insertItem( i18n("Default"), CONTEXT_ICONSIZES );
2065 // Query the current theme for available sizes
2066 TDEIconTheme *theme = TDEGlobal::instance()->iconLoader()->theme();
2067 TQValueList<int> avSizes;
2068 if (theme)
2069 {
2070 if (!::qstrcmp(name(), "mainToolBar"))
2071 avSizes = theme->querySizes( TDEIcon::MainToolbar);
2072 else
2073 avSizes = theme->querySizes( TDEIcon::Toolbar);
2074 }
2075
2076 d->iconSizes = avSizes;
2077 qHeapSort(avSizes);
2078
2079 TQValueList<int>::Iterator it;
2080 if (avSizes.count() < 10) {
2081 // Fixed or threshold type icons
2082 TQValueList<int>::Iterator end(avSizes.end());
2083 for (it=avSizes.begin(); it!=end; ++it) {
2084 TQString text;
2085 if ( *it < 19 )
2086 text = i18n("Small (%1x%2)").arg(*it).arg(*it);
2087 else if (*it < 25)
2088 text = i18n("Medium (%1x%2)").arg(*it).arg(*it);
2089 else if (*it < 35)
2090 text = i18n("Large (%1x%2)").arg(*it).arg(*it);
2091 else
2092 text = i18n("Huge (%1x%2)").arg(*it).arg(*it);
2093 //we use the size as an id, with an offset
2094 size->insertItem( text, CONTEXT_ICONSIZES + *it );
2095 }
2096 }
2097 else {
2098 // Scalable icons.
2099 const int progression[] = {16, 22, 32, 48, 64, 96, 128, 192, 256};
2100
2101 it = avSizes.begin();
2102 for (uint i = 0; i < 9; i++) {
2103 while (it++ != avSizes.end()) {
2104 if (*it >= progression[i]) {
2105 TQString text;
2106 if ( *it < 19 )
2107 text = i18n("Small (%1x%2)").arg(*it).arg(*it);
2108 else if (*it < 25)
2109 text = i18n("Medium (%1x%2)").arg(*it).arg(*it);
2110 else if (*it < 35)
2111 text = i18n("Large (%1x%2)").arg(*it).arg(*it);
2112 else
2113 text = i18n("Huge (%1x%2)").arg(*it).arg(*it);
2114 //we use the size as an id, with an offset
2115 size->insertItem( text, CONTEXT_ICONSIZES + *it );
2116 break;
2117 }
2118 }
2119 }
2120 }
2121
2122 context->insertItem( i18n("Orientation"), orient );
2123 orient->setItemChecked(CONTEXT_TOP, true);
2124 context->insertItem( i18n("Text Position"), mode );
2125 context->setItemChecked(CONTEXT_ICONS, true);
2126 context->insertItem( i18n("Icon Size"), size );
2127
2128 connect( context, TQ_SIGNAL( aboutToShow() ), this, TQ_SLOT( slotContextAboutToShow() ) );
2129 // Unplugging a submenu from abouttohide leads to the popupmenu floating around
2130 // So better simply call that code from after exec() returns (DF)
2131 //connect( context, TQ_SIGNAL( aboutToHide() ), this, TQ_SLOT( slotContextAboutToHide() ) );
2132 return context;
2133}
2134
2135void TDEToolBar::slotContextAboutToShow()
2136{
2137 // The idea here is to reuse the "static" part of the menu to save time.
2138 // But the "Toolbars" action is dynamic (can be a single action or a submenu)
2139 // and ToolBarHandler::setupActions() deletes it, so better not keep it around.
2140 // So we currently plug/unplug the last two actions of the menu.
2141 // Another way would be to keep around the actions and plug them all into a (new each time) popupmenu.
2142 TDEMainWindow *kmw = dynamic_cast<TDEMainWindow *>(mainWindow());
2143 if ( kmw ) {
2144 kmw->setupToolbarMenuActions();
2145 // Only allow hiding a toolbar if the action is also plugged somewhere else (e.g. menubar)
2146 TDEAction *tbAction = kmw->toolBarMenuAction();
2147 if ( tbAction && tbAction->containerCount() > 0 )
2148 tbAction->plug(context);
2149 }
2150
2151 // try to find "configure toolbars" action
2152 TDEAction *configureAction = 0;
2153 const char* actionName = KStdAction::name(KStdAction::ConfigureToolbars);
2154 if ( d->m_xmlguiClient )
2155 configureAction = d->m_xmlguiClient->actionCollection()->action(actionName);
2156 if ( !configureAction && kmw )
2157 configureAction = kmw->actionCollection()->action(actionName);
2158 if ( configureAction )
2159 configureAction->plug(context);
2160 KEditToolbar::setDefaultToolbar(name());
2161
2162 for(int i = CONTEXT_ICONS; i <= CONTEXT_TEXTUNDER; ++i)
2163 context->setItemChecked(i, false);
2164
2165 switch( d->m_iconText )
2166 {
2167 case IconOnly:
2168 default:
2169 context->setItemChecked(CONTEXT_ICONS, true);
2170 break;
2171 case IconTextRight:
2172 context->setItemChecked(CONTEXT_TEXTRIGHT, true);
2173 break;
2174 case TextOnly:
2175 context->setItemChecked(CONTEXT_TEXT, true);
2176 break;
2177 case IconTextBottom:
2178 context->setItemChecked(CONTEXT_TEXTUNDER, true);
2179 break;
2180 }
2181
2182 TQValueList<int>::ConstIterator iIt = d->iconSizes.begin();
2183 TQValueList<int>::ConstIterator iEnd = d->iconSizes.end();
2184 for (; iIt != iEnd; ++iIt )
2185 context->setItemChecked( CONTEXT_ICONSIZES + *iIt, false );
2186
2187 context->setItemChecked( CONTEXT_ICONSIZES, false );
2188
2189 context->setItemChecked( CONTEXT_ICONSIZES + d->m_iconSize, true );
2190
2191 for ( int i = CONTEXT_TOP; i <= CONTEXT_FLAT; ++i )
2192 context->setItemChecked( i, false );
2193
2194 switch ( barPos() )
2195 {
2196 case TDEToolBar::Flat:
2197 context->setItemChecked( CONTEXT_FLAT, true );
2198 break;
2199 case TDEToolBar::Bottom:
2200 context->setItemChecked( CONTEXT_BOTTOM, true );
2201 break;
2202 case TDEToolBar::Left:
2203 context->setItemChecked( CONTEXT_LEFT, true );
2204 break;
2205 case TDEToolBar::Right:
2206 context->setItemChecked( CONTEXT_RIGHT, true );
2207 break;
2208 case TDEToolBar::Floating:
2209 context->setItemChecked( CONTEXT_FLOAT, true );
2210 break;
2211 case TDEToolBar::Top:
2212 context->setItemChecked( CONTEXT_TOP, true );
2213 break;
2214 default: break;
2215 }
2216}
2217
2218void TDEToolBar::slotContextAboutToHide()
2219{
2220 // We have to unplug whatever slotContextAboutToShow plugged into the menu.
2221 // Unplug the toolbar menu action
2222 TDEMainWindow *kmw = dynamic_cast<TDEMainWindow *>(mainWindow());
2223 if ( kmw && kmw->toolBarMenuAction() )
2224 if ( kmw->toolBarMenuAction()->containerCount() > 1 )
2225 kmw->toolBarMenuAction()->unplug(context);
2226
2227 // Unplug the configure toolbars action too, since it's afterwards anyway
2228 TDEAction *configureAction = 0;
2229 const char* actionName = KStdAction::name(KStdAction::ConfigureToolbars);
2230 if ( d->m_xmlguiClient )
2231 configureAction = d->m_xmlguiClient->actionCollection()->action(actionName);
2232 if ( !configureAction && kmw )
2233 configureAction = kmw->actionCollection()->action(actionName);
2234 if ( configureAction )
2235 configureAction->unplug(context);
2236
2237 TQPtrListIterator<TQWidget> it( widgets );
2238 TQWidget *wdg;
2239 while ( ( wdg = it.current() ) != 0 ) {
2240 if ( wdg->inherits( "TQToolButton" ) )
2241 static_cast<TQToolButton*>( wdg )->setDown( false );
2242 ++it;
2243 }
2244}
2245
2246void TDEToolBar::widgetDestroyed()
2247{
2248 removeWidgetInternal( (TQWidget*)sender() );
2249}
2250
2251void TDEToolBar::removeWidgetInternal( TQWidget * w )
2252{
2253 widgets.removeRef( w );
2254 TQMap< TQWidget*, int >::Iterator it = widget2id.find( w );
2255 if ( it == widget2id.end() )
2256 return;
2257 id2widget.remove( *it );
2258 widget2id.remove( it );
2259}
2260
2261void TDEToolBar::virtual_hook( int, void* )
2262{ /*BASE::virtual_hook( id, data );*/ }
2263
2264#include "tdetoolbar.moc"
2265
KAnimWidget
Standard "About KDE" dialog box.
Definition: kanimwidget.h:56
KComboBox
An enhanced combo box.
Definition: kcombobox.h:152
KComboBox::setCurrentItem
void setCurrentItem(const TQString &item, bool insert=false, int index=-1)
Selects the first item that matches item.
Definition: kcombobox.cpp:306
KEditToolbar::setDefaultToolbar
static void setDefaultToolbar(const char *toolbarName)
Sets the default toolbar, which will be auto-selected when the constructor without the defaultToolbar...
Definition: kedittoolbar.cpp:534
KLineEdit
An enhanced TQLineEdit widget for inputting text.
Definition: klineedit.h:146
KLineEdit::setText
virtual void setText(const TQString &)
Re-implemented to enable text squeezing.
Definition: klineedit.cpp:310
KXMLGUIClient
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document,...
Definition: kxmlguiclient.h:44
KXMLGUIClient::actionCollection
virtual TDEActionCollection * actionCollection() const
Retrieves the entire action collection for the GUI client.
Definition: kxmlguiclient.cpp:107
TDEActionCollection::action
virtual TDEAction * action(int index) const
Return the TDEAction* at position "index" in the action collection.
Definition: tdeactioncollection.cpp:400
TDEAction
Class to encapsulate user-driven action or event.
Definition: tdeaction.h:203
TDEAction::unplug
virtual void unplug(TQWidget *w)
"Unplug" or remove this action from a given widget.
Definition: tdeaction.cpp:745
TDEAction::plug
virtual int plug(TQWidget *widget, int index=-1)
"Plug" or insert this action into a given widget.
Definition: tdeaction.cpp:628
TDEConfigBase::hasDefault
bool hasDefault(const TQString &key) const
TDEConfigBase::readEntry
TQString readEntry(const TQString &pKey, const TQString &aDefault=TQString::null) const
TDEConfigBase::revertToDefault
void revertToDefault(const TQString &key)
TDEConfigBase::readNumEntry
int readNumEntry(const TQString &pKey, int nDefault=0) const
TDEConfigBase::readBoolEntry
bool readBoolEntry(const TQString &pKey, bool bDefault=false) const
TDEConfigBase::hasGroup
bool hasGroup(const TQString &group) const
TDEConfigBase::sync
virtual void sync()
TDEConfigBase::hasKey
bool hasKey(const TQString &key) const
TDEConfigBase::writeEntry
void writeEntry(const TQString &pKey, const TQString &pValue, bool bPersistent=true, bool bGlobal=false, bool bNLS=false)
TDEConfigBase::setGroup
void setGroup(const TQString &group)
TDEConfigGroupSaver
TDEConfig
TDEGlobal::iconLoader
static TDEIconLoader * iconLoader()
TDEGlobal::config
static TDEConfig * config()
TDEGlobal::instance
static TDEInstance * instance()
TDEGlobal::staticQString
static const TQString & staticQString(const char *str)
TDEIconLoader::currentSize
int currentSize(TDEIcon::Group group) const
TDEIconLoader::theme
TDEIconTheme * theme() const
TDEIconTheme
TDEIconTheme::querySizes
TQValueList< int > querySizes(TDEIcon::Group group) const
TDEIcon::Toolbar
Toolbar
TDEIcon::MainToolbar
MainToolbar
TDEInstance
TDEInstance::iconLoader
TDEIconLoader * iconLoader() const
TDEMainWindow
KDE top level main window
Definition: tdemainwindow.h:99
TDEMainWindow::setupToolbarMenuActions
void setupToolbarMenuActions()
Definition: tdemainwindow.cpp:282
TDEMainWindow::toolBarMenuAction
TDEAction * toolBarMenuAction()
Returns a pointer to the mainwindows action responsible for the toolbars menu.
Definition: tdemainwindow.cpp:273
TDEMainWindow::setSettingsDirty
void setSettingsDirty()
Apply a state change.
Definition: tdemainwindow.cpp:1009
TDEPopupMenu
A menu with title items.
Definition: tdepopupmenu.h:123
TDEPopupMenu::insertTitle
int insertTitle(const TQString &text, int id=-1, int index=-1)
Inserts a title item with no icon.
Definition: tdepopupmenu.cpp:181
TDEToolBarButton
A toolbar button.
Definition: tdetoolbarbutton.h:45
TDEToolBarButton::setIconSet
virtual void setIconSet(const TQIconSet &iconset)
Set the pixmaps for this toolbar button from a TQIconSet.
Definition: tdetoolbarbutton.cpp:298
TDEToolBarButton::setToggle
void setToggle(bool toggle=true)
Turn this button into a toggle button or disable the toggle aspects of it.
Definition: tdetoolbarbutton.cpp:733
TDEToolBarButton::setIcon
virtual void setIcon(const TQString &icon)
Set the icon for this button.
Definition: tdetoolbarbutton.cpp:284
TDEToolBarButton::setPopup
void setPopup(TQPopupMenu *p, bool unused=false)
Give this button a popup menu.
Definition: tdetoolbarbutton.cpp:365
TDEToolBarButton::setNoStyle
void setNoStyle(bool no_style=true)
Toolbar buttons naturally will assume the global styles concerning icons, icons sizes,...
Definition: tdetoolbarbutton.cpp:700
TDEToolBarButton::setPixmap
virtual void setPixmap(const TQPixmap &pixmap) TDE_DEPRECATED
Definition: tdetoolbarbutton.cpp:304
TDEToolBarButton::on
void on(bool flag=true)
Turn this button on or off.
Definition: tdetoolbarbutton.cpp:715
TDEToolBarButton::setDelayedPopup
void setDelayedPopup(TQPopupMenu *p, bool unused=false)
Gives this button a delayed popup menu.
Definition: tdetoolbarbutton.cpp:372
TDEToolBarButton::toggle
void toggle()
Toggle this button.
Definition: tdetoolbarbutton.cpp:727
TDEToolBar
Floatable toolbar with auto resize.
Definition: tdetoolbar.h:105
TDEToolBar::setItemAutoSized
void setItemAutoSized(int id, bool yes=true)
Set item autosized.
Definition: tdetoolbar.cpp:659
TDEToolBar::insertCombo
int insertCombo(const TQStringList &list, int id, bool writable, const char *signal, const TQObject *receiver, const char *slot, bool enabled=true, const TQString &tooltiptext=TQString::null, int size=70, int index=-1, TQComboBox::Policy policy=TQComboBox::AtBottom)
Inserts a KComboBox with list.
Definition: tdetoolbar.cpp:352
TDEToolBar::setButton
void setButton(int id, bool flag)
Sets a toggle button state.
Definition: tdetoolbar.cpp:529
TDEToolBar::setButtonIcon
void setButtonIcon(int id, const TQString &_icon)
Sets the icon for a button.
Definition: tdetoolbar.cpp:482
TDEToolBar::toolbarDestroyed
void toolbarDestroyed()
This signal is emitted when the toolbar is getting deleted, and before ~TDEToolbar finishes (so it's ...
TDEToolBar::setEnableContextMenu
void setEnableContextMenu(bool enable=true)
This allows you to enable or disable the context menu.
Definition: tdetoolbar.cpp:921
TDEToolBar::setCurrentComboItem
void setCurrentComboItem(int id, int index)
Sets item index to be current item in combobox id.
Definition: tdetoolbar.cpp:582
TDEToolBar::text
TQString text() const
Returns the toolbar's text.
Definition: tdetoolbar.cpp:1140
TDEToolBar::addConnection
void addConnection(int id, const char *signal, const TQObject *receiver, const char *slot)
Adds connections to items.
Definition: tdetoolbar.cpp:458
TDEToolBar::pressed
void pressed(int)
Emitted when button id is pressed.
TDEToolBar::highlightSetting
static bool highlightSetting()
Returns the global setting for "Highlight buttons under mouse".
Definition: tdetoolbar.cpp:1487
TDEToolBar::idAt
int idAt(int index)
Returns the id of the item at the given index.
Definition: tdetoolbar.cpp:737
TDEToolBar::enableMoving
void enableMoving(bool flag=true) TDE_DEPRECATED
Enable or disable moving of toolbar.
Definition: tdetoolbar.cpp:756
TDEToolBar::insertComboItem
void insertComboItem(int id, const TQString &text, int index)
Inserts text in combobox id at position index.
Definition: tdetoolbar.cpp:559
TDEToolBar::toggled
void toggled(int)
Emitted when a toggle button changes state.
TDEToolBar::released
void released(int)
Emits when button id is released.
TDEToolBar::setFullSize
void setFullSize(bool flag=true)
Set toolbar to full parent size (default).
Definition: tdetoolbar.cpp:743
TDEToolBar::getWidget
TQWidget * getWidget(int id)
Returns a pointer to the widget corresponding to id.
Definition: tdetoolbar.cpp:652
TDEToolBar::insertLined
int insertLined(const TQString &text, int id, const char *signal, const TQObject *receiver, const char *slot, bool enabled=true, const TQString &toolTipText=TQString::null, int size=70, int index=-1)
Inserts a KLineEdit.
Definition: tdetoolbar.cpp:333
TDEToolBar::insertComboList
void insertComboList(int id, const TQStringList &list, int index)
Inserts list in combobox id at position index.
Definition: tdetoolbar.cpp:566
TDEToolBar::setDelayedPopup
void setDelayedPopup(int id, TQPopupMenu *_popup, bool toggle=false)
Sets a delayed popup for a button.
Definition: tdetoolbar.cpp:497
TDEToolBar::setText
void setText(const TQString &txt)
Assign a (translated) text to this toolbar.
Definition: tdetoolbar.cpp:1134
TDEToolBar::getCombo
KComboBox * getCombo(int id)
Returns a pointer to the combobox with id.
Definition: tdetoolbar.cpp:613
TDEToolBar::setLinedText
void setLinedText(int id, const TQString &text)
Sets the text of a line editor.
Definition: tdetoolbar.cpp:544
TDEToolBar::BarPosition
BarPosition
Possible bar positions.
Definition: tdetoolbar.h:125
TDEToolBar::hideItem
void hideItem(int id)
Hide item id.
Definition: tdetoolbar.cpp:715
TDEToolBar::count
int count() const
Returns the total number of items in the toolbar.
Definition: tdetoolbar.cpp:956
TDEToolBar::insertWidget
int insertWidget(int id, int width, TQWidget *_widget, int index=-1)
Inserts a user-defined widget.
Definition: tdetoolbar.cpp:411
TDEToolBar::clear
void clear()
Remove all items.
Definition: tdetoolbar.cpp:667
TDEToolBar::insertButton
int insertButton(const TQString &icon, int id, bool enabled=true, const TQString &text=TQString::null, int index=-1, TDEInstance *_instance=TDEGlobal::instance())
Insert a button (a TDEToolBarButton) with a pixmap.
Definition: tdetoolbar.cpp:259
TDEToolBar::setIconText
void setIconText(IconText it)
Set the kind of painting for buttons.
Definition: tdetoolbar.cpp:833
TDEToolBar::setToggle
void setToggle(int id, bool flag=true)
Turns button into a toggle button if flag is true.
Definition: tdetoolbar.cpp:513
TDEToolBar::TDEToolBar
TDEToolBar(TQWidget *parent, const char *name=0, bool honorStyle=false, bool readConfig=true)
Normal constructor.
Definition: tdetoolbar.cpp:196
TDEToolBar::alignItemRight
void alignItemRight(int id, bool right=true)
Align item to the right.
Definition: tdetoolbar.cpp:640
TDEToolBar::applySettings
void applySettings(TDEConfig *config, const TQString &configGroup, bool force)
Read the toolbar settings from group configGroup in config and apply them.
Definition: tdetoolbar.cpp:1645
TDEToolBar::getLinedText
TQString getLinedText(int id) const
Returns the line editor text.
Definition: tdetoolbar.cpp:552
TDEToolBar::insertLineSeparator
int insertLineSeparator(int index=-1, int id=-1)
Inserts a line separator into the toolbar with the given id.
Definition: tdetoolbar.cpp:403
TDEToolBar::positionYourself
void positionYourself(bool force=false)
Definition: tdetoolbar.cpp:2011
TDEToolBar::setMaxHeight
void setMaxHeight(int h) TDE_DEPRECATED
Use setMaximumHeight() instead.
Definition: tdetoolbar.cpp:799
TDEToolBar::modechange
void modechange()
This signal is emitted when toolbar detects changing of following parameters: highlighting,...
TDEToolBar::getButton
TDEToolBarButton * getButton(int id)
Returns a pointer to TDEToolBarButton.
Definition: tdetoolbar.cpp:631
TDEToolBar::iconSizeDefault
int iconSizeDefault() const
Returns the default size for this type of toolbar.
Definition: tdetoolbar.cpp:913
TDEToolBar::~TDEToolBar
virtual ~TDEToolBar()
Destructor.
Definition: tdetoolbar.cpp:221
TDEToolBar::doubleClicked
void doubleClicked(int id)
Emitted when button id is double-clicked.
TDEToolBar::enableFloating
void enableFloating(bool flag) TDE_DEPRECATED
Use setMovingEnabled(bool) instead.
Definition: tdetoolbar.cpp:828
TDEToolBar::setItemNoStyle
void setItemNoStyle(int id, bool no_style=true)
This will inform a toolbar button to ignore certain style changes.
Definition: tdetoolbar.cpp:933
TDEToolBar::setIconSize
void setIconSize(int size)
Set the icon size to load.
Definition: tdetoolbar.cpp:875
TDEToolBar::iconSize
int iconSize() const
Returns the current icon size for buttons.
Definition: tdetoolbar.cpp:905
TDEToolBar::getLined
KLineEdit * getLined(int id)
Returns a pointer to TDEToolBarLined with id.
Definition: tdetoolbar.cpp:622
TDEToolBar::BarStatus
BarStatus
The state of the status bar.
Definition: tdetoolbar.h:121
TDEToolBar::setAutoRepeat
void setAutoRepeat(int id, bool flag=true)
Turns a button into an autorepeat button.
Definition: tdetoolbar.cpp:505
TDEToolBar::getComboItem
TQString getComboItem(int id, int index=-1) const
Returns text of item index from combobox id.
Definition: tdetoolbar.cpp:606
TDEToolBar::insertAnimatedWidget
int insertAnimatedWidget(int id, TQObject *receiver, const char *slot, const TQString &icons, int index=-1)
Inserts an animated widget.
Definition: tdetoolbar.cpp:418
TDEToolBar::contextMenuEnabled
bool contextMenuEnabled() const
Returns the context menu enabled flag.
Definition: tdetoolbar.cpp:927
TDEToolBar::transparentSetting
static bool transparentSetting()
Returns the global setting for "Toolbars transparent when moving".
Definition: tdetoolbar.cpp:1495
TDEToolBar::animatedWidget
KAnimWidget * animatedWidget(int id)
This will return a pointer to the animated widget with the given id, if it exists.
Definition: tdetoolbar.cpp:430
TDEToolBar::maxHeight
int maxHeight() TDE_DEPRECATED
Returns the value set with setMaxHeight().
Definition: tdetoolbar.cpp:804
TDEToolBar::setButtonIconSet
void setButtonIconSet(int id, const TQIconSet &iconset)
Sets a button icon from a TQIconSet.
Definition: tdetoolbar.cpp:489
TDEToolBar::saveSettings
void saveSettings(TDEConfig *config, const TQString &configGroup)
Save the toolbar settings to group configGroup in config.
Definition: tdetoolbar.cpp:1043
TDEToolBar::removeItem
void removeItem(int id)
Remove item id.
Definition: tdetoolbar.cpp:680
TDEToolBar::fullSize
bool fullSize() const
Returns the full-size mode enabled flag.
Definition: tdetoolbar.cpp:750
TDEToolBar::enable
bool enable(BarStatus stat) TDE_DEPRECATED
Show, hide, or toggle toolbar.
Definition: tdetoolbar.cpp:786
TDEToolBar::highlighted
void highlighted(int id, bool isHighlighted)
This signal is emitted when item id gets highlighted/unhighlighted (i.e when mouse enters/exits).
TDEToolBar::insertSeparator
int insertSeparator(int index=-1, int id=-1)
Inserts a separator into the toolbar with the given id.
Definition: tdetoolbar.cpp:396
TDEToolBar::loadState
void loadState(const TQDomElement &e)
Load state from an XML element, called by KXMLGUIBuilder.
Definition: tdetoolbar.cpp:1779
TDEToolBar::toggleButton
void toggleButton(int id)
Toggles a togglebutton.
Definition: tdetoolbar.cpp:521
TDEToolBar::clearCombo
void clearCombo(int id)
Clears the combobox id.
Definition: tdetoolbar.cpp:598
TDEToolBar::barPos
BarPosition barPos() const
Returns the toolbar position.
Definition: tdetoolbar.cpp:771
TDEToolBar::iconTextSetting
static IconText iconTextSetting()
Returns the global setting for "Icon Text".
Definition: tdetoolbar.cpp:1503
TDEToolBar::showItem
void showItem(int id)
Show item id.
Definition: tdetoolbar.cpp:723
TDEToolBar::removeComboItem
void removeComboItem(int id, int index)
Removes item index from combobox id.
Definition: tdetoolbar.cpp:574
TDEToolBar::removeItemDelayed
void removeItemDelayed(int id)
Remove item id.
Definition: tdetoolbar.cpp:696
TDEToolBar::setItemEnabled
void setItemEnabled(int id, bool enabled)
Enables/disables item.
Definition: tdetoolbar.cpp:466
TDEToolBar::setMaxWidth
void setMaxWidth(int dw) TDE_DEPRECATED
Use setMaximumWidth() instead.
Definition: tdetoolbar.cpp:810
TDEToolBar::iconText
IconText iconText() const
Returns the current text style for buttons.
Definition: tdetoolbar.cpp:869
TDEToolBar::itemIndex
int itemIndex(int id)
Returns the index of the item id.
Definition: tdetoolbar.cpp:731
TDEToolBar::setBarPos
void setBarPos(BarPosition bpos)
Set position of toolbar.
Definition: tdetoolbar.cpp:762
TDEToolBar::maxWidth
int maxWidth() TDE_DEPRECATED
Returns the value set with setMaxWidth().
Definition: tdetoolbar.cpp:816
TDEToolBar::saveState
void saveState()
Instruct the toolbar to save it's current state to either the app config file or to the XML-GUI resou...
Definition: tdetoolbar.cpp:962
TDEToolBar::isButtonOn
bool isButtonOn(int id) const
Returns true if button is on and is a toggle button.
Definition: tdetoolbar.cpp:537
TDEToolBar::setTitle
void setTitle(const TQString &_title)
Set title for toolbar when it floats.
Definition: tdetoolbar.cpp:822
TDEToolBar::clicked
void clicked(int id)
Emitted when button id is clicked.
TDEToolBar::setButtonPixmap
void setButtonPixmap(int id, const TQPixmap &_pixmap)
Sets button pixmap.
Definition: tdetoolbar.cpp:474
TDEToolBar::changeComboItem
void changeComboItem(int id, const TQString &text, int index=-1)
Changes item index in combobox id to text.
Definition: tdetoolbar.cpp:590
endl
kndbgstream & endl(kndbgstream &s)
kdDebug
kdbgstream kdDebug(int area=0)
KStdAction::name
const char * name(StdAction id)
This will return the internal name of a given standard action.
Definition: kstdaction.cpp:136
TDEStdAccel::name
TQString name(StdAccel id)
TDEStdAccel::end
const TDEShortcut & end()
tdelocale.h

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.4
This website is maintained by Timothy Pearson.