summaryrefslogtreecommitdiffstats
path: root/kpovmodeler/pmobjectaction.h
blob: 5397759c5f32a9bd154c40bae729c3f5ab9f9f77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//-*-C++-*-
/*
**************************************************************************
                                 description
                             --------------------
    copyright            : (C) 2002 by Andreas Zehender
    email                : zehender@kde.org
**************************************************************************

**************************************************************************
*                                                                        *
*  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 <tqptrlist.h>
#include <tqstring.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 TQString& 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
    */
   TQString 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;
   TQString m_description;
   bool m_enabled;
   int m_menuID;
};

#endif