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

tdeui

  • tdeui
tdetoolbarlabelaction.cpp
1 /* This file is part of the KDE libraries
2  Copyright (C) 2004 Felix Berger <felixberger@beldesign.de>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 
19 #include "tdetoolbarlabelaction.h"
20 
21 #include <tqlabel.h>
22 #include <tqapplication.h>
23 
24 class TDEToolBarLabelAction::TDEToolBarLabelActionPrivate
25 {
26 public:
27  TDEToolBarLabelActionPrivate()
28  : m_label(0)
29  {
30  }
31  TQLabel* m_label;
32 };
33 
34 
35 TDEToolBarLabelAction::TDEToolBarLabelAction(const TQString &text,
36  const TDEShortcut &cut,
37  const TQObject *receiver,
38  const char *slot,
39  TDEActionCollection *parent,
40  const char *name)
41  : KWidgetAction(new TQLabel(text, 0, "tde toolbar widget"), text, cut,
42  receiver, slot, parent, name),
43  d(new TDEToolBarLabelActionPrivate)
44 {
45  init();
46 }
47 
48 TDEToolBarLabelAction::TDEToolBarLabelAction(TQWidget* buddy,
49  const TQString &text,
50  const TDEShortcut &cut,
51  const TQObject *receiver,
52  const char *slot,
53  TDEActionCollection *parent,
54  const char *name)
55  : KWidgetAction(new TQLabel(buddy, text, 0, "tde toolbar widget"), text,
56  cut, receiver, slot, parent, name),
57  d(new TDEToolBarLabelActionPrivate)
58 {
59  init();
60 }
61 
62 TDEToolBarLabelAction::TDEToolBarLabelAction(TQLabel* label,
63  const TDEShortcut &cut,
64  const TQObject *receiver,
65  const char *slot,
66  TDEActionCollection* parent,
67  const char *name)
68  : KWidgetAction(label, label->text(), cut, receiver, slot, parent, name),
69  d(new TDEToolBarLabelActionPrivate)
70 {
71  Q_ASSERT(TQString::fromLatin1("tde toolbar widget") == label->name());
72  init();
73 }
74 
75 TDEToolBarLabelAction::~TDEToolBarLabelAction()
76 {
77  delete d;
78  d = 0;
79 }
80 
81 void TDEToolBarLabelAction::init()
82 {
83  d->m_label = static_cast<TQLabel*>(widget());
84  /* these lines were copied from Konqueror's KonqDraggableLabel class in
85  konq_misc.cpp */
86  d->m_label->setBackgroundMode(TQt::PaletteButton);
87  d->m_label->setAlignment((TQApplication::reverseLayout()
88  ? Qt::AlignRight : Qt::AlignLeft) |
89  Qt::AlignVCenter | TQt::ShowPrefix );
90  d->m_label->adjustSize();
91 }
92 
93 void TDEToolBarLabelAction::setText(const TQString& text)
94 {
95  KWidgetAction::setText(text);
96  d->m_label->setText(text);
97 }
98 
99 void TDEToolBarLabelAction::setBuddy(TQWidget* buddy)
100 {
101  d->m_label->setBuddy(buddy);
102 }
103 
104 TQWidget* TDEToolBarLabelAction::buddy() const
105 {
106  return d->m_label->buddy();
107 }
108 
109 TQLabel* TDEToolBarLabelAction::label() const
110 {
111  return d->m_label;
112 }
113 
114 void TDEToolBarLabelAction::virtual_hook(int, void*)
115 {
116 
117 }
TDEToolBarLabelAction::setBuddy
virtual void setBuddy(TQWidget *buddy)
Sets the label's buddy to buddy.
Definition: tdetoolbarlabelaction.cpp:99
KWidgetAction
An action that automatically embeds a widget into a toolbar.
Definition: tdeactionclasses.h:1309
TDEActionCollection
A managed set of TDEAction objects.
Definition: tdeactioncollection.h:78
TDEToolBarLabelAction::TDEToolBarLabelAction
TDEToolBarLabelAction(const TQString &text, const TDEShortcut &cut, const TQObject *receiver, const char *slot, TDEActionCollection *parent, const char *name)
Constructs a toolbar label.
Definition: tdetoolbarlabelaction.cpp:35
TDEAction::setText
virtual void setText(const TQString &text)
Sets the text associated with this action.
Definition: tdeaction.cpp:879
TDEToolBarLabelAction::label
TQLabel * label() const
Returns the label which is used internally.
Definition: tdetoolbarlabelaction.cpp:109
TDEShortcut
KWidgetAction::widget
TQWidget * widget()
Returns the widget associated with this action.
Definition: tdeactionclasses.h:1328
TDEToolBarLabelAction::setText
virtual void setText(const TQString &text)
Reimplemented to update both the action's text and the label's text.
Definition: tdetoolbarlabelaction.cpp:93
TDEToolBarLabelAction::buddy
TQWidget * buddy() const
Returns the label's buddy or 0 if no buddy is currently set.
Definition: tdetoolbarlabelaction.cpp:104

tdeui

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

tdeui

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