Module cSigCJPopupControl.pkg
1//==============================================================================
2// Project : SigCj - VDF Classes for Codejock
3// File : cSigCJPopupControl.pkg
4// Description : VDF Class for Codejock control
5//
6// Revision : $Rev: 675 $
7// $Date: 2011-02-23 10:51:39 -0500 (Wed, 23 Feb 2011) $
8// $Author: martin $ Martin Pincott
9//
10// Requirements : Visual DataFlex 12.1
11// Codejock SuitePro 2007 - 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 SigCjW_Controls.pkg
37Use cSigCJMethods_Mixin.pkg
38Use cSigCJImage_Manager_Mixin.pkg
39Use StdFont.pkg
40
41Class cSigCjPopupControlItem is a cSigCjComPopupControlItem
42 Import_Class_Protocol cSigCJMethods_Mixin
43
44 Procedure Construct_Object
45 Forward Send Construct_Object
46
47 // Font Properties
48 { DesignTime=False }
49 Property Boolean Private_pbBold False
50
51 { DesignTime=False }
52 Property Boolean Private_pbItalic False
53
54 { DesignTime=False }
55 Property Boolean Private_pbStrikethrough False
56
57 { DesignTime=False }
58 Property Boolean Private_pbUnderline False
59
60 { DesignTime=False }
61 Property String Private_psFontName "MS Sans Serif"
62
63 { DesignTime=False }
64 Property Number Private_pnFontSize 8.25
65
66 { DesignTime=False }
67 Property Handle Private_phoFont (Create(Self, U_cComStdFont))
68
69 End_Procedure
70
71 Procedure Load_Fonts
72 Handle hoFont
73
74 Get Private_phoFont to hoFont
75 Set pvComObject of hoFont to (ComFont(Self))
76
77 // Load defaults
78 Set ComBold of hoFont to (Private_pbBold(Self))
79 Set ComItalic of hoFont to (Private_pbItalic(Self))
80 Set ComStrikethrough of hoFont to (Private_pbStrikethrough(Self))
81 Set ComUnderline of hoFont to (Private_pbUnderline(Self))
82 Set ComName of hoFont to (Private_psFontName(Self))
83 Set ComSize of hoFont to (Private_pnFontSize(Self))
84 End_Procedure
85
86 { MethodType=Property Category="Font" InitialValue=False }
87 Procedure Set pbBold Boolean bState
88 Set ComBold of (Private_phoFont(Self)) to bState
89 End_Procedure
90
91 Function pbBold Returns Boolean
92 Function_Return (ComBold(Private_phoFont(Self)))
93 End_Function
94
95 //-------------------------------------------------------------------------
96
97 { MethodType=Property Category="Font" InitialValue=False }
98 Procedure Set pbItalic Boolean bState
99 Set ComItalic of (Private_phoFont(Self)) to bState
100 End_Procedure
101
102 Function pbItalic Returns Boolean
103 Function_Return (ComItalic(Private_phoFont(Self)))
104 End_Function
105
106 //-------------------------------------------------------------------------
107
108 { MethodType=Property Category="Font" InitialValue=False }
109 Procedure Set pbStrikethrough Boolean bState
110 Set ComStrikethrough of (Private_phoFont(Self)) to bState
111 End_Procedure
112
113 Function pbStrikethrough Returns Boolean
114 Function_Return (ComStrikethrough(Private_phoFont(Self)))
115 End_Function
116
117 //-------------------------------------------------------------------------
118
119 { MethodType=Property Category="Font" InitialValue=False }
120 Procedure Set pbUnderline Boolean bState
121 Set ComUnderline of (Private_phoFont(Self)) to bState
122 End_Procedure
123
124 Function pbUnderline Returns Boolean
125 Function_Return (ComUnderline(Private_phoFont(Self)))
126 End_Function
127
128 //-------------------------------------------------------------------------
129
130 { MethodType=Property Category="Font" InitialValue="MS Sans Serif" }
131 Procedure Set psFontName String sName
132 Set ComName of (Private_phoFont(Self) )to sName
133 End_Procedure
134
135 Function psFontName Returns String
136 Function_Return (ComName(Private_phoFont(Self)))
137 End_Function
138
139 //-------------------------------------------------------------------------
140
141 { MethodType=Property Category="Font" InitialValue=8.25 }
142 Procedure Set pnFontSize Number nSize
143 Set ComSize of (Private_phoFont(Self)) to nSize
144 End_Procedure
145
146 Function pnFontSize Returns Number
147 Function_Return (ComSize(Private_phoFont(Self)))
148 End_Function
149
150 //--------------------------------------------------------------------------------------------------
151
152
153End_Class
154
155{ OverrideProperty=Label DesignTime=False }
156{ OverrideProperty=Label_Col_Offset DesignTime=False }
157{ OverrideProperty=Label_Justification_Mode DesignTime=False }
158{ OverrideProperty=Label_Row_Offset DesignTime=False }
159{ OverrideProperty=Location DesignTime=False }
160{ OverrideProperty=peAnchors DesignTime=False }
161{ OverrideProperty=piMinSize DesignTime=False }
162{ OverrideProperty=Size DesignTime=False }
163{ OverrideProperty=TextColor DesignTime=False }
164{ OverrideProperty=Color DesignTime=False }
165{ OverrideProperty=Border_Style DesignTime=False }
166{ OverrideProperty=Enabled_State DesignTime=False }
167{ OverrideProperty=Visible_State DesignTime=False }
168{ OverrideProperty=Attach_Parent_State DesignTime=False }
169{ OverrideProperty=Block_Mouse_State DesignTime=False }
170{ OverrideProperty=Client_Area_State DesignTime=False }
171{ OverrideProperty=Delegation_Mode DesignTime=False }
172{ OverrideProperty=Focus_Mode DesignTime=False }
173{ OverrideProperty=pbBindValue DesignTime=False }
174{ OverrideProperty=peAutoCreate DesignTime=False }
175{ OverrideProperty=peNeighborhood DesignTime=False }
176{ OverrideProperty=Popup_State DesignTime=False }
177{ OverrideProperty=Ring_State DesignTime=False }
178{ OverrideProperty=Scope_State DesignTime=False }
179{ OverrideProperty=Search_Case DesignTime=False }
180{ OverrideProperty=Skip_State DesignTime=False }
181{ OverrideProperty=Help_Id DesignTime=False }
182{ OverrideProperty=Help_Keyword DesignTime=False }
183{ OverrideProperty=psHtmlHelpTopic DesignTime=False }
184{ OverrideProperty=Status_Help DesignTime=False }
185{ OverrideProperty=Use_Parent_Status_Help DesignTime=False }
186{ OverrideProperty=psLicenseKey DesignTime=False }
187{ OverrideProperty=psProgID DesignTime=False }
188Class cSigCJPopupControl is a cSigCjComPopupControl
189 Import_Class_Protocol cSigCJMethods_Mixin
190 Import_Class_Protocol cSigCJImage_Manager_Mixin
191
192 Procedure Construct_Object
193 Forward Send Construct_Object
194
195 { Visibility=Private }
196 { MethodType=Property }
197 Property Variant[] pvItemHandles
198
199 { Visibility=Private }
200 { MethodType=Property }
201 Property Integer Private.pTheme
202
203 { DesignTime=False }
204 Property Handle phoItem (Create(Self,U_cSigCjPopupControlItem))
205
206 Send Initialise_Image_Manager_Mixin
207 End_Procedure
208
209 { MethodType=Event }
210 Procedure OnCreate
211 Handle hoImageList
212
213 Forward Send OnCreate
214
215 // Connect to Imagelist
216 Get phoImagelist to hoImageList
217 If (hoImageList <> 0) Begin
218 Send Create_Image_Manager // cSigCJImage_Manager_Mixin
219 End
220
221 Send Load_Images
222 Set ComAnimation to OLExtpPopupAnimationSlide
223 Set ComVisualTheme to (Private.pTheme(Self))
224 End_Procedure // OnCreate
225
226 { MethodType=Property }
227 { Category="CodeJock" }
228 #IF (SigCj_Codejock_Version < 150001)
229 { EnumList="OLExtpPopupThemeOffice2000, OLExtpPopupThemeOfficeXP, OLExtpPopupThemeOffice2003, OLExtpPopupThemeMSN, OLExtpPopupThemeOffice2007" }
230 { InitialValue=OLExtpPopupThemeOffice2000 }
231 #ELSE
232 { EnumList="OLExtpPopupThemeOffice2000, OLExtpPopupThemeOfficeXP, OLExtpPopupThemeOffice2003, OLExtpPopupThemeMSN, OLExtpPopupThemeResource, OLExtpPopupThemeCustom" }
233 { InitialValue=OLExtpPopupThemeResource }
234 #ENDIF
235 Procedure Set pPopupControlTheme Integer iTheme
236 If (IsComObjectCreated(Self)) Set ComVisualTheme to iTheme
237 Else Set Private.pTheme to iTheme
238 End_Procedure // Set pPopupControlTheme
239
240 { MethodType=Property }
241 { Category="CodeJock" }
242 Function pPopupControlTheme Returns Integer
243 Function_Return (ComVisualTheme(Self))
244 End_Function // pPopupControlTheme
245
246 // Store list of Variant handles (IDispatch)
247 { Visibility=Private }
248 { MethodType=Property }
249 Procedure Set pvItemHandle Variant vHandle
250 Variant[] vItemHandles
251 Get pvItemHandles to vItemHandles
252 Move vHandle to vItemHandles[(SizeOfArray(vItemHandles))]
253 Set pvItemHandles to vItemHandles
254 End_Procedure
255
256 // Used to find which item the user clicked on
257 { Visibility=Private }
258 { MethodType=Property }
259 Function pvItemHandle Variant vItemHandle Returns Integer
260 Variant[] vItemHandles
261 Integer iCount iRetval
262 Get pvItemHandles to vItemHandles
263 For iCount from 0 to (SizeOfArray(vItemHandles)-1)
264 If (IsSameComObject(vItemHandle, vItemHandles[iCount])) Begin
265 Move iCount to iRetval
266 End
267 Loop
268 Function_Return (iRetval+1)
269 End_Function
270
271 { Visibility=Private }
272 { MethodType=Event }
273 Procedure OnComItemClick Variant vItem
274 Integer iItem
275
276 // Find which item the user clicked on and send it
277 Get pvItemHandle vItem to iItem
278
279 Send OnClick iItem
280 End_Procedure // OnComItemClick
281
282 { MethodType=Event }
283 Procedure OnClick Integer iItem
284 End_Procedure //OnClick
285
286 { MethodType=Method }
287 Procedure Reset
288 Send ComClose
289 Send ComRemoveAllItems
290 End_Procedure
291
292 { MethodType=Method }
293 Procedure Popup
294 Send ComShow
295 End_Procedure
296
297 { MethodType=Method }
298 Function Add_Image_Item Integer iLocX Integer iLocY Integer iSizeX Integer iSizeY Integer iImage Returns Handle
299 Variant vRetval
300 Handle hoItem
301
302 Get phoItem to hoItem
303
304 Get ComAddItem iLocX iLocY iSizeX iSizeY "" "" "" to vRetval
305 Set pvItemHandle to vRetval
306 Set pvComObject of hoItem to vRetval
307
308 Send Load_Fonts of hoItem
309 Set ComIconIndex of hoItem to iImage
310
311 Function_Return hoItem
312 End_Function // Add_Image_Item
313
314 { MethodType=Method }
315 Function Add_Text_Item Integer iLocX Integer iLocY Integer iSizeX Integer iSizeY String sValue Boolean bBold Returns Handle
316 Variant vRetval
317 Handle hoItem hoFont
318
319 Get phoItem to hoItem
320
321 Get ComAddItem iLocX iLocY iSizeX iSizeY sValue "" "" to vRetval
322 Set pvItemHandle to vRetval
323 Set pvComObject of hoItem to vRetval
324
325 Send Load_Fonts of hoItem
326 Set ComIconIndex of hoItem to 0
327 Set ComTextAlignment of hoItem to 17
328
329 Function_Return hoItem
330 End_Function // Add_Item
331
332 {MethodType=Event Visibility=Private}
333 Procedure OnComStateChanged
334 Integer eState
335
336 If (not(IsComObjectCreated(Self))) Begin
337 Procedure_Return
338 End
339 Get ComState to eState
340 Case Begin
341 Case (eState=OLExtpPopupStateClosed)
342 Send OnCollapsed
343 Case Break
344 Case (eState=OLExtpPopupStateExpanding)
345 Send OnExpanding
346 Case Break
347 Case (eState=OLExtpPopupStateShow)
348 Send OnExpanded
349 Case Break
350 Case (eState=OLExtpPopupStateCollapsing)
351 Send OnCollapsing
352 Case Break
353 Case End
354
355 End_Procedure
356
357 {MethodType=Event}
358 Procedure OnCollapsed
359 End_Procedure
360
361 {MethodType=Event}
362 Procedure OnExpanding
363 End_Procedure
364
365 {MethodType=Event}
366 Procedure OnCollapsing
367 End_Procedure
368
369 {MethodType=Event}
370 Procedure OnExpanded
371 End_Procedure
372
373End_Class
374
375//==============================================================================
376//End of Package - cSigCJPopupControl.pkg
377//==============================================================================
378