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

tdeui

  • tdeui
tdepopupmenu.cpp
1 /* This file is part of the KDE libraries
2  Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
3  Copyright (C) 2002 Hamish Rodda <rodda@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 #include <tqcursor.h>
20 #include <tqpainter.h>
21 #include <tqtimer.h>
22 #include <tqfontmetrics.h>
23 
24 #ifdef USE_QT4
25 #undef None
26 #endif // USE_QT4
27 
28 #include <tqstyle.h>
29 
30 #include "tdepopupmenu.h"
31 
32 #include <kdebug.h>
33 #include <tdeapplication.h>
34 
35 TDEPopupTitle::TDEPopupTitle(TQWidget *parent, const char *name)
36  : TQWidget(parent, name)
37 {
38  setMinimumSize(16, fontMetrics().height()+8);
39 }
40 
41 TDEPopupTitle::TDEPopupTitle(KPixmapEffect::GradientType /* gradient */,
42  const TQColor &/* color */, const TQColor &/* textColor */,
43  TQWidget *parent, const char *name)
44  : TQWidget(parent, name)
45 {
46  calcSize();
47 }
48 
49 TDEPopupTitle::TDEPopupTitle(const KPixmap & /* background */, const TQColor &/* color */,
50  const TQColor &/* textColor */, TQWidget *parent,
51  const char *name)
52  : TQWidget(parent, name)
53 {
54  calcSize();
55 }
56 
57 void TDEPopupTitle::setTitle(const TQString &text, const TQPixmap *icon)
58 {
59  titleStr = text;
60  if (icon)
61  miniicon = *icon;
62  else
63  miniicon.resize(0, 0);
64 
65  calcSize();
66 }
67 
68 void TDEPopupTitle::setText( const TQString &text )
69 {
70  titleStr = text;
71  calcSize();
72 }
73 
74 void TDEPopupTitle::setIcon( const TQPixmap &pix )
75 {
76  miniicon = pix;
77  calcSize();
78 }
79 
80 void TDEPopupTitle::calcSize()
81 {
82  TQFont f = font();
83  f.setBold(true);
84  int w = miniicon.width()+TQFontMetrics(f).width(titleStr);
85  int h = TQMAX( fontMetrics().height(), miniicon.height() );
86  setMinimumSize( w+16, h+8 );
87 }
88 
89 void TDEPopupTitle::paintEvent(TQPaintEvent *)
90 {
91  TQRect r(rect());
92  TQPainter p(this);
93  kapp->style().tqdrawPrimitive(TQStyle::PE_HeaderSectionMenu, &p, r, palette().active());
94 
95  if (!miniicon.isNull())
96  p.drawPixmap(4, (r.height()-miniicon.height())/2, miniicon);
97 
98  if (!titleStr.isNull())
99  {
100  p.setPen(palette().active().text());
101  TQFont f = p.font();
102  f.setBold(true);
103  p.setFont(f);
104  if(!miniicon.isNull())
105  {
106  p.drawText(miniicon.width()+8, 0, width()-(miniicon.width()+8),
107  height(), AlignLeft | AlignVCenter | SingleLine,
108  titleStr);
109  }
110  else
111  {
112  p.drawText(0, 0, width(), height(),
113  AlignCenter | SingleLine, titleStr);
114  }
115  }
116 }
117 
118 TQSize TDEPopupTitle::sizeHint() const
119 {
120  return minimumSize();
121 }
122 
123 class TDEPopupMenu::TDEPopupMenuPrivate
124 {
125 public:
126  TDEPopupMenuPrivate ()
127  : noMatches(false)
128  , shortcuts(false)
129  , autoExec(false)
130  , lastHitIndex(-1)
131  , state(Qt::NoButton)
132  , m_ctxMenu(0)
133  {}
134 
135  ~TDEPopupMenuPrivate ()
136  {
137  delete m_ctxMenu;
138  }
139 
140  TQString m_lastTitle;
141 
142  // variables for keyboard navigation
143  TQTimer clearTimer;
144 
145  bool noMatches : 1;
146  bool shortcuts : 1;
147  bool autoExec : 1;
148 
149  TQString keySeq;
150  TQString originalText;
151 
152  int lastHitIndex;
153  TQt::ButtonState state;
154 
155  // support for RMB menus on menus
156  TQPopupMenu* m_ctxMenu;
157  static bool s_continueCtxMenuShow;
158  static int s_highlightedItem;
159  static TDEPopupMenu* s_contextedMenu;
160 };
161 
162 int TDEPopupMenu::TDEPopupMenuPrivate::s_highlightedItem(-1);
163 TDEPopupMenu* TDEPopupMenu::TDEPopupMenuPrivate::s_contextedMenu(0);
164 bool TDEPopupMenu::TDEPopupMenuPrivate::s_continueCtxMenuShow(true);
165 
166 TDEPopupMenu::TDEPopupMenu(TQWidget *parent, const char *name)
167  : TQPopupMenu(parent, name)
168 {
169  d = new TDEPopupMenuPrivate;
170  resetKeyboardVars();
171  connect(&(d->clearTimer), TQT_SIGNAL(timeout()), TQT_SLOT(resetKeyboardVars()));
172 }
173 
174 TDEPopupMenu::~TDEPopupMenu()
175 {
176  if (TDEPopupMenuPrivate::s_contextedMenu == this)
177  {
178  TDEPopupMenuPrivate::s_contextedMenu = 0;
179  TDEPopupMenuPrivate::s_highlightedItem = -1;
180  }
181 
182  delete d;
183 }
184 
185 int TDEPopupMenu::insertTitle(const TQString &text, int id, int index)
186 {
187  TDEPopupTitle *titleItem = new TDEPopupTitle();
188  titleItem->setTitle(text);
189  int ret = insertItem(titleItem, id, index);
190  setItemEnabled(ret, false);
191  return ret;
192 }
193 
194 int TDEPopupMenu::insertTitle(const TQPixmap &icon, const TQString &text, int id,
195  int index)
196 {
197  TDEPopupTitle *titleItem = new TDEPopupTitle();
198  titleItem->setTitle(text, &icon);
199  int ret = insertItem(titleItem, id, index);
200  setItemEnabled(ret, false);
201  return ret;
202 }
203 
204 void TDEPopupMenu::changeTitle(int id, const TQString &text)
205 {
206  TQMenuItem *item = findItem(id);
207  if(item){
208  if(item->widget())
209  ((TDEPopupTitle *)item->widget())->setTitle(text);
210 #ifndef NDEBUG
211  else
212  kdWarning() << "TDEPopupMenu: changeTitle() called with non-title id "<< id << endl;
213 #endif
214  }
215 #ifndef NDEBUG
216  else
217  kdWarning() << "TDEPopupMenu: changeTitle() called with invalid id " << id << endl;
218 #endif
219 }
220 
221 void TDEPopupMenu::changeTitle(int id, const TQPixmap &icon, const TQString &text)
222 {
223  TQMenuItem *item = findItem(id);
224  if(item){
225  if(item->widget())
226  ((TDEPopupTitle *)item->widget())->setTitle(text, &icon);
227 #ifndef NDEBUG
228  else
229  kdWarning() << "TDEPopupMenu: changeTitle() called with non-title id "<< id << endl;
230 #endif
231  }
232 #ifndef NDEBUG
233  else
234  kdWarning() << "TDEPopupMenu: changeTitle() called with invalid id " << id << endl;
235 #endif
236 }
237 
238 TQString TDEPopupMenu::title(int id) const
239 {
240  if(id == -1) // obsolete
241  return d->m_lastTitle;
242  TQMenuItem *item = findItem(id);
243  if(item){
244  if(item->widget())
245  return ((TDEPopupTitle *)item->widget())->title();
246  else
247  tqWarning("TDEPopupMenu: title() called with non-title id %d.", id);
248  }
249  else
250  tqWarning("TDEPopupMenu: title() called with invalid id %d.", id);
251  return TQString::null;
252 }
253 
254 TQPixmap TDEPopupMenu::titlePixmap(int id) const
255 {
256  TQMenuItem *item = findItem(id);
257  if(item){
258  if(item->widget())
259  return ((TDEPopupTitle *)item->widget())->icon();
260  else
261  tqWarning("TDEPopupMenu: titlePixmap() called with non-title id %d.", id);
262  }
263  else
264  tqWarning("TDEPopupMenu: titlePixmap() called with invalid id %d.", id);
265  TQPixmap tmp;
266  return tmp;
267 }
268 
272 void TDEPopupMenu::closeEvent(TQCloseEvent*e)
273 {
274  if (d->shortcuts)
275  resetKeyboardVars();
276  TQPopupMenu::closeEvent(e);
277 }
278 
279 void TDEPopupMenu::activateItemAt(int index)
280 {
281  d->state = Qt::NoButton;
282  TQPopupMenu::activateItemAt(index);
283 }
284 
285 TQt::ButtonState TDEPopupMenu::state() const
286 {
287  return d->state;
288 }
289 
290 void TDEPopupMenu::keyPressEvent(TQKeyEvent* e)
291 {
292  d->state = Qt::NoButton;
293  if (!d->shortcuts) {
294  // continue event processing by Qpopup
295  //e->ignore();
296  d->state = e->state();
297  TQPopupMenu::keyPressEvent(e);
298  return;
299  }
300 
301  int i = 0;
302  bool firstpass = true;
303  TQString keyString = e->text();
304 
305  // check for common commands dealt with by QPopup
306  int key = e->key();
307  if (key == Key_Escape || key == Key_Return || key == Key_Enter
308  || key == Key_Up || key == Key_Down || key == Key_Left
309  || key == Key_Right || key == Key_F1) {
310 
311  resetKeyboardVars();
312  // continue event processing by Qpopup
313  //e->ignore();
314  d->state = e->state();
315  TQPopupMenu::keyPressEvent(e);
316  return;
317  } else if ( key == Key_Shift || key == Key_Control || key == Key_Alt || key == Key_Meta )
318  return TQPopupMenu::keyPressEvent(e);
319 
320  // check to see if the user wants to remove a key from the sequence (backspace)
321  // or clear the sequence (delete)
322  if (!d->keySeq.isNull()) {
323 
324  if (key == Key_Backspace) {
325 
326  if (d->keySeq.length() == 1) {
327  resetKeyboardVars();
328  return;
329  }
330 
331  // keep the last sequence in keyString
332  keyString = d->keySeq.left(d->keySeq.length() - 1);
333 
334  // allow sequence matching to be tried again
335  resetKeyboardVars();
336 
337  } else if (key == Key_Delete) {
338  resetKeyboardVars();
339 
340  // clear active item
341  setActiveItem(0);
342  return;
343 
344  } else if (d->noMatches) {
345  // clear if there are no matches
346  resetKeyboardVars();
347 
348  // clear active item
349  setActiveItem(0);
350 
351  } else {
352  // the key sequence is not a null string
353  // therefore the lastHitIndex is valid
354  i = d->lastHitIndex;
355  }
356  } else if (key == Key_Backspace && parentMenu) {
357  // backspace with no chars in the buffer... go back a menu.
358  hide();
359  resetKeyboardVars();
360  return;
361  }
362 
363  d->keySeq += keyString;
364  int seqLen = d->keySeq.length();
365 
366  for (; i < (int)count(); i++) {
367  // compare typed text with text of this entry
368  int j = idAt(i);
369 
370  // don't search disabled entries
371  if (!isItemEnabled(j))
372  continue;
373 
374  TQString thisText;
375 
376  // retrieve the right text
377  // (the last selected item one may have additional ampersands)
378  if (i == d->lastHitIndex)
379  thisText = d->originalText;
380  else
381  thisText = text(j);
382 
383  // if there is an accelerator present, remove it
384  if ((int)accel(j) != 0)
385  thisText = thisText.replace("&", TQString());
386 
387  // chop text to the search length
388  thisText = thisText.left(seqLen);
389 
390  // do the search
391  if (!thisText.find(d->keySeq, 0, false)) {
392 
393  if (firstpass) {
394  // match
395  setActiveItem(i);
396 
397  // check to see if we're underlining a different item
398  if (d->lastHitIndex != i)
399  // yes; revert the underlining
400  changeItem(idAt(d->lastHitIndex), d->originalText);
401 
402  // set the original text if it's a different item
403  if (d->lastHitIndex != i || d->lastHitIndex == -1)
404  d->originalText = text(j);
405 
406  // underline the currently selected item
407  changeItem(j, underlineText(d->originalText, d->keySeq.length()));
408 
409  // remember what's going on
410  d->lastHitIndex = i;
411 
412  // start/restart the clear timer
413  d->clearTimer.start(5000, true);
414 
415  // go around for another try, to see if we can execute
416  firstpass = false;
417  } else {
418  // don't allow execution
419  return;
420  }
421  }
422 
423  // fall through to allow execution
424  }
425 
426  if (!firstpass) {
427  if (d->autoExec) {
428  // activate anything
429  activateItemAt(d->lastHitIndex);
430  resetKeyboardVars();
431 
432  } else if (findItem(idAt(d->lastHitIndex)) &&
433  findItem(idAt(d->lastHitIndex))->popup()) {
434  // only activate sub-menus
435  activateItemAt(d->lastHitIndex);
436  resetKeyboardVars();
437  }
438 
439  return;
440  }
441 
442  // no matches whatsoever, clean up
443  resetKeyboardVars(true);
444  //e->ignore();
445  TQPopupMenu::keyPressEvent(e);
446 }
447 
448 bool TDEPopupMenu::focusNextPrevChild( bool next )
449 {
450  resetKeyboardVars();
451  return TQPopupMenu::focusNextPrevChild( next );
452 }
453 
454 TQString TDEPopupMenu::underlineText(const TQString& text, uint length)
455 {
456  TQString ret = text;
457  for (uint i = 0; i < length; i++) {
458  if (ret[2*i] != '&')
459  ret.insert(2*i, "&");
460  }
461  return ret;
462 }
463 
464 void TDEPopupMenu::resetKeyboardVars(bool noMatches /* = false */)
465 {
466  // Clean up keyboard variables
467  if (d->lastHitIndex != -1) {
468  changeItem(idAt(d->lastHitIndex), d->originalText);
469  d->lastHitIndex = -1;
470  }
471 
472  if (!noMatches) {
473  d->keySeq = TQString::null;
474  }
475 
476  d->noMatches = noMatches;
477 }
478 
479 void TDEPopupMenu::setKeyboardShortcutsEnabled(bool enable)
480 {
481  d->shortcuts = enable;
482 }
483 
484 void TDEPopupMenu::setKeyboardShortcutsExecute(bool enable)
485 {
486  d->autoExec = enable;
487 }
496 void TDEPopupMenu::mousePressEvent(TQMouseEvent* e)
497 {
498  if (d->m_ctxMenu && d->m_ctxMenu->isVisible())
499  {
500  // hide on a second context menu event
501  d->m_ctxMenu->hide();
502  }
503 
504  TQPopupMenu::mousePressEvent(e);
505 }
506 
507 void TDEPopupMenu::mouseReleaseEvent(TQMouseEvent* e)
508 {
509  // Save the button, and the modifiers from state()
510  d->state = TQt::ButtonState(e->button() | (e->state() & KeyButtonMask));
511 
512  if ( !d->m_ctxMenu || !d->m_ctxMenu->isVisible() )
513  TQPopupMenu::mouseReleaseEvent(e);
514 }
515 
516 TQPopupMenu* TDEPopupMenu::contextMenu()
517 {
518  if (!d->m_ctxMenu)
519  {
520  d->m_ctxMenu = new TQPopupMenu(this);
521  connect(d->m_ctxMenu, TQT_SIGNAL(aboutToHide()), this, TQT_SLOT(ctxMenuHiding()));
522  }
523 
524  return d->m_ctxMenu;
525 }
526 
527 const TQPopupMenu* TDEPopupMenu::contextMenu() const
528 {
529  return const_cast< TDEPopupMenu* >( this )->contextMenu();
530 }
531 
532 void TDEPopupMenu::hideContextMenu()
533 {
534  TDEPopupMenuPrivate::s_continueCtxMenuShow = false;
535 }
536 
537 int TDEPopupMenu::contextMenuFocusItem()
538 {
539  return TDEPopupMenuPrivate::s_highlightedItem;
540 }
541 
542 TDEPopupMenu* TDEPopupMenu::contextMenuFocus()
543 {
544  return TDEPopupMenuPrivate::s_contextedMenu;
545 }
546 
547 void TDEPopupMenu::itemHighlighted(int /* whichItem */)
548 {
549  if (!d->m_ctxMenu || !d->m_ctxMenu->isVisible())
550  {
551  return;
552  }
553 
554  d->m_ctxMenu->hide();
555  showCtxMenu(mapFromGlobal(TQCursor::pos()));
556 }
557 
558 void TDEPopupMenu::showCtxMenu(TQPoint pos)
559 {
560  TQMenuItem* item = findItem(TDEPopupMenuPrivate::s_highlightedItem);
561  if (item)
562  {
563  TQPopupMenu* subMenu = item->popup();
564  if (subMenu)
565  {
566  disconnect(subMenu, TQT_SIGNAL(aboutToShow()), this, TQT_SLOT(ctxMenuHideShowingMenu()));
567  }
568  }
569 
570  TDEPopupMenuPrivate::s_highlightedItem = idAt(pos);
571 
572  if (TDEPopupMenuPrivate::s_highlightedItem == -1)
573  {
574  TDEPopupMenuPrivate::s_contextedMenu = 0;
575  return;
576  }
577 
578  emit aboutToShowContextMenu(this, TDEPopupMenuPrivate::s_highlightedItem, d->m_ctxMenu);
579 
580  TQPopupMenu* subMenu = findItem(TDEPopupMenuPrivate::s_highlightedItem)->popup();
581  if (subMenu)
582  {
583  connect(subMenu, TQT_SIGNAL(aboutToShow()), TQT_SLOT(ctxMenuHideShowingMenu()));
584  TQTimer::singleShot(100, subMenu, TQT_SLOT(hide()));
585  }
586 
587  if (!TDEPopupMenuPrivate::s_continueCtxMenuShow)
588  {
589  TDEPopupMenuPrivate::s_continueCtxMenuShow = true;
590  return;
591  }
592 
593  TDEPopupMenuPrivate::s_contextedMenu = this;
594  d->m_ctxMenu->popup(this->mapToGlobal(pos));
595  connect(this, TQT_SIGNAL(highlighted(int)), this, TQT_SLOT(itemHighlighted(int)));
596 }
597 
598 /*
599  * this method helps prevent submenus popping up while we have a context menu
600  * showing
601  */
602 void TDEPopupMenu::ctxMenuHideShowingMenu()
603 {
604  TQMenuItem* item = findItem(TDEPopupMenuPrivate::s_highlightedItem);
605  if (item)
606  {
607  TQPopupMenu* subMenu = item->popup();
608  if (subMenu)
609  {
610  TQTimer::singleShot(0, subMenu, TQT_SLOT(hide()));
611  }
612  }
613 }
614 
615 void TDEPopupMenu::ctxMenuHiding()
616 {
617  if (TDEPopupMenuPrivate::s_highlightedItem)
618  {
619  TQPopupMenu* subMenu = findItem(TDEPopupMenuPrivate::s_highlightedItem)->popup();
620  if (subMenu)
621  {
622  disconnect(subMenu, TQT_SIGNAL(aboutToShow()), this, TQT_SLOT(ctxMenuHideShowingMenu()));
623  }
624  }
625 
626  disconnect(this, TQT_SIGNAL(highlighted(int)), this, TQT_SLOT(itemHighlighted(int)));
627  TDEPopupMenuPrivate::s_continueCtxMenuShow = true;
628 }
629 
630 void TDEPopupMenu::contextMenuEvent(TQContextMenuEvent* e)
631 {
632  if (d->m_ctxMenu)
633  {
634  if (e->reason() == TQContextMenuEvent::Mouse)
635  {
636  showCtxMenu(e->pos());
637  }
638  else if (actItem != -1)
639  {
640  showCtxMenu(itemGeometry(actItem).center());
641  }
642 
643  e->accept();
644  return;
645  }
646 
647  TQPopupMenu::contextMenuEvent(e);
648 }
649 
650 void TDEPopupMenu::hideEvent(TQHideEvent*)
651 {
652  if (d->m_ctxMenu && d->m_ctxMenu->isVisible())
653  {
654  // we need to block signals here when the ctxMenu is showing
655  // to prevent the TQPopupMenu::activated(int) signal from emitting
656  // when hiding with a context menu, the user doesn't expect the
657  // menu to actually do anything.
658  // since hideEvent gets called very late in the process of hiding
659  // (deep within TQWidget::hide) the activated(int) signal is the
660  // last signal to be emitted, even after things like aboutToHide()
661  // AJS
662  blockSignals(true);
663  d->m_ctxMenu->hide();
664  blockSignals(false);
665  }
666 }
671 // Obsolete
672 TDEPopupMenu::TDEPopupMenu(const TQString& title, TQWidget *parent, const char *name)
673  : TQPopupMenu(parent, name)
674 {
675  d = new TDEPopupMenuPrivate;
676  insertTitle(title);
677 }
678 
679 // Obsolete
680 void TDEPopupMenu::setTitle(const TQString &title)
681 {
682  TDEPopupTitle *titleItem = new TDEPopupTitle();
683  titleItem->setTitle(title);
684  insertItem(titleItem);
685  d->m_lastTitle = title;
686 }
687 
688 void TDEPopupTitle::virtual_hook( int, void* )
689 { /*BASE::virtual_hook( id, data );*/ }
690 
691 void TDEPopupMenu::virtual_hook( int, void* )
692 { /*BASE::virtual_hook( id, data );*/ }
693 
694 #include "tdepopupmenu.moc"
TDEPopupTitle::setIcon
void setIcon(const TQPixmap &pix)
Definition: tdepopupmenu.cpp:74
TDEPopupMenu::contextMenuFocusItem
static int contextMenuFocusItem()
returns the ID of the menuitem associated with the current context menu
Definition: tdepopupmenu.cpp:537
TDEPopupTitle::icon
TQPixmap icon() const
Returns the current icon.
Definition: tdepopupmenu.h:75
TDEPopupMenu::titlePixmap
TQPixmap titlePixmap(int id) const
Returns the icon of the title item at the specified id.
Definition: tdepopupmenu.cpp:254
TDEStdAccel::key
int key(StdAccel) KDE_DEPRECATED
TDEPopupMenu::contextMenuFocus
static TDEPopupMenu * contextMenuFocus()
Returns the TDEPopupMenu associated with the current context menu.
Definition: tdepopupmenu.cpp:542
KPixmap
TDEPopupMenu::resetKeyboardVars
void resetKeyboardVars(bool noMatches=false)
Definition: tdepopupmenu.cpp:464
TDEPopupMenu::changeTitle
void changeTitle(int id, const TQString &text)
Changes the title of the item at the specified id.
Definition: tdepopupmenu.cpp:204
TDEPopupTitle::TDEPopupTitle
TDEPopupTitle(TQWidget *parent=0, const char *name=0)
Constructs a title widget with the user specified gradient, pixmap, and colors.
Definition: tdepopupmenu.cpp:35
TDEPopupTitle
TDEPopupMenu title widget.
Definition: tdepopupmenu.h:38
TDEPopupMenu::setTitle
void setTitle(const TQString &title) KDE_DEPRECATED
Definition: tdepopupmenu.cpp:680
TDEPopupMenu::hideContextMenu
void hideContextMenu()
Hides the context menu if shown.
Definition: tdepopupmenu.cpp:532
TDEPopupMenu::mousePressEvent
virtual void mousePressEvent(TQMouseEvent *e)
End keyboard navigation.
Definition: tdepopupmenu.cpp:496
TDEPopupMenu::setKeyboardShortcutsExecute
void setKeyboardShortcutsExecute(bool enable)
Enables execution of the menu item once it is uniquely specified.
Definition: tdepopupmenu.cpp:484
TDEPopupMenu::title
TQString title(int id=-1) const
Returns the title of the title item at the specified id.
Definition: tdepopupmenu.cpp:238
TDEPopupMenu::insertTitle
int insertTitle(const TQString &text, int id=-1, int index=-1)
Inserts a title item with no icon.
Definition: tdepopupmenu.cpp:185
TDEPopupMenu::TDEPopupMenu
TDEPopupMenu(TQWidget *parent=0, const char *name=0)
Constructs a TDEPopupMenu.
Definition: tdepopupmenu.cpp:166
kdWarning
kdbgstream kdWarning(int area=0)
TDEPopupMenu::activateItemAt
virtual void activateItemAt(int index)
Reimplemented for internal purposes.
Definition: tdepopupmenu.cpp:279
TDEPopupMenu::aboutToShowContextMenu
void aboutToShowContextMenu(TDEPopupMenu *menu, int menuItem, TQPopupMenu *ctxMenu)
connect to this signal to be notified when a context menu is about to be shown
TDEPopupTitle::setTitle
void setTitle(const TQString &text, const TQPixmap *icon=0)
Sets the title string and optional icon for the title widget.
Definition: tdepopupmenu.cpp:57
TDEPopupMenu::contextMenu
TQPopupMenu * contextMenu()
Returns the context menu associated with this menu.
Definition: tdepopupmenu.cpp:516
TDEPopupMenu::mouseReleaseEvent
virtual void mouseReleaseEvent(TQMouseEvent *e)
Definition: tdepopupmenu.cpp:507
TDEPopupMenu::~TDEPopupMenu
~TDEPopupMenu()
Destructs the object.
Definition: tdepopupmenu.cpp:174
TDEPopupMenu
A menu with title items.
Definition: tdepopupmenu.h:123
TDEPopupMenu::state
TQt::ButtonState state() const
Return the state of the mouse button and keyboard modifiers when the last menuitem was activated...
Definition: tdepopupmenu.cpp:285
endl
kndbgstream & endl(kndbgstream &s)
TDEPopupMenu::underlineText
TQString underlineText(const TQString &text, uint length)
Definition: tdepopupmenu.cpp:454
TDEPopupTitle::setText
void setText(const TQString &text)
Definition: tdepopupmenu.cpp:68
TDEPopupMenu::setKeyboardShortcutsEnabled
void setKeyboardShortcutsEnabled(bool enable)
Enables keyboard navigation by searching for the entered key sequence.
Definition: tdepopupmenu.cpp:479
TDEPopupMenu::closeEvent
virtual void closeEvent(TQCloseEvent *)
This is re-implemented for keyboard navigation.
Definition: tdepopupmenu.cpp:272

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.