KParts
partmanager.h
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 Copyright (C) 1999 Simon Hausmann <hausmann@kde.org> 00003 (C) 1999 David Faure <faure@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 #ifndef __kpartmanager_h__ 00021 #define __kpartmanager_h__ 00022 00023 #include <QtGui/QWidget> 00024 00025 #include <kparts/kparts_export.h> 00026 00027 class KComponentData; 00028 00029 namespace KParts 00030 { 00031 00032 class Part; 00033 00034 class PartManagerPrivate; 00035 00047 class KPARTS_EXPORT PartManager : public QObject 00048 { 00049 Q_OBJECT 00050 Q_ENUMS( SelectionPolicy ) 00051 Q_PROPERTY( SelectionPolicy selectionPolicy READ selectionPolicy WRITE setSelectionPolicy ) 00052 Q_PROPERTY( bool allowNestedParts READ allowNestedParts WRITE setAllowNestedParts ) 00053 Q_PROPERTY( bool ignoreScrollBars READ ignoreScrollBars WRITE setIgnoreScrollBars ) 00054 public: 00056 enum SelectionPolicy { Direct, TriState }; 00057 00063 enum Reason { ReasonLeftClick = 100, ReasonMidClick, ReasonRightClick, NoReason }; 00064 00072 PartManager( QWidget * parent ); 00081 PartManager( QWidget * topLevel, QObject *parent ); 00082 virtual ~PartManager(); 00083 00087 void setSelectionPolicy( SelectionPolicy policy ); 00091 SelectionPolicy selectionPolicy() const; 00092 00105 void setAllowNestedParts( bool allow ); 00109 bool allowNestedParts() const; 00110 00119 void setIgnoreScrollBars( bool ignore ); 00123 bool ignoreScrollBars() const; 00124 00130 void setActivationButtonMask( short int buttonMask ); 00134 short int activationButtonMask() const; 00135 00139 virtual bool eventFilter( QObject *obj, QEvent *ev ); 00140 00148 virtual void addPart( Part *part, bool setActive = true ); 00149 00155 virtual void removePart( Part *part ); 00156 00162 virtual void replacePart( Part * oldPart, Part * newPart, bool setActive = true ); 00163 00172 virtual void setActivePart( Part *part, QWidget *widget = 0 ); 00173 00177 virtual Part *activePart() const; 00178 00182 virtual QWidget *activeWidget() const; 00183 00192 virtual void setSelectedPart( Part *part, QWidget *widget = 0 ); 00193 00197 virtual Part *selectedPart() const; 00198 00202 virtual QWidget *selectedWidget() const; 00203 00207 const QList<Part *> parts() const; 00208 00216 void addManagedTopLevelWidget( const QWidget *topLevel ); 00221 void removeManagedTopLevelWidget( const QWidget *topLevel ); 00222 00227 int reason() const; 00228 00229 Q_SIGNALS: 00234 void partAdded( KParts::Part *part ); 00239 void partRemoved( KParts::Part *part ); 00244 void activePartChanged( KParts::Part *newPart ); 00245 00246 protected: 00252 virtual void setActiveComponent(const KComponentData &instance); 00253 00254 protected Q_SLOTS: 00258 void slotObjectDestroyed(); 00259 00263 void slotWidgetDestroyed(); 00264 00268 void slotManagedTopLevelWidgetDestroyed(); 00269 private: 00270 Part * findPartFromWidget( QWidget * widget, const QPoint &pos ); 00271 Part * findPartFromWidget( QWidget * widget ); 00272 00273 private: 00274 PartManagerPrivate* const d; 00275 }; 00276 00277 } 00278 00279 #endif 00280
KDE 4.6 API Reference