##// END OF EJS Templates
Added a class for RadioButtons container...
Jonathan Frederic -
Show More
@@ -1,382 +1,381 b''
1 //----------------------------------------------------------------------------
1 //----------------------------------------------------------------------------
2 // Copyright (C) 2013 The IPython Development Team
2 // Copyright (C) 2013 The IPython Development Team
3 //
3 //
4 // Distributed under the terms of the BSD License. The full license is in
4 // Distributed under the terms of the BSD License. The full license is in
5 // the file COPYING, distributed as part of this software.
5 // the file COPYING, distributed as part of this software.
6 //----------------------------------------------------------------------------
6 //----------------------------------------------------------------------------
7
7
8 //============================================================================
8 //============================================================================
9 // SelectionWidget
9 // SelectionWidget
10 //============================================================================
10 //============================================================================
11
11
12 /**
12 /**
13 * @module IPython
13 * @module IPython
14 * @namespace IPython
14 * @namespace IPython
15 **/
15 **/
16
16
17 define(["notebook/js/widgets/widget"], function(WidgetManager){
17 define(["notebook/js/widgets/widget"], function(WidgetManager){
18
18
19 var DropdownView = IPython.DOMWidgetView.extend({
19 var DropdownView = IPython.DOMWidgetView.extend({
20 render : function(){
20 render : function(){
21 // Called when view is rendered.
21 // Called when view is rendered.
22 this.$el
22 this.$el
23 .addClass('widget-hbox-single');
23 .addClass('widget-hbox-single');
24 this.$label = $('<div />')
24 this.$label = $('<div />')
25 .appendTo(this.$el)
25 .appendTo(this.$el)
26 .addClass('widget-hlabel')
26 .addClass('widget-hlabel')
27 .hide();
27 .hide();
28 this.$buttongroup = $('<div />')
28 this.$buttongroup = $('<div />')
29 .addClass('widget_item')
29 .addClass('widget_item')
30 .addClass('btn-group')
30 .addClass('btn-group')
31 .appendTo(this.$el);
31 .appendTo(this.$el);
32 this.$el_to_style = this.$buttongroup; // Set default element to style
32 this.$el_to_style = this.$buttongroup; // Set default element to style
33 this.$droplabel = $('<button />')
33 this.$droplabel = $('<button />')
34 .addClass('btn')
34 .addClass('btn')
35 .addClass('widget-combo-btn')
35 .addClass('widget-combo-btn')
36 .html("&nbsp;")
36 .html("&nbsp;")
37 .appendTo(this.$buttongroup);
37 .appendTo(this.$buttongroup);
38 this.$dropbutton = $('<button />')
38 this.$dropbutton = $('<button />')
39 .addClass('btn')
39 .addClass('btn')
40 .addClass('dropdown-toggle')
40 .addClass('dropdown-toggle')
41 .addClass('widget-combo-carrot-btn')
41 .addClass('widget-combo-carrot-btn')
42 .attr('data-toggle', 'dropdown')
42 .attr('data-toggle', 'dropdown')
43 .append($('<span />').addClass("caret"))
43 .append($('<span />').addClass("caret"))
44 .appendTo(this.$buttongroup);
44 .appendTo(this.$buttongroup);
45 this.$droplist = $('<ul />')
45 this.$droplist = $('<ul />')
46 .addClass('dropdown-menu')
46 .addClass('dropdown-menu')
47 .appendTo(this.$buttongroup);
47 .appendTo(this.$buttongroup);
48
48
49 // Set defaults.
49 // Set defaults.
50 this.update();
50 this.update();
51 },
51 },
52
52
53 update : function(options){
53 update : function(options){
54 // Update the contents of this view
54 // Update the contents of this view
55 //
55 //
56 // Called when the model is changed. The model may have been
56 // Called when the model is changed. The model may have been
57 // changed by another view or by a state update from the back-end.
57 // changed by another view or by a state update from the back-end.
58
58
59 if (options === undefined || options.updated_view != this) {
59 if (options === undefined || options.updated_view != this) {
60 var selected_item_text = this.model.get('value_name');
60 var selected_item_text = this.model.get('value_name');
61 if (selected_item_text.trim().length === 0) {
61 if (selected_item_text.trim().length === 0) {
62 this.$droplabel.html("&nbsp;");
62 this.$droplabel.html("&nbsp;");
63 } else {
63 } else {
64 this.$droplabel.text(selected_item_text);
64 this.$droplabel.text(selected_item_text);
65 }
65 }
66
66
67 var items = this.model.get('value_names');
67 var items = this.model.get('value_names');
68 var $replace_droplist = $('<ul />')
68 var $replace_droplist = $('<ul />')
69 .addClass('dropdown-menu');
69 .addClass('dropdown-menu');
70 var that = this;
70 var that = this;
71 _.each(items, function(item, i) {
71 _.each(items, function(item, i) {
72 var item_button = $('<a href="#"/>')
72 var item_button = $('<a href="#"/>')
73 .text(item)
73 .text(item)
74 .on('click', $.proxy(that.handle_click, that));
74 .on('click', $.proxy(that.handle_click, that));
75 $replace_droplist.append($('<li />').append(item_button));
75 $replace_droplist.append($('<li />').append(item_button));
76 });
76 });
77
77
78 this.$droplist.replaceWith($replace_droplist);
78 this.$droplist.replaceWith($replace_droplist);
79 this.$droplist.remove();
79 this.$droplist.remove();
80 this.$droplist = $replace_droplist;
80 this.$droplist = $replace_droplist;
81
81
82 if (this.model.get('disabled')) {
82 if (this.model.get('disabled')) {
83 this.$buttongroup.attr('disabled','disabled');
83 this.$buttongroup.attr('disabled','disabled');
84 this.$droplabel.attr('disabled','disabled');
84 this.$droplabel.attr('disabled','disabled');
85 this.$dropbutton.attr('disabled','disabled');
85 this.$dropbutton.attr('disabled','disabled');
86 this.$droplist.attr('disabled','disabled');
86 this.$droplist.attr('disabled','disabled');
87 } else {
87 } else {
88 this.$buttongroup.removeAttr('disabled');
88 this.$buttongroup.removeAttr('disabled');
89 this.$droplabel.removeAttr('disabled');
89 this.$droplabel.removeAttr('disabled');
90 this.$dropbutton.removeAttr('disabled');
90 this.$dropbutton.removeAttr('disabled');
91 this.$droplist.removeAttr('disabled');
91 this.$droplist.removeAttr('disabled');
92 }
92 }
93
93
94 var description = this.model.get('description');
94 var description = this.model.get('description');
95 if (description.length === 0) {
95 if (description.length === 0) {
96 this.$label.hide();
96 this.$label.hide();
97 } else {
97 } else {
98 this.$label.text(description);
98 this.$label.text(description);
99 this.$label.show();
99 this.$label.show();
100 }
100 }
101 }
101 }
102 return DropdownView.__super__.update.apply(this);
102 return DropdownView.__super__.update.apply(this);
103 },
103 },
104
104
105 handle_click: function (e) {
105 handle_click: function (e) {
106 // Handle when a value is clicked.
106 // Handle when a value is clicked.
107
107
108 // Calling model.set will trigger all of the other views of the
108 // Calling model.set will trigger all of the other views of the
109 // model to update.
109 // model to update.
110 this.model.set('value_name', $(e.target).text(), {updated_view: this});
110 this.model.set('value_name', $(e.target).text(), {updated_view: this});
111 this.touch();
111 this.touch();
112 },
112 },
113
113
114 });
114 });
115 WidgetManager.register_widget_view('DropdownView', DropdownView);
115 WidgetManager.register_widget_view('DropdownView', DropdownView);
116
116
117
117
118 var RadioButtonsView = IPython.DOMWidgetView.extend({
118 var RadioButtonsView = IPython.DOMWidgetView.extend({
119 render : function(){
119 render : function(){
120 // Called when view is rendered.
120 // Called when view is rendered.
121 this.$el
121 this.$el
122 .addClass('widget-hbox');
122 .addClass('widget-hbox');
123 this.$label = $('<div />')
123 this.$label = $('<div />')
124 .appendTo(this.$el)
124 .appendTo(this.$el)
125 .addClass('widget-hlabel')
125 .addClass('widget-hlabel')
126 .hide();
126 .hide();
127 this.$container = $('<div />')
127 this.$container = $('<div />')
128 .appendTo(this.$el)
128 .appendTo(this.$el)
129 .addClass('widget-container')
129 .addClass('widget-radio-box');
130 .addClass('vbox');
131 this.$el_to_style = this.$container; // Set default element to style
130 this.$el_to_style = this.$container; // Set default element to style
132 this.update();
131 this.update();
133 },
132 },
134
133
135 update : function(options){
134 update : function(options){
136 // Update the contents of this view
135 // Update the contents of this view
137 //
136 //
138 // Called when the model is changed. The model may have been
137 // Called when the model is changed. The model may have been
139 // changed by another view or by a state update from the back-end.
138 // changed by another view or by a state update from the back-end.
140 if (options === undefined || options.updated_view != this) {
139 if (options === undefined || options.updated_view != this) {
141 // Add missing items to the DOM.
140 // Add missing items to the DOM.
142 var items = this.model.get('value_names');
141 var items = this.model.get('value_names');
143 var disabled = this.model.get('disabled');
142 var disabled = this.model.get('disabled');
144 var that = this;
143 var that = this;
145 _.each(items, function(item, index) {
144 _.each(items, function(item, index) {
146 var item_query = ' :input[value="' + item + '"]';
145 var item_query = ' :input[value="' + item + '"]';
147 if (that.$el.find(item_query).length === 0) {
146 if (that.$el.find(item_query).length === 0) {
148 var $label = $('<label />')
147 var $label = $('<label />')
149 .addClass('radio')
148 .addClass('radio')
150 .text(item)
149 .text(item)
151 .appendTo(that.$container);
150 .appendTo(that.$container);
152
151
153 $('<input />')
152 $('<input />')
154 .attr('type', 'radio')
153 .attr('type', 'radio')
155 .addClass(that.model)
154 .addClass(that.model)
156 .val(item)
155 .val(item)
157 .prependTo($label)
156 .prependTo($label)
158 .on('click', $.proxy(that.handle_click, that));
157 .on('click', $.proxy(that.handle_click, that));
159 }
158 }
160
159
161 var $item_element = that.$container.find(item_query);
160 var $item_element = that.$container.find(item_query);
162 if (that.model.get('value_name') == item) {
161 if (that.model.get('value_name') == item) {
163 $item_element.prop('checked', true);
162 $item_element.prop('checked', true);
164 } else {
163 } else {
165 $item_element.prop('checked', false);
164 $item_element.prop('checked', false);
166 }
165 }
167 $item_element.prop('disabled', disabled);
166 $item_element.prop('disabled', disabled);
168 });
167 });
169
168
170 // Remove items that no longer exist.
169 // Remove items that no longer exist.
171 this.$container.find('input').each(function(i, obj) {
170 this.$container.find('input').each(function(i, obj) {
172 var value = $(obj).val();
171 var value = $(obj).val();
173 var found = false;
172 var found = false;
174 _.each(items, function(item, index) {
173 _.each(items, function(item, index) {
175 if (item == value) {
174 if (item == value) {
176 found = true;
175 found = true;
177 return false;
176 return false;
178 }
177 }
179 });
178 });
180
179
181 if (!found) {
180 if (!found) {
182 $(obj).parent().remove();
181 $(obj).parent().remove();
183 }
182 }
184 });
183 });
185
184
186 var description = this.model.get('description');
185 var description = this.model.get('description');
187 if (description.length === 0) {
186 if (description.length === 0) {
188 this.$label.hide();
187 this.$label.hide();
189 } else {
188 } else {
190 this.$label.text(description);
189 this.$label.text(description);
191 this.$label.show();
190 this.$label.show();
192 }
191 }
193 }
192 }
194 return RadioButtonsView.__super__.update.apply(this);
193 return RadioButtonsView.__super__.update.apply(this);
195 },
194 },
196
195
197 handle_click: function (e) {
196 handle_click: function (e) {
198 // Handle when a value is clicked.
197 // Handle when a value is clicked.
199
198
200 // Calling model.set will trigger all of the other views of the
199 // Calling model.set will trigger all of the other views of the
201 // model to update.
200 // model to update.
202 this.model.set('value_name', $(e.target).val(), {updated_view: this});
201 this.model.set('value_name', $(e.target).val(), {updated_view: this});
203 this.touch();
202 this.touch();
204 },
203 },
205 });
204 });
206 WidgetManager.register_widget_view('RadioButtonsView', RadioButtonsView);
205 WidgetManager.register_widget_view('RadioButtonsView', RadioButtonsView);
207
206
208
207
209 var ToggleButtonsView = IPython.DOMWidgetView.extend({
208 var ToggleButtonsView = IPython.DOMWidgetView.extend({
210 render : function(){
209 render : function(){
211 // Called when view is rendered.
210 // Called when view is rendered.
212 this.$el
211 this.$el
213 .addClass('widget-hbox-single');
212 .addClass('widget-hbox-single');
214 this.$label = $('<div />')
213 this.$label = $('<div />')
215 .appendTo(this.$el)
214 .appendTo(this.$el)
216 .addClass('widget-hlabel')
215 .addClass('widget-hlabel')
217 .hide();
216 .hide();
218 this.$buttongroup = $('<div />')
217 this.$buttongroup = $('<div />')
219 .addClass('btn-group')
218 .addClass('btn-group')
220 .attr('data-toggle', 'buttons-radio')
219 .attr('data-toggle', 'buttons-radio')
221 .appendTo(this.$el);
220 .appendTo(this.$el);
222 this.$el_to_style = this.$buttongroup; // Set default element to style
221 this.$el_to_style = this.$buttongroup; // Set default element to style
223 this.update();
222 this.update();
224 },
223 },
225
224
226 update : function(options){
225 update : function(options){
227 // Update the contents of this view
226 // Update the contents of this view
228 //
227 //
229 // Called when the model is changed. The model may have been
228 // Called when the model is changed. The model may have been
230 // changed by another view or by a state update from the back-end.
229 // changed by another view or by a state update from the back-end.
231 if (options === undefined || options.updated_view != this) {
230 if (options === undefined || options.updated_view != this) {
232 // Add missing items to the DOM.
231 // Add missing items to the DOM.
233 var items = this.model.get('value_names');
232 var items = this.model.get('value_names');
234 var disabled = this.model.get('disabled');
233 var disabled = this.model.get('disabled');
235 var that = this;
234 var that = this;
236 var item_html;
235 var item_html;
237 _.each(items, function(item, index) {
236 _.each(items, function(item, index) {
238 if (item.trim().length == 0) {
237 if (item.trim().length == 0) {
239 item_html = "&nbsp;";
238 item_html = "&nbsp;";
240 } else {
239 } else {
241 item_html = IPython.utils.escape_html(item);
240 item_html = IPython.utils.escape_html(item);
242 }
241 }
243 var item_query = '[data-value="' + item + '"]';
242 var item_query = '[data-value="' + item + '"]';
244 var $item_element = that.$buttongroup.find(item_query);
243 var $item_element = that.$buttongroup.find(item_query);
245 if (!$item_element.length) {
244 if (!$item_element.length) {
246 $item_element = $('<button/>')
245 $item_element = $('<button/>')
247 .attr('type', 'button')
246 .attr('type', 'button')
248 .addClass('btn')
247 .addClass('btn')
249 .html(item_html)
248 .html(item_html)
250 .appendTo(that.$buttongroup)
249 .appendTo(that.$buttongroup)
251 .attr('data-value', item)
250 .attr('data-value', item)
252 .on('click', $.proxy(that.handle_click, that));
251 .on('click', $.proxy(that.handle_click, that));
253 }
252 }
254 if (that.model.get('value_name') == item) {
253 if (that.model.get('value_name') == item) {
255 $item_element.addClass('active');
254 $item_element.addClass('active');
256 } else {
255 } else {
257 $item_element.removeClass('active');
256 $item_element.removeClass('active');
258 }
257 }
259 $item_element.prop('disabled', disabled);
258 $item_element.prop('disabled', disabled);
260 });
259 });
261
260
262 // Remove items that no longer exist.
261 // Remove items that no longer exist.
263 this.$buttongroup.find('button').each(function(i, obj) {
262 this.$buttongroup.find('button').each(function(i, obj) {
264 var value = $(obj).data('value');
263 var value = $(obj).data('value');
265 var found = false;
264 var found = false;
266 _.each(items, function(item, index) {
265 _.each(items, function(item, index) {
267 if (item == value) {
266 if (item == value) {
268 found = true;
267 found = true;
269 return false;
268 return false;
270 }
269 }
271 });
270 });
272
271
273 if (!found) {
272 if (!found) {
274 $(obj).remove();
273 $(obj).remove();
275 }
274 }
276 });
275 });
277
276
278 var description = this.model.get('description');
277 var description = this.model.get('description');
279 if (description.length === 0) {
278 if (description.length === 0) {
280 this.$label.hide();
279 this.$label.hide();
281 } else {
280 } else {
282 this.$label.text(description);
281 this.$label.text(description);
283 this.$label.show();
282 this.$label.show();
284 }
283 }
285 }
284 }
286 return ToggleButtonsView.__super__.update.apply(this);
285 return ToggleButtonsView.__super__.update.apply(this);
287 },
286 },
288
287
289 handle_click: function (e) {
288 handle_click: function (e) {
290 // Handle when a value is clicked.
289 // Handle when a value is clicked.
291
290
292 // Calling model.set will trigger all of the other views of the
291 // Calling model.set will trigger all of the other views of the
293 // model to update.
292 // model to update.
294 this.model.set('value_name', $(e.target).data('value'), {updated_view: this});
293 this.model.set('value_name', $(e.target).data('value'), {updated_view: this});
295 this.touch();
294 this.touch();
296 },
295 },
297 });
296 });
298 WidgetManager.register_widget_view('ToggleButtonsView', ToggleButtonsView);
297 WidgetManager.register_widget_view('ToggleButtonsView', ToggleButtonsView);
299
298
300
299
301 var SelectView = IPython.DOMWidgetView.extend({
300 var SelectView = IPython.DOMWidgetView.extend({
302 render : function(){
301 render : function(){
303 // Called when view is rendered.
302 // Called when view is rendered.
304 this.$el
303 this.$el
305 .addClass('widget-hbox');
304 .addClass('widget-hbox');
306 this.$label = $('<div />')
305 this.$label = $('<div />')
307 .appendTo(this.$el)
306 .appendTo(this.$el)
308 .addClass('widget-hlabel')
307 .addClass('widget-hlabel')
309 .hide();
308 .hide();
310 this.$listbox = $('<select />')
309 this.$listbox = $('<select />')
311 .addClass('widget-listbox')
310 .addClass('widget-listbox')
312 .attr('size', 6)
311 .attr('size', 6)
313 .appendTo(this.$el);
312 .appendTo(this.$el);
314 this.$el_to_style = this.$listbox; // Set default element to style
313 this.$el_to_style = this.$listbox; // Set default element to style
315 this.update();
314 this.update();
316 },
315 },
317
316
318 update : function(options){
317 update : function(options){
319 // Update the contents of this view
318 // Update the contents of this view
320 //
319 //
321 // Called when the model is changed. The model may have been
320 // Called when the model is changed. The model may have been
322 // changed by another view or by a state update from the back-end.
321 // changed by another view or by a state update from the back-end.
323 if (options === undefined || options.updated_view != this) {
322 if (options === undefined || options.updated_view != this) {
324 // Add missing items to the DOM.
323 // Add missing items to the DOM.
325 var items = this.model.get('value_names');
324 var items = this.model.get('value_names');
326 var that = this;
325 var that = this;
327 _.each(items, function(item, index) {
326 _.each(items, function(item, index) {
328 var item_query = ' :contains("' + item + '")';
327 var item_query = ' :contains("' + item + '")';
329 if (that.$listbox.find(item_query).length === 0) {
328 if (that.$listbox.find(item_query).length === 0) {
330 $('<option />')
329 $('<option />')
331 .text(item)
330 .text(item)
332 .attr('value_name', item)
331 .attr('value_name', item)
333 .appendTo(that.$listbox)
332 .appendTo(that.$listbox)
334 .on('click', $.proxy(that.handle_click, that));
333 .on('click', $.proxy(that.handle_click, that));
335 }
334 }
336 });
335 });
337
336
338 // Select the correct element
337 // Select the correct element
339 this.$listbox.val(this.model.get('value_name'));
338 this.$listbox.val(this.model.get('value_name'));
340
339
341 // Disable listbox if needed
340 // Disable listbox if needed
342 var disabled = this.model.get('disabled');
341 var disabled = this.model.get('disabled');
343 this.$listbox.prop('disabled', disabled);
342 this.$listbox.prop('disabled', disabled);
344
343
345 // Remove items that no longer exist.
344 // Remove items that no longer exist.
346 this.$listbox.find('option').each(function(i, obj) {
345 this.$listbox.find('option').each(function(i, obj) {
347 var value = $(obj).text();
346 var value = $(obj).text();
348 var found = false;
347 var found = false;
349 _.each(items, function(item, index) {
348 _.each(items, function(item, index) {
350 if (item == value) {
349 if (item == value) {
351 found = true;
350 found = true;
352 return false;
351 return false;
353 }
352 }
354 });
353 });
355
354
356 if (!found) {
355 if (!found) {
357 $(obj).remove();
356 $(obj).remove();
358 }
357 }
359 });
358 });
360
359
361 var description = this.model.get('description');
360 var description = this.model.get('description');
362 if (description.length === 0) {
361 if (description.length === 0) {
363 this.$label.hide();
362 this.$label.hide();
364 } else {
363 } else {
365 this.$label.text(description);
364 this.$label.text(description);
366 this.$label.show();
365 this.$label.show();
367 }
366 }
368 }
367 }
369 return SelectView.__super__.update.apply(this);
368 return SelectView.__super__.update.apply(this);
370 },
369 },
371
370
372 handle_click: function (e) {
371 handle_click: function (e) {
373 // Handle when a value is clicked.
372 // Handle when a value is clicked.
374
373
375 // Calling model.set will trigger all of the other views of the
374 // Calling model.set will trigger all of the other views of the
376 // model to update.
375 // model to update.
377 this.model.set('value_name', $(e.target).text(), {updated_view: this});
376 this.model.set('value_name', $(e.target).text(), {updated_view: this});
378 this.touch();
377 this.touch();
379 },
378 },
380 });
379 });
381 WidgetManager.register_widget_view('SelectView', SelectView);
380 WidgetManager.register_widget_view('SelectView', SelectView);
382 });
381 });
@@ -1,271 +1,280 b''
1 .widget-area {
1 .widget-area {
2 /*
2 /*
3 LESS file that styles IPython notebook widgets and the area they sit in.
3 LESS file that styles IPython notebook widgets and the area they sit in.
4
4
5 The widget area typically looks something like this:
5 The widget area typically looks something like this:
6 +------------------------------------------+
6 +------------------------------------------+
7 | widget-area |
7 | widget-area |
8 | +--------+---------------------------+ |
8 | +--------+---------------------------+ |
9 | | prompt | widget-subarea | |
9 | | prompt | widget-subarea | |
10 | | | +--------+ +--------+ | |
10 | | | +--------+ +--------+ | |
11 | | | | widget | | widget | | |
11 | | | | widget | | widget | | |
12 | | | +--------+ +--------+ | |
12 | | | +--------+ +--------+ | |
13 | +--------+---------------------------+ |
13 | +--------+---------------------------+ |
14 +------------------------------------------+
14 +------------------------------------------+
15 */
15 */
16
16
17 page-break-inside : avoid;
17 page-break-inside : avoid;
18 .hbox();
18 .hbox();
19
19
20 .widget-subarea {
20 .widget-subarea {
21 padding : 0.44em 0.4em 0.4em 1px;
21 padding : 0.44em 0.4em 0.4em 1px;
22 margin-left : 6px;
22 margin-left : 6px;
23
23
24 .border-box-sizing();
24 .border-box-sizing();
25 .vbox();
25 .vbox();
26 .box-flex2();
26 .box-flex2();
27 .align-start();
27 .align-start();
28 }
28 }
29 }
29 }
30
30
31 /* THE CLASSES BELOW CAN APPEAR ANYWHERE IN THE DOM (POSSIBLEY OUTSIDE OF
31 /* THE CLASSES BELOW CAN APPEAR ANYWHERE IN THE DOM (POSSIBLEY OUTSIDE OF
32 THE WIDGET AREA). */
32 THE WIDGET AREA). */
33
33
34 .widget-hlabel {
34 .widget-hlabel {
35 /* Horizontal Label */
35 /* Horizontal Label */
36 min-width : 10ex;
36 min-width : 10ex;
37 padding-right : 8px;
37 padding-right : 8px;
38 padding-top : 3px;
38 padding-top : 3px;
39 text-align : right;
39 text-align : right;
40 vertical-align : text-top;
40 vertical-align : text-top;
41 }
41 }
42
42
43 .widget-vlabel {
43 .widget-vlabel {
44 /* Vertical Label */
44 /* Vertical Label */
45 padding-bottom : 5px;
45 padding-bottom : 5px;
46 text-align : center;
46 text-align : center;
47 vertical-align : text-bottom;
47 vertical-align : text-bottom;
48 }
48 }
49
49
50 .widget-hreadout {
50 .widget-hreadout {
51 padding-left : 8px;
51 padding-left : 8px;
52 padding-top : 3px;
52 padding-top : 3px;
53 text-align : left;
53 text-align : left;
54 vertical-align : text-top;
54 vertical-align : text-top;
55 }
55 }
56
56
57 .widget-vreadout {
57 .widget-vreadout {
58 /* Vertical Label */
58 /* Vertical Label */
59 padding-top : 5px;
59 padding-top : 5px;
60 text-align : center;
60 text-align : center;
61 vertical-align : text-top;
61 vertical-align : text-top;
62 }
62 }
63
63
64 .slide-track {
64 .slide-track {
65 /* Slider Track */
65 /* Slider Track */
66 border : 1px solid #CCCCCC;
66 border : 1px solid #CCCCCC;
67 background : #FFFFFF;
67 background : #FFFFFF;
68
68
69 .corner-all(); /* Round the corners of the slide track */
69 .corner-all(); /* Round the corners of the slide track */
70 }
70 }
71
71
72 .widget-hslider {
72 .widget-hslider {
73 /* Horizontal jQuery Slider
73 /* Horizontal jQuery Slider
74
74
75 Both the horizontal and vertical versions of the slider are characterized
75 Both the horizontal and vertical versions of the slider are characterized
76 by a styled div that contains an invisible jQuery slide div which
76 by a styled div that contains an invisible jQuery slide div which
77 contains a visible slider handle div. This is requred so we can control
77 contains a visible slider handle div. This is requred so we can control
78 how the slider is drawn and 'fix' the issue where the slide handle
78 how the slider is drawn and 'fix' the issue where the slide handle
79 doesn't stop at the end of the slide.
79 doesn't stop at the end of the slide.
80
80
81 Both horizontal and vertical sliders have this div nesting:
81 Both horizontal and vertical sliders have this div nesting:
82 +------------------------------------------+
82 +------------------------------------------+
83 | widget-(h/v)slider |
83 | widget-(h/v)slider |
84 | +--------+---------------------------+ |
84 | +--------+---------------------------+ |
85 | | ui-slider | |
85 | | ui-slider | |
86 | | +------------------+ | |
86 | | +------------------+ | |
87 | | | ui-slider-handle | | |
87 | | | ui-slider-handle | | |
88 | | +------------------+ | |
88 | | +------------------+ | |
89 | +--------+---------------------------+ |
89 | +--------+---------------------------+ |
90 +------------------------------------------+
90 +------------------------------------------+
91 */
91 */
92
92
93 /* Fix the padding of the slide track so the ui-slider is sized
93 /* Fix the padding of the slide track so the ui-slider is sized
94 correctly. */
94 correctly. */
95 padding-left : 8px;
95 padding-left : 8px;
96 padding-right : 5px;
96 padding-right : 5px;
97 overflow : visible;
97 overflow : visible;
98
98
99 /* Default size of the slider */
99 /* Default size of the slider */
100 width : 348px;
100 width : 348px;
101 height : 5px;
101 height : 5px;
102 max-height : 5px;
102 max-height : 5px;
103 margin-top : 11px;
103 margin-top : 11px;
104 margin-bottom: 10px;
104 margin-bottom: 10px;
105
105
106 /* Style the slider track */
106 /* Style the slider track */
107 .slide-track();
107 .slide-track();
108
108
109 /* Make the div a flex box (makes FF behave correctly). */
109 /* Make the div a flex box (makes FF behave correctly). */
110 .hbox();
110 .hbox();
111
111
112 .ui-slider {
112 .ui-slider {
113 /* Inner, invisible slide div */
113 /* Inner, invisible slide div */
114 border : 0px !important;
114 border : 0px !important;
115 background : none !important;
115 background : none !important;
116
116
117 .hbox();
117 .hbox();
118 .box-flex1();
118 .box-flex1();
119
119
120 .ui-slider-handle {
120 .ui-slider-handle {
121 width : 14px !important;
121 width : 14px !important;
122 height : 28px !important;
122 height : 28px !important;
123 margin-top : -8px !important;
123 margin-top : -8px !important;
124 }
124 }
125 }
125 }
126 }
126 }
127
127
128 .widget-vslider {
128 .widget-vslider {
129 /* Vertical jQuery Slider */
129 /* Vertical jQuery Slider */
130
130
131 /* Fix the padding of the slide track so the ui-slider is sized
131 /* Fix the padding of the slide track so the ui-slider is sized
132 correctly. */
132 correctly. */
133 padding-bottom : 8px;
133 padding-bottom : 8px;
134 overflow : visible;
134 overflow : visible;
135
135
136 /* Default size of the slider */
136 /* Default size of the slider */
137 width : 5px;
137 width : 5px;
138 max-width : 5px;
138 max-width : 5px;
139 height : 250px;
139 height : 250px;
140 margin-left : 12px;
140 margin-left : 12px;
141
141
142 /* Style the slider track */
142 /* Style the slider track */
143 .slide-track();
143 .slide-track();
144
144
145 /* Make the div a flex box (makes FF behave correctly). */
145 /* Make the div a flex box (makes FF behave correctly). */
146 .vbox();
146 .vbox();
147
147
148 .ui-slider {
148 .ui-slider {
149 /* Inner, invisible slide div */
149 /* Inner, invisible slide div */
150 border : 0px !important;
150 border : 0px !important;
151 background : none !important;
151 background : none !important;
152 margin-left : -4px;
152 margin-left : -4px;
153 margin-top : 5px;
153 margin-top : 5px;
154
154
155 .vbox();
155 .vbox();
156 .box-flex1();
156 .box-flex1();
157
157
158 .ui-slider-handle {
158 .ui-slider-handle {
159 width : 28px !important;
159 width : 28px !important;
160 height : 14px !important;
160 height : 14px !important;
161 margin-left : -9px;
161 margin-left : -9px;
162 }
162 }
163 }
163 }
164 }
164 }
165
165
166 .widget-text {
166 .widget-text {
167 /* String Textbox - used for TextBoxView and TextAreaView */
167 /* String Textbox - used for TextBoxView and TextAreaView */
168 width : 350px;
168 width : 350px;
169 margin : 0px !important;
169 margin : 0px !important;
170 }
170 }
171
171
172 .widget-listbox {
172 .widget-listbox {
173 /* Listbox */
173 /* Listbox */
174 width : 364px;
174 width : 364px;
175 margin-bottom : 0px;
175 margin-bottom : 0px;
176 }
176 }
177
177
178 .widget-numeric-text {
178 .widget-numeric-text {
179 /* Single Line Textbox - used for IntTextView and FloatTextView */
179 /* Single Line Textbox - used for IntTextView and FloatTextView */
180 width : 150px;
180 width : 150px;
181 margin : 0px !important;
181 }
182 }
182
183
183 .widget-progress {
184 .widget-progress {
184 /* Progress Bar */
185 /* Progress Bar */
185 width : 363px;
186 width : 363px;
186
187
187 .bar {
188 .bar {
188 /* Disable progress bar animation */
189 /* Disable progress bar animation */
189 -webkit-transition : none;
190 -webkit-transition : none;
190 -moz-transition : none;
191 -moz-transition : none;
191 -ms-transition : none;
192 -ms-transition : none;
192 -o-transition : none;
193 -o-transition : none;
193 transition : none;
194 transition : none;
194 }
195 }
195 }
196 }
196
197
197 .widget-combo-btn {
198 .widget-combo-btn {
198 /* ComboBox Main Button */
199 /* ComboBox Main Button */
199 min-width : 138px; /* + 26px drop arrow btn = 164px */
200 min-width : 138px; /* + 26px drop arrow btn = 164px */
200 }
201 }
201
202
202 .widget-box {
203 .widget-box {
203 /* The following section sets the style for the invisible div that
204 /* The following section sets the style for the invisible div that
204 hold widgets and their accompanying labels.
205 hold widgets and their accompanying labels.
205
206
206 Looks like this:
207 Looks like this:
207 +-----------------------------+
208 +-----------------------------+
208 | widget-box (or similar) |
209 | widget-box (or similar) |
209 | +-------+---------------+ |
210 | +-------+---------------+ |
210 | | Label | Actual Widget | |
211 | | Label | Actual Widget | |
211 | +-------+---------------+ |
212 | +-------+---------------+ |
212 +-----------------------------+
213 +-----------------------------+
213 */
214 */
214 margin : 5px;
215 margin : 5px;
215
216
216 .start();
217 .start();
217 .widget-container();
218 .widget-container();
218 }
219 }
219
220
220 .widget-hbox {
221 .widget-hbox {
221 /* Horizontal widgets */
222 /* Horizontal widgets */
222 .widget-box();
223 .widget-box();
223 .hbox();
224 .hbox();
224 }
225 }
225
226
226 .widget-hbox-single {
227 .widget-hbox-single {
227 /* Single line horizontal widgets */
228 /* Single line horizontal widgets */
228 .widget-hbox();
229 .widget-hbox();
229 height : 30px;
230 height : 30px;
230 }
231 }
231
232
232 .widget-vbox {
233 .widget-vbox {
233 /* Vertical widgets */
234 /* Vertical widgets */
234 .widget-box();
235 .widget-box();
235 .vbox();
236 .vbox();
236 }
237 }
237
238
238 .widget-vbox-single {
239 .widget-vbox-single {
239 /* For vertical slides */
240 /* For vertical slides */
240 .widget-vbox();
241 .widget-vbox();
241 width : 30px;
242 width : 30px;
242 }
243 }
243
244
244 .widget-modal {
245 .widget-modal {
245 /* ContainerWidget - ModalView */
246 /* ContainerWidget - ModalView */
246 overflow : hidden;
247 overflow : hidden;
247 position : absolute !important;
248 position : absolute !important;
248 top : 0px;
249 top : 0px;
249 left : 0px;
250 left : 0px;
250 margin-left : 0px !important;
251 margin-left : 0px !important;
251 }
252 }
252
253
253 .widget-modal-body {
254 .widget-modal-body {
254 /* ContainerWidget - ModalView Body */
255 /* ContainerWidget - ModalView Body */
255 max-height: none !important;
256 max-height: none !important;
256 }
257 }
257
258
258 .widget-container {
259 .widget-container {
259 /* ContainerWidget */
260 /* ContainerWidget */
260 .border-box-sizing();
261 .border-box-sizing();
261 .align-start();
262 .align-start();
262 }
263 }
263
264
265 .widget-radio-box {
266 /* Contains RadioButtonsWidget */
267 .vbox();
268 .border-box-sizing();
269
270 padding-top: 4px;
271 }
272
264 .docked-widget-modal {
273 .docked-widget-modal {
265 /* Horizontal Label */
274 /* Horizontal Label */
266 overflow: hidden;
275 overflow: hidden;
267 position: relative !important;
276 position: relative !important;
268 top: 0px !important;
277 top: 0px !important;
269 left: 0px !important;
278 left: 0px !important;
270 margin-left: 0px !important;
279 margin-left: 0px !important;
271 } No newline at end of file
280 }
General Comments 0
You need to be logged in to leave comments. Login now