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

Side by Side Diff: apps/ui/views/app_window_frame_view.h

Issue 2744463002: Add VectorIconButton functionality to ImageButton. (Closed)
Patch Set: fix cros build Created 3 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef APPS_UI_VIEWS_APP_WINDOW_FRAME_VIEW_H_ 5 #ifndef APPS_UI_VIEWS_APP_WINDOW_FRAME_VIEW_H_
6 #define APPS_UI_VIEWS_APP_WINDOW_FRAME_VIEW_H_ 6 #define APPS_UI_VIEWS_APP_WINDOW_FRAME_VIEW_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "third_party/skia/include/core/SkColor.h" 10 #include "third_party/skia/include/core/SkColor.h"
11 #include "ui/gfx/geometry/rect.h" 11 #include "ui/gfx/geometry/rect.h"
12 #include "ui/gfx/geometry/size.h" 12 #include "ui/gfx/geometry/size.h"
13 #include "ui/gfx/path.h" 13 #include "ui/gfx/path.h"
14 #include "ui/views/controls/button/button.h" 14 #include "ui/views/controls/button/image_button.h"
15 #include "ui/views/window/non_client_view.h" 15 #include "ui/views/window/non_client_view.h"
16 16
17 namespace extensions { 17 namespace extensions {
18 class NativeAppWindow; 18 class NativeAppWindow;
19 } 19 }
20 20
21 namespace gfx { 21 namespace gfx {
22 class Canvas; 22 class Canvas;
23 class Point; 23 class Point;
24 } 24 }
25 25
26 namespace ui { 26 namespace ui {
27 class Event; 27 class Event;
28 } 28 }
29 29
30 namespace views { 30 namespace views {
31 class ImageButton;
32 class Widget; 31 class Widget;
33 } 32 }
34 33
35 namespace apps { 34 namespace apps {
36 35
37 // A frameless or non-Ash, non-panel NonClientFrameView for app windows. 36 // A frameless or non-Ash, non-panel NonClientFrameView for app windows.
38 class AppWindowFrameView : public views::NonClientFrameView, 37 class AppWindowFrameView : public views::NonClientFrameView,
39 public views::ButtonListener { 38 public views::ImageButtonDelegate {
40 public: 39 public:
41 static const char kViewClassName[]; 40 static const char kViewClassName[];
42 41
43 // AppWindowFrameView is used to draw frames for app windows when a non 42 // AppWindowFrameView is used to draw frames for app windows when a non
44 // standard frame is needed. This occurs if there is no frame needed, or if 43 // standard frame is needed. This occurs if there is no frame needed, or if
45 // there is a frame color. 44 // there is a frame color.
46 // If |draw_frame| is true, the view draws its own window title area and 45 // If |draw_frame| is true, the view draws its own window title area and
47 // controls, using |frame_color|. If |draw_frame| is not true, no frame is 46 // controls, using |frame_color|. If |draw_frame| is not true, no frame is
48 // drawn. 47 // drawn.
49 // TODO(benwells): Refactor this to split out frameless and colored frame 48 // TODO(benwells): Refactor this to split out frameless and colored frame
50 // views. See http://crbug.com/359432. 49 // views. See http://crbug.com/359432.
51 AppWindowFrameView(views::Widget* widget, 50 AppWindowFrameView(views::Widget* widget,
52 extensions::NativeAppWindow* window, 51 extensions::NativeAppWindow* window,
53 bool draw_frame, 52 bool draw_frame,
54 const SkColor& active_frame_color, 53 const SkColor& active_frame_color,
55 const SkColor& inactive_frame_color); 54 const SkColor& inactive_frame_color);
56 ~AppWindowFrameView() override; 55 ~AppWindowFrameView() override;
57 56
58 void Init(); 57 void Init();
59 58
60 void SetResizeSizes(int resize_inside_bounds_size, 59 void SetResizeSizes(int resize_inside_bounds_size,
61 int resize_outside_bounds_size, 60 int resize_outside_bounds_size,
62 int resize_area_corner_size); 61 int resize_area_corner_size);
63 int resize_inside_bounds_size() const { 62 int resize_inside_bounds_size() const {
64 return resize_inside_bounds_size_; 63 return resize_inside_bounds_size_;
65 }; 64 };
66 65
67 private: 66 private:
68 // views::NonClientFrameView implementation. 67 // views::NonClientFrameView:
69 gfx::Rect GetBoundsForClientView() const override; 68 gfx::Rect GetBoundsForClientView() const override;
70 gfx::Rect GetWindowBoundsForClientBounds( 69 gfx::Rect GetWindowBoundsForClientBounds(
71 const gfx::Rect& client_bounds) const override; 70 const gfx::Rect& client_bounds) const override;
72 int NonClientHitTest(const gfx::Point& point) override; 71 int NonClientHitTest(const gfx::Point& point) override;
73 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override; 72 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override;
74 void ResetWindowControls() override {} 73 void ResetWindowControls() override {}
75 void UpdateWindowIcon() override {} 74 void UpdateWindowIcon() override {}
76 void UpdateWindowTitle() override {} 75 void UpdateWindowTitle() override {}
77 void SizeConstraintsChanged() override; 76 void SizeConstraintsChanged() override;
78 77
79 // views::View implementation. 78 // views::View:
80 gfx::Size GetPreferredSize() const override; 79 gfx::Size GetPreferredSize() const override;
81 void Layout() override; 80 void Layout() override;
82 const char* GetClassName() const override; 81 const char* GetClassName() const override;
83 void OnPaint(gfx::Canvas* canvas) override; 82 void OnPaint(gfx::Canvas* canvas) override;
84 gfx::Size GetMinimumSize() const override; 83 gfx::Size GetMinimumSize() const override;
85 gfx::Size GetMaximumSize() const override; 84 gfx::Size GetMaximumSize() const override;
86 85
87 // views::ButtonListener implementation. 86 // views::ImageButtonDelegate:
88 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 87 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
89 88
90 // Some button images we use depend on the color of the frame. This 89 // Some button images we use depend on the color of the frame. This
91 // will set these images based on the color of the frame. 90 // will set these images based on the color of the frame.
92 void SetButtonImagesForFrame(); 91 void SetButtonImagesForFrame();
93 92
94 // Return the current frame color based on the active state of the window. 93 // Return the current frame color based on the active state of the window.
95 SkColor CurrentFrameColor(); 94 SkColor CurrentFrameColor();
96 95
97 views::Widget* widget_; 96 views::Widget* widget_;
(...skipping 14 matching lines...) Expand all
112 111
113 // Size in pixels of the lower-right corner resize handle. 112 // Size in pixels of the lower-right corner resize handle.
114 int resize_area_corner_size_; 113 int resize_area_corner_size_;
115 114
116 DISALLOW_COPY_AND_ASSIGN(AppWindowFrameView); 115 DISALLOW_COPY_AND_ASSIGN(AppWindowFrameView);
117 }; 116 };
118 117
119 } // namespace apps 118 } // namespace apps
120 119
121 #endif // APPS_UI_VIEWS_APP_WINDOW_FRAME_VIEW_H_ 120 #endif // APPS_UI_VIEWS_APP_WINDOW_FRAME_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | apps/ui/views/app_window_frame_view.cc » ('j') | ui/views/animation/ink_drop_host_view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698