summaryrefslogtreecommitdiffstats
path: root/kpovmodeler/pmobjectaction.h
diff options
context:
space:
mode:
Diffstat (limited to 'kpovmodeler/pmobjectaction.h')
-rw-r--r--kpovmodeler/pmobjectaction.h100
1 files changed, 100 insertions, 0 deletions
diff --git a/kpovmodeler/pmobjectaction.h b/kpovmodeler/pmobjectaction.h
new file mode 100644
index 00000000..e9a843ce
--- /dev/null
+++ b/kpovmodeler/pmobjectaction.h
@@ -0,0 +1,100 @@
+//-*-C++-*-
+/*
+**************************************************************************
+ description
+ --------------------
+ copyright : (C) 2002 by Andreas Zehender
+**************************************************************************
+
+**************************************************************************
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+**************************************************************************/
+
+
+#ifndef PMOBJECTACTION_H
+#define PMOBJECTACTION_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "pmvector.h"
+#include "pmcontrolpoint.h"
+#include "pmmetaobject.h"
+#include <qptrlist.h>
+#include <qstring.h>
+
+class KAction;
+
+/**
+ * Helper class for object action functions.
+ *
+ * Each object can define actions that are inserted into the context
+ * menu. This class stores informations of one action.
+ *
+ * The actionID has to be unique for each class.
+ *
+ * The member m_action is set later by the framework.
+ */
+class PMObjectAction
+{
+public:
+ /**
+ * Constructor
+ */
+ PMObjectAction( PMMetaObject* objectType, int actionID,
+ const QString& description, bool enabled = true )
+ {
+ m_class = objectType;
+ m_actionID = actionID;
+ m_description = description;
+ m_enabled = enabled;
+ m_menuID = -1;
+ }
+
+ /**
+ * Returns the class type for the action
+ */
+ PMMetaObject* objectType( ) const { return m_class; }
+ /**
+ * Returns the action ID
+ */
+ int actionID( ) const { return m_actionID; }
+ /**
+ * Returns the description
+ */
+ QString description( ) const { return m_description; }
+
+ /**
+ * Returns the enabled flag
+ */
+ bool isEnabled( ) const { return m_enabled; }
+ /**
+ * Sets the enabled flag
+ */
+ void setEnabled( bool enable ) { m_enabled = enable; }
+
+ /**
+ * Returns the menu id
+ */
+ int menuID( ) const { return m_menuID; }
+ /**
+ * Sets the menu id
+ */
+ void setMenuID( int id ) { m_menuID = id; }
+
+private:
+ PMMetaObject* m_class;
+ int m_actionID;
+ QString m_description;
+ bool m_enabled;
+ int m_menuID;
+};
+
+#endif