| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef APPS_UI_VIEWS_SHELL_WINDOW_FRAME_VIEW_H_ | |
| 6 #define APPS_UI_VIEWS_SHELL_WINDOW_FRAME_VIEW_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "ui/gfx/path.h" | |
| 11 #include "ui/gfx/rect.h" | |
| 12 #include "ui/gfx/size.h" | |
| 13 #include "ui/views/controls/button/button.h" | |
| 14 #include "ui/views/window/non_client_view.h" | |
| 15 | |
| 16 namespace gfx { | |
| 17 class Canvas; | |
| 18 class Point; | |
| 19 } | |
| 20 | |
| 21 namespace ui { | |
| 22 class Event; | |
| 23 } | |
| 24 | |
| 25 namespace views { | |
| 26 class ImageButton; | |
| 27 class Widget; | |
| 28 } | |
| 29 | |
| 30 namespace apps { | |
| 31 | |
| 32 class NativeAppWindow; | |
| 33 | |
| 34 // A frameless or non-Ash, non-panel NonClientFrameView for app windows. | |
| 35 class ShellWindowFrameView : public views::NonClientFrameView, | |
| 36 public views::ButtonListener { | |
| 37 public: | |
| 38 static const char kViewClassName[]; | |
| 39 | |
| 40 explicit ShellWindowFrameView(NativeAppWindow* window); | |
| 41 virtual ~ShellWindowFrameView(); | |
| 42 | |
| 43 // Initializes this for the window |frame|. Sets the number of pixels for | |
| 44 // which a click is interpreted as a resize for the inner and outer border of | |
| 45 // the window and the lower-right corner resize handle. | |
| 46 void Init(views::Widget* frame, | |
| 47 int resize_inside_bounds_size, | |
| 48 int resize_outside_bounds_size, | |
| 49 int resize_outside_scale_for_touch, | |
| 50 int resize_area_corner_size); | |
| 51 | |
| 52 private: | |
| 53 // views::NonClientFrameView implementation. | |
| 54 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; | |
| 55 virtual gfx::Rect GetWindowBoundsForClientBounds( | |
| 56 const gfx::Rect& client_bounds) const OVERRIDE; | |
| 57 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; | |
| 58 virtual void GetWindowMask(const gfx::Size& size, | |
| 59 gfx::Path* window_mask) OVERRIDE; | |
| 60 virtual void ResetWindowControls() OVERRIDE {} | |
| 61 virtual void UpdateWindowIcon() OVERRIDE {} | |
| 62 virtual void UpdateWindowTitle() OVERRIDE {} | |
| 63 | |
| 64 // views::View implementation. | |
| 65 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
| 66 virtual void Layout() OVERRIDE; | |
| 67 virtual const char* GetClassName() const OVERRIDE; | |
| 68 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | |
| 69 virtual gfx::Size GetMinimumSize() OVERRIDE; | |
| 70 virtual gfx::Size GetMaximumSize() OVERRIDE; | |
| 71 | |
| 72 // views::ButtonListener implementation. | |
| 73 virtual void ButtonPressed(views::Button* sender, const ui::Event& event) | |
| 74 OVERRIDE; | |
| 75 | |
| 76 NativeAppWindow* window_; | |
| 77 views::Widget* frame_; | |
| 78 views::ImageButton* close_button_; | |
| 79 views::ImageButton* maximize_button_; | |
| 80 views::ImageButton* restore_button_; | |
| 81 views::ImageButton* minimize_button_; | |
| 82 | |
| 83 // Allow resize for clicks this many pixels inside the bounds. | |
| 84 int resize_inside_bounds_size_; | |
| 85 | |
| 86 // Allow resize for clicks this many pixels outside the bounds. | |
| 87 int resize_outside_bounds_size_; | |
| 88 | |
| 89 // Size in pixels of the lower-right corner resize handle. | |
| 90 int resize_area_corner_size_; | |
| 91 | |
| 92 DISALLOW_COPY_AND_ASSIGN(ShellWindowFrameView); | |
| 93 }; | |
| 94 | |
| 95 } // namespace apps | |
| 96 | |
| 97 #endif // APPS_UI_VIEWS_SHELL_WINDOW_FRAME_VIEW_H_ | |
| OLD | NEW |