| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_ | 5 #ifndef ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_ |
| 6 #define ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_ | 6 #define ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/views/controls/button/image_button.h" | 10 #include "ui/views/controls/button/image_button.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 virtual ~FrameMaximizeButton(); | 28 virtual ~FrameMaximizeButton(); |
| 29 | 29 |
| 30 // ImageButton overrides: | 30 // ImageButton overrides: |
| 31 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | 31 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
| 32 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; | 32 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; |
| 33 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; | 33 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; |
| 34 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; | 34 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; |
| 35 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; | 35 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; |
| 36 virtual void OnMouseCaptureLost() OVERRIDE; | 36 virtual void OnMouseCaptureLost() OVERRIDE; |
| 37 | 37 |
| 38 void set_is_left_right_enabled(bool e) { is_left_right_enabled_ = e; } |
| 39 void set_is_maximize_enabled(bool e) { is_maximize_enabled_ = e; } |
| 40 |
| 38 protected: | 41 protected: |
| 39 // ImageButton overrides: | 42 // ImageButton overrides: |
| 40 virtual SkBitmap GetImageToPaint() OVERRIDE; | 43 virtual SkBitmap GetImageToPaint() OVERRIDE; |
| 41 | 44 |
| 42 private: | 45 private: |
| 43 class EscapeEventFilter; | 46 class EscapeEventFilter; |
| 44 | 47 |
| 45 // Where to snap to. | 48 // Where to snap to. |
| 46 enum SnapType { | 49 enum SnapType { |
| 47 SNAP_LEFT, | 50 SNAP_LEFT, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 77 // Frame that the maximize button acts on. | 80 // Frame that the maximize button acts on. |
| 78 views::NonClientFrameView* frame_; | 81 views::NonClientFrameView* frame_; |
| 79 | 82 |
| 80 // Renders the snap position. | 83 // Renders the snap position. |
| 81 scoped_ptr<internal::PhantomWindowController> phantom_window_; | 84 scoped_ptr<internal::PhantomWindowController> phantom_window_; |
| 82 | 85 |
| 83 // Is snapping enabled? Set on press so that in drag we know whether we | 86 // Is snapping enabled? Set on press so that in drag we know whether we |
| 84 // should show the snap locations. | 87 // should show the snap locations. |
| 85 bool is_snap_enabled_; | 88 bool is_snap_enabled_; |
| 86 | 89 |
| 90 // Selectively enable/disable button functionality. |
| 91 bool is_left_right_enabled_; |
| 92 bool is_maximize_enabled_; |
| 93 |
| 87 // Did the user drag far enough to trigger snapping? | 94 // Did the user drag far enough to trigger snapping? |
| 88 bool exceeded_drag_threshold_; | 95 bool exceeded_drag_threshold_; |
| 89 | 96 |
| 90 // Location of the press. | 97 // Location of the press. |
| 91 gfx::Point press_location_; | 98 gfx::Point press_location_; |
| 92 | 99 |
| 93 // Current snap type. | 100 // Current snap type. |
| 94 SnapType snap_type_; | 101 SnapType snap_type_; |
| 95 | 102 |
| 96 scoped_ptr<internal::SnapSizer> snap_sizer_; | 103 scoped_ptr<internal::SnapSizer> snap_sizer_; |
| 97 | 104 |
| 98 scoped_ptr<EscapeEventFilter> escape_event_filter_; | 105 scoped_ptr<EscapeEventFilter> escape_event_filter_; |
| 99 | 106 |
| 100 DISALLOW_COPY_AND_ASSIGN(FrameMaximizeButton); | 107 DISALLOW_COPY_AND_ASSIGN(FrameMaximizeButton); |
| 101 }; | 108 }; |
| 102 | 109 |
| 103 } // namespace ash | 110 } // namespace ash |
| 104 | 111 |
| 105 #endif // ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_ | 112 #endif // ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_ |
| OLD | NEW |