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

tdeui

  • tdeui
tdetoolbarbutton.cpp
1/* This file is part of the KDE libraries
2 Copyright (C) 1997, 1998 Stephan Kulow (coolo@kde.org)
3 (C) 1997, 1998 Mark Donohoe (donohoe@kde.org)
4 (C) 1997, 1998 Sven Radej (radej@kde.org)
5 (C) 1997, 1998 Matthias Ettrich (ettrich@kde.org)
6 (C) 1999 Chris Schlaeger (cs@kde.org)
7 (C) 1999 Kurt Granroth (granroth@kde.org)
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public
11 License version 2 as published by the Free Software Foundation.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
17
18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA.
22*/
23
24#include <config.h>
25#include <string.h>
26
27#include "tdetoolbarbutton.h"
28#include "tdetoolbar.h"
29
30#include <tqstyle.h>
31#include <tqimage.h>
32#include <tqtimer.h>
33#include <tqdrawutil.h>
34#include <tqtooltip.h>
35#include <tqbitmap.h>
36#include <tqpopupmenu.h>
37#include <tqcursor.h>
38#include <tqpainter.h>
39#include <tqlayout.h>
40
41#include <tdeapplication.h>
42#include <kdebug.h>
43#include <tdeglobal.h>
44#include <tdeglobalsettings.h>
45#include <kiconeffect.h>
46#include <kiconloader.h>
47
48// needed to get our instance
49#include <tdemainwindow.h>
50
51template class TQIntDict<TDEToolBarButton>;
52
53class TDEToolBarButtonPrivate
54{
55public:
56 TDEToolBarButtonPrivate();
57 ~TDEToolBarButtonPrivate();
58
59 int m_id;
60 bool m_buttonDown;
61 bool m_noStyle;
62 bool m_isSeparator;
63 bool m_isRadio;
64 bool m_highlight;
65 bool m_isRaised;
66 bool m_isActive;
67
68 TQString m_iconName;
69
70 TDEToolBar *m_parent;
71 TDEToolBar::IconText m_iconText;
72 int m_iconSize;
73 TQSize size;
74
75 TQPoint m_mousePressPos;
76
77 TDEInstance *m_instance;
78};
79
80TDEToolBarButtonPrivate::TDEToolBarButtonPrivate()
81{
82 m_buttonDown = false;
83
84 m_noStyle = false;
85 m_isSeparator = false;
86 m_isRadio = false;
87 m_highlight = false;
88 m_isRaised = false;
89 m_isActive = false;
90
91 m_iconName = TQString::null;
92 m_iconText = TDEToolBar::IconOnly;
93 m_iconSize = 0;
94
95 m_parent = 0;
96 m_instance = TDEGlobal::instance();
97}
98
99TDEToolBarButtonPrivate::~TDEToolBarButtonPrivate()
100{
101 //
102}
103
104// This will construct a separator
105TDEToolBarButton::TDEToolBarButton( TQWidget *_parent, const char *_name )
106 : TQToolButton( _parent , _name)
107{
108 d = new TDEToolBarButtonPrivate();
109
110 resize(6,6);
111 hide();
112 d->m_isSeparator = true;
113}
114
115TDEToolBarButton::TDEToolBarButton( const TQString& _icon, int _id,
116 TQWidget *_parent, const char *_name,
117 const TQString &_txt, TDEInstance *_instance )
118 : TQToolButton( _parent, _name ), d( 0 )
119{
120 d = new TDEToolBarButtonPrivate();
121
122 d->m_id = _id;
123 TQToolButton::setTextLabel(_txt);
124 d->m_instance = _instance;
125
126 d->m_parent = dynamic_cast<TDEToolBar*>(_parent);
127 if (d->m_parent) {
128 connect(d->m_parent, TQ_SIGNAL( modechange() ),
129 this, TQ_SLOT( modeChange() ));
130 }
131
132 setFocusPolicy( TQWidget::NoFocus );
133
134 // connect all of our slots and start trapping events
135 connect(this, TQ_SIGNAL( clicked() ),
136 this, TQ_SLOT( slotClicked() ) );
137 connect(this, TQ_SIGNAL( pressed() ),
138 this, TQ_SLOT( slotPressed() ) );
139 connect(this, TQ_SIGNAL( released() ),
140 this, TQ_SLOT( slotReleased() ) );
141 installEventFilter(this);
142
143 d->m_iconName = _icon;
144
145 // do our initial setup
146 modeChange();
147}
148
149TDEToolBarButton::TDEToolBarButton( const TQPixmap& pixmap, int _id,
150 TQWidget *_parent, const char *name,
151 const TQString& txt)
152 : TQToolButton( _parent, name ), d( 0 )
153{
154 d = new TDEToolBarButtonPrivate();
155
156 d->m_id = _id;
157 TQToolButton::setTextLabel(txt);
158
159 d->m_parent = dynamic_cast<TDEToolBar*>(_parent);
160 if (d->m_parent) {
161 connect(d->m_parent, TQ_SIGNAL( modechange() ),
162 this, TQ_SLOT( modeChange() ));
163 }
164
165 setFocusPolicy( TQWidget::NoFocus );
166
167 // connect all of our slots and start trapping events
168 connect(this, TQ_SIGNAL( clicked() ),
169 this, TQ_SLOT( slotClicked() ));
170 connect(this, TQ_SIGNAL( pressed() ),
171 this, TQ_SLOT( slotPressed() ));
172 connect(this, TQ_SIGNAL( released() ),
173 this, TQ_SLOT( slotReleased() ));
174 installEventFilter(this);
175
176 // set our pixmap and do our initial setup
177 setIconSet( TQIconSet( pixmap ));
178 modeChange();
179}
180
181TDEToolBarButton::~TDEToolBarButton()
182{
183 delete d; d = 0;
184}
185
186void TDEToolBarButton::modeChange()
187{
188 TQSize mysize;
189
190 // grab a few global variables for use in this function and others
191 if (d->m_parent) {
192 d->m_highlight = d->m_parent->highlight();
193 d->m_iconText = d->m_parent->iconText();
194
195 d->m_iconSize = d->m_parent->iconSize();
196 }
197 if (!d->m_iconName.isNull())
198 setIcon(d->m_iconName);
199
200 // we'll start with the size of our pixmap
201 int pix_width = d->m_iconSize;
202 if ( d->m_iconSize == 0 ) {
203 if (d->m_parent && !strcmp(d->m_parent->name(), "mainToolBar"))
204 pix_width = IconSize( TDEIcon::MainToolbar );
205 else
206 pix_width = IconSize( TDEIcon::Toolbar );
207 }
208 int pix_height = pix_width;
209
210 int text_height = 0;
211 int text_width = 0;
212
213 TQToolTip::remove(this);
214 if (d->m_iconText != TDEToolBar::IconOnly)
215 {
216 // okay, we have to deal with fonts. let's get our information now
217 TQFont tmp_font = TDEGlobalSettings::toolBarFont();
218
219 // now parse out our font sizes from our chosen font
220 TQFontMetrics fm(tmp_font);
221
222 text_height = fm.lineSpacing();
223 text_width = fm.width(textLabel());
224
225 // none of the other modes want tooltips
226 }
227 else
228 {
229 TQToolTip::add(this, textLabel());
230 }
231
232 switch (d->m_iconText)
233 {
234 case TDEToolBar::IconOnly:
235 mysize = TQSize(pix_width, pix_height);
236 break;
237
238 case TDEToolBar::IconTextRight:
239 mysize = TQSize(pix_width + text_width + 4, pix_height);
240 break;
241
242 case TDEToolBar::TextOnly:
243 mysize = TQSize(text_width + 4, text_height);
244 break;
245
246 case TDEToolBar::IconTextBottom:
247 mysize = TQSize((text_width + 4 > pix_width) ? text_width + 4 : pix_width, pix_height + text_height);
248 break;
249
250 default:
251 break;
252 }
253
254 mysize = style().sizeFromContents(TQStyle::CT_ToolButton, this, mysize).
255 expandedTo(TQApplication::globalStrut());
256
257 // make sure that this isn't taller then it is wide
258 if (mysize.height() > mysize.width())
259 mysize.setWidth(mysize.height());
260
261 d->size = mysize;
262 updateGeometry();
263}
264
265void TDEToolBarButton::setTextLabel( const TQString& text, bool tipToo)
266{
267 if (text.isNull())
268 return;
269
270 TQString txt(text);
271 if (txt.endsWith(TQString::fromLatin1("...")))
272 txt.truncate(txt.length() - 3);
273
274 TQToolButton::setTextLabel(txt, tipToo);
275 update();
276}
277
278void TDEToolBarButton::setText( const TQString& text)
279{
280 setTextLabel(text, true);
281 modeChange();
282}
283
284void TDEToolBarButton::setIcon( const TQString &icon )
285{
286 d->m_iconName = icon;
287 if (d->m_parent)
288 d->m_iconSize = d->m_parent->iconSize();
289 // TQObject::name() return "const char *" instead of TQString.
290 if (d->m_parent && !strcmp(d->m_parent->name(), "mainToolBar"))
291 TQToolButton::setIconSet( d->m_instance->iconLoader()->loadIconSet(
292 d->m_iconName, TDEIcon::MainToolbar, d->m_iconSize ));
293 else
294 TQToolButton::setIconSet( d->m_instance->iconLoader()->loadIconSet(
295 d->m_iconName, TDEIcon::Toolbar, d->m_iconSize ));
296}
297
298void TDEToolBarButton::setIconSet( const TQIconSet &iconset )
299{
300 TQToolButton::setIconSet( iconset );
301}
302
303// remove?
304void TDEToolBarButton::setPixmap( const TQPixmap &pixmap )
305{
306 if( pixmap.isNull()) // called by TQToolButton
307 {
308 TQToolButton::setPixmap( pixmap );
309 return;
310 }
311 TQIconSet set = iconSet();
312 set.setPixmap( pixmap, TQIconSet::Automatic, TQIconSet::Active );
313 TQToolButton::setIconSet( set );
314}
315
316void TDEToolBarButton::setDefaultPixmap( const TQPixmap &pixmap )
317{
318 TQIconSet set = iconSet();
319 set.setPixmap( pixmap, TQIconSet::Automatic, TQIconSet::Normal );
320 TQToolButton::setIconSet( set );
321}
322
323void TDEToolBarButton::setDisabledPixmap( const TQPixmap &pixmap )
324{
325 TQIconSet set = iconSet();
326 set.setPixmap( pixmap, TQIconSet::Automatic, TQIconSet::Disabled );
327 TQToolButton::setIconSet( set );
328}
329
330void TDEToolBarButton::setDefaultIcon( const TQString& icon )
331{
332 TQIconSet set = iconSet();
333 TQPixmap pm;
334 if (d->m_parent && !strcmp(d->m_parent->name(), "mainToolBar"))
335 pm = d->m_instance->iconLoader()->loadIcon( icon, TDEIcon::MainToolbar,
336 d->m_iconSize );
337 else
338 pm = d->m_instance->iconLoader()->loadIcon( icon, TDEIcon::Toolbar,
339 d->m_iconSize );
340 set.setPixmap( pm, TQIconSet::Automatic, TQIconSet::Normal );
341 TQToolButton::setIconSet( set );
342}
343
344void TDEToolBarButton::setDisabledIcon( const TQString& icon )
345{
346 TQIconSet set = iconSet();
347 TQPixmap pm;
348 if (d->m_parent && !strcmp(d->m_parent->name(), "mainToolBar"))
349 pm = d->m_instance->iconLoader()->loadIcon( icon, TDEIcon::MainToolbar,
350 d->m_iconSize );
351 else
352 pm = d->m_instance->iconLoader()->loadIcon( icon, TDEIcon::Toolbar,
353 d->m_iconSize );
354 set.setPixmap( pm, TQIconSet::Automatic, TQIconSet::Disabled );
355 TQToolButton::setIconSet( set );
356}
357
358TQPopupMenu *TDEToolBarButton::popup()
359{
360 // obsolete
361 // KDE4: remove me
362 return TQToolButton::popup();
363}
364
365void TDEToolBarButton::setPopup(TQPopupMenu *p, bool)
366{
367 TQToolButton::setPopup(p);
368 TQToolButton::setPopupDelay(-1);
369}
370
371
372void TDEToolBarButton::setDelayedPopup (TQPopupMenu *p, bool)
373{
374 TQToolButton::setPopup(p);
375 TQToolButton::setPopupDelay(TQApplication::startDragTime());
376}
377
378void TDEToolBarButton::leaveEvent(TQEvent *)
379{
380 if( d->m_isRaised || d->m_isActive )
381 {
382 d->m_isRaised = false;
383 d->m_isActive = false;
384 repaint(false);
385 }
386
387 emit highlighted(d->m_id, false);
388}
389
390void TDEToolBarButton::enterEvent(TQEvent *)
391{
392 if (d->m_highlight)
393 {
394 if (isEnabled())
395 {
396 d->m_isActive = true;
397 if (!isToggleButton())
398 d->m_isRaised = true;
399 }
400 else
401 {
402 d->m_isRaised = false;
403 d->m_isActive = false;
404 }
405
406 repaint(false);
407 }
408 emit highlighted(d->m_id, true);
409}
410
411bool TDEToolBarButton::eventFilter(TQObject *o, TQEvent *ev)
412{
413 if (o == this)
414 {
415
416 // Popup the menu when the left mousebutton is pressed and the mouse
417 // is moved by a small distance.
418 if (TQToolButton::popup())
419 {
420 if (ev->type() == TQEvent::MouseButtonPress)
421 {
422 TQMouseEvent* mev = static_cast<TQMouseEvent*>(ev);
423 d->m_mousePressPos = mev->pos();
424 }
425 else if (ev->type() == TQEvent::MouseMove)
426 {
427 TQMouseEvent* mev = static_cast<TQMouseEvent*>(ev);
428 if ((mev->pos() - d->m_mousePressPos).manhattanLength()
429 > TDEGlobalSettings::dndEventDelay())
430 {
431 openPopup();
432 return true;
433 }
434 }
435 }
436
437 if (d->m_isRadio &&
438 (ev->type() == TQEvent::MouseButtonPress ||
439 ev->type() == TQEvent::MouseButtonRelease ||
440 ev->type() == TQEvent::MouseButtonDblClick) && isOn())
441 return true;
442
443 // From Kai-Uwe Sattler <kus@iti.CS.Uni-Magdeburg.De>
444 if (ev->type() == TQEvent::MouseButtonDblClick)
445 {
446 emit doubleClicked(d->m_id);
447 return false;
448 }
449 }
450
451 return TQToolButton::eventFilter(o, ev);
452}
453
454void TDEToolBarButton::mousePressEvent( TQMouseEvent * e )
455{
456 d->m_buttonDown = true;
457
458 if ( e->button() == TQt::MidButton )
459 {
460 // Get TQToolButton to show the button being down while pressed
461 TQMouseEvent ev( TQEvent::MouseButtonPress, e->pos(), e->globalPos(), TQt::LeftButton, e->state() );
462 TQToolButton::mousePressEvent(&ev);
463 return;
464 }
465 TQToolButton::mousePressEvent(e);
466}
467
468void TDEToolBarButton::mouseReleaseEvent( TQMouseEvent * e )
469{
470 TQt::ButtonState state = TQt::ButtonState(e->button() | (e->state() & KeyButtonMask));
471 if ( e->button() == TQt::MidButton )
472 {
473 TQMouseEvent ev( TQEvent::MouseButtonRelease, e->pos(), e->globalPos(), TQt::LeftButton, e->state() );
474 TQToolButton::mouseReleaseEvent(&ev);
475 }
476 else
477 TQToolButton::mouseReleaseEvent(e);
478
479 if ( !d->m_buttonDown )
480 return;
481 d->m_buttonDown = false;
482
483 if ( hitButton( e->pos() ) )
484 emit buttonClicked( d->m_id, state );
485}
486
487void TDEToolBarButton::drawButton( TQPainter *_painter )
488{
489 TQStyle::SFlags flags = TQStyle::Style_Default;
490 TQStyle::SCFlags active = TQStyle::SC_None;
491
492 if (isDown()) {
493 flags |= TQStyle::Style_Down;
494 active |= TQStyle::SC_ToolButton;
495 }
496 if (isEnabled()) flags |= TQStyle::Style_Enabled;
497 if (isOn()) flags |= TQStyle::Style_On;
498 if (isEnabled() && hasMouse()) flags |= TQStyle::Style_Raised;
499 if (hasFocus()) flags |= TQStyle::Style_HasFocus;
500
501 // Draw a styled toolbutton
502 style().drawComplexControl(TQStyle::CC_ToolButton, _painter, this, rect(),
503 colorGroup(), flags, TQStyle::SC_ToolButton, active, TQStyleOption());
504
505 int dx, dy;
506 TQFont tmp_font(TDEGlobalSettings::toolBarFont());
507 TQFontMetrics fm(tmp_font);
508 TQRect textRect;
509 int textFlags = 0;
510
511 if (d->m_iconText == TDEToolBar::IconOnly) // icon only
512 {
513 TQPixmap pixmap = iconSet().pixmap( TQIconSet::Automatic,
514 isEnabled() ? (d->m_isActive ? TQIconSet::Active : TQIconSet::Normal) :
515 TQIconSet::Disabled,
516 isOn() ? TQIconSet::On : TQIconSet::Off );
517 if( !pixmap.isNull())
518 {
519 dx = ( width() - pixmap.width() ) / 2;
520 dy = ( height() - pixmap.height() ) / 2;
521 if ( isDown() && style().styleHint(TQStyle::SH_GUIStyle) == WindowsStyle )
522 {
523 ++dx;
524 ++dy;
525 }
526 _painter->drawPixmap( dx, dy, pixmap );
527 }
528 }
529 else if (d->m_iconText == TDEToolBar::IconTextRight) // icon and text (if any)
530 {
531 TQPixmap pixmap = iconSet().pixmap( TQIconSet::Automatic,
532 isEnabled() ? (d->m_isActive ? TQIconSet::Active : TQIconSet::Normal) :
533 TQIconSet::Disabled,
534 isOn() ? TQIconSet::On : TQIconSet::Off );
535 if( !pixmap.isNull())
536 {
537 dx = 4;
538 dy = ( height() - pixmap.height() ) / 2;
539 if ( isDown() && style().styleHint(TQStyle::SH_GUIStyle) == WindowsStyle )
540 {
541 ++dx;
542 ++dy;
543 }
544 _painter->drawPixmap( dx, dy, pixmap );
545 }
546
547 if (!textLabel().isNull())
548 {
549 textFlags = AlignVCenter|AlignLeft;
550 if (!pixmap.isNull())
551 dx = 4 + pixmap.width() + 2;
552 else
553 dx = 4;
554 dy = 0;
555 if ( isDown() && style().styleHint(TQStyle::SH_GUIStyle) == WindowsStyle )
556 {
557 ++dx;
558 ++dy;
559 }
560 textRect = TQRect(dx, dy, width()-dx, height());
561 }
562 }
563 else if (d->m_iconText == TDEToolBar::TextOnly)
564 {
565 if (!textLabel().isNull())
566 {
567 textFlags = AlignVCenter|AlignLeft;
568 dx = (width() - fm.width(textLabel())) / 2;
569 dy = (height() - fm.lineSpacing()) / 2;
570 if ( isDown() && style().styleHint(TQStyle::SH_GUIStyle) == WindowsStyle )
571 {
572 ++dx;
573 ++dy;
574 }
575 textRect = TQRect( dx, dy, fm.width(textLabel()), fm.lineSpacing() );
576 }
577 }
578 else if (d->m_iconText == TDEToolBar::IconTextBottom)
579 {
580 TQPixmap pixmap = iconSet().pixmap( TQIconSet::Automatic,
581 isEnabled() ? (d->m_isActive ? TQIconSet::Active : TQIconSet::Normal) :
582 TQIconSet::Disabled,
583 isOn() ? TQIconSet::On : TQIconSet::Off );
584 if( !pixmap.isNull())
585 {
586 dx = (width() - pixmap.width()) / 2;
587 dy = (height() - fm.lineSpacing() - pixmap.height()) / 2;
588 if ( isDown() && style().styleHint(TQStyle::SH_GUIStyle) == WindowsStyle )
589 {
590 ++dx;
591 ++dy;
592 }
593 _painter->drawPixmap( dx, dy, pixmap );
594 }
595
596 if (!textLabel().isNull())
597 {
598 textFlags = AlignBottom|AlignHCenter;
599 dx = (width() - fm.width(textLabel())) / 2;
600 dy = height() - fm.lineSpacing() - 4;
601
602 if ( isDown() && style().styleHint(TQStyle::SH_GUIStyle) == WindowsStyle )
603 {
604 ++dx;
605 ++dy;
606 }
607 textRect = TQRect( dx, dy, fm.width(textLabel()), fm.lineSpacing() );
608 }
609 }
610
611 // Draw the text at the position given by textRect, and using textFlags
612 if (!textLabel().isNull() && !textRect.isNull())
613 {
614 _painter->setFont(TDEGlobalSettings::toolBarFont());
615 if (!isEnabled())
616 _painter->setPen(palette().disabled().dark());
617 else if(d->m_isRaised)
618 _painter->setPen(TDEGlobalSettings::toolBarHighlightColor());
619 else
620 _painter->setPen( colorGroup().buttonText() );
621 _painter->drawText(textRect, textFlags, textLabel());
622 }
623
624 if (TQToolButton::popup())
625 {
626 TQStyle::SFlags arrowFlags = TQStyle::Style_Default;
627
628 if (isDown()) arrowFlags |= TQStyle::Style_Down;
629 if (isEnabled()) arrowFlags |= TQStyle::Style_Enabled;
630
631 style().drawPrimitive(TQStyle::PE_ArrowDown, _painter,
632 TQRect(width()-7, height()-7, 7, 7), colorGroup(),
633 arrowFlags, TQStyleOption() );
634 }
635}
636
637void TDEToolBarButton::paletteChange(const TQPalette &)
638{
639 if(!d->m_isSeparator)
640 {
641 modeChange();
642 repaint(false); // no need to delete it first therefore only false
643 }
644}
645
646bool TDEToolBarButton::event(TQEvent *e)
647{
648 if (e->type() == TQEvent::ParentFontChange || e->type() == TQEvent::ApplicationFontChange)
649 {
650 //If we use toolbar text, apply the settings again, to relayout...
651 if (d->m_iconText != TDEToolBar::IconOnly)
652 modeChange();
653 return true;
654 }
655
656 return TQToolButton::event(e);
657}
658
659
660void TDEToolBarButton::showMenu()
661{
662 // obsolete
663 // KDE4: remove me
664}
665
666void TDEToolBarButton::slotDelayTimeout()
667{
668 // obsolete
669 // KDE4: remove me
670}
671
672void TDEToolBarButton::slotClicked()
673{
674 emit clicked( d->m_id );
675
676 // emit buttonClicked when the button was clicked while being in an extension popupmenu
677 if ( d->m_parent && !d->m_parent->rect().contains( geometry().center() ) ) {
678 ButtonState state = TDEApplication::keyboardMouseState();
679 if ( ( state & TQt::MouseButtonMask ) == TQt::NoButton )
680 state = ButtonState( TQt::LeftButton | state );
681 emit buttonClicked( d->m_id, state ); // Doesn't work with MidButton
682 }
683}
684
685void TDEToolBarButton::slotPressed()
686{
687 emit pressed( d->m_id );
688}
689
690void TDEToolBarButton::slotReleased()
691{
692 emit released( d->m_id );
693}
694
695void TDEToolBarButton::slotToggled()
696{
697 emit toggled( d->m_id );
698}
699
700void TDEToolBarButton::setNoStyle(bool no_style)
701{
702 d->m_noStyle = no_style;
703
704 modeChange();
705 d->m_iconText = TDEToolBar::IconTextRight;
706 repaint(false);
707}
708
709void TDEToolBarButton::setRadio (bool f)
710{
711 if ( d )
712 d->m_isRadio = f;
713}
714
715void TDEToolBarButton::on(bool flag)
716{
717 if(isToggleButton())
718 setOn(flag);
719 else
720 {
721 setDown(flag);
722 leaveEvent((TQEvent *) 0);
723 }
724 repaint();
725}
726
727void TDEToolBarButton::toggle()
728{
729 setOn(!isOn());
730 repaint();
731}
732
733void TDEToolBarButton::setToggle(bool flag)
734{
735 setToggleButton(flag);
736 if (flag)
737 connect(this, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(slotToggled()));
738 else
739 disconnect(this, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(slotToggled()));
740}
741
742TQSize TDEToolBarButton::sizeHint() const
743{
744 return d->size;
745}
746
747TQSize TDEToolBarButton::minimumSizeHint() const
748{
749 return d->size;
750}
751
752TQSize TDEToolBarButton::minimumSize() const
753{
754 return d->size;
755}
756
757bool TDEToolBarButton::isRaised() const
758{
759 return d->m_isRaised;
760}
761
762bool TDEToolBarButton::isActive() const
763{
764 return d->m_isActive;
765}
766
767int TDEToolBarButton::iconTextMode() const
768{
769 return static_cast<int>( d->m_iconText );
770}
771
772int TDEToolBarButton::id() const
773{
774 return d->m_id;
775}
776
777// TDEToolBarButtonList
778TDEToolBarButtonList::TDEToolBarButtonList()
779{
780 setAutoDelete(false);
781}
782
783void TDEToolBarButton::virtual_hook( int, void* )
784{ /*BASE::virtual_hook( id, data );*/ }
785
786#include "tdetoolbarbutton.moc"
TDEApplication::keyboardMouseState
static ButtonState keyboardMouseState()
TDEGlobalSettings::toolBarHighlightColor
static TQColor toolBarHighlightColor()
TDEGlobalSettings::toolBarFont
static TQFont toolBarFont()
TDEGlobalSettings::dndEventDelay
static int dndEventDelay()
TDEGlobal::instance
static TDEInstance * instance()
TDEIcon::Toolbar
Toolbar
TDEIcon::MainToolbar
MainToolbar
TDEInstance
TDEToolBarButton::setIconSet
virtual void setIconSet(const TQIconSet &iconset)
Set the pixmaps for this toolbar button from a TQIconSet.
Definition: tdetoolbarbutton.cpp:298
TDEToolBarButton::setText
virtual void setText(const TQString &text)
Set the text for this button.
Definition: tdetoolbarbutton.cpp:278
TDEToolBarButton::id
int id() const
Returns the button's id.
Definition: tdetoolbarbutton.cpp:772
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::setDefaultPixmap
void setDefaultPixmap(const TQPixmap &pixmap) TDE_DEPRECATED
Definition: tdetoolbarbutton.cpp:316
TDEToolBarButton::~TDEToolBarButton
~TDEToolBarButton()
Standard destructor.
Definition: tdetoolbarbutton.cpp:181
TDEToolBarButton::setIcon
virtual void setIcon(const TQString &icon)
Set the icon for this button.
Definition: tdetoolbarbutton.cpp:284
TDEToolBarButton::isActive
bool isActive() const
Definition: tdetoolbarbutton.cpp:762
TDEToolBarButton::isRaised
bool isRaised() const
Definition: tdetoolbarbutton.cpp:757
TDEToolBarButton::setPopup
void setPopup(TQPopupMenu *p, bool unused=false)
Give this button a popup menu.
Definition: tdetoolbarbutton.cpp:365
TDEToolBarButton::buttonClicked
void buttonClicked(int, TQt::ButtonState state)
Emitted when the toolbar button is clicked (with any mouse button)
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::mousePressEvent
void mousePressEvent(TQMouseEvent *)
Definition: tdetoolbarbutton.cpp:454
TDEToolBarButton::setPixmap
virtual void setPixmap(const TQPixmap &pixmap) TDE_DEPRECATED
Definition: tdetoolbarbutton.cpp:304
TDEToolBarButton::setDisabledPixmap
void setDisabledPixmap(const TQPixmap &pixmap) TDE_DEPRECATED
Definition: tdetoolbarbutton.cpp:323
TDEToolBarButton::on
void on(bool flag=true)
Turn this button on or off.
Definition: tdetoolbarbutton.cpp:715
TDEToolBarButton::setRadio
void setRadio(bool f=true)
Turn this button into a radio button.
Definition: tdetoolbarbutton.cpp:709
TDEToolBarButton::setDisabledIcon
void setDisabledIcon(const TQString &icon) TDE_DEPRECATED
Definition: tdetoolbarbutton.cpp:344
TDEToolBarButton::setDefaultIcon
void setDefaultIcon(const TQString &icon) TDE_DEPRECATED
Definition: tdetoolbarbutton.cpp:330
TDEToolBarButton::mouseReleaseEvent
void mouseReleaseEvent(TQMouseEvent *)
Definition: tdetoolbarbutton.cpp:468
TDEToolBarButton::setDelayedPopup
void setDelayedPopup(TQPopupMenu *p, bool unused=false)
Gives this button a delayed popup menu.
Definition: tdetoolbarbutton.cpp:372
TDEToolBarButton::clicked
void clicked(int)
Emitted when the toolbar button is clicked (with LMB or MMB)
TDEToolBarButton::iconTextMode
int iconTextMode() const
Definition: tdetoolbarbutton.cpp:767
TDEToolBarButton::popup
TQPopupMenu * popup()
Return a pointer to this button's popup menu (if it exists)
Definition: tdetoolbarbutton.cpp:358
TDEToolBarButton::modeChange
void modeChange()
This slot should be called whenever the toolbar mode has potentially changed.
Definition: tdetoolbarbutton.cpp:186
TDEToolBarButton::TDEToolBarButton
TDEToolBarButton(const TQString &icon, int id, TQWidget *parent, const char *name=0L, const TQString &txt=TQString::null, TDEInstance *_instance=TDEGlobal::instance())
Construct a button with an icon loaded by the button itself.
Definition: tdetoolbarbutton.cpp:115
TDEToolBarButton::toggle
void toggle()
Toggle this button.
Definition: tdetoolbarbutton.cpp:727
TDEToolBar
Floatable toolbar with auto resize.
Definition: tdetoolbar.h:105

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.