Module cSigCJMenuItem.pkg
1//==============================================================================
2// Project : SigCj - VDF Classes for Codejock
3// File : cSigCJMenuItem.pkg
4// Description : VDF Class for Codejock control
5//
6// Revision : $Rev: 666 $
7// $Date: 2010-11-16 08:24:39 -0500 (Tue, 16 Nov 2010) $
8// $Author: martin $ Martin Pincott
9//
10// Requirements : Visual DataFlex 12.1+
11// Codejock SuitePro - Version 12.0.0+
12//
13// Copyright : (c) 2008 VDF SIG UK
14// Visual DataFlex Special Interest Group UK.
15// http://www.vdfsig.co.uk/
16// dev@vdfsig.co.uk
17//
18// This file is part of SigCj.
19//
20// SigCj is free software: you can redistribute it and/or modify
21// it under the terms of the GNU Lesser General Public License
22// as published by the Free Software Foundation, either version
23// 2.1 of the License, or (at your option) any later version.
24//
25// SigCj is distributed in the hope that it will be useful, but
26// WITHOUT ANY WARRANTY; without even the implied warranty of
27// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28// GNU Lesser General Public License for more details.
29//
30// If you have the complete SigCj workspace then a copy of the
31// GNU Lesser General Public License is in the Docs folder. If
32// not, see <http://www.gnu.org/licenses/>.
33//
34//==============================================================================
35
36Use cCJCommandBarSystem.pkg
37Use cSigCJMethods_Mixin.pkg
38
39{ OverrideProperty=Delegation_Mode DesignTime=False }
40{ OverrideProperty=peAutoCreate DesignTime=False }
41{ OverrideProperty=peNeighborhood DesignTime=False }
42{ OverrideProperty=psLicenseKey DesignTime=False }
43{ OverrideProperty=psProgID DesignTime=False }
44Class cSigCJMenuItem is a cCJMenuItem
45 Import_Class_Protocol cSigCJMethods_Mixin
46
47 Procedure Construct_Object
48 Forward Send Construct_Object
49
50 Property String psMessage
51 Property Handle phDestination Self
52 Property String psAuxillery "" //Any arguments to go with the message when it is fired?
53 End_Procedure
54
55 Procedure End_Construct_Object
56 Forward Send End_Construct_Object
57
58 // Add your code that needs to be executed at the end of the object construction here:
59 End_Procedure
60
61 // AR/PA
62 // Following procedure and Function are replicated from the cSigCJContextMenu package
63 // to allow for the implementation of context menu sub menus. Without this, you are unable
64 // to generate sub menus on the context menu.
65 // These methods really should be in a mixin to be incorporated into both classes.
66 { DesignTime=False }
67 Procedure Add_MenuItem String sCaption String sMessage Boolean bBeginGroup_Optional String sImage_Optional
68 Handle hoMenuItem
69 String sImage
70 Boolean bBeginGroup
71
72 Move False to bBeginGroup
73 If (num_arguments >= 3) ;
74 Move bBeginGroup_Optional to bBeginGroup
75
76 Move "" to sImage
77 If (num_arguments >= 4) ;
78 Move sImage_Optional to sImage
79
80 Get phAdd_MenuItem sCaption sMessage bBeginGroup sImage to hoMenuItem
81 End_Procedure
82
83 { DesignTime=False }
84 Function phAdd_MenuItem String sCaption String sMessage Boolean bBeginGroup String sImage Returns Handle
85 Integer iArraySize
86 Handle hoMenuItem
87 String[][] saMenuItem
88
89 Get psaMenuItem to saMenuItem
90 Move (SizeOfArray(saMenuItem)) to iArraySize
91
92 Get Create U_cSigCJMenuItem to hoMenuItem
93 If (Trim(sImage) <> "") Set psImage of hoMenuItem to (Trim(sImage))
94 If (Trim(sCaption) <> "") Set psCaption of hoMenuItem to (Trim(sCaption))
95 If (Trim(sMessage) <> "") Set psMessage of hoMenuItem to (Trim(sMessage))
96 If (bBeginGroup) Set pbControlBeginGroup of hoMenuItem to True
97
98 Move (Trim(sCaption)) to saMenuItem[iArraySize][0]
99 Move hoMenuItem to saMenuItem[iArraySize][1]
100
101 Set psaMenuItem to saMenuItem
102 Function_Return hoMenuItem
103 End_Function //-- pAdd_MenuItem
104
105 Procedure OnExecute Variant vCommandBarControl
106 Handle hoDestination
107 Integer iMessage
108
109 Move (eval("msg_" + psMessage(Self) )) to iMessage
110 Get phDestination to hoDestination
111 If (Object_Id(hoDestination) and iMessage) ;
112 Send iMessage of hoDestination (psAuxillery(Self))
113 End_Procedure
114End_Class
115
116//==============================================================================
117//End of Package - cSigCJMenuItem.pkg
118//==============================================================================
119