Added popupEvent.

CCMAIL:plasma-devel@kde.org

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=854047
This commit is contained in:
Davide Bettio 2008-08-28 18:30:50 +00:00
parent a32ca528f0
commit 2a8024d4a1
2 changed files with 15 additions and 0 deletions

View File

@ -243,6 +243,7 @@ void PopupApplet::constraintsEvent(Plasma::Constraints constraints)
void PopupApplet::showPopup(uint popupDuration)
{
if (d->dialog && (formFactor() == Horizontal || formFactor() == Vertical)) {
popupEvent(true);
d->dialog->move(popupPosition(d->dialog->size()));
d->dialog->show();
@ -264,10 +265,16 @@ void PopupApplet::showPopup(uint popupDuration)
void PopupApplet::hidePopup()
{
if (d->dialog && (formFactor() == Horizontal || formFactor() == Vertical)) {
popupEvent(false);
d->dialog->hide();
}
}
void PopupApplet::popupEvent(bool)
{
}
void PopupApplet::widgetGeometryChanged()
{
if (graphicsWidget() && layout()) {
@ -284,6 +291,8 @@ void PopupApplet::widgetGeometryChanged()
void PopupAppletPrivate::togglePopup()
{
if (dialog) {
q->popupEvent(!dialog->isVisible());
if (dialog->isVisible()) {
dialog->hide();
} else {

View File

@ -88,6 +88,12 @@ public:
*/
void showPopup(uint displayTime = 0);
/**
* This event handler can be reimplemented in a subclass to receive an event before the popup is showed or hidden.
* @arg show true if the popup is going to be showed, false if the popup is going to be hiden.
*/
virtual void popupEvent(bool show);
public Q_SLOTS:
/**
* Hides the popup.