From 5afd621c8180a057e7648d9c922cf37b62d611f2 2012-11-17 20:30:02 From: Matthias BUSSONNIER Date: 2012-11-17 20:30:02 Subject: [PATCH] document base of toolbar --- diff --git a/IPython/frontend/html/notebook/static/js/kernel.js b/IPython/frontend/html/notebook/static/js/kernel.js index b90b20f..4fde17a 100644 --- a/IPython/frontend/html/notebook/static/js/kernel.js +++ b/IPython/frontend/html/notebook/static/js/kernel.js @@ -10,7 +10,6 @@ //============================================================================ /** - * An extendable module that provide base functionnality to create cell for notebook. * @module IPython * @namespace IPython * @submodule Kernel diff --git a/IPython/frontend/html/notebook/static/js/toolbar.js b/IPython/frontend/html/notebook/static/js/toolbar.js index e00b5fc..1362b87 100644 --- a/IPython/frontend/html/notebook/static/js/toolbar.js +++ b/IPython/frontend/html/notebook/static/js/toolbar.js @@ -8,9 +8,20 @@ //============================================================================ // ToolBar //============================================================================ +/** + * @module IPython + * @namespace IPython + * @submodule ToolBar + */ var IPython = (function (IPython) { + /** + * A generic toolbar on which one can add button + * @class ToolBar + * @constructor + * @param {Dom object} selector + */ var ToolBar = function (selector) { this.selector = selector; if (this.selector !== undefined) { @@ -19,37 +30,38 @@ var IPython = (function (IPython) { } }; - // add a group of button into the current toolbar. - // - // First argument : Mandatory - // list of dict as argument, each dict should contain - // 3 mandatory keys and values : - // label : string -- the text to show on hover - // icon : string -- the jQuery-ui icon to add on this button - // callback : function -- the callback to execute on a click - // - // and optionally an 'id' key that is assigned to the button element - // - // Second Argument, optional, - // string reprensenting the id to give to the button group. - // - // Example - // - // IPython.toolbar.add_button_group([ - // {label:'my button', - // icon:'ui-icon-disk', - // callback:function(){alert('hoho'), - // id : 'my_button_id', // this is optional - // } - // }, - // {label:'my second button', - // icon:'ui-icon-scissors', - // callback:function(){alert('be carefull I cut')} - // } - // ], - // "my_button_group_id" - // ) - // + /** + * add a group of button into the current toolbar. + * + * + * @example + * + * IPython.toolbar.add_button_group([ + * { + * label:'my button', + * icon:'ui-icon-disk', + * callback:function(){alert('hoho'), + * id : 'my_button_id', // this is optional + * }, + * { + * label:'my second button', + * icon:'ui-icon-scissors', + * callback:function(){alert('be carefull I cut')} + * } + * ], + * "my_button_group_id" + * ) + * + * @method add_buttons_group + * @param list {List} + * List of button of the group, with the following paramter for each : + * @param list.label {string} text to show on button hover + * @param list.icon {string} icon to choose from [jQuery ThemeRoller](http://jqueryui.com/themeroller/) + * @param list.callback {function} function to be called on button click + * @param [list.id] {String} id to give to the button + * @param [group_id] {String} optionnal id to give to the group + * + */ ToolBar.prototype.add_buttons_group = function (list, group_id) { var span_group = $(''); if( group_id != undefined ) { @@ -80,7 +92,10 @@ var IPython = (function (IPython) { css('border-right-style','none'); }; - + /** + * Show and hide toolbar + * @method toggle + */ ToolBar.prototype.toggle = function () { this.element.toggle(); if (IPython.layout_manager != undefined) {