Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1356)

Side by Side Diff: tools/dom/src/chrome/app_window.dart

Issue 12209045: Initial commit of generated dart:chrome app_window and app_runtime (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Ensuring latest copy is uploaded Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/dom/src/chrome/app_runtime.dart ('k') | tools/dom/src/chrome/chrome.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Generated from namespace: app.window
6
7 part of chrome;
8
9 /**
10 * Types
11 */
12
13 class AppWindowCreateWindowOptions extends ChromeObject {
14 /*
15 * Public constructor
16 */
17 AppWindowCreateWindowOptions({String id, int defaultWidth, int defaultHeight, int defaultLeft, int defaultTop, int width, int height, int left, int top, int m inWidth, int minHeight, int maxWidth, int maxHeight, String type, String frame, AppWindowBounds bounds, bool transparentBackground, bool hidden, bool singleton} ) {
18 if (?id)
19 this.id = id;
20 if (?defaultWidth)
21 this.defaultWidth = defaultWidth;
22 if (?defaultHeight)
23 this.defaultHeight = defaultHeight;
24 if (?defaultLeft)
25 this.defaultLeft = defaultLeft;
26 if (?defaultTop)
27 this.defaultTop = defaultTop;
28 if (?width)
29 this.width = width;
30 if (?height)
31 this.height = height;
32 if (?left)
33 this.left = left;
34 if (?top)
35 this.top = top;
36 if (?minWidth)
37 this.minWidth = minWidth;
38 if (?minHeight)
39 this.minHeight = minHeight;
40 if (?maxWidth)
41 this.maxWidth = maxWidth;
42 if (?maxHeight)
43 this.maxHeight = maxHeight;
44 if (?type)
45 this.type = type;
46 if (?frame)
47 this.frame = frame;
48 if (?bounds)
49 this.bounds = bounds;
50 if (?transparentBackground)
51 this.transparentBackground = transparentBackground;
52 if (?hidden)
53 this.hidden = hidden;
54 if (?singleton)
55 this.singleton = singleton;
56 }
57
58 /*
59 * Private constructor
60 */
61 AppWindowCreateWindowOptions._proxy(_jsObject) : super._proxy(_jsObject);
62
63 /*
64 * Public accessors
65 */
66 /// Id to identify the window. This will be used to remember the size and
67 /// position of the window and restore that geometry when a window with the
68 /// same id (and no explicit size or position) is later opened.
69 String get id => JS('String', '#.id', this._jsObject);
70
71 void set id(String id) {
72 JS('void', '#.id = #', this._jsObject, id);
73 }
74
75 /// Default width of the window. (Deprecated; regular bounds act like this
76 /// now.)
77 int get defaultWidth => JS('int', '#.defaultWidth', this._jsObject);
78
79 void set defaultWidth(int defaultWidth) {
80 JS('void', '#.defaultWidth = #', this._jsObject, defaultWidth);
81 }
82
83 /// Default height of the window. (Deprecated; regular bounds act like this
84 /// now.)
85 int get defaultHeight => JS('int', '#.defaultHeight', this._jsObject);
86
87 void set defaultHeight(int defaultHeight) {
88 JS('void', '#.defaultHeight = #', this._jsObject, defaultHeight);
89 }
90
91 /// Default X coordinate of the window. (Deprecated; regular bounds act like
92 /// this now.)
93 int get defaultLeft => JS('int', '#.defaultLeft', this._jsObject);
94
95 void set defaultLeft(int defaultLeft) {
96 JS('void', '#.defaultLeft = #', this._jsObject, defaultLeft);
97 }
98
99 /// Default Y coordinate of the window. (Deprecated; regular bounds act like
100 /// this now.)
101 int get defaultTop => JS('int', '#.defaultTop', this._jsObject);
102
103 void set defaultTop(int defaultTop) {
104 JS('void', '#.defaultTop = #', this._jsObject, defaultTop);
105 }
106
107 /// Width of the window. (Deprecated; use 'bounds'.)
108 int get width => JS('int', '#.width', this._jsObject);
109
110 void set width(int width) {
111 JS('void', '#.width = #', this._jsObject, width);
112 }
113
114 /// Height of the window. (Deprecated; use 'bounds'.)
115 int get height => JS('int', '#.height', this._jsObject);
116
117 void set height(int height) {
118 JS('void', '#.height = #', this._jsObject, height);
119 }
120
121 /// X coordinate of the window. (Deprecated; use 'bounds'.)
122 int get left => JS('int', '#.left', this._jsObject);
123
124 void set left(int left) {
125 JS('void', '#.left = #', this._jsObject, left);
126 }
127
128 /// Y coordinate of the window. (Deprecated; use 'bounds'.)
129 int get top => JS('int', '#.top', this._jsObject);
130
131 void set top(int top) {
132 JS('void', '#.top = #', this._jsObject, top);
133 }
134
135 /// Minimum width of the window.
136 int get minWidth => JS('int', '#.minWidth', this._jsObject);
137
138 void set minWidth(int minWidth) {
139 JS('void', '#.minWidth = #', this._jsObject, minWidth);
140 }
141
142 /// Minimum height of the window.
143 int get minHeight => JS('int', '#.minHeight', this._jsObject);
144
145 void set minHeight(int minHeight) {
146 JS('void', '#.minHeight = #', this._jsObject, minHeight);
147 }
148
149 /// Maximum width of the window.
150 int get maxWidth => JS('int', '#.maxWidth', this._jsObject);
151
152 void set maxWidth(int maxWidth) {
153 JS('void', '#.maxWidth = #', this._jsObject, maxWidth);
154 }
155
156 /// Maximum height of the window.
157 int get maxHeight => JS('int', '#.maxHeight', this._jsObject);
158
159 void set maxHeight(int maxHeight) {
160 JS('void', '#.maxHeight = #', this._jsObject, maxHeight);
161 }
162
163 /// Window type: 'shell' - the default window type 'panel' - a panel, manage d
164 /// by the OS (Currently experimental, Ash only)
165 String get type => JS('String', '#.type', this._jsObject);
166
167 void set type(String type) {
168 JS('void', '#.type = #', this._jsObject, type);
169 }
170
171 /// Frame type: 'none' or 'chrome' (defaults to 'chrome').
172 String get frame => JS('String', '#.frame', this._jsObject);
173
174 void set frame(String frame) {
175 JS('void', '#.frame = #', this._jsObject, frame);
176 }
177
178 /// Size of the content in the window (excluding the titlebar). If specified i n
179 /// addition to any of the left/top/width/height parameters, this field takes
180 /// precedence. If a frameBounds is specified, the frameBounds take precedence .
181 AppWindowBounds get bounds => new AppWindowBounds._proxy(JS('', '#.bounds', th is._jsObject));
182
183 void set bounds(AppWindowBounds bounds) {
184 JS('void', '#.bounds = #', this._jsObject, convertArgument(bounds));
185 }
186
187 /// Enable window background transparency. Only supported in ash. Requires
188 /// experimental API permission.
189 bool get transparentBackground => JS('bool', '#.transparentBackground', this._ jsObject);
190
191 void set transparentBackground(bool transparentBackground) {
192 JS('void', '#.transparentBackground = #', this._jsObject, transparentBackgro und);
193 }
194
195 /// If true, the window will be created in a hidden state. Call show() on the
196 /// window to show it once it has been created. Defaults to false.
197 bool get hidden => JS('bool', '#.hidden', this._jsObject);
198
199 void set hidden(bool hidden) {
200 JS('void', '#.hidden = #', this._jsObject, hidden);
201 }
202
203 /// By default if you specify an id for the window, the window will only be
204 /// created if another window with the same id doesn't already exist. If a
205 /// window with the same id already exists that window is activated instead. I f
206 /// you do want to create multiple windows with the same id, you can set this
207 /// property to false.
208 bool get singleton => JS('bool', '#.singleton', this._jsObject);
209
210 void set singleton(bool singleton) {
211 JS('void', '#.singleton = #', this._jsObject, singleton);
212 }
213
214 }
215
216 class AppWindowBounds extends ChromeObject {
217 /*
218 * Public constructor
219 */
220 AppWindowBounds({int left, int top, int width, int height}) {
221 if (?left)
222 this.left = left;
223 if (?top)
224 this.top = top;
225 if (?width)
226 this.width = width;
227 if (?height)
228 this.height = height;
229 }
230
231 /*
232 * Private constructor
233 */
234 AppWindowBounds._proxy(_jsObject) : super._proxy(_jsObject);
235
236 /*
237 * Public accessors
238 */
239 int get left => JS('int', '#.left', this._jsObject);
240
241 void set left(int left) {
242 JS('void', '#.left = #', this._jsObject, left);
243 }
244
245 int get top => JS('int', '#.top', this._jsObject);
246
247 void set top(int top) {
248 JS('void', '#.top = #', this._jsObject, top);
249 }
250
251 int get width => JS('int', '#.width', this._jsObject);
252
253 void set width(int width) {
254 JS('void', '#.width = #', this._jsObject, width);
255 }
256
257 int get height => JS('int', '#.height', this._jsObject);
258
259 void set height(int height) {
260 JS('void', '#.height = #', this._jsObject, height);
261 }
262
263 }
264
265 class AppWindowAppWindow extends ChromeObject {
266 /*
267 * Private constructor
268 */
269 AppWindowAppWindow._proxy(_jsObject) : super._proxy(_jsObject);
270
271 /*
272 * Public accessors
273 */
274 /// The JavaScript 'window' object for the created child.
275 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
276 // for details. All rights reserved. Use of this source code is governed by a
277 // BSD-style license that can be found in the LICENSE file.
278
279 // TODO(sashab, sra): Detect whether this is the current window, or an
280 // external one, and return an appropriately-typed object
281 WindowBase get contentWindow =>
282 JS("Window", "#.contentWindow", this._jsObject);
283
284 /*
285 * Methods
286 */
287 /// Focus the window.
288 void focus() => JS('void', '#.focus()', this._jsObject);
289
290 /// Minimize the window.
291 void minimize() => JS('void', '#.minimize()', this._jsObject);
292
293 /// Is the window minimized?
294 void isMinimized() => JS('void', '#.isMinimized()', this._jsObject);
295
296 /// Maximize the window.
297 void maximize() => JS('void', '#.maximize()', this._jsObject);
298
299 /// Is the window maximized?
300 void isMaximized() => JS('void', '#.isMaximized()', this._jsObject);
301
302 /// Restore the window.
303 void restore() => JS('void', '#.restore()', this._jsObject);
304
305 /// Move the window to the position (|left|, |top|).
306 void moveTo(int left, int top) => JS('void', '#.moveTo(#, #)', this._jsObject, left, top);
307
308 /// Resize the window to |width|x|height| pixels in size.
309 void resizeTo(int width, int height) => JS('void', '#.resizeTo(#, #)', this._j sObject, width, height);
310
311 /// Draw attention to the window.
312 void drawAttention() => JS('void', '#.drawAttention()', this._jsObject);
313
314 /// Clear attention to the window.
315 void clearAttention() => JS('void', '#.clearAttention()', this._jsObject);
316
317 /// Close the window.
318 void close() => JS('void', '#.close()', this._jsObject);
319
320 /// Show the window. Does nothing if the window is already visible.
321 void show() => JS('void', '#.show()', this._jsObject);
322
323 /// Hide the window. Does nothing if the window is already hidden.
324 void hide() => JS('void', '#.hide()', this._jsObject);
325
326 /// Get the window's bounds as a $ref:Bounds object.
327 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
328 // for details. All rights reserved. Use of this source code is governed by a
329 // BSD-style license that can be found in the LICENSE file.
330
331 // TODO(sashab, kalman): Fix IDL parser to read function return values
332 // correctly. Currently, it just reads void for all functions.
333 AppWindowBounds getBounds() =>
334 new AppWindowBounds._proxy(JS('void', '#.getBounds()', this._jsObject));
335
336 /// Set the window's bounds.
337 void setBounds(AppWindowBounds bounds) => JS('void', '#.setBounds(#)', this._j sObject, convertArgument(bounds));
338
339 /// Set the app icon for the window (experimental). Currently this is only
340 /// being implemented on Ash. TODO(stevenjb): Investigate implementing this on
341 /// Windows and OSX.
342 void setIcon(String icon_url) => JS('void', '#.setIcon(#)', this._jsObject, ic on_url);
343
344 }
345
346 /**
347 * Events
348 */
349
350 /// Fired when the window is resized.
351 class Event_app_window_onBoundsChanged extends Event {
352 void addListener(void callback()) => super.addListener(callback);
353
354 void removeListener(void callback()) => super.removeListener(callback);
355
356 bool hasListener(void callback()) => super.hasListener(callback);
357
358 Event_app_window_onBoundsChanged(jsObject) : super._(jsObject, 0);
359 }
360
361 /// Fired when the window is closed.
362 class Event_app_window_onClosed extends Event {
363 void addListener(void callback()) => super.addListener(callback);
364
365 void removeListener(void callback()) => super.removeListener(callback);
366
367 bool hasListener(void callback()) => super.hasListener(callback);
368
369 Event_app_window_onClosed(jsObject) : super._(jsObject, 0);
370 }
371
372 /// Fired when the window is maximized.
373 class Event_app_window_onMaximized extends Event {
374 void addListener(void callback()) => super.addListener(callback);
375
376 void removeListener(void callback()) => super.removeListener(callback);
377
378 bool hasListener(void callback()) => super.hasListener(callback);
379
380 Event_app_window_onMaximized(jsObject) : super._(jsObject, 0);
381 }
382
383 /// Fired when the window is minimized.
384 class Event_app_window_onMinimized extends Event {
385 void addListener(void callback()) => super.addListener(callback);
386
387 void removeListener(void callback()) => super.removeListener(callback);
388
389 bool hasListener(void callback()) => super.hasListener(callback);
390
391 Event_app_window_onMinimized(jsObject) : super._(jsObject, 0);
392 }
393
394 /// Fired when the window is restored from being minimized or maximized.
395 class Event_app_window_onRestored extends Event {
396 void addListener(void callback()) => super.addListener(callback);
397
398 void removeListener(void callback()) => super.removeListener(callback);
399
400 bool hasListener(void callback()) => super.hasListener(callback);
401
402 Event_app_window_onRestored(jsObject) : super._(jsObject, 0);
403 }
404
405 /**
406 * Functions
407 */
408
409 class API_app_window {
410 /*
411 * API connection
412 */
413 Object _jsObject;
414
415 /*
416 * Events
417 */
418 Event_app_window_onBoundsChanged onBoundsChanged;
419 Event_app_window_onClosed onClosed;
420 Event_app_window_onMaximized onMaximized;
421 Event_app_window_onMinimized onMinimized;
422 Event_app_window_onRestored onRestored;
423
424 /*
425 * Functions
426 */
427 /// The size and position of a window can be specified in a number of differen t
428 /// ways. The most simple option is not specifying anything at all, in which
429 /// case a default size and platform dependent position will be used.<br/><br/ >
430 /// Another option is to use the top/left and width/height properties, which
431 /// will always put the window at the specified coordinates with the specified
432 /// size.<br/><br/> Yet another option is to give the window a (unique) id.
433 /// This id is then used to remember the size and position of the window
434 /// whenever it is moved or resized. This size and position is then used
435 /// instead of the specified bounds on subsequent opening of a window with the
436 /// same id. If you need to open a window with an id at a location other than
437 /// the remembered default, you can create it hidden, move it to the desired
438 /// location, then show it.<br/><br/> You can also combine these various
439 /// options, explicitly specifying for example the size while having the
440 /// position be remembered or other combinations like that. Size and position
441 /// are dealt with seperately, but individual coordinates are not. So if you
442 /// specify a top (or left) coordinate, you should also specify a left (or top )
443 /// coordinate, and similar for size.<br/><br/> If you specify both a regular
444 /// and a default value for the same option the regular value is the only one
445 /// that takes effect.
446 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
447 // for details. All rights reserved. Use of this source code is governed by a
448 // BSD-style license that can be found in the LICENSE file.
449
450 // TODO(sashab): This override is no longer needed once prefixes are removed.
451 void create(String url,
452 [AppWindowCreateWindowOptions options,
453 void callback(AppWindowAppWindow created_window)]) {
454 void __proxy_callback(created_window) {
455 if (?callback)
456 callback(new AppWindowAppWindow._proxy(created_window));
457 }
458 JS('void', '#.create(#, #, #)', this._jsObject, url, convertArgument(options ),
459 convertDartClosureToJS(__proxy_callback, 1));
460 }
461
462 /// Returns an $ref:AppWindow object for the current script context (ie
463 /// JavaScript 'window' object). This can also be called on a handle to a
464 /// script context for another page, for example:
465 /// otherWindow.chrome.app.window.current().
466 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
467 // for details. All rights reserved. Use of this source code is governed by a
468 // BSD-style license that can be found in the LICENSE file.
469
470 // TODO(sashab, kalman): Fix IDL parser to read function return values
471 // correctly. Currently, it just reads void for all functions.
472 AppWindowAppWindow current() =>
473 new AppWindowAppWindow._proxy(JS('void', '#.current()', this._jsObject));
474
475 void initializeAppWindow(Object state) => JS('void', '#.initializeAppWindow(#) ', this._jsObject, convertArgument(state));
476
477 API_app_window(this._jsObject) {
478 onBoundsChanged = new Event_app_window_onBoundsChanged(JS('', '#.onBoundsCha nged', this._jsObject));
479 onClosed = new Event_app_window_onClosed(JS('', '#.onClosed', this._jsObject ));
480 onMaximized = new Event_app_window_onMaximized(JS('', '#.onMaximized', this. _jsObject));
481 onMinimized = new Event_app_window_onMinimized(JS('', '#.onMinimized', this. _jsObject));
482 onRestored = new Event_app_window_onRestored(JS('', '#.onRestored', this._js Object));
483 }
484 }
OLDNEW
« no previous file with comments | « tools/dom/src/chrome/app_runtime.dart ('k') | tools/dom/src/chrome/chrome.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698