[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdelibs/kdeui
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2004-11-25 9:21:58
Message-ID: 20041125092158.CE20E1C36A () office ! kde ! org
[Download RAW message or body]
CVS commit by aseigo:
allow PanelExtensions to optionally provide a custom context menu, much
the same as applets can
M +14 -0 kpanelextension.cpp 1.8
M +20 -0 kpanelextension.h 1.23
--- kdelibs/kdeui/kpanelextension.cpp #1.7:1.8
@@ -22,4 +22,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE
******************************************************************/
+#include <qpopupmenu.h>
+
#include <kconfig.h>
@@ -32,8 +34,10 @@ public:
KPanelExtensionPrivate()
: _size(KPanelExtension::SizeNormal),
+ _customMenu(0),
_customSize(58)
{}
KPanelExtension::Size _size;
+ QPopupMenu* _customMenu;
int _customSize;
};
@@ -133,4 +137,14 @@ int KPanelExtension::sizeInPixels() cons
}
+QPopupMenu* KPanelExtension::customMenu() const
+{
+ return d->_customMenu;
+}
+
+void KPanelExtension::setCustomMenu(QPopupMenu* menu)
+{
+ d->_customMenu = menu;
+}
+
void KPanelExtension::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
--- kdelibs/kdeui/kpanelextension.h #1.22:1.23
@@ -25,4 +25,5 @@ CONNECTION WITH THE SOFTWARE OR THE USE
#define __kpanelextension_h__
+class QPopupMenu;
class KConfig;
class KPanelExtensionPrivate;
@@ -207,4 +208,10 @@ public:
int customSize() const;
+ /**
+ * @return the extension's custom menu, usually the same as the context menu, or 0 if none
+ * see setCustomMenu(QPopupMenu*)
+ * @since 3.4
+ */
+ QPopupMenu* customMenu() const;
signals:
@@ -290,4 +297,17 @@ protected:
virtual void alignmentChange( Alignment ) {};
+ /**
+ * Use this method to set the custom menu for this extensions so that it can be shown
+ * at the appropriate places/times that the extension many not itself
+ * be aware of. The extension itself is still responsible for deleting and managing the
+ * the menu.
+ *
+ * If the menu is deleted during the life of the extension, be sure to call this method again
+ * with the new menu (or 0) to avoid crashes
+ * @since 3.4
+ */
+ void setCustomMenu(QPopupMenu*);
+
+
private:
Type _type;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic