##// END OF EJS Templates
document base of toolbar
Matthias BUSSONNIER -
Show More
@@ -10,7 +10,6 b''
10 10 //============================================================================
11 11
12 12 /**
13 * An extendable module that provide base functionnality to create cell for notebook.
14 13 * @module IPython
15 14 * @namespace IPython
16 15 * @submodule Kernel
@@ -8,9 +8,20 b''
8 8 //============================================================================
9 9 // ToolBar
10 10 //============================================================================
11 /**
12 * @module IPython
13 * @namespace IPython
14 * @submodule ToolBar
15 */
11 16
12 17 var IPython = (function (IPython) {
13 18
19 /**
20 * A generic toolbar on which one can add button
21 * @class ToolBar
22 * @constructor
23 * @param {Dom object} selector
24 */
14 25 var ToolBar = function (selector) {
15 26 this.selector = selector;
16 27 if (this.selector !== undefined) {
@@ -19,37 +30,38 b' var IPython = (function (IPython) {'
19 30 }
20 31 };
21 32
22 // add a group of button into the current toolbar.
23 //
24 // First argument : Mandatory
25 // list of dict as argument, each dict should contain
26 // 3 mandatory keys and values :
27 // label : string -- the text to show on hover
28 // icon : string -- the jQuery-ui icon to add on this button
29 // callback : function -- the callback to execute on a click
30 //
31 // and optionally an 'id' key that is assigned to the button element
32 //
33 // Second Argument, optional,
34 // string reprensenting the id to give to the button group.
35 //
36 // Example
37 //
38 // IPython.toolbar.add_button_group([
39 // {label:'my button',
40 // icon:'ui-icon-disk',
41 // callback:function(){alert('hoho'),
42 // id : 'my_button_id', // this is optional
43 // }
44 // },
45 // {label:'my second button',
46 // icon:'ui-icon-scissors',
47 // callback:function(){alert('be carefull I cut')}
48 // }
49 // ],
50 // "my_button_group_id"
51 // )
52 //
33 /**
34 * add a group of button into the current toolbar.
35 *
36 *
37 * @example
38 *
39 * IPython.toolbar.add_button_group([
40 * {
41 * label:'my button',
42 * icon:'ui-icon-disk',
43 * callback:function(){alert('hoho'),
44 * id : 'my_button_id', // this is optional
45 * },
46 * {
47 * label:'my second button',
48 * icon:'ui-icon-scissors',
49 * callback:function(){alert('be carefull I cut')}
50 * }
51 * ],
52 * "my_button_group_id"
53 * )
54 *
55 * @method add_buttons_group
56 * @param list {List}
57 * List of button of the group, with the following paramter for each :
58 * @param list.label {string} text to show on button hover
59 * @param list.icon {string} icon to choose from [jQuery ThemeRoller](http://jqueryui.com/themeroller/)
60 * @param list.callback {function} function to be called on button click
61 * @param [list.id] {String} id to give to the button
62 * @param [group_id] {String} optionnal id to give to the group
63 *
64 */
53 65 ToolBar.prototype.add_buttons_group = function (list, group_id) {
54 66 var span_group = $('<span/>');
55 67 if( group_id != undefined ) {
@@ -80,7 +92,10 b' var IPython = (function (IPython) {'
80 92 css('border-right-style','none');
81 93 };
82 94
83
95 /**
96 * Show and hide toolbar
97 * @method toggle
98 */
84 99 ToolBar.prototype.toggle = function () {
85 100 this.element.toggle();
86 101 if (IPython.layout_manager != undefined) {
General Comments 0
You need to be logged in to leave comments. Login now