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

kdeui

  • kdeui
ktoolbarlabelaction.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 "ktoolbarlabelaction.h"
20 
21 #include <tqlabel.h>
22 #include <tqapplication.h>
23 
24 class KToolBarLabelAction::KToolBarLabelActionPrivate
25 {
26 public:
27  KToolBarLabelActionPrivate()
28  : m_label(0)
29  {
30  }
31  TQLabel* m_label;
32 };
33 
34 
35 KToolBarLabelAction::KToolBarLabelAction(const TQString &text,
36  const KShortcut &cut,
37  const TQObject *receiver,
38  const char *slot,
39  KActionCollection *parent,
40  const char *name)
41  : KWidgetAction(new TQLabel(text, 0, "kde toolbar widget"), text, cut,
42  receiver, slot, parent, name),
43  d(new KToolBarLabelActionPrivate)
44 {
45  init();
46 }
47 
48 KToolBarLabelAction::KToolBarLabelAction(TQWidget* buddy,
49  const TQString &text,
50  const KShortcut &cut,
51  const TQObject *receiver,
52  const char *slot,
53  KActionCollection *parent,
54  const char *name)
55  : KWidgetAction(new TQLabel(buddy, text, 0, "kde toolbar widget"), text,
56  cut, receiver, slot, parent, name),
57  d(new KToolBarLabelActionPrivate)
58 {
59  init();
60 }
61 
62 KToolBarLabelAction::KToolBarLabelAction(TQLabel* label,
63  const KShortcut &cut,
64  const TQObject *receiver,
65  const char *slot,
66  KActionCollection* parent,
67  const char *name)
68  : KWidgetAction(label, label->text(), cut, receiver, slot, parent, name),
69  d(new KToolBarLabelActionPrivate)
70 {
71  Q_ASSERT(TQString::fromLatin1("kde toolbar widget") == label->name());
72  init();
73 }
74 
75 KToolBarLabelAction::~KToolBarLabelAction()
76 {
77  delete d;
78  d = 0;
79 }
80 
81 void KToolBarLabelAction::init()
82 {
83  d->m_label = static_cast<TQLabel*>(widget());
84  /* these lines were copied from Konqueror's KonqDraggableLabel class in
85  konq_misc.cc */
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 KToolBarLabelAction::setText(const TQString& text)
94 {
95  KWidgetAction::setText(text);
96  d->m_label->setText(text);
97 }
98 
99 void KToolBarLabelAction::setBuddy(TQWidget* buddy)
100 {
101  d->m_label->setBuddy(buddy);
102 }
103 
104 TQWidget* KToolBarLabelAction::buddy() const
105 {
106  return d->m_label->buddy();
107 }
108 
109 TQLabel* KToolBarLabelAction::label() const
110 {
111  return d->m_label;
112 }
113 
114 void KToolBarLabelAction::virtual_hook(int, void*)
115 {
116 
117 }

kdeui

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

kdeui

Skip menu "kdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdeui by doxygen 1.8.3.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |