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

Side by Side Diff: aura/demo/demo_main.cc

Issue 7791030: Proper MouseEvent targeting. Adds a Window method that locates a Window for a given point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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 | « aura/aura.gyp ('k') | aura/desktop.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "aura/desktop.h" 5 #include "aura/desktop.h"
6 #include "aura/event.h"
6 #include "aura/window.h" 7 #include "aura/window.h"
7 #include "aura/window_delegate.h" 8 #include "aura/window_delegate.h"
8 #include "base/at_exit.h" 9 #include "base/at_exit.h"
9 #include "base/command_line.h" 10 #include "base/command_line.h"
10 #include "base/i18n/icu_util.h" 11 #include "base/i18n/icu_util.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "third_party/skia/include/core/SkXfermode.h" 13 #include "third_party/skia/include/core/SkXfermode.h"
13 #include "ui/base/resource/resource_bundle.h" 14 #include "ui/base/resource/resource_bundle.h"
14 #include "ui/base/ui_base_paths.h" 15 #include "ui/base/ui_base_paths.h"
15 #include "ui/gfx/canvas.h"
16 #include "ui/gfx/canvas_skia.h" 16 #include "ui/gfx/canvas_skia.h"
17 #include "ui/gfx/rect.h" 17 #include "ui/gfx/rect.h"
18 18
19 namespace { 19 namespace {
20 20
21 // Trivial WindowDelegate implementation that draws a colored background. 21 // Trivial WindowDelegate implementation that draws a colored background.
22 class DemoWindowDelegate : public aura::WindowDelegate { 22 class DemoWindowDelegate : public aura::WindowDelegate {
23 public: 23 public:
24 explicit DemoWindowDelegate(SkColor color) : color_(color) {} 24 explicit DemoWindowDelegate(SkColor color) : color_(color) {}
25 25
26 virtual bool OnMouseEvent(const aura::MouseEvent& event) OVERRIDE {
27 return true;
28 }
29
26 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { 30 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
27 canvas->AsCanvasSkia()->drawColor(color_, SkXfermode::kSrc_Mode); 31 canvas->AsCanvasSkia()->drawColor(color_, SkXfermode::kSrc_Mode);
28 } 32 }
29 33
34 virtual void OnWindowDestroyed() OVERRIDE {
35 }
36
30 private: 37 private:
31 SkColor color_; 38 SkColor color_;
32 39
33 DISALLOW_COPY_AND_ASSIGN(DemoWindowDelegate); 40 DISALLOW_COPY_AND_ASSIGN(DemoWindowDelegate);
34 }; 41 };
35 42
36 43
37 } // namespace 44 } // namespace
38 45
39 int main(int argc, char** argv) { 46 int main(int argc, char** argv) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 window3.set_id(3); 81 window3.set_id(3);
75 window3.Init(); 82 window3.Init();
76 window3.SetBounds(gfx::Rect(10, 10, 50, 50), 0); 83 window3.SetBounds(gfx::Rect(10, 10, 50, 50), 0);
77 window3.SetVisibility(aura::Window::VISIBILITY_SHOWN); 84 window3.SetVisibility(aura::Window::VISIBILITY_SHOWN);
78 window3.SetParent(&window2); 85 window3.SetParent(&window2);
79 86
80 aura::Desktop::GetInstance()->Run(); 87 aura::Desktop::GetInstance()->Run();
81 return 0; 88 return 0;
82 } 89 }
83 90
OLDNEW
« no previous file with comments | « aura/aura.gyp ('k') | aura/desktop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698