• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Applets

x11embeddelegate.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   x11embeddelegate.cpp                                                  *
00003  *                                                                         *
00004  *   Copyright (C) 2008 Jason Stubbs <jasonbstubbs@gmail.com>              *
00005  *                                                                         *
00006  *   This program is free software; you can redistribute it and/or modify  *
00007  *   it under the terms of the GNU General Public License as published by  *
00008  *   the Free Software Foundation; either version 2 of the License, or     *
00009  *   (at your option) any later version.                                   *
00010  *                                                                         *
00011  *   This program is distributed in the hope that it will be useful,       *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU General Public License for more details.                          *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU General Public License     *
00017  *   along with this program; if not, write to the                         *
00018  *   Free Software Foundation, Inc.,                                       *
00019  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
00020  ***************************************************************************/
00021 
00022 #include "x11embedcontainer.h"
00023 #include "x11embeddelegate.h"
00024 
00025 #include <QtCore/QEvent>
00026 
00027 
00028 namespace SystemTray
00029 {
00030 
00031 class X11EmbedDelegate::Private
00032 {
00033 public:
00034     X11EmbedContainer *container;
00035 };
00036 
00037 
00038 X11EmbedDelegate::X11EmbedDelegate(QWidget *parent)
00039     : QWidget(parent),
00040       d(new Private())
00041 {
00042     d->container = new X11EmbedContainer(this);
00043     d->container->move(0, 0);
00044     d->container->show();
00045 }
00046 
00047 
00048 X11EmbedDelegate::~X11EmbedDelegate()
00049 {
00050     delete d;
00051 }
00052 
00053 
00054 void X11EmbedDelegate::setParent(QWidget *newParent)
00055 {
00056     if (parent()) {
00057         parent()->removeEventFilter(this);
00058     }
00059     QWidget::setParent(newParent);
00060     if (newParent) {
00061         newParent->installEventFilter(this);
00062     }
00063 }
00064 
00065 
00066 void X11EmbedDelegate::resizeEvent(QResizeEvent *event)
00067 {
00068     Q_UNUSED(event);
00069     d->container->resize(size());
00070 }
00071 
00072 
00073 X11EmbedContainer* X11EmbedDelegate::container()
00074 {
00075     return d->container;
00076 }
00077 
00078 
00079 bool X11EmbedDelegate::eventFilter(QObject *watched, QEvent *event)
00080 {
00081     bool ret = QWidget::eventFilter(watched, event);
00082 
00083     if (event->type() == QEvent::Hide) {
00084         setParent(0);
00085     }
00086 
00087     return ret;
00088 }
00089 
00090 }
00091 
00092 #include "x11embeddelegate.moc"

Applets

Skip menu "Applets"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal