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

Side by Side Diff: examples/wm_flow/wm/window_frame.sky

Issue 817573003: Move wm_flow off of views and onto Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « examples/wm_flow/wm/frame_controller.cc ('k') | examples/wm_flow/wm/window_frame_host.mojom » ('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 #!mojo:sky_viewer
2 <!--
3 // Copyright 2015 The Chromium Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style license that can be
5 // found in the LICENSE file.
6 -->
7 <sky>
8 <import src="/gen/examples/wm_flow/wm/window_frame_host.mojom.sky" as="example" />
9 <import src="/sky/framework/embedder.sky" as="embedder" />
10 <import src="/sky/framework/sky-button/sky-button.sky"/>
11 <import src="/sky/framework/sky-checkbox/sky-checkbox.sky"/>
12 <import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement"/>
13
14 <style>
15 /* FIXME: Hack until the requirement of a single root element is lifted. */
16 sky { height: 100%; }
17 </style>
18
19 <sky-element name="window-frame">
20 <template>
21 <style>
22 :host {
23 height: 100%;
24 background-color: lightgrey;
25 }
26 /* Nest two flexboxes and make the right side take up as much as possible */
27 window-bar {
28 display: flex;
29 }
30 left {
31 flex: 1;
32 display: flex;
33 align-content: flex-start;
34 }
35 /* Also making the checkbox and label a flexbox for convenience */
36 right {
37 display: flex;
38 }
39
40 /* Style sky controls to make them look more like ui/views */
41 sky-button {
42 border: none;
43 border: 1px solid blue;
44 padding: 2px;
45 }
46 sky-button:hover {
47 border: 1px solid lightblue;
48 background-color: darkgrey;
49 }
50 </style>
51 <window-bar>
52 <left>
53 <sky-checkbox on-click="handleCaptureClick" />Capture
54 </left>
55 <right>
56 <sky-button on-click="handleEmbiggenClick">Embiggen</sky-button>
57 <sky-button on-click="handleBegoneClick">Begone</sky-button>
58 </right>
59 </window-bar>
60 </template>
61 <script>
62 module.exports = class extends SkyElement {
63 created() {
64 this.embedder = embedder.connectToEmbedderService(example.WindowFrameHost);
65 this.addEventListener('mousedown', function() {
66 this.embedder.activateWindow();
67 }.bind(this));
68 }
69 handleCaptureClick(event) {
70 this.embedder.setCapture(event.target.checked);
71 }
72 handleEmbiggenClick(event) {
73 this.embedder.toggleMaximize();
74 }
75 handleBegoneClick(event) {
76 this.embedder.closeWindow();
77 }
78 }.register();
79 </script>
80 </sky-element>
81
82 <window-frame />
83
84 </sky>
OLDNEW
« no previous file with comments | « examples/wm_flow/wm/frame_controller.cc ('k') | examples/wm_flow/wm/window_frame_host.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698