addTaskBarAndMenu.html

<script>var dFrameFilePath = '../../../../../dFrame/'</script>

<script language="Javascript" src="../../../../../dFrame/dFrame/lib/dFrameAPI.js"></script>

<script language="Javascript">

//Style

DFrameAPI.include('dFrame/styles/windows/styleWindows.js')

//Globals

var dFrameFalse, dFrameTrue, dFramePrivate

DFrameAPI.onLoad = function(){

//Instanciate the base dFrame

baseAll = new DFrame([10, 10, 90, 90], 'addTaskBarAndMenu.html', dFrameStyle);

baseAll.addToTaskBars(false)

baseAll.addToTaskMenus(false)

baseAll.setDragEnabled(true)

var txt = '2 task Bars (one with a key) and a task Menu (also with a key) are ready to store Buttons relative to tasks.'

txt += '<br>The Test Menu allow to create 3 DFrames:'

txt += '<br>- The first one will be added every where.'

txt += '<br>- The second one will be added nowhere.'

txt += '<br>- The third one will only be added to the Private Task Menu and the Private Task Bar.'

txt += '<br>A context Menu is also created from the Private Task Menu and store the same items than this one.'

baseAll.addText(txt, null, [10, 30])

//Add a menu with the 3 needed Buttons for demo.

var M = new Array()

M[0] = ['BUTTON', 'Added everywhere', 'createAddToTaskBarTrue()']

M[1] = ['BUTTON', 'Added nowhere', 'createAddToTaskBarFalse()']

M[2] = ['BUTTON', 'Added to Privates', 'createAddToTaskBarPrivate()']

var menu = baseAll.addMenu(M, 'Tests')

menu.debugName = 'test'

//add a taskMenu, no key

var taskMenu = baseAll.addTaskMenu(null, 'Base taskMenu')

taskMenu.getButton().setActivateOn('OVER')

//add a taskMenu, key is 'Private taskMenu'

var taskMenu = baseAll.addTaskMenu(null, 'Private taskMenu', null, 'Private taskMenu')

taskMenu.getButton().setActivateOn('OVER')

//Add the same one as a context Menu

var menu = baseAll.addContextMenu(taskMenu)

//add a taskBar

baseAll.addTaskBar()

//add a (floating) taskBar, key is 'Private taskBar'

var bar = baseAll.addTaskBar(null, 'Private taskBar', [70,'25','*','*'], 'Private taskBar')

bar.setWidth(0)

bar.setHeight(0)

bar.setOverlayParentBars()

bar.addTitleBar(dFrameStyle.getDefaultTitleBarStyle())

bar.setDragEnabled(true)

bar.setStartFrom('TOP')

//Modify the style for indentation of later created DFrames

dFrameStyle.setIndentX(30)

dFrameStyle.setIndentY(30)

baseAll.show()

}

function createAddToTaskBarTrue() {

//Create a DFrame, addToTaskBars/Menus(true)

if (!dFrameTrue) {

dFrameTrue = new DFrame([10,20,60,80], 'Added everywhere', dFrameStyleHide, baseAll)

dFrameTrue.addToTaskBars(true)

dFrameTrue.addToTaskMenus(true)

}

dFrameTrue.show()

}

function createAddToTaskBarFalse() {

//Create a DFrame, addToTaskBars/Menus(false)

if (!dFrameFalse) {

dFrameFalse = new DFrame([10,20,60,80], 'Added nowhere', dFrameStyleHide, baseAll)

dFrameFalse.addToTaskBars(false)

dFrameFalse.addToTaskMenus(false)

}

dFrameFalse.show()

}

function createAddToTaskBarPrivate() {

//Create a DFrame, addToTaskBar/Menus('Private taskBar')

if (!dFramePrivate) {

dFramePrivate = new DFrame([10,20,60,80], 'Added to Privates', dFrameStyleHide, baseAll)

dFramePrivate.addToTaskBars('Private taskBar')

dFramePrivate.addToTaskMenus('Private taskMenu')

}

dFramePrivate.show()

}

</script>