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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: examples/wm_flow/wm/window_frame.sky
diff --git a/examples/wm_flow/wm/window_frame.sky b/examples/wm_flow/wm/window_frame.sky
new file mode 100644
index 0000000000000000000000000000000000000000..2f9a6dc82032ba64a432d6fd145394b91a2fe1f0
--- /dev/null
+++ b/examples/wm_flow/wm/window_frame.sky
@@ -0,0 +1,84 @@
+#!mojo:sky_viewer
+<!--
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+-->
+<sky>
+<import src="/gen/examples/wm_flow/wm/window_frame_host.mojom.sky" as="example" />
+<import src="/sky/framework/embedder.sky" as="embedder" />
+<import src="/sky/framework/sky-button/sky-button.sky"/>
+<import src="/sky/framework/sky-checkbox/sky-checkbox.sky"/>
+<import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement"/>
+
+<style>
+/* FIXME: Hack until the requirement of a single root element is lifted. */
+sky { height: 100%; }
+</style>
+
+<sky-element name="window-frame">
+<template>
+ <style>
+ :host {
+ height: 100%;
+ background-color: lightgrey;
+ }
+ /* Nest two flexboxes and make the right side take up as much as possible */
+ window-bar {
+ display: flex;
+ }
+ left {
+ flex: 1;
+ display: flex;
+ align-content: flex-start;
+ }
+ /* Also making the checkbox and label a flexbox for convenience */
+ right {
+ display: flex;
+ }
+
+ /* Style sky controls to make them look more like ui/views */
+ sky-button {
+ border: none;
+ border: 1px solid blue;
+ padding: 2px;
+ }
+ sky-button:hover {
+ border: 1px solid lightblue;
+ background-color: darkgrey;
+ }
+ </style>
+ <window-bar>
+ <left>
+ <sky-checkbox on-click="handleCaptureClick" />Capture
+ </left>
+ <right>
+ <sky-button on-click="handleEmbiggenClick">Embiggen</sky-button>
+ <sky-button on-click="handleBegoneClick">Begone</sky-button>
+ </right>
+ </window-bar>
+</template>
+<script>
+module.exports = class extends SkyElement {
+ created() {
+ this.embedder = embedder.connectToEmbedderService(example.WindowFrameHost);
+ this.addEventListener('mousedown', function() {
+ this.embedder.activateWindow();
+ }.bind(this));
+ }
+ handleCaptureClick(event) {
+ this.embedder.setCapture(event.target.checked);
+ }
+ handleEmbiggenClick(event) {
+ this.embedder.toggleMaximize();
+ }
+ handleBegoneClick(event) {
+ this.embedder.closeWindow();
+ }
+}.register();
+</script>
+</sky-element>
+
+<window-frame />
+
+</sky>
« 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