##// END OF EJS Templates
Added baseline and stretch
Jonathan Frederic -
Show More
@@ -1,221 +1,269
1 1
2 2 /* Flexible box model classes */
3 3 /* Taken from Alex Russell http://infrequently.org/2009/08/css-3-progress/ */
4 4
5 5 /* This file is a compatability layer. It allows the usage of flexible box
6 6 model layouts accross multiple browsers, including older browsers. The newest,
7 7 universal implementation of the flexible box model is used when available (see
8 8 `Modern browsers` comments below). Browsers that are known to implement this
9 9 new spec completely include:
10 10
11 11 Firefox 28.0+
12 12 Chrome 29.0+
13 13 Internet Explorer 11+
14 14 Opera 17.0+
15 15
16 16 Browsers not listed, including Safari, are supported via the styling under the
17 17 `Old browsers` comments below.
18 18 */
19 19
20 20
21 21 .hbox {
22 22 /* Old browsers */
23 23 display: -webkit-box;
24 24 -webkit-box-orient: horizontal;
25 25 -webkit-box-align: stretch;
26 26
27 27 display: -moz-box;
28 28 -moz-box-orient: horizontal;
29 29 -moz-box-align: stretch;
30 30
31 31 display: box;
32 32 box-orient: horizontal;
33 33 box-align: stretch;
34 34
35 35 /* Modern browsers */
36 36 display: flex;
37 37 flex-direction: row;
38 38 align-items: stretch;
39 39 }
40 40
41 41 .hbox > * {
42 42 /* Old browsers */
43 43 -webkit-box-flex: 0;
44 44 -moz-box-flex: 0;
45 45 box-flex: 0;
46 46
47 47 /* Modern browsers */
48 48 flex: none;
49 49 }
50 50
51 51 .vbox {
52 52 /* Old browsers */
53 53 display: -webkit-box;
54 54 -webkit-box-orient: vertical;
55 55 -webkit-box-align: stretch;
56 56
57 57 display: -moz-box;
58 58 -moz-box-orient: vertical;
59 59 -moz-box-align: stretch;
60 60
61 61 display: box;
62 62 box-orient: vertical;
63 63 box-align: stretch;
64 64
65 65 /* Modern browsers */
66 66 display: flex;
67 67 flex-direction: column;
68 68 align-items: stretch;
69 69 }
70 70
71 71 .vbox > * {
72 72 /* Old browsers */
73 73 -webkit-box-flex: 0;
74 74 -moz-box-flex: 0;
75 75 box-flex: 0;
76 76
77 77 /* Modern browsers */
78 78 flex: none;
79 79 }
80 80
81 81 .hbox.reverse,
82 82 .vbox.reverse,
83 83 .reverse {
84 84 /* Old browsers */
85 85 -webkit-box-direction: reverse;
86 86 -moz-box-direction: reverse;
87 87 box-direction: reverse;
88 88
89 89 /* Modern browsers */
90 90 flex-direction: row-reverse;
91 91 }
92 92
93 93 .hbox.box-flex0,
94 94 .vbox.box-flex0,
95 95 .box-flex0 {
96 96 /* Old browsers */
97 97 -webkit-box-flex: 0;
98 98 -moz-box-flex: 0;
99 99 box-flex: 0;
100 100
101 101 /* Modern browsers */
102 102 flex: none;
103 103 width: auto;
104 104 }
105 105
106 106 .hbox.box-flex1,
107 107 .vbox.box-flex1,
108 108 .box-flex1 {
109 109 /* Old browsers */
110 110 -webkit-box-flex: 1;
111 111 -moz-box-flex: 1;
112 112 box-flex: 1;
113 113
114 114 /* Modern browsers */
115 115 flex: 1;
116 116 }
117 117
118 118 .hbox.box-flex,
119 119 .vbox.box-flex,
120 120 .box-flex {
121 121 /* Old browsers */
122 122 .box-flex1();
123 123 }
124 124
125 125 .hbox.box-flex2,
126 126 .vbox.box-flex2,
127 127 .box-flex2 {
128 128 /* Old browsers */
129 129 -webkit-box-flex: 2;
130 130 -moz-box-flex: 2;
131 131 box-flex: 2;
132 132
133 133 /* Modern browsers */
134 134 flex: 2;
135 135 }
136 136
137 137 .box-group1 {
138 138 /* Deprecated */
139 139 -webkit-box-flex-group: 1;
140 140 -moz-box-flex-group: 1;
141 141 box-flex-group: 1;
142 142 }
143 143
144 144 .box-group2 {
145 145 /* Deprecated */
146 146 -webkit-box-flex-group: 2;
147 147 -moz-box-flex-group: 2;
148 148 box-flex-group: 2;
149 149 }
150 150
151 151 .hbox.start,
152 152 .vbox.start,
153 153 .start {
154 154 /* Old browsers */
155 155 -webkit-box-pack: start;
156 156 -moz-box-pack: start;
157 157 box-pack: start;
158 158
159 159 /* Modern browsers */
160 160 justify-content: flex-start;
161 161 }
162 162
163 163 .hbox.end,
164 164 .vbox.end,
165 165 .end {
166 166 /* Old browsers */
167 167 -webkit-box-pack: end;
168 168 -moz-box-pack: end;
169 169 box-pack: end;
170 170
171 171 /* Modern browsers */
172 172 justify-content: flex-end;
173 173 }
174 174
175 175 .hbox.center,
176 176 .vbox.center,
177 177 .center {
178 178 /* Old browsers */
179 179 -webkit-box-pack: center;
180 180 -moz-box-pack: center;
181 181 box-pack: center;
182 182
183 183 /* Modern browsers */
184 184 justify-content: center;
185 185 }
186 186
187 .hbox.baseline,
188 .vbox.baseline,
189 .baseline {
190 /* Old browsers */
191 -webkit-box-pack: baseline;
192 -moz-box-pack: baseline;
193 box-pack: baseline;
194
195 /* Modern browsers */
196 justify-content: baseline;
197 }
198
199 .hbox.stretch,
200 .vbox.stretch,
201 .stretch {
202 /* Old browsers */
203 -webkit-box-pack: stretch;
204 -moz-box-pack: stretch;
205 box-pack: stretch;
206
207 /* Modern browsers */
208 justify-content: stretch;
209 }
210
187 211 .hbox.align-start,
188 212 .vbox.align-start,
189 213 .align-start {
190 214 /* Old browsers */
191 215 -webkit-box-align: start;
192 216 -moz-box-align: start;
193 217 box-align: start;
194 218
195 219 /* Modern browsers */
196 220 align-items: flex-start;
197 221 }
198 222
199 223 .hbox.align-end,
200 224 .vbox.align-end,
201 225 .align-end {
202 226 /* Old browsers */
203 227 -webkit-box-align: end;
204 228 -moz-box-align: end;
205 229 box-align: end;
206 230
207 231 /* Modern browsers */
208 232 align-items: flex-end;
209 233 }
210 234
211 235 .hbox.align-center,
212 236 .vbox.align-center,
213 237 .align-center {
214 238 /* Old browsers */
215 239 -webkit-box-align: center;
216 240 -moz-box-align: center;
217 241 box-align: center;
218 242
219 243 /* Modern browsers */
220 244 align-items: center;
221 245 }
246
247 .hbox.align-baseline,
248 .vbox.align-baseline,
249 .align-baseline {
250 /* Old browsers */
251 -webkit-box-align: baseline;
252 -moz-box-align: baseline;
253 box-align: baseline;
254
255 /* Modern browsers */
256 align-items: baseline;
257 }
258
259 .hbox.align-stretch,
260 .vbox.align-stretch,
261 .align-stretch {
262 /* Old browsers */
263 -webkit-box-align: stretch;
264 -moz-box-align: stretch;
265 box-align: stretch;
266
267 /* Modern browsers */
268 align-items: stretch;
269 }
@@ -1,12 +1,12
1 1 from .widget import Widget, DOMWidget, CallbackDispatcher
2 2
3 3 from .widget_bool import CheckboxWidget, ToggleButtonWidget
4 4 from .widget_button import ButtonWidget
5 from .widget_container import ContainerWidget, PopupWidget, FlexContainerWidget, HBoxContainerWidget, VBoxContainerWidget
5 from .widget_container import ContainerWidget, PopupWidget, FlexContainerWidget, HBoxWidget, VBoxWidget
6 6 from .widget_float import FloatTextWidget, BoundedFloatTextWidget, FloatSliderWidget, FloatProgressWidget
7 7 from .widget_image import ImageWidget
8 8 from .widget_int import IntTextWidget, BoundedIntTextWidget, IntSliderWidget, IntProgressWidget
9 9 from .widget_selection import RadioButtonsWidget, ToggleButtonsWidget, DropdownWidget, SelectWidget
10 10 from .widget_selectioncontainer import TabWidget, AccordionWidget
11 11 from .widget_string import HTMLWidget, LatexWidget, TextWidget, TextareaWidget
12 12 from .interaction import interact, interactive, fixed
@@ -1,55 +1,59
1 1 """ContainerWidget class.
2 2
3 3 Represents a container that can be used to group other widgets.
4 4 """
5 5
6 6 # Copyright (c) IPython Development Team.
7 7 # Distributed under the terms of the Modified BSD License.
8 8
9 9 from .widget import DOMWidget
10 10 from IPython.utils.traitlets import Unicode, Tuple, TraitError, Int, CaselessStrEnum
11 11
12 12 class ContainerWidget(DOMWidget):
13 13 _view_name = Unicode('ContainerView', sync=True)
14 14
15 15 # Child widgets in the container.
16 16 # Using a tuple here to force reassignment to update the list.
17 17 # When a proper notifying-list trait exists, that is what should be used here.
18 18 children = Tuple(sync=True, allow_none=False)
19 19
20 20 def __init__(self, children = (), **kwargs):
21 21 kwargs['children'] = children
22 22 super(ContainerWidget, self).__init__(**kwargs)
23 23 self.on_displayed(ContainerWidget._fire_children_displayed)
24 24
25 25 def _fire_children_displayed(self):
26 26 for child in self.children:
27 27 child._handle_displayed()
28 28
29 29
30 30 class PopupWidget(ContainerWidget):
31 31 _view_name = Unicode('PopupView', sync=True)
32 32
33 33 description = Unicode(sync=True)
34 34 button_text = Unicode(sync=True)
35 35
36 36
37 37 class FlexContainerWidget(ContainerWidget):
38 38 _view_name = Unicode('FlexContainerView', sync=True)
39 39 flex = Int(0, sync=True, help="""Specify the flexible-ness of the model.""")
40 40 def _flex_changed(self, name, old, new):
41 41 new = min(max(0, new), 2)
42 42 if self.flex != new:
43 43 self.flex = new
44 44
45 _locations = ['start', 'center', 'end']
46 pack = CaselessStrEnum(values=_locations, default_value='start', allow_none=False, sync=True)
47 align = CaselessStrEnum(values=_locations, default_value='start', allow_none=False, sync=True)
45 _locations = ['start', 'center', 'end', 'baseline', 'stretch']
46 pack = CaselessStrEnum(
47 values=_locations,
48 default_value='start', allow_none=False, sync=True)
49 align = CaselessStrEnum(
50 values=_locations,
51 default_value='start', allow_none=False, sync=True)
48 52
49 53
50 class VBoxContainerWidget(FlexContainerWidget):
54 class VBoxWidget(FlexContainerWidget):
51 55 _view_name = Unicode('VBoxContainerView', sync=True)
52 56
53 57
54 class HBoxContainerWidget(FlexContainerWidget):
58 class HBoxWidget(FlexContainerWidget):
55 59 _view_name = Unicode('HBoxContainerView', sync=True)
General Comments 0
You need to be logged in to leave comments. Login now