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

Side by Side Diff: ash/wm/workspace/frame_maximize_button.h

Issue 9773009: Disable left/right/maximize for panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ash/ash_strings.grd ('k') | ash/wm/workspace/frame_maximize_button.cc » ('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) 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
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 // Sets is_left_right_enabled_ and updates tooltip.
39 void SetIsLeftRightEnabled(bool e);
40
41 void set_is_maximize_enabled(bool e) { is_maximize_enabled_ = e; }
42
38 protected: 43 protected:
39 // ImageButton overrides: 44 // ImageButton overrides:
40 virtual SkBitmap GetImageToPaint() OVERRIDE; 45 virtual SkBitmap GetImageToPaint() OVERRIDE;
41 46
42 private: 47 private:
43 class EscapeEventFilter; 48 class EscapeEventFilter;
44 49
45 // Where to snap to. 50 // Where to snap to.
46 enum SnapType { 51 enum SnapType {
47 SNAP_LEFT, 52 SNAP_LEFT,
48 SNAP_RIGHT, 53 SNAP_RIGHT,
49 SNAP_MAXIMIZE, 54 SNAP_MAXIMIZE,
50 SNAP_MINIMIZE, 55 SNAP_MINIMIZE,
51 SNAP_NONE 56 SNAP_NONE
52 }; 57 };
53 58
54 // Cancels snap behavior. 59 // Cancels snap behavior.
55 void Cancel(); 60 void Cancel();
56 61
57 // Installs/uninstalls an EventFilter to track when escape is pressed. 62 // Installs/uninstalls an EventFilter to track when escape is pressed.
58 void InstallEventFilter(); 63 void InstallEventFilter();
59 void UninstallEventFilter(); 64 void UninstallEventFilter();
60 65
61 // Updates |snap_type_| based on a mouse drag. 66 // Updates |snap_type_| based on a mouse drag.
62 void UpdateSnap(const gfx::Point& location); 67 void UpdateSnap(const gfx::Point& location);
63 68
69 // Returns true if maximizing is allowed.
70 bool AllowMaximize() const;
71
64 // Returns the type of snap based on the specified location. 72 // Returns the type of snap based on the specified location.
65 SnapType SnapTypeForLocation(const gfx::Point& location) const; 73 SnapType SnapTypeForLocation(const gfx::Point& location) const;
66 74
67 // Returns the bounds of the resulting window for the specified type. 75 // Returns the bounds of the resulting window for the specified type.
68 gfx::Rect BoundsForType(SnapType type) const; 76 gfx::Rect BoundsForType(SnapType type) const;
69 77
70 // Converts location to screen coordinates and returns it. These are the 78 // Converts location to screen coordinates and returns it. These are the
71 // coordinates used by the SnapSizer. 79 // coordinates used by the SnapSizer.
72 gfx::Point LocationForSnapSizer(const gfx::Point& location) const; 80 gfx::Point LocationForSnapSizer(const gfx::Point& location) const;
73 81
74 // Snaps the window to the current snap position. 82 // Snaps the window to the current snap position.
75 void Snap(); 83 void Snap();
76 84
77 // Frame that the maximize button acts on. 85 // Frame that the maximize button acts on.
78 views::NonClientFrameView* frame_; 86 views::NonClientFrameView* frame_;
79 87
80 // Renders the snap position. 88 // Renders the snap position.
81 scoped_ptr<internal::PhantomWindowController> phantom_window_; 89 scoped_ptr<internal::PhantomWindowController> phantom_window_;
82 90
83 // Is snapping enabled? Set on press so that in drag we know whether we 91 // Is snapping enabled? Set on press so that in drag we know whether we
84 // should show the snap locations. 92 // should show the snap locations.
85 bool is_snap_enabled_; 93 bool is_snap_enabled_;
86 94
95 // Selectively enable/disable button functionality.
96 bool is_left_right_enabled_;
97 bool is_maximize_enabled_;
98
87 // Did the user drag far enough to trigger snapping? 99 // Did the user drag far enough to trigger snapping?
88 bool exceeded_drag_threshold_; 100 bool exceeded_drag_threshold_;
89 101
90 // Location of the press. 102 // Location of the press.
91 gfx::Point press_location_; 103 gfx::Point press_location_;
92 104
93 // Current snap type. 105 // Current snap type.
94 SnapType snap_type_; 106 SnapType snap_type_;
95 107
96 scoped_ptr<internal::SnapSizer> snap_sizer_; 108 scoped_ptr<internal::SnapSizer> snap_sizer_;
97 109
98 scoped_ptr<EscapeEventFilter> escape_event_filter_; 110 scoped_ptr<EscapeEventFilter> escape_event_filter_;
99 111
100 DISALLOW_COPY_AND_ASSIGN(FrameMaximizeButton); 112 DISALLOW_COPY_AND_ASSIGN(FrameMaximizeButton);
101 }; 113 };
102 114
103 } // namespace ash 115 } // namespace ash
104 116
105 #endif // ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_ 117 #endif // ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_
OLDNEW
« no previous file with comments | « ash/ash_strings.grd ('k') | ash/wm/workspace/frame_maximize_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698