*-------------------------------------------------------------------------------------------------------------------------------------------------------- * (EN) AUTOGENERATED - ATTENTION!! - NOT INTENDED FOR EXECUTION!! USE ONLY FOR MERGING CHANGES AND STORING WITH SCM TOOLS!! *-------------------------------------------------------------------------------------------------------------------------------------------------------- *< FOXBIN2PRG: Version="1.21" SourceFile="explorerbar.vcx" CPID="1252" /> (Solo para binarios VFP 9 / Only for VFP 9 binaries) * * DEFINE CLASS explorerbar 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="Ctl32_Scrollbar" UniqueID="" Timestamp="" /> * *m: changetheme && Occurs when theme change. *m: initthemedcontrol *m: reposition && Reposition groups after collapse/expand a group. *m: scroll && Move the ScrollBar to show the current group. *p: custombuilder *p: version && ExplorerBar version. *p: _memberdata && XML Metadata for customizable properties * PROTECTED Init,Resize * Anchor = 7 BorderWidth = 0 custombuilder = Double click here to open Builder Height = 208 Name = "explorerbar" version = 3.5.0 Width = 267 _memberdata = * ADD OBJECT 'Ctl32_Scrollbar' AS ctl32_scrollbar WITH ; ctlorientation = 1, ; Height = 0, ; Left = 249, ; Name = "Ctl32_Scrollbar", ; Top = -1, ; Width = 18, ; lblname.Name = "lblname", ; ctlTextBox.Name = "ctlTextBox" *< END OBJECT: ClassLib="ctl32.vcx" BaseClass="container" /> ADD OBJECT 'imgBackground' AS image WITH ; Height = 0, ; Name = "imgBackground", ; Stretch = 2, ; Top = -1, ; Width = 249 *< END OBJECT: BaseClass="image" /> PROCEDURE changetheme && Occurs when theme change. This.imgBackground.Picture = _Screen.ThemesManager.GetMember("ExplorerBar.Background.Picture") ENDPROC PROTECTED PROCEDURE Init This.InitThemedControl() This.Reposition(.T.) ENDPROC HIDDEN PROCEDURE initthemedcontrol If Not Vartype(_Screen.ThemesManager)=="O" _Screen.Newobject("ThemesManager","ThemesManager","ThemedControls.vcx") Endif This.ChangeTheme() ENDPROC PROCEDURE reposition && Reposition groups after collapse/expand a group. Lparameters llMove Local lnTop, lnHeight, loGroup With This.Ctl32_Scrollbar m.lnTop = .ctlMinimum - .ctlValue Endwith m.lnHeight = 0 For Each loGroup In This.Controls With m.loGroup If Not Inlist(Upper(.Name),; "IMGBACKGROUND","CTL32_SCROLLBAR") If m.llMove .Top = m.lnTop .Left = 4 Endif m.lnTop = .Top + .Height m.lnHeight = m.lnHeight + .Height Endif Endwith Endfor m.loGroup = Null * With This Local llScrollBar llScrollBar = (m.lnHeight > .Height) With .Ctl32_Scrollbar If llScrollBar .ctlMaximum = m.lnHeight .ctlLargeChange = .Height Else If Not .ctlValue==.ctlMinimum .ctlValue = .ctlMinimum Endif Endif .ctlVisible = llScrollBar Endwith Endwith ENDPROC PROTECTED PROCEDURE Resize With This Store 0 To ; .imgBackground.Top, ; .Ctl32_Scrollbar.Top Store .Height To ; .imgBackground.Height, ; .Ctl32_Scrollbar.Height .imgBackground.Width = .Width .Reposition(.F.) Endwith * The following code ensures that focus rectangle is visible Try Local loObject m.loObject = This.ActiveControl With m.loObject If Upper(.Name)=="CMDFOCUS" This.Scroll(.Parent.Top,.Parent.Height) .Visible = .F. .Visible = .T. Endif Endwith m.loObject = Null Catch Endtry ENDPROC PROCEDURE scroll && Move the ScrollBar to show the current group. Lparameters lnTop, lnHeight With This.Ctl32_ScrollBar If .ctlVisible .ctlValue = (m.lnTop + m.lnHeight + 1 + .ctlValue) - This.Height Endif Endwith ENDPROC PROCEDURE Ctl32_Scrollbar.ctlvaluechanged This.Parent.Reposition(.T.) ENDPROC ENDDEFINE DEFINE CLASS explorergroup 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="linBottomBorder" UniqueID="" Timestamp="" /> *< OBJECTDATA: ObjPath="linLeftBorder" UniqueID="" Timestamp="" /> *< OBJECTDATA: ObjPath="linRightBorder" UniqueID="" Timestamp="" /> *< OBJECTDATA: ObjPath="cntUserControls" UniqueID="" Timestamp="" /> *< OBJECTDATA: ObjPath="imgTitle" UniqueID="" Timestamp="" /> *< OBJECTDATA: ObjPath="cmdFocus" UniqueID="" Timestamp="" /> *< OBJECTDATA: ObjPath="lblTitle" UniqueID="" Timestamp="" /> *< OBJECTDATA: ObjPath="imgPicture" UniqueID="" Timestamp="" /> *< OBJECTDATA: ObjPath="shpMouseHandler" UniqueID="" Timestamp="" /> * *m: activate && Occurs when group receive the focus. *m: changetheme && Occurs when theme change. *m: clicked && Occurs when shpMouseHandler or cmdFocus are clicked. *m: collapse && Occurs when group is collapsed. *m: expand && Occurs when group is expanded. *m: highlightheader && Occurs when header receive focus. *m: initthemedcontrol *p: custombuilder *p: imgcollapsehighlighted && Path and name of the button's image displayed when group is collapsed and highlighted. *p: imgcollapsenothighlighted && Path and name of the button's image displayed when group is collapsed and not highlighted. *p: imgexpandhighlighted && Path and name of the button's image displayed when group is expanded and highlighted. *p: imgexpandnothighlighted && Path and name of the button's image displayed when group is expanded and highlighted. *p: initialheight && Initial group height. *p: lblhighlight && Highlighted group font color. *p: lblnothighlight && Not highlighted group font color. *p: state && Specify if the group is expanded (0) or collapsed (1). *p: type && Specify if group type is normal (0) or special (1). *p: _memberdata && XML Metadata for customizable properties * HIDDEN initialheight PROTECTED GotFocus,Init,Resize * BackStyle = 0 BorderWidth = 0 custombuilder = Double click here to open Builder Height = 200 imgcollapsehighlighted = ("") imgcollapsenothighlighted = ("") imgexpandhighlighted = ("") imgexpandnothighlighted = ("") initialheight = 0 lblhighlight = 0 lblnothighlight = 0 Name = "explorergroup" state = 0 type = 0 Width = 241 _memberdata = * ADD OBJECT 'cmdFocus' AS commandbutton WITH ; Caption = "Command1", ; Height = 21, ; Left = 3, ; Name = "cmdFocus", ; Style = 1, ; TabIndex = 2, ; Top = 14, ; Width = 235 *< END OBJECT: BaseClass="commandbutton" /> ADD OBJECT 'cntUserControls' AS container WITH ; Height = 159, ; Left = 0, ; Name = "cntUserControls", ; TabIndex = 3, ; Top = 37, ; Width = 241 *< END OBJECT: BaseClass="container" /> ADD OBJECT 'imgBackground' AS image WITH ; BackStyle = 0, ; Height = 159, ; Left = 0, ; Name = "imgBackground", ; Stretch = 2, ; Themes = .F., ; Top = 37, ; Width = 241 *< END OBJECT: BaseClass="image" /> ADD OBJECT 'imgPicture' AS image WITH ; BackStyle = 0, ; Height = 32, ; Left = 0, ; Name = "imgPicture", ; Stretch = 2, ; Top = 4, ; Width = 32 *< END OBJECT: BaseClass="image" /> ADD OBJECT 'imgTitle' AS image WITH ; BackStyle = 0, ; Height = 25, ; Left = 0, ; Name = "imgTitle", ; Stretch = 2, ; Top = 12, ; Width = 241 *< END OBJECT: BaseClass="image" /> ADD OBJECT 'lblTitle' AS label WITH ; Caption = "Label1", ; FontBold = .T., ; FontSize = 8, ; Height = 17, ; Left = 37, ; Name = "lblTitle", ; TabIndex = 1, ; Top = 16, ; Width = 176 *< END OBJECT: BaseClass="label" /> ADD OBJECT 'linBottomBorder' AS line WITH ; Height = 0, ; Left = 0, ; Name = "linBottomBorder", ; Top = 196, ; Width = 241 *< END OBJECT: BaseClass="line" /> ADD OBJECT 'linLeftBorder' AS line WITH ; Height = 160, ; Left = 0, ; Name = "linLeftBorder", ; Top = 37, ; Width = 0 *< END OBJECT: BaseClass="line" /> ADD OBJECT 'linRightBorder' AS line WITH ; Height = 160, ; Left = 240, ; Name = "linRightBorder", ; Top = 37, ; Width = 0 *< END OBJECT: BaseClass="line" /> ADD OBJECT 'shpMouseHandler' AS shape WITH ; BackStyle = 0, ; BorderStyle = 0, ; Height = 33, ; Left = 0, ; MousePointer = 15, ; Name = "shpMouseHandler", ; Top = 4, ; Width = 241 *< END OBJECT: BaseClass="shape" /> PROCEDURE activate && Occurs when group receive the focus. ENDPROC PROCEDURE changetheme && Occurs when theme change. With _Screen.ThemesManager Store .GetMember("ExplorerBar.Bordercolor") To ; This.linLeftBorder.BorderColor, ; This.linRightBorder.BorderColor, ; This.linBottomBorder.BorderColor If This.Type==0 This.ImgCollapseHighlighted = .GetMember("ExplorerBar.NormalGroupCollapseHighlight.Picture") This.ImgCollapseNotHighlighted = .GetMember("ExplorerBar.NormalGroupCollapseNotHighlight.Picture") This.ImgExpandHighlighted = .GetMember("ExplorerBar.NormalGroupExpandHighlight.Picture") This.ImgExpandNotHighlighted = .GetMember("ExplorerBar.NormalGroupExpandNotHighlight.Picture") This.lblHighlight = .GetMember("ExplorerBar.NormalGroupHighlight.Forecolor") This.lblNotHighlight = .GetMember("ExplorerBar.NormalGroupNotHighlight.Forecolor") This.imgBackground.Picture = .GetMember("ExplorerBar.NormalGroupBackground.Picture") Else This.ImgCollapseHighlighted = .GetMember("ExplorerBar.SpecialGroupCollapseHighlight.Picture") This.ImgCollapseNotHighlighted = .GetMember("ExplorerBar.SpecialGroupCollapseNotHighlight.Picture") This.ImgExpandHighlighted = .GetMember("ExplorerBar.SpecialGroupExpandHighlight.Picture") This.ImgExpandNotHighlighted = .GetMember("ExplorerBar.SpecialGroupExpandNotHighlight.Picture") This.lblHighlight = .GetMember("ExplorerBar.SpecialGroupHighlight.Forecolor") This.lblNotHighlight = .GetMember("ExplorerBar.SpecialGroupNotHighlight.Forecolor") This.imgBackground.Picture = .GetMember("ExplorerBar.SpecialGroupBackground.Picture") Endif This.HighlightHeader(.F.) Endwith ENDPROC PROCEDURE clicked && Occurs when shpMouseHandler or cmdFocus are clicked. With This If .State==0 .Collapse() Else .Expand() Endif .cmdFocus.SetFocus() .Parent.Scroll(.Top,.Height) * The following code must not be placed in Collapse * and Expand methods because I must call Collapse * in the Init when group must be start collapsed. Local loObject loObject = Sys(1270) If Vartype(loObject)=="O" If Upper(loObject.Name)==Upper(This.Name) .HighlightHeader(.T.) Else .HighlightHeader(.F.) Endif Endif Endwith ENDPROC PROCEDURE collapse && Occurs when group is collapsed. Local lnHeight With This .State = 1 *For m.lnHeight=.Height-1 To 37 Step -1 * .Height = m.lnHeight * .Parent.Reposition(.T.) *Endfor .Height = 37 .Parent.Reposition(.T.) .cntUserControls.Visible = .F. Endwith ENDPROC PROCEDURE expand && Occurs when group is expanded. Local lnHeight With This .State = 0 *For m.lnHeight=.Height+1 To .InitialHeight * .Height = m.lnHeight * .Parent.Reposition(.T.) *Endfor .Height = .InitialHeight .Parent.Reposition(.T.) .cntUserControls.Visible = .T. Endwith ENDPROC PROTECTED PROCEDURE GotFocus With This .Parent.Scroll(.Top,.Height) .Activate() Endwith ENDPROC PROCEDURE highlightheader && Occurs when header receive focus. Lparameters llHighlight With This If m.llHighlight .lblTitle.ForeColor = .lblHighlight .imgTitle.Picture = Iif(.State==0,.ImgCollapseHighlighted,.ImgExpandHighlighted) Else .lblTitle.ForeColor = .lblNotHighlight .imgTitle.Picture = Iif(.State==0,.ImgCollapseNotHighlighted,.ImgExpandNotHighlighted) Endif * The following code ensures that focus rectangle is visible. With .cmdFocus .Visible = .F. .Visible = .T. Endwith Endwith ENDPROC PROTECTED PROCEDURE Init With This .InitialHeight = .Height If Empty(.imgPicture.Picture) Local lnWidth With .imgPicture m.lnWidth = .Width .Visible = .F. Endwith With .lblTitle .Left = .Left - m.lnWidth .Width = .Width + m.lnWidth Endwith Endif .lblTitle.BackStyle = 0 .cntUserControls.BorderWidth = 0 .cntUserControls.BackStyle = 0 If .State==1 .Collapse() Endif * .InitThemedControl() Endwith ENDPROC HIDDEN PROCEDURE initthemedcontrol If Not Vartype(_Screen.ThemesManager)=="O" _Screen.Newobject("ThemesManager","ThemesManager","ThemedControls.vcx") Endif This.ChangeTheme() ENDPROC PROTECTED PROCEDURE Resize With This Store Max(0,.Height - .shpMouseHandler.Height - 8) To ; .linLeftBorder.Height, ; .linRightBorder.Height, ; .imgBackground.Height, ; .cntUserControls.Height .linBottomBorder.Top = (.imgBackground.Top + .imgBackground.Height) .linBottomBorder.Visible = (.State==0) Endwith ENDPROC PROCEDURE cmdFocus.KeyPress Lparameters nKeyCode, nShiftAltCtrl If nKeyCode==13 Nodefault This.Parent.Clicked() Endif ENDPROC PROCEDURE shpMouseHandler.Click This.Parent.Clicked() ENDPROC PROCEDURE shpMouseHandler.MouseEnter Lparameters nButton, nShift, nXCoord, nYCoord This.Parent.HighlightHeader(.T.) ENDPROC PROCEDURE shpMouseHandler.MouseLeave Lparameters nButton, nShift, nXCoord, nYCoord This.Parent.HighlightHeader(.F.) ENDPROC ENDDEFINE