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

tdeui

  • tdeui
tdepassivepopupstack.cpp
1/* This file is part of the TDE libraries
2 * Copyright (C) 2011 - 2015 Timothy Pearson <kb9vqf@pearsoncomputing.net>
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 "tdepassivepopupstack.h"
20
21TDEPassivePopupStackContainer::TDEPassivePopupStackContainer(TQWidget *parent, const char *name) : TQWidget(parent, name) {
22 mPopupList.clear();
23
24 // Determine bottom of desktop
25 TQPoint cursorPos = TQCursor::pos();
26 TQRect r = TDEGlobalSettings::desktopGeometry(cursorPos);
27 mTopOfStack = r.height();
28 mRightOfStack = r.width();
29}
30
31TDEPassivePopupStackContainer::~TDEPassivePopupStackContainer() {
32 //
33}
34
35KPassivePopup* TDEPassivePopupStackContainer::displayMessage(TQString title, TQString message, TQString icon, int x, int y, TQString id) {
36 TQPixmap px;
37 TDEIconLoader* il = TDEGlobal::iconLoader();
38 px = il->loadIcon(icon, TDEIcon::NoGroup);
39
40 return displayMessage(title, message, px, x, y, id);
41}
42
43KPassivePopup* TDEPassivePopupStackContainer::displayMessage(TQString title, TQString message, TQPixmap icon, int x, int y, TQString id) {
44 KPassivePopup *popup = new KPassivePopup(KPassivePopup::Boxed, this, "");
45 popup->setAutoDelete(true);
46 popup->setView(title, message, icon);
47 popup->setTimeout(-1);
48 TQPoint leftCorner(x, y);
49 if (leftCorner.isNull()) {
50 if (mPopupList.isEmpty()) {
51 // Determine bottom of desktop
52 TQPoint cursorPos = TQCursor::pos();
53 TQRect r = TDEGlobalSettings::desktopGeometry(cursorPos);
54 mTopOfStack = r.height();
55 mRightOfStack = r.width();
56 }
57 TQSize popupSize = popup->sizeHint();
58 mTopOfStack = mTopOfStack-popupSize.height();
59 if (mTopOfStack < 0) mTopOfStack = 0;
60 leftCorner.setX(mRightOfStack-popupSize.width());
61 leftCorner.setY(mTopOfStack);
62 }
63 connect(popup, TQ_SIGNAL(hidden(KPassivePopup*)), this, TQ_SLOT(popupClosed(KPassivePopup*)));
64 connect(popup, TQ_SIGNAL(clicked(TQPoint)), this, TQ_SLOT(popupClicked(TQPoint)));
65 connect(popup, TQ_SIGNAL(destroyed(TQObject*)), this, TQ_SLOT(popupDestroyed(TQObject*)));
66 mPopupList.append(popup);
67 mPopupIDMap[popup] = id;
68 popup->show(leftCorner);
69
70 return popup;
71}
72
73void TDEPassivePopupStackContainer::processEvents() {
74 tqApp->processEvents();
75}
76
77void TDEPassivePopupStackContainer::popupClosed(KPassivePopup* popup) {
78 // Remove the popup from our list of popups
79 mPopupList.remove(popup);
80
81 if (mPopupList.isEmpty()) {
82 // Determine bottom of desktop
83 TQPoint cursorPos = TQCursor::pos();
84 TQRect r = TDEGlobalSettings::desktopGeometry(cursorPos);
85 mTopOfStack = r.height();
86 mRightOfStack = r.width();
87 }
88}
89
90void TDEPassivePopupStackContainer::popupClicked(TQPoint point) {
91 KPassivePopup* popup = dynamic_cast<KPassivePopup*>(const_cast<TQObject*>(TQObject::sender()));
92 if (popup) {
93 emit(popupClicked(popup, point, mPopupIDMap[popup]));
94 }
95 else {
96 emit(popupClicked(NULL, point, TQString::null));
97 }
98}
99
100void TDEPassivePopupStackContainer::popupDestroyed(TQObject* object) {
101 KPassivePopup* popup = static_cast<KPassivePopup*>(const_cast<TQObject*>(object));
102 if (popup) {
103 mPopupIDMap.remove(popup);
104 }
105}
106
107#include "tdepassivepopupstack.moc"
KPassivePopup
A dialog-like popup that displays messages without interupting the user.
Definition: kpassivepopup.h:67
KPassivePopup::setTimeout
void setTimeout(int delay)
Sets the delay for the popup is removed automatically.
Definition: kpassivepopup.cpp:223
KPassivePopup::setView
void setView(TQWidget *child)
Sets the main view to be the specified widget (which must be a child of the popup).
Definition: kpassivepopup.cpp:108
KPassivePopup::setAutoDelete
virtual void setAutoDelete(bool autoDelete)
Enables / disables auto-deletion of this widget when the timeout occurs.
Definition: kpassivepopup.cpp:236
KPassivePopup::Boxed
@ Boxed
Information will appear in a framed box (default)
Definition: kpassivepopup.h:79
KPassivePopup::show
virtual void show()
Reimplemented to reposition the popup.
Definition: kpassivepopup.cpp:251
TDEGlobalSettings::desktopGeometry
static TQRect desktopGeometry(const TQPoint &point)
TDEGlobal::iconLoader
static TDEIconLoader * iconLoader()
TDEIconLoader
TDEIconLoader::loadIcon
TQPixmap loadIcon(const TQString &name, TDEIcon::Group group, int size=0, int state=TDEIcon::DefaultState, TQString *path_store=0L, bool canReturnNull=false) const
TDEIcon::NoGroup
NoGroup
TDEStdAccel::name
TQString name(StdAccel id)

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
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.4
This website is maintained by Timothy Pearson.