1 /** |
|
2 * ButtonGroup.js |
|
3 * |
|
4 * Copyright, Moxiecode Systems AB |
|
5 * Released under LGPL License. |
|
6 * |
|
7 * License: http://www.tinymce.com/license |
|
8 * Contributing: http://www.tinymce.com/contributing |
|
9 */ |
|
10 |
|
11 /** |
|
12 * This control enables you to put multiple buttons into a group. This is |
|
13 * useful when you want to combine similar toolbar buttons into a group. |
|
14 * |
|
15 * @example |
|
16 * // Create and render a buttongroup with two buttons to the body element |
|
17 * tinymce.ui.Factory.create({ |
|
18 * type: 'buttongroup', |
|
19 * items: [ |
|
20 * {text: 'Button A'}, |
|
21 * {text: 'Button B'} |
|
22 * ] |
|
23 * }).renderTo(document.body); |
|
24 * |
|
25 * @-x-less ButtonGroup.less |
|
26 * @class tinymce.ui.ButtonGroup |
|
27 * @extends tinymce.ui.Container |
|
28 */ |
|
29 define("tinymce/ui/ButtonGroup", [ |
|
30 "tinymce/ui/Container" |
|
31 ], function(Container) { |
|
32 "use strict"; |
|
33 |
|
34 return Container.extend({ |
|
35 Defaults: { |
|
36 defaultType: 'button', |
|
37 role: 'group' |
|
38 }, |
|
39 |
|
40 /** |
|
41 * Renders the control as a HTML string. |
|
42 * |
|
43 * @method renderHtml |
|
44 * @return {String} HTML representing the control. |
|
45 */ |
|
46 renderHtml: function() { |
|
47 var self = this, layout = self._layout; |
|
48 |
|
49 self.addClass('btn-group'); |
|
50 self.preRender(); |
|
51 layout.preRender(self); |
|
52 |
|
53 return ( |
|
54 '<div id="' + self._id + '" class="' + self.classes() + '">' + |
|
55 '<div id="' + self._id + '-body">' + |
|
56 (self.settings.html || '') + layout.renderHtml(self) + |
|
57 '</div>' + |
|
58 '</div>' |
|
59 ); |
|
60 } |
|
61 }); |
|
62 }); |
|