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