File: u_dwtb_explorer.sru
Size: 2482
Date: Mon, 07 Apr 2008 21:32:45 +0200
$PBExportHeader$u_dwtb_explorer.sru
$PBExportComments$Explorer toolbar
forward
global type u_dwtb_explorer from u_dwtoolbar
end type
end forward

global type u_dwtb_explorer from u_dwtoolbar
string #toolbardataobject = "toolbar_explorer"
end type
global u_dwtb_explorer u_dwtb_explorer

type variables
Public:

Boolean #ShowFolderButton = TRUE
Boolean #ShowCloseButton = TRUE
Boolean #MDIParent

Protected:

n_explorer inv_explorer
end variables

forward prototypes
public subroutine of_setexplorer (readonly n_explorer anv_explorer)
public subroutine of_settoolbarbuttons (datastore ads)
end prototypes

public subroutine of_setexplorer (readonly n_explorer anv_explorer);inv_explorer = anv_explorer
end subroutine

public subroutine of_settoolbarbuttons (datastore ads);IF NOT #ShowCloseButton THEN
   ads.DeleteRow(7) //close
   ads.DeleteRow(6) //separator
END IF
IF NOT #ShowFolderButton THEN
   ads.DeleteRow(5) //folder
   ads.DeleteRow(4) //separator
END IF
SUPER::of_SetToolbarButtons(ads)
end subroutine

on u_dwtb_explorer.create
call super::create
end on

on u_dwtb_explorer.destroy
call super::destroy
end on

event ke_buttonclicked;call super::ke_buttonclicked;IF ISVALID(inv_explorer) THEN
   inv_explorer.EVENT ke_toolbar_buttonclicked(buttonid, buttontext, buttondata)
END IF


end event

event ke_dropdown;call super::ke_dropdown;long ll_popx

IF NOT ISVALID(inv_explorer) THEN RETURN

IF #MDIParent THEN
   //popup workaround for MDI
   //there has to be a better way...
   ll_popx = popx + 864
END IF

inv_explorer.EVENT ke_toolbar_dropdown(buttonid, buttontext, buttondata, popx, popy)
end event

event ke_dropdowncoordinate;integer lix, liy

lix = popx //+ auo_toolbar.of_GetParentWindow().X + 24
liy = popy //+ auo_toolbar.of_GetParentWindow().Y + auo_toolbar.height

RECT rc
n_svc_mgr lnv_svc
n_svc_win32 lnv_win32

lnv_svc.of_LoadSvc(lnv_win32, CSvc.WIN32)
lnv_win32.GetWindowRect(Handle(this.dw_1), rc)

rc.left = PixelsToUnits(rc.left, XPixelsToUnits!)
rc.top = PixelsToUnits(rc.top, YPixelsToUnits!)

IF #MdiParent THEN
   liy = rc.top - popy + 12
ELSE
   liy = popy
END IF

EVENT ke_dropdown(istr_buttons[buttonindex].id, &
               istr_buttons[buttonindex].text, &
               istr_buttons[buttonindex].data, &
               popx, &
               liy)
end event

type label from u_dwtoolbar`label within u_dwtb_explorer
end type

type dw_1 from u_dwtoolbar`dw_1 within u_dwtb_explorer
end type