Files
comun/utile/ctl32/zoomnavbar.vc2

883 lines
31 KiB
Plaintext

*--------------------------------------------------------------------------------------------------------------------------------------------------------
* (EN) AUTOGENERATED - ATTENTION!! - NOT INTENDED FOR EXECUTION!! USE ONLY FOR MERGING CHANGES AND STORING WITH SCM TOOLS!!
*--------------------------------------------------------------------------------------------------------------------------------------------------------
*< FOXBIN2PRG: Version="1.21" SourceFile="zoomnavbar.vcx" CPID="1252" /> (Solo para binarios VFP 9 / Only for VFP 9 binaries)
*
*
DEFINE CLASS reflectedimage AS image
*< CLASSDATA: Baseclass="image" Timestamp="" Scale="Pixels" Uniqueid="" />
*<DefinedPropArrayMethod>
*m: enabled_assign
*p: deletedisabledpicture && Internal to the class. Specify if disabled picture must be deleted when control is destroyed.
*p: deletepicture && Internal to the class. Specify if picture must be deleted when control is destroyed.
*p: disabledpicture && Internal to the class. Specifies the graphic to display when the control is disabled.
*p: enabledpicture && Internal to the class. Specifies the graphic to display when the control is enabled.
*p: _memberdata && XML Metadata for customizable properties
*</DefinedPropArrayMethod>
*<PropValue>
BackStyle = 0
deletedisabledpicture = .F.
deletepicture = .F.
disabledpicture = ("")
enabledpicture = ("")
Height = 48
Name = "reflectedimage"
Stretch = 2
Themes = .F.
Width = 48
_memberdata = <VFPData>
<memberdata name="enabled_assign" type="method" display="Enabled_Assign"/>
<memberdata name="disabledpicture" type="property" display="DisabledPicture"/>
<memberdata name="enabledpicture" type="property" display="EnabledPicture"/>
<memberdata name="deletedisabledpicture" type="property" display="DeleteDisabledPicture"/>
<memberdata name="deletepicture" type="property" display="DeletePicture"/>
</VFPData>
*</PropValue>
PROCEDURE Destroy
* Change this method for builder version
* Set picture property to a non existant image to avoid
* errors while deleting temporary reflected image.
This.Picture = "ZoomNavBarFake.bmp"
*
If This.DeleteDisabledPicture
If File(This.DisabledPicture)
Clear Resources (This.DisabledPicture)
Delete File (This.DisabledPicture)
Endif
Endif
If This.DeletePicture
If File(This.EnabledPicture)
Clear Resources (This.EnabledPicture)
Delete File (This.EnabledPicture)
Endif
Endif
DoDefault()
ENDPROC
HIDDEN PROCEDURE enabled_assign
Lparameters vNewVal
With This
If m.vNewVal
.Picture = .EnabledPicture
Else
.Picture = .DisabledPicture
Endif
.Enabled = m.vNewVal
Endwith
ENDPROC
ENDDEFINE
DEFINE CLASS separatorimage AS image
*< CLASSDATA: Baseclass="image" Timestamp="" Scale="Pixels" Uniqueid="" />
*<DefinedPropArrayMethod>
*m: changetheme
*m: initthemedcontrol
*p: imageid && Internal to the class. Unique identifier.
*p: _memberdata && XML Metadata for customizable properties
*</DefinedPropArrayMethod>
*<PropValue>
BackStyle = 0
Height = 48
imageid = 0
Name = "separatorimage"
Stretch = 2
Themes = .F.
Width = 48
_memberdata = <VFPData>
<memberdata name="imageid" type="property" display="ImageID"/>
<memberdata name="changetheme" type="method" display="ChangeTheme"/>
<memberdata name="initthemedcontrol" type="method" display="InitThemedControl"/>
</VFPData>
*</PropValue>
PROCEDURE changetheme
With This
Local lcMemberName
lcMemberName = ""
If Upper(.Parent.Name)=="CNTREFLECTED"
lcMemberName = "Reflected"
Endif
.Picture = _Screen.ThemesManager.GetMember("ZoomNavBar."+lcMemberName+"Separator.Picture")
Endwith
ENDPROC
PROCEDURE Init
* Change this method for builder version
With This
.Top = 0
.InitThemedControl()
.Visible = .T.
Endwith
ENDPROC
HIDDEN PROCEDURE initthemedcontrol
If Not Vartype(_Screen.ThemesManager)=="O"
_Screen.Newobject("ThemesManager","ThemesManager","ThemedControls.vcx")
Endif
This.ChangeTheme()
ENDPROC
ENDDEFINE
DEFINE CLASS stackbutton AS container
*< CLASSDATA: Baseclass="container" Timestamp="" Scale="Pixels" Uniqueid="" />
*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder
*< OBJECTDATA: ObjPath="imgBackground" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="lblCaption" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="imgPicture" UniqueID="" Timestamp="" />
*<DefinedPropArrayMethod>
*m: changetheme && Internal to the class. Occurs when theme change.
*m: enabled_assign
*m: initthemedcontrol && Internal to the class.
*p: deletedisabledpicture && Internal to the class. Specify if disabled picture must be deleted when control is destroyed.
*p: disabledpicture && Internal to the class. Specifies the graphic to display when the control is disabled.
*p: enabledpicture && Internal to the class. Specifies the graphic to display when the control is enabled.
*p: _memberdata && XML Metadata for customizable properties
*</DefinedPropArrayMethod>
*<PropValue>
BackStyle = 0
BorderWidth = 0
deletedisabledpicture = .F.
disabledpicture = ("")
enabledpicture = ("")
Height = 36
Name = "stackbutton"
Width = 192
_memberdata = <VFPData>
<memberdata name="changetheme" type="method" display="ChangeTheme"/>
<memberdata name="initthemedcontrol" type="method" display="InitThemedControl"/>
<memberdata name="enabled_assign" type="method" display="Enabled_Assign"/>
<memberdata name="deletedisabledpicture" type="property" display="DeleteDisabledPicture"/>
<memberdata name="disabledpicture" type="property" display="DisabledPicture"/>
<memberdata name="enabledpicture" type="property" display="EnabledPicture"/>
</VFPData>
*</PropValue>
ADD OBJECT 'imgBackground' AS image WITH ;
BackStyle = 0, ;
Height = 24, ;
Name = "imgBackground", ;
Stretch = 2, ;
Top = 6, ;
Width = 155
*< END OBJECT: BaseClass="image" />
ADD OBJECT 'imgPicture' AS image WITH ;
BackStyle = 0, ;
Height = 32, ;
Left = 157, ;
Name = "imgPicture", ;
Stretch = 2, ;
Top = 2, ;
Width = 32
*< END OBJECT: BaseClass="image" />
ADD OBJECT 'lblCaption' AS label WITH ;
Alignment = 1, ;
BackStyle = 0, ;
Caption = "Label1", ;
FontBold = .T., ;
FontSize = 8, ;
ForeColor = 255,255,255, ;
Height = 16, ;
Left = 5, ;
Name = "lblCaption", ;
Top = 10, ;
Width = 145
*< END OBJECT: BaseClass="label" />
PROCEDURE changetheme && Internal to the class. Occurs when theme change.
This.imgBackground.Picture = _Screen.ThemesManager.GetMember("ZoomNavBar.StackButton.Picture")
ENDPROC
PROCEDURE Destroy
* Change this method for builder version
* Set picture property to a non existant image to avoid
* errors while deleting temporary reflected image.
This.imgPicture.Picture = "ZoomNavBarFake.bmp"
*
If This.DeleteDisabledPicture
If File(This.DisabledPicture)
Clear Resources (This.DisabledPicture)
Delete File (This.DisabledPicture)
Endif
Endif
DoDefault()
ENDPROC
HIDDEN PROCEDURE enabled_assign
Lparameters vNewVal
With This
If m.vNewVal
.imgPicture.Picture = .EnabledPicture
Else
.imgPicture.Picture = .DisabledPicture
Endif
.Enabled = m.vNewVal
Endwith
ENDPROC
PROCEDURE Init
Lparameters lcCaption, lcPicture, lcDisabledPicture, ;
llDeleteDisabledPicture, llEnabled, lnTop
With This
With .lblCaption
.Caption = lcCaption
.Width = Txtwidth(lcCaption,.FontName,.FontSize,"B")*;
Fontmetric(6,.FontName,.FontSize,"B")
Endwith
.DeleteDisabledPicture = llDeleteDisabledPicture
.DisabledPicture = lcDisabledPicture
.EnabledPicture = lcPicture
.Enabled = llEnabled
.imgBackground.Width = .lblCaption.Width + 10
.Top = lnTop
.Width = .imgBackground.Width + ;
5 + .imgPicture.Width
.imgPicture.Left = .Width - 2 - .imgPicture.Width
If .Width > .Parent.Width
.Parent.Width = .Width
Endif
.InitThemedControl()
.Visible = .T.
Endwith
ENDPROC
HIDDEN PROCEDURE initthemedcontrol && Internal to the class.
If Not Vartype(_Screen.ThemesManager)=="O"
_Screen.Newobject("ThemesManager","ThemesManager","ThemedControls.vcx")
Endif
This.ChangeTheme()
ENDPROC
ENDDEFINE
DEFINE CLASS stackcontainer AS container
*< CLASSDATA: Baseclass="container" Timestamp="" Scale="Pixels" Uniqueid="" />
*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder
*< OBJECTDATA: ObjPath="shpMouseHandler" UniqueID="" Timestamp="" />
*<DefinedPropArrayMethod>
*m: buttonclicked && Occurs when a button is clicked.
*m: reposition && Move the stack to the current parent button coordinates.
*p: _memberdata && XML Metadata for customizable properties
*</DefinedPropArrayMethod>
*<PropValue>
BackStyle = 0
BorderWidth = 0
Name = "stackcontainer"
Visible = .F.
_memberdata = <VFPData>
<memberdata name="reposition" type="method" display="Reposition"/>
<memberdata name="buttonclicked" type="method" display="ButtonClicked"/>
</VFPData>
*</PropValue>
ADD OBJECT 'shpMouseHandler' AS shape WITH ;
Anchor = 15, ;
BackStyle = 0, ;
BorderStyle = 0, ;
Height = 75, ;
Name = "shpMouseHandler", ;
Width = 75
*< END OBJECT: BaseClass="shape" />
PROCEDURE buttonclicked && Occurs when a button is clicked.
ENDPROC
PROCEDURE reposition && Move the stack to the current parent button coordinates.
Lparameters lnRight, lnTop
With This
.Left = lnRight - .Width
.Top = lnTop - .Height
.shpMouseHandler.ZOrder(0)
.Visible = .T.
Endwith
ENDPROC
PROCEDURE shpMouseHandler.Click
This.Visible = .F.
Local loObject, lcButton, llEnabled
loObject = Sys(1270)
llEnabled = .T.
Do Case
Case Upper(loObject.Class)=="STACKBUTTON"
lcButton = loObject.Name
llEnabled = loObject.Enabled
Case Upper(loObject.Parent.Class)=="STACKBUTTON"
lcButton = loObject.Parent.Name
llEnabled = loObject.Parent.Enabled
Endcase
loObject = Null
This.Visible = .T.
If llEnabled
This.Parent.Visible = .F.
If Not Empty(lcButton)
This.Parent.ButtonClicked(lcButton)
Endif
Endif
ENDPROC
PROCEDURE shpMouseHandler.MouseLeave
Lparameters nButton, nShift, nXCoord, nYCoord
This.Parent.Visible = .F.
ENDPROC
ENDDEFINE
DEFINE CLASS zoomimage AS image
*< CLASSDATA: Baseclass="image" Timestamp="" Scale="Pixels" Uniqueid="" />
*<DefinedPropArrayMethod>
*m: enabled_assign
*p: deletedisabledpicture && Internal to the class. Specify if disabled picture must be deleted when control is destroyed.
*p: description && Button's function description.
*p: disabledpicture && Internal to the class. Specifies the graphic to display when the control is disabled.
*p: enabledpicture && Internal to the class. Specifies the graphic to display when the control is enabled.
*p: imageid && Internal to the class. Unique identifier.
*p: stack && Internal to the class. A pointer to an StackContainer object.
*p: _memberdata && XML Metadata for customizable properties
*</DefinedPropArrayMethod>
*<PropValue>
BackStyle = 0
deletedisabledpicture = .F.
disabledpicture = ("")
enabledpicture = ("")
Height = 48
imageid = 0
Name = "zoomimage"
stack = .F.
Stretch = 2
Themes = .F.
Width = 48
_memberdata = <VFPData>
<memberdata name="description" type="property" display="Description"/>
<memberdata name="imageid" type="property" display="ImageID"/>
<memberdata name="stack" type="property" display="Stack"/>
<memberdata name="enabled_assign" type="method" display="Enabled_Assign"/>
<memberdata name="deletedisabledpicture" type="property" display="DeleteDisabledPicture"/>
<memberdata name="disabledpicture" type="property" display="DisabledPicture"/>
<memberdata name="enabledpicture" type="property" display="EnabledPicture"/>
</VFPData>
*</PropValue>
PROCEDURE Click
With This.Parent.Parent
If Vartype(This.Stack)=="O"
Bindevent(This.Stack,"ButtonClicked",This.Parent.Parent,"StackButtonClicked",1)
Bindevent(This.Stack.shpMouseHandler,"MouseLeave",This,"MouseLeave",1)
This.Stack.RePosition(.Left+This.Left+This.Width,.Top+3)
Else
.ButtonClicked(.ActiveButtonName)
Endif
Endwith
ENDPROC
PROCEDURE Destroy
This.Stack = Null
* Change this method for builder version
* Set picture property to a non existant image to avoid
* errors while deleting temporary reflected image.
This.Picture = "ZoomNavBarFake.bmp"
*
If This.DeleteDisabledPicture
If File(This.DisabledPicture)
Clear Resources (This.DisabledPicture)
Delete File (This.DisabledPicture)
Endif
Endif
DoDefault()
ENDPROC
HIDDEN PROCEDURE enabled_assign
Lparameters vNewVal
With This
If m.vNewVal
.Picture = .EnabledPicture
Else
.Picture = .DisabledPicture
Endif
.Enabled = m.vNewVal
Endwith
ENDPROC
PROCEDURE MouseEnter
Lparameters nButton, nShift, nXCoord, nYCoord
This.Parent.Parent.ActiveButtonName = This.Name
This.Parent.Parent.ActiveButtonNumber = This.ImageID
This.Parent.Parent.RearrangeButtons()
*
With This.Parent.Parent
With .Ctl32_BalloonTip
.ctlVisible = .F.
.ctlFadeIn = .T.
.ctlFadeOut = .T.
.ctlOffsetY = 1
.ctlAlignment = 6
.ctlPosition = 6
.ctlPositionStyle = 4
.ctlHideDelay = 10000
.ctlCapsLockStyle = 0
.ctlText = This.Description
.ctlVisible = .T.
Endwith
Endwith
ENDPROC
PROCEDURE MouseLeave
Lparameters nButton, nShift, nXCoord, nYCoord
*
With This.Parent.Parent
With .Ctl32_BalloonTip
If .ctlVisible
.ctlVisible = .F.
Endif
Endwith
Endwith
*
Local llStack
llStack = (Vartype(This.Stack)=="O")
If Not (llStack And This.Stack.Visible)
If llStack
Unbindevents(This.Stack,"ButtonClicked",This.Parent.Parent,"StackButtonClicked")
Unbindevents(This.Stack.shpMouseHandler,"MouseLeave",This,"MouseLeave")
Endif
This.Parent.Parent.Parent.Refresh()
This.Parent.Parent.ActiveButtonName = "None"
This.Parent.Parent.ActiveButtonNumber = 0
This.Parent.Parent.RearrangeButtons()
Endif
ENDPROC
ENDDEFINE
DEFINE CLASS zoomnavbar AS container
*< CLASSDATA: Baseclass="container" Timestamp="" Scale="Pixels" Uniqueid="" />
*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder
*< OBJECTDATA: ObjPath="imgBackground" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="shpMouseHandler" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="Ctl32_BalloonTip" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="cntZoom" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="cntReflected" UniqueID="" Timestamp="" />
*<DefinedPropArrayMethod>
*m: addbutton && Add a new button.
*m: addstackbutton && Add a new stack button.
*m: buttonclicked && Occurs when a button is clicked.
*m: changetheme && Internal to the class. Occurs when theme change.
*m: createadditionalimages && Internal to the class. Create necessary images to achieve the effects.
*m: initthemedcontrol && Internal to the class.
*m: rearrangebuttons && Internal to the class. Rearrange buttons to show in correctly position.
*m: setbuttonstate && Set the button state: enabled or disabled.
*m: setstackbuttonstate && Set the stack button state: enabled or disabled.
*m: stackbuttonclicked && Occurs when a stack button is clicked.
*p: activebuttonname && Internal to the class. Contain the name of the active (zoomed) button.
*p: activebuttonnumber && Internal to the class. Contain the number of the active (zoomed) button.
*p: custombuilder
*p: stretch && Specify if the bar is stretched or not.
*p: version && ZoomNavBar version.
*p: _memberdata && XML Metadata for customizable properties
*</DefinedPropArrayMethod>
PROTECTED version
*<PropValue>
activebuttonname = ("None")
activebuttonnumber = 0
Anchor = 14
BackStyle = 0
BorderWidth = 0
custombuilder = Double click here to open Builder
Height = 125
Name = "zoomnavbar"
version = 3.5.0
Width = 200
_memberdata = <VFPData>
<memberdata name="addbutton" type="method" display="AddButton"/>
<memberdata name="buttonclicked" type="method" display="ButtonClicked"/>
<memberdata name="rearrange" type="method" display="ReArrange"/>
<memberdata name="rearrangebuttons" type="method" display="ReArrangeButtons"/>
<memberdata name="version" type="property" display="Version"/>
<memberdata name="transparentimage" type="property" display="TransparentImage"/>
<memberdata name="activebuttonname" type="property" display="ActiveButtonName"/>
<memberdata name="activebuttonnumber" type="property" display="ActiveButtonNumber"/>
<memberdata name="tempfolder" type="property" display="TempFolder"/>
<memberdata name="stretch" type="property" display="Stretch"/>
<memberdata name="addstackbutton" type="method" display="AddStackButton"/>
<memberdata name="stackbuttonclicked" type="method" display="StackButtonClicked"/>
<memberdata name="changetheme" type="method" display="ChangeTheme"/>
<memberdata name="custombuilder" type="property" display="CustomBuilder" script="Local lnControls, laObjects[1]&#xA;m.lnControls = Aselobj(m.laObjects)&#xA;If m.lnControls # 0&#xA; Local loObject, lcClassLib, loBuilder&#xA; m.loObject = m.laObjects[1]&#xA; m.lcClassLib = Addbs(Justpath(m.loObject.ClassLibrary))+&quot;ThemedControlsBuilders.vcx&quot;&#xA; Set Classlib To (m.lcClassLib) Additive&#xA; m.loBuilder = Createobject(&quot;ZoomNavBarBuilder&quot;, m.loObject)&#xA; m.loBuilder.Show()&#xA;Endif"/>
<memberdata name="initthemedcontrol" type="method" display="InitThemedControl"/>
<memberdata name="createadditionalimages" type="method" display="CreateAdditionalImages"/>
<memberdata name="setbuttonstate" type="method" display="SetButtonState"/>
<memberdata name="setstackbuttonstate" type="method" display="SetStackButtonState"/>
</VFPData>
*</PropValue>
ADD OBJECT 'cntReflected' AS container WITH ;
BackStyle = 0, ;
BorderWidth = 0, ;
Height = 24, ;
Left = 0, ;
Name = "cntReflected", ;
Top = 99, ;
Width = 200
*< END OBJECT: BaseClass="container" />
ADD OBJECT 'cntZoom' AS container WITH ;
BackStyle = 0, ;
BorderWidth = 0, ;
Height = 96, ;
Left = 0, ;
Name = "cntZoom", ;
Top = 3, ;
Width = 200
*< END OBJECT: BaseClass="container" />
ADD OBJECT 'Ctl32_BalloonTip' AS ctl32_balloontip WITH ;
Height = 0, ;
Name = "Ctl32_BalloonTip", ;
Width = 0, ;
tmrHide.Name = "tmrHide", ;
lblname.Name = "lblname", ;
tmrShow.Name = "tmrShow"
*< END OBJECT: ClassLib="ctl32.vcx" BaseClass="container" />
ADD OBJECT 'imgBackground' AS image WITH ;
BackStyle = 0, ;
BorderStyle = 1, ;
Height = 0, ;
Left = 0, ;
Name = "imgBackground", ;
Stretch = 2, ;
Themes = .F., ;
Top = 75, ;
Width = 0
*< END OBJECT: BaseClass="image" />
ADD OBJECT 'shpMouseHandler' AS shape WITH ;
BackStyle = 0, ;
BorderStyle = 0, ;
Height = 3, ;
Name = "shpMouseHandler", ;
Width = 200
*< END OBJECT: BaseClass="shape" />
PROCEDURE addbutton && Add a new button.
Lparameters lcName, lcDescription, ;
lcPicture, lcReflectedPicture, ;
lcDisabledPicture, lcDisabledReflectedPicture, ;
llEnabled
If Pcount()<7
* To avoid changes to this method call when upgrading from previous versions
llEnabled = .T.
Endif
With This
Local lcClassLibrary, lnControlCount
lcClassLibrary = "ZoomNavBar.vcx"
lnControlCount = .cntZoom.ControlCount+1
If Upper(lcName)=="SEPARATOR"
lcName = lcName + Alltrim(Transform(lnControlCount))
.cntZoom.Newobject( lcName,"SeparatorImage",lcClassLibrary )
.cntReflected.Newobject( lcName,"SeparatorImage",lcClassLibrary )
Else
Local llCreateReflectedPicture, llCreateDisabledPicture, llCreateDisabledReflectedPicture
lcPicture = Fullpath(lcPicture)
*
If Empty(lcReflectedPicture)
lcReflectedPicture = Addbs(_Screen.ThemesManager.TempFolder) + ;
Juststem(lcPicture) + "_Reflected." + Justext(lcPicture)
Endif
llCreateReflectedPicture = Not File(lcReflectedPicture)
If Empty(lcDisabledPicture)
lcDisabledPicture = Addbs(_Screen.ThemesManager.TempFolder) + ;
Juststem(lcPicture) + "_Disabled." + Justext(lcPicture)
Endif
llCreateDisabledPicture = Not File(lcDisabledPicture)
If Empty(lcDisabledReflectedPicture)
lcDisabledReflectedPicture = Addbs(_Screen.ThemesManager.TempFolder) + ;
Juststem(lcPicture) + "_DisabledReflected." + Justext(lcPicture)
Endif
llCreateDisabledReflectedPicture = Not File(lcDisabledReflectedPicture)
*
If llCreateReflectedPicture Or llCreateDisabledPicture Or llCreateDisabledReflectedPicture
.CreateAdditionalImages(lcPicture,;
Iif(llCreateReflectedPicture,lcReflectedPicture,""),;
Iif(llCreateDisabledPicture,lcDisabledPicture,""),;
Iif(llCreateDisabledReflectedPicture,lcDisabledReflectedPicture,""))
Endif
*
.cntZoom.Newobject( lcName,"ZoomImage",lcClassLibrary )
With .cntZoom.Controls(lnControlCount)
.DeleteDisabledPicture = llCreateDisabledPicture
.Description = lcDescription
.DisabledPicture = lcDisabledPicture
.EnabledPicture = lcPicture
.ImageID = lnControlCount
.Top = 48
.Visible = .T.
Endwith
*
.cntReflected.Newobject( lcName,"ReflectedImage",lcClassLibrary )
With .cntReflected.Controls(lnControlCount)
.DeleteDisabledPicture = llCreateDisabledReflectedPicture
.DeletePicture = llCreateReflectedPicture
.DisabledPicture = lcDisabledReflectedPicture
.EnabledPicture = lcReflectedPicture
.Top = 0
.Visible = .T.
Endwith
*
.SetButtonState(lcName,llEnabled)
Endif
If Upper(Thisform.BaseClass)=="TOOLBAR"
This.Width = (lnControlCount*48)+48+24+24+12
Endif
.ReArrangeButtons()
Endwith
ENDPROC
PROCEDURE addstackbutton && Add a new stack button.
Lparameters lcParent, lcName, lcCaption, ;
lcPicture, lcDisabledPicture, llEnabled
If Pcount()<6
* To avoid changes to this method call when upgrading from previous versions
llEnabled = .T.
Endif
If Not Upper(Thisform.BaseClass)=="TOOLBAR"
If Pemstatus(This.cntZoom,lcParent,5)
*
Local llCreateDisabledPicture
lcPicture = Fullpath(lcPicture)
If Empty(lcDisabledPicture)
lcDisabledPicture = Addbs(_Screen.ThemesManager.TempFolder) + ;
Juststem(lcPicture) + "_Disabled." + Justext(lcPicture)
Endif
llCreateDisabledPicture = Not File(lcDisabledPicture)
If llCreateDisabledPicture
.CreateAdditionalImages(lcPicture,"",;
Iif(llCreateDisabledPicture,lcDisabledPicture,""),;
"")
Endif
*
Local lcClassLibrary, loParent, lnTop
lcClassLibrary = "ZoomNavBar.vcx"
loParent = Evaluate("This.cntZoom."+lcParent)
If Not Vartype(loParent.Stack)=="O"
Local lcStackName
lcStackName = "Stack_"+loParent.Name
Thisform.Newobject(lcStackName,"StackContainer",lcClassLibrary)
loParent.Stack = Evaluate("Thisform."+lcStackName)
Endif
lnTop = ((loParent.Stack.ControlCount-1)*36)
loParent.Stack.Newobject(lcName,"StackButton",lcClassLibrary,,;
lcCaption,lcPicture,lcDisabledPicture,llCreateDisabledPicture,llEnabled,lnTop)
loParent.Stack.Controls(loParent.Stack.ControlCount).ChangeTheme()
*
Local lnHeight, loStackButton
lnHeight = 0
For Each loStackButton In loParent.Stack.Controls
With loStackButton
If Upper(loStackButton.Class)=="STACKBUTTON"
lnHeight = lnHeight + .Height
.Left = loParent.Stack.Width - .Width
Endif
Endwith
Endfor
loParent.Stack.Height = lnHeight
*
Store Null To loStackButton, loParent
Endif
Endif
ENDPROC
PROCEDURE buttonclicked && Occurs when a button is clicked.
Lparameters lcName
ENDPROC
PROCEDURE changetheme && Internal to the class. Occurs when theme change.
With This.imgBackground
.BorderColor = _Screen.ThemesManager.GetMember("Container.BorderColor")
.Picture = _Screen.ThemesManager.GetMember("ZoomNavBar.Bar.Picture")
Endwith
ENDPROC
PROCEDURE createadditionalimages && Internal to the class. Create necessary images to achieve the effects.
Lparameters lcPicture, lcReflectedPicture, ;
lcDisabledPicture, lcDisabledReflectedPicture
If Not Vartype(_Screen.System)=="O"
Do System.App && Init GDIPlusX
Endif
Local loBitmap As xfcBitmap, loClrMatrix As xfcColorMatrix
With _Screen.System.Drawing
If Not Empty(lcReflectedPicture) Or Not Empty(lcDisabledReflectedPicture)
loBitmap = .Bitmap.New(lcPicture)
loBitmap.RotateFlip(.RotateFlipType.Rotate180FlipX)
loClrMatrix = .Imaging.ColorMatrix.New()
loClrMatrix.Matrix33 = 0.3
loBitmap.ApplyColorMatrix(loClrMatrix)
If Not Empty(lcReflectedPicture)
loBitmap.Save(lcReflectedPicture,.Imaging.ImageFormat.Png)
Endif
If Not Empty(lcDisabledReflectedPicture)
loClrMatrix = _Screen.System.Drawing.Imaging.ColorMatrix.New( ;
.299, .299, .299, 0, 0, ;
.587, .587, .587, 0, 0, ;
.114, .114, .114, 0, 0, ;
0 , 0, 0, 1, 0, ;
0 , 0, 0, 0, 1)
loBitmap.ApplyColorMatrix(loClrMatrix)
loBitmap.Save(lcDisabledReflectedPicture,.Imaging.ImageFormat.Png)
Endif
Endif
*
If Not Empty(lcDisabledPicture)
loBitmap = .Bitmap.New(lcPicture)
loClrMatrix = _Screen.System.Drawing.Imaging.ColorMatrix.New( ;
.299, .299, .299, 0, 0, ;
.587, .587, .587, 0, 0, ;
.114, .114, .114, 0, 0, ;
0 , 0, 0, 1, 0, ;
0 , 0, 0, 0, 1)
loBitmap.ApplyColorMatrix(loClrMatrix)
loBitmap.Save(lcDisabledPicture,.Imaging.ImageFormat.Png)
Endif
*
Endwith
Store Null To loBitmap, loClrMatrix
ENDPROC
PROCEDURE Init
Thisform.ShowTips = .T.
This.InitThemedControl()
ENDPROC
HIDDEN PROCEDURE initthemedcontrol && Internal to the class.
If Not Vartype(_Screen.ThemesManager)=="O"
_Screen.Newobject("ThemesManager","ThemesManager","ThemedControls.vcx")
Endif
This.ChangeTheme()
ENDPROC
PROCEDURE rearrangebuttons && Internal to the class. Rearrange buttons to show in correctly position.
Local lnActiveButton
lnActiveButton = This.ActiveButtonNumber
With This.cntZoom
Local lnControlCount, lnZoomOffset, lnLeft, lnButton, lnWidth
lnControlCount = .ControlCount
If lnActiveButton==0
lnZoomOffset = 0
Else
lnZoomOffset = 48
If lnActiveButton>1 And Not ;
Upper(.Controls(lnActiveButton-1).Class)=="SEPARATORIMAGE"
lnZoomOffset = lnZoomOffset + 24
Endif
If lnActiveButton<lnControlCount And Not ;
Upper(.Controls(lnActiveButton+1).Class)=="SEPARATORIMAGE"
lnZoomOffset = lnZoomOffset + 24
Endif
Endif
lnLeft = Max(0,Int((.Width - (lnControlCount*48) - lnZoomOffset)/2))
For lnButton = 1 To lnControlCount
With .Controls(lnButton)
If Vartype(.Stack)=="O"
.Stack.Visible = .F.
Endif
Store lnLeft To .Left, ;
This.cntReflected.Controls(lnButton).Left
If lnActiveButton>0 And ;
lnActiveButton==.ImageID
.Top = 0
lnWidth = 96
Else
If Not Upper(.Class)=="SEPARATORIMAGE" And ;
lnActiveButton>0 And ;
Inlist(.ImageID,lnActiveButton-1,;
lnActiveButton+1)
.Top = 24
lnWidth = 72
Else
.Top = 48
lnWidth = 48
Endif
Endif
Store lnWidth To .Height, .Width, ;
This.cntReflected.Controls(lnButton).Height, ;
This.cntReflected.Controls(lnButton).Width
lnLeft = lnLeft + lnWidth
Endwith
Next
*
If Not This.Stretch And lnControlCount>0
With This.cntZoom
This.imgBackground.Left = .Controls(1).Left - 6
This.imgBackground.Width = (.Controls(lnControlCount).Left + ;
.Controls(lnControlCount).Width) - This.imgBackground.Left + 6
Endwith
Endif
Endwith
ENDPROC
PROCEDURE Resize
DoDefault()
With This
.shpMouseHandler.Width = .Width
.cntZoom.Width = .Width
.cntReflected.Width = .Width
If .Stretch
.imgBackground.Width = .Width
Endif
.ReArrangeButtons()
Endwith
ENDPROC
PROCEDURE setbuttonstate && Set the button state: enabled or disabled.
Lparameters lcButton, llEnabled
Store llEnabled To ;
This.cntZoom.&lcButton..Enabled, ;
This.cntReflected.&lcButton..Enabled
ENDPROC
PROCEDURE setstackbuttonstate && Set the stack button state: enabled or disabled.
Lparameters lcButton, lcStackButton, llEnabled
This.cntZoom.&lcButton..Stack.&lcStackButton..Enabled = llEnabled
ENDPROC
PROCEDURE stackbuttonclicked && Occurs when a stack button is clicked.
Lparameters lcName
ENDPROC
PROCEDURE imgBackground.Init
This.Height = 50
ENDPROC
PROCEDURE shpMouseHandler.MouseEnter
Lparameters nButton, nShift, nXCoord, nYCoord
With This.Parent
If Not .ActiveButtonName = "None"
.ActiveButtonName = "None"
.ActiveButtonNumber = 0
.RearrangeButtons()
Endif
Endwith
ENDPROC
ENDDEFINE