23 #include <tqiconset.h>
27 #include <kiconloader.h>
32 class KGuiItem::KGuiItemPrivate
41 KGuiItemPrivate(
const KGuiItemPrivate &rhs )
46 KGuiItemPrivate &operator=(
const KGuiItemPrivate &rhs )
49 m_iconSet = rhs.m_iconSet;
50 m_iconName = rhs.m_iconName;
51 m_toolTip = rhs.m_toolTip;
52 m_whatsThis = rhs.m_whatsThis;
53 m_statusText = rhs.m_statusText;
54 m_enabled = rhs.m_enabled;
55 m_hasIcon = rhs.m_hasIcon;
63 TQString m_statusText;
71 KGuiItem::KGuiItem() {
72 d =
new KGuiItemPrivate;
75 KGuiItem::KGuiItem(
const TQString &text,
const TQString &iconName,
76 const TQString &toolTip,
const TQString &whatsThis )
78 d =
new KGuiItemPrivate;
80 d->m_toolTip = toolTip;
82 setIconName( iconName );
85 KGuiItem::KGuiItem(
const TQString &text,
const TQIconSet &iconSet,
86 const TQString &toolTip,
const TQString &whatsThis )
88 d =
new KGuiItemPrivate;
90 d->m_toolTip = toolTip;
92 setIconSet( iconSet );
95 KGuiItem::KGuiItem(
const KGuiItem &rhs )
109 d =
new KGuiItemPrivate( *rhs.d );
114 KGuiItem::~KGuiItem()
119 TQString KGuiItem::text()
const
125 TQString KGuiItem::plainText()
const
127 const int len = d->m_text.length();
135 int resultLength = 0;
136 stripped.setLength(len);
138 const TQChar* data = d->m_text.unicode();
139 for (
int pos = 0; pos < len; ++pos )
141 if ( data[ pos ] !=
'&' )
142 stripped[ resultLength++ ] = data[ pos ];
143 else if ( pos + 1 < len && data[ pos + 1 ] ==
'&' )
144 stripped[ resultLength++ ] = data[ pos++ ];
147 stripped.truncate(resultLength);
156 if( !d->m_iconName.isEmpty())
172 TQString KGuiItem::iconName()
const
174 return d->m_iconName;
177 TQString KGuiItem::toolTip()
const
182 TQString KGuiItem::whatsThis()
const
184 return d->m_whatsThis;
187 bool KGuiItem::isEnabled()
const
197 void KGuiItem::setText(
const TQString &text ) {
201 void KGuiItem::setIconSet(
const TQIconSet &iconset )
203 d->m_iconSet = iconset;
204 d->m_iconName = TQString::null;
205 d->m_hasIcon = !iconset.isNull();
208 void KGuiItem::setIconName(
const TQString &iconName )
210 d->m_iconName = iconName;
211 d->m_iconSet = TQIconSet();
212 d->m_hasIcon = !iconName.isEmpty();
215 void KGuiItem::setToolTip(
const TQString &toolTip )
217 d->m_toolTip = toolTip;
220 void KGuiItem::setWhatsThis(
const TQString &whatsThis )
225 void KGuiItem::setEnabled(
bool enabled )
227 d->m_enabled = enabled;
An abstract class for GUI data such as ToolTip and Icon.
bool hasIcon() const
returns whether an icon is defined, doesn't tell if it really exists
TQIconSet loadIconSet(const TQString &name, TDEIcon::Group group, int size, bool canReturnNull, bool immediateExistenceCheck)
TDEIconLoader * iconLoader() const
TQString whatsThis(StdAccel id)