File: u_tv.sru
Size: 4273
Date: Mon, 07 Apr 2008 21:31:03 +0200
$PBExportHeader$u_tv.sru
$PBExportComments$Base Treeview Object
forward
global type u_tv from treeview
end type
end forward

global type u_tv from treeview
integer width = 411
integer height = 324
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
borderstyle borderstyle = stylelowered!
boolean linesatroot = true
boolean hideselection = false
long picturemaskcolor = 536870912
long statepicturemaskcolor = 536870912
event type boolean ke_statechanging ( readonly long al_itemhandle,  readonly boolean ab_newvalue )
event ke_statechanged ( readonly long al_itemhandle,  readonly boolean ab_selected )
event ke_constructor ( )
end type
global u_tv u_tv

type variables
Public:
Boolean #StandardImages, #StateImages
//Size Order
Long #SizeOrder
//Anchoring
Boolean #AnchorTop
Boolean #AnchorLeft
Boolean #AnchorRight
Boolean #AnchorBottom
//Docking
Boolean #Dock
//Dock Padding
Long #DockType, #DockPadTop, #DockPadLeft, #DockPadRight, #DockPadBottom
//Dock control reference
String #Dock_Control_Top, #Dock_Control_Left, #Dock_Control_Right, #Dock_Control_Bottom
Private:
str_resize istr_resize
boolean ib_imagelistassigned
end variables

forward prototypes
public function str_resize of_getresizeattrib ()
public subroutine of_imagelistassigned ()
protected subroutine of_swapdummyimagelist ()
public subroutine of_loadstateimages ()
public subroutine of_loadstandardimages ()
end prototypes

event ke_statechanging;//set to false to prevent change
RETURN TRUE
end event

event ke_statechanged(readonly long al_itemhandle, readonly boolean ab_selected);//fired when item state has changed
end event

event ke_constructor();of_LoadStateImages()
of_LoadStandardImages()
end event

public function str_resize of_getresizeattrib ();istr_resize.Control = this
istr_resize.ControlName = ClassName(this)
istr_resize.SizeOrder = #SizeOrder
istr_resize.SizeOrder = #SizeOrder
istr_resize.Dock = #Dock
istr_resize.DockType = #DockType
istr_resize.DockPadTop = #DockPadTop
istr_resize.DockPadLeft = #DockPadLeft
istr_resize.DockPadRight = #DockPadRight
istr_resize.DockPadBottom = #DockPadBottom
istr_resize.AnchorTop = #AnchorTop
istr_resize.AnchorLeft = #AnchorLeft
istr_resize.AnchorRight = #Anchorright
istr_resize.AnchorBottom = #Anchorbottom
istr_resize.reftop = #Dock_Control_top
istr_resize.refleft = #Dock_Control_left
istr_resize.refright = #Dock_Control_right
istr_resize.refbottom = #Dock_Control_bottom
istr_resize.bounds.left = X
istr_resize.bounds.top = Y
istr_resize.bounds.right = width
istr_resize.bounds.bottom = height

RETURN istr_resize
end function

public subroutine of_imagelistassigned ();ib_imagelistassigned = TRUE
end subroutine

protected subroutine of_swapdummyimagelist ();n_svc_mgr lnv_svc
n_svc_tv lnv_tv
n_svc_resource lnv_res
long ll

lnv_svc.of_LoadSvc(lnv_res, CSvc.RESOURCE)
lnv_svc.of_LoadSvc(lnv_tv, CSvc.TV)

ll = lnv_res.of_GetDummyimagelist(lnv_svc)
lnv_tv.of_SetImagelist(this, ll)
lnv_tv.of_SetStateImageList(this, ll)
end subroutine

public subroutine of_loadstateimages ();IF #StateImages THEN
   n_svc_mgr lnv_svc
   n_svc_tv lnv_tv
   
   lnv_svc.of_LoadSvc(lnv_tv, CSvc.TV)
   lnv_tv.of_Loadstateimages(lnv_svc, this)
END IF
end subroutine

public subroutine of_loadstandardimages ();IF #StandardImages THEN
   n_svc_mgr lnv_svc
   n_svc_tv lnv_tv

   lnv_Svc.of_LoadSvc(lnv_tv, CSvc.TV)
   lnv_tv.of_LoadStandardImages(lnv_svc, this)
END IF
end subroutine

on u_tv.create
end on

on u_tv.destroy
end on

event destructor;IF ib_imagelistassigned THEN
   //swap a dummy imagelist
   of_swapdummyimagelist()
END IF
end event

event clicked;IF #StateImages THEN
   n_svc_tv lnv_tv
   n_svc_mgr lnv_svc

   lnv_svc.of_loadsvc(lnv_tv, CSvc.TV)
   lnv_tv.EVENT ke_itemclicked(lnv_svc, &
                              this, &
                              handle, &
                              this.PointerX(), &
                              this.PointerY())     
END IF
end event

event key;IF #StateImages THEN
   n_svc_tv lnv_tv
   n_svc_mgr lnv_svc

   lnv_svc.of_loadsvc(lnv_tv, CSvc.TV)
   lnv_tv.EVENT ke_key(this, key, keyflags)
END IF
end event