1
0
Fork 0
forked from 0x2620/oxjs

some documentation

This commit is contained in:
j 2011-05-16 10:24:46 +02:00
commit bdb8d98787
45 changed files with 775 additions and 255 deletions

View file

@ -1,24 +1,31 @@
// vim: et:ts=4:sw=4:sts=4:ft=js
/**
options
element the element the menu is attached to
id the menu id
items array of menu items
mainmenu the main menu this menu is part of, if any
offset offset of the menu, in px
parent the supermenu, if any
selected the position of the selected item
side open to 'bottom' or 'right'
size 'large', 'medium' or 'small'
/*@
Ox.Menu <f:Ox.Element> Menu Object
() -> <f> Menu Object
(options) -> <f> Menu Object
(options, self) -> <f> Menu Object
options <o> Options object
element <o> the element the menu is attached to
id <s> the menu id
items <a> array of menu items
mainmenu <o> the main menu this menu is part of, if any
offset <o> offset of the menu, in px
left <n> left
top <n> top
parent <o> the supermenu, if any
selected <b> the position of the selected item
side <s> open to 'bottom' or 'right'
size <s> 'large', 'medium' or 'small'
self <o> shared private variable
change_groupId <!> {id, value} checked item of a group has changed
click_itemId <!> item not belonging to a group was clicked
click_menuId <!> {id, value} item not belonging to a group was clicked
deselect_menuId <!> {id, value} item was deselected not needed, not implemented
hide_menuId <!> menu was hidden
select_menuId <!> {id, value} item was selected
@*/
events:
change_groupId {id, value} checked item of a group has changed
click_itemId item not belonging to a group was clicked
click_menuId {id, value} item not belonging to a group was clicked
deselect_menuId {id, value} item was deselected not needed, not implemented
hide_menuId menu was hidden
select_menuId {id, value} item was selected
*/
Ox.Menu = function(options, self) {
Ox.print(options)
var self = self || {},
@ -524,18 +531,30 @@ Ox.print(options)
}
}
/*@
addItem <f>
@*/
that.addItem = function(item, position) {
};
/*@
addItemAfter <f>
@*/
that.addItemAfter = function(item, id) {
};
/*@
addItemBefore <f>
@*/
that.addItemBefore = function(item, id) {
};
/*@
checkItem <f>
@*/
that.checkItem = function(id) {
var item = that.getItem(id);
if (item.options('group')) {
@ -553,6 +572,9 @@ Ox.print(options)
}
};
/*@
getItem <f>
@*/
that.getItem = function(id) {
//Ox.print('id', id)
var ids = id.split('_'),
@ -576,6 +598,9 @@ Ox.print(options)
return item;
};
/*@
getSubmenu <f>
@*/
that.getSubmenu = function(id) {
var ids = id.split('_'),
submenu;
@ -588,6 +613,9 @@ Ox.print(options)
return submenu;
}
/*@
hasEnabledItems <f>
@*/
that.hasEnabledItems = function() {
var ret = false;
Ox.forEach(that.items, function(item) {
@ -598,6 +626,10 @@ Ox.print(options)
return ret;
};
/*@
hideMenu <f>
() -> <f> Menu Object
@*/
that.hideMenu = function() {
if (that.is(':hidden')) {
return;
@ -625,14 +657,24 @@ Ox.print(options)
return that;
};
/*@
removeItem <f>
@*/
that.removeItem = function() {
};
/*@
selectFirstItem <f>
@*/
that.selectFirstItem = function() {
selectNextItem();
};
/*@
showMenu <f>
() -> <f> Menu Object
@*/
that.showMenu = function() {
if (!that.is(':hidden')) {
return;
@ -679,6 +721,9 @@ Ox.print(options)
//that.triggerEvent('show');
};
/*@
toggelMenu <f>
@*/
that.toggleMenu = function() {
that.is(':hidden') ? that.showMenu() : that.hideMenu();
};