Index: ash/wm/workspace/workspace_window_resizer.h |
diff --git a/ash/wm/workspace/workspace_window_resizer.h b/ash/wm/workspace/workspace_window_resizer.h |
index e881202ab96262c00dca245147cbf97f5057b457..741084682b6a7266a90d9463e99a83d363847c50 100644 |
--- a/ash/wm/workspace/workspace_window_resizer.h |
+++ b/ash/wm/workspace/workspace_window_resizer.h |
@@ -6,6 +6,8 @@ |
#define ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ |
#pragma once |
+#include <vector> |
+ |
#include "ash/wm/window_resizer.h" |
#include "base/compiler_specific.h" |
@@ -21,15 +23,19 @@ class RootWindowEventFilter; |
// attempt to restore the old height. |
class ASH_EXPORT WorkspaceWindowResizer : public WindowResizer { |
public: |
+ // When dragging an attached window this is the min size we'll make sure is |
+ // visibile. In the vertical direction we take the max of this and that from |
+ // the delegate. |
+ static const int kMinOnscreenSize; |
+ |
virtual ~WorkspaceWindowResizer(); |
- // Creates a new WorkspaceWindowResizer. The caller takes ownership of the |
- // returned object. Returns NULL if not resizable. |
static WorkspaceWindowResizer* Create( |
aura::Window* window, |
const gfx::Point& location, |
int window_component, |
- int grid_size); |
+ int grid_size, |
+ const std::vector<aura::Window*>& attached_windows); |
// Returns true if the drag will result in changing the window in anyway. |
bool is_resizable() const { return details_.is_resizable; } |
@@ -44,8 +50,16 @@ class ASH_EXPORT WorkspaceWindowResizer : public WindowResizer { |
virtual void RevertDrag() OVERRIDE; |
private: |
+ WorkspaceWindowResizer(const Details& details, |
+ const std::vector<aura::Window*>& attached_windows); |
+ |
+ private: |
explicit WorkspaceWindowResizer(const Details& details); |
+ // Lays out the attached windows. |bounds| is the bounds of the main window. |
+ void LayoutAttachedWindowsHorizontally(const gfx::Rect& bounds); |
+ void LayoutAttachedWindowsVertically(const gfx::Rect& bounds); |
+ |
// Adjusts the bounds to enforce that windows are vertically contained in the |
// work area. |
void AdjustBoundsForMainWindow(gfx::Rect* bounds) const; |
@@ -53,11 +67,18 @@ class ASH_EXPORT WorkspaceWindowResizer : public WindowResizer { |
aura::Window* window, |
gfx::Rect* bounds) const; |
- // Clears the cached height of the window being dragged. |
+ // Clears the cached width/height of the window being dragged. |
void ClearCachedHeights(); |
+ void ClearCachedWidths(); |
- // Returns true if the window touches the bottom of the work area. |
+ // Returns true if the window touches the bottom/right edge of the work area. |
bool TouchesBottomOfScreen() const; |
+ bool TouchesRightSideOfScreen() const; |
+ |
+ // Returns a coordinate along the primary axis. Used to share code for |
+ // left/right multi window resize and top/bottom resize. |
+ int PrimaryAxisSize(const gfx::Size& size) const; |
+ int PrimaryAxisCoordinate(int x, int y) const; |
aura::Window* window() const { return details_.window; } |
@@ -66,11 +87,32 @@ class ASH_EXPORT WorkspaceWindowResizer : public WindowResizer { |
// True if the window size (height) should be constrained. |
const bool constrain_size_; |
+ const std::vector<aura::Window*> attached_windows_; |
+ |
// Set to true once Drag() is invoked and the bounds of the window change. |
bool did_move_or_resize_; |
internal::RootWindowEventFilter* root_filter_; |
+ // The initial size of each of the windows in |attached_windows_| along the |
+ // primary axis. |
+ std::vector<int> initial_size_; |
+ |
+ // The min size of each of the windows in |attached_windows_| along the |
+ // primary axis. |
+ std::vector<int> min_size_; |
+ |
+ // The amount each of the windows in |attached_windows_| can be compressed. |
+ // This is a fraction of the amount a window can be compressed over the total |
+ // space the windows can be compressed. |
+ std::vector<float> compress_fraction_; |
+ |
+ // Sum of sizes in |min_size_|. |
+ int total_min_; |
+ |
+ // Sum of the sizes in |initial_size_|. |
+ int total_initial_size_; |
+ |
DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); |
}; |