| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_DOCK_INFO_H_ | 5 #ifndef CHROME_BROWSER_DOCK_INFO_H_ |
| 6 #define CHROME_BROWSER_DOCK_INFO_H_ | 6 #define CHROME_BROWSER_DOCK_INFO_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 MAXIMIZE, | 41 MAXIMIZE, |
| 42 | 42 |
| 43 // Indicates the window should be docked to a specific side of the monitor. | 43 // Indicates the window should be docked to a specific side of the monitor. |
| 44 LEFT_HALF, | 44 LEFT_HALF, |
| 45 RIGHT_HALF, | 45 RIGHT_HALF, |
| 46 BOTTOM_HALF | 46 BOTTOM_HALF |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 DockInfo() : type_(NONE), hwnd_(NULL), in_enable_area_(false) {} | 49 DockInfo() : type_(NONE), hwnd_(NULL), in_enable_area_(false) {} |
| 50 | 50 |
| 51 // Size of the popup window shown to indicate a valid dock location. |
| 52 static int popup_width(); |
| 53 static int popup_height(); |
| 54 |
| 51 // Returns the DockInfo for the specified point |screen_point|. |ignore| | 55 // Returns the DockInfo for the specified point |screen_point|. |ignore| |
| 52 // contains the set of hwnds to ignore from consideration. This contains the | 56 // contains the set of hwnds to ignore from consideration. This contains the |
| 53 // dragged window as well as any windows showing possible dock locations. | 57 // dragged window as well as any windows showing possible dock locations. |
| 54 // | 58 // |
| 55 // If there is no docking position for the specified location the returned | 59 // If there is no docking position for the specified location the returned |
| 56 // DockInfo has a type of NONE. | 60 // DockInfo has a type of NONE. |
| 57 static DockInfo GetDockInfoAtPoint(const gfx::Point& screen_point, | 61 static DockInfo GetDockInfoAtPoint(const gfx::Point& screen_point, |
| 58 const std::set<HWND>& ignore); | 62 const std::set<HWND>& ignore); |
| 59 | 63 |
| 60 // Returns the top most window from the current process at |screen_point|. | 64 // Returns the top most window from the current process at |screen_point|. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 91 // The location of the hotspot. | 95 // The location of the hotspot. |
| 92 void set_hot_spot(const gfx::Point& hot_spot) { hot_spot_ = hot_spot; } | 96 void set_hot_spot(const gfx::Point& hot_spot) { hot_spot_ = hot_spot; } |
| 93 const gfx::Point& hot_spot() const { return hot_spot_; } | 97 const gfx::Point& hot_spot() const { return hot_spot_; } |
| 94 | 98 |
| 95 // Bounds of the monitor. | 99 // Bounds of the monitor. |
| 96 void set_monitor_bounds(const gfx::Rect& monitor_bounds) { | 100 void set_monitor_bounds(const gfx::Rect& monitor_bounds) { |
| 97 monitor_bounds_ = monitor_bounds; | 101 monitor_bounds_ = monitor_bounds; |
| 98 } | 102 } |
| 99 const gfx::Rect& monitor_bounds() const { return monitor_bounds_; } | 103 const gfx::Rect& monitor_bounds() const { return monitor_bounds_; } |
| 100 | 104 |
| 105 // Returns the bounds of the window to show the indicator for. |
| 106 gfx::Rect GetPopupRect() const; |
| 107 |
| 101 // Returns true if the drop should result in docking. DockInfo maintains two | 108 // Returns true if the drop should result in docking. DockInfo maintains two |
| 102 // states (as indicated by this boolean): | 109 // states (as indicated by this boolean): |
| 103 // 1. The mouse is close enough to the hot spot such that a visual indicator | 110 // 1. The mouse is close enough to the hot spot such that a visual indicator |
| 104 // should be shown, but if the user releases the mouse docking shouldn't | 111 // should be shown, but if the user releases the mouse docking shouldn't |
| 105 // result. This corresponds to a value of false for in_enable_area. | 112 // result. This corresponds to a value of false for in_enable_area. |
| 106 // 2. The mouse is close enough to the hot spot such that releasing the mouse | 113 // 2. The mouse is close enough to the hot spot such that releasing the mouse |
| 107 // should result in docking. This corresponds to a value of true for | 114 // should result in docking. This corresponds to a value of true for |
| 108 // in_enable_area. | 115 // in_enable_area. |
| 109 void set_in_enable_area(bool in_enable_area) { | 116 void set_in_enable_area(bool in_enable_area) { |
| 110 in_enable_area_ = in_enable_area; | 117 in_enable_area_ = in_enable_area; |
| 111 } | 118 } |
| 112 bool in_enable_area() const { return in_enable_area_; } | 119 bool in_enable_area() const { return in_enable_area_; } |
| 113 | 120 |
| 114 // Returns true if |other| is considered equal to this. Two DockInfos are | 121 // Returns true if |other| is considered equal to this. Two DockInfos are |
| 115 // considered equal if they have the same type and same hwnd. | 122 // considered equal if they have the same type and same hwnd. |
| 116 bool equals(const DockInfo& other) const { | 123 bool equals(const DockInfo& other) const { |
| 117 return type_ == other.type_ && hwnd_ == other.hwnd_; | 124 return type_ == other.type_ && hwnd_ == other.hwnd_ && |
| 125 monitor_bounds_ == other.monitor_bounds_; |
| 118 } | 126 } |
| 119 | 127 |
| 120 // If screen_loc is close enough to the hot spot given by |x| and |y|, the | 128 // If screen_loc is close enough to the hot spot given by |x| and |y|, the |
| 121 // type and hot_spot are set from the supplied parameters. This is used | 129 // type and hot_spot are set from the supplied parameters. This is used |
| 122 // internally, there is no need to invoke this otherwise. |monitor| gives the | 130 // internally, there is no need to invoke this otherwise. |
| 123 // monitor the location is on. | 131 bool CheckMonitorPoint(const gfx::Point& screen_loc, |
| 124 bool CheckMonitorPoint(HMONITOR monitor, | |
| 125 const gfx::Point& screen_loc, | |
| 126 int x, | 132 int x, |
| 127 int y, | 133 int y, |
| 128 Type type); | 134 Type type); |
| 129 | 135 |
| 130 private: | 136 private: |
| 131 Type type_; | 137 Type type_; |
| 132 HWND hwnd_; | 138 HWND hwnd_; |
| 133 gfx::Point hot_spot_; | 139 gfx::Point hot_spot_; |
| 134 gfx::Rect monitor_bounds_; | 140 gfx::Rect monitor_bounds_; |
| 135 bool in_enable_area_; | 141 bool in_enable_area_; |
| 136 }; | 142 }; |
| 137 | 143 |
| 138 #endif // CHROME_BROWSER_DOCK_INFO_H_ | 144 #endif // CHROME_BROWSER_DOCK_INFO_H_ |
| OLD | NEW |