4 * Copyright 2009, Moxiecode Systems AB
5 * Released under LGPL License.
7 * License: http://tinymce.moxiecode.com/license
8 * Contributing: http://tinymce.moxiecode.com/contributing
12 // Shorten class names
13 var dom = tinymce.DOM, each = tinymce.each;
15 * This class is used to create toolbars a toolbar is a container for other controls like buttons etc.
17 * @class tinymce.ui.Toolbar
18 * @extends tinymce.ui.Container
20 tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
22 * Renders the toolbar as a HTML string. This method is much faster than using the DOM and when
23 * creating a whole toolbar with buttons it does make a lot of difference.
26 * @return {String} HTML for the toolbar control.
28 renderHTML : function() {
29 var t = this, h = '', c, co, s = t.settings, i, pr, nx, cl;
32 for (i=0; i<cl.length; i++) {
33 // Get current control, prev control, next control and if the control is a list box or not
40 c = 'mceToolbarStart';
43 c += ' mceToolbarStartButton';
44 else if (co.SplitButton)
45 c += ' mceToolbarStartSplitButton';
47 c += ' mceToolbarStartListBox';
49 h += dom.createHTML('td', {'class' : c}, dom.createHTML('span', null, '<!-- IE -->'));
52 // Add toolbar end before list box and after the previous button
53 // This is to fix the o2k7 editor skins
54 if (pr && co.ListBox) {
55 if (pr.Button || pr.SplitButton)
56 h += dom.createHTML('td', {'class' : 'mceToolbarEnd'}, dom.createHTML('span', null, '<!-- IE -->'));
59 // Render control HTML
61 // IE 8 quick fix, needed to propertly generate a hit area for anchors
63 h += '<td style="position: relative">' + co.renderHTML() + '</td>';
65 h += '<td>' + co.renderHTML() + '</td>';
67 // Add toolbar start after list box and before the next button
68 // This is to fix the o2k7 editor skins
69 if (nx && co.ListBox) {
70 if (nx.Button || nx.SplitButton)
71 h += dom.createHTML('td', {'class' : 'mceToolbarStart'}, dom.createHTML('span', null, '<!-- IE -->'));
78 c += ' mceToolbarEndButton';
79 else if (co.SplitButton)
80 c += ' mceToolbarEndSplitButton';
82 c += ' mceToolbarEndListBox';
84 h += dom.createHTML('td', {'class' : c}, dom.createHTML('span', null, '<!-- IE -->'));
86 return dom.createHTML('table', {id : t.id, 'class' : 'mceToolbar' + (s['class'] ? ' ' + s['class'] : ''), cellpadding : '0', cellspacing : '0', align : t.settings.align || '', role: 'presentation', tabindex: '-1'}, '<tbody><tr>' + h + '</tr></tbody>');