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;
81 d->m_whatsThis = whatsThis;
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;
91 d->m_whatsThis = whatsThis;
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())
170 TQString KGuiItem::iconName()
const 172 return d->m_iconName;
175 TQString KGuiItem::toolTip()
const 180 TQString KGuiItem::whatsThis()
const 182 return d->m_whatsThis;
185 bool KGuiItem::isEnabled()
const 195 void KGuiItem::setText(
const TQString &text ) {
199 void KGuiItem::setIconSet(
const TQIconSet &iconset )
201 d->m_iconSet = iconset;
202 d->m_iconName = TQString::null;
203 d->m_hasIcon = !iconset.isNull();
206 void KGuiItem::setIconName(
const TQString &iconName )
208 d->m_iconName = iconName;
209 d->m_iconSet = TQIconSet();
210 d->m_hasIcon = !iconName.isEmpty();
213 void KGuiItem::setToolTip(
const TQString &toolTip )
215 d->m_toolTip = toolTip;
218 void KGuiItem::setWhatsThis(
const TQString &whatsThis )
220 d->m_whatsThis = whatsThis;
223 void KGuiItem::setEnabled(
bool enabled )
225 d->m_enabled = enabled;
TQIconSet loadIconSet(const TQString &name, KIcon::Group group, int size, bool canReturnNull, bool immediateExistenceCheck)
bool hasIcon() const
returns whether an icon is defined, doesn't tell if it really exists
An abstract class for GUI data such as ToolTip and Icon.
KIconLoader * iconLoader() const