kradio4 r778
|
00001 /*************************************************************************** 00002 widgetplugins.h - description 00003 ------------------- 00004 begin : Mi Aug 27 2003 00005 copyright : (C) 2003 by Martin Witte 00006 email : emw-kradio@nocabal.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef KRADIO_WIDGETPLUGINS_INTERFACES_H 00019 #define KRADIO_WIDGETPLUGINS_INTERFACES_H 00020 00021 #ifdef HAVE_CONFIG_H 00022 #include <config.h> 00023 #endif 00024 00025 #include <QtGui/QAction> 00026 00027 #include "pluginbase.h" 00028 00029 00030 class QWidget; 00031 class KConfigGroup; 00032 00033 class KDE_EXPORT WidgetPluginBase : public PluginBase 00034 { 00035 public : 00036 WidgetPluginBase(QWidget *myself, const QString &instanceID, const QString &name, const QString &description); 00037 00038 virtual void saveState ( KConfigGroup &) const; 00039 virtual void restoreState (const KConfigGroup &); 00040 virtual void restoreState (const KConfigGroup &, bool showByDefault); 00041 virtual void startPlugin(); 00042 00043 virtual QWidget *getWidget() { return m_myself; } 00044 virtual const QWidget *getWidget() const { return m_myself; } 00045 00046 virtual bool isReallyVisible(const QWidget *w = NULL, bool ignore_mapping_state = false) const; 00047 virtual bool isAnywhereVisible(const QWidget *w = NULL) const; 00048 00049 virtual QAction *getHideShowAction() { return &m_HideShowAction; } 00050 virtual void updateHideShowAction(bool show); 00051 00052 virtual void showOnOrgDesktop(); 00053 00054 protected: 00055 virtual void toggleShown() = 0; // must be implemented as protected SLOT in the widget plugin! 00056 virtual void setVisible(bool) = 0; // this QWidget method must be intercepted 00057 00058 virtual void pShow (); 00059 virtual void pHide (); 00060 virtual void pSetVisible(bool v); 00061 virtual void pToggleShown (); 00062 00063 virtual void showEvent(QShowEvent *) = 0; 00064 virtual void pShowEvent(QShowEvent *); 00065 virtual void hideEvent(QHideEvent *) = 0; 00066 virtual void pHideEvent(QHideEvent *); 00067 00068 virtual void notifyManager(bool shown); 00069 00070 virtual void getKWinState(const QWidget *w = NULL) const; 00071 00072 00073 protected: 00074 QWidget *m_myself; 00075 QAction m_HideShowAction; 00076 bool m_restoreShow; 00077 bool m_geoRestoreFlag; 00078 bool m_ignoreHideShow; 00079 00080 // temporary data 00081 mutable bool m_geoCacheValid; 00082 mutable bool m_saveMinimized; 00083 mutable bool m_saveMaximized; 00084 mutable bool m_saveSticky; 00085 mutable int m_saveDesktop; 00086 mutable QRect m_saveGeometry; 00087 00088 00089 }; 00090 00091 00092 00093 #endif