| 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_SHELF_SHELF_VIEW_H_ | 5 #ifndef ASH_SHELF_SHELF_VIEW_H_ |
| 6 #define ASH_SHELF_SHELF_VIEW_H_ | 6 #define ASH_SHELF_SHELF_VIEW_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 | 163 |
| 164 // Sets the bounds of each view to its ideal bounds. | 164 // Sets the bounds of each view to its ideal bounds. |
| 165 void LayoutToIdealBounds(); | 165 void LayoutToIdealBounds(); |
| 166 | 166 |
| 167 // Update all button's visibility in overflow. | 167 // Update all button's visibility in overflow. |
| 168 void UpdateAllButtonsVisibilityInOverflowMode(); | 168 void UpdateAllButtonsVisibilityInOverflowMode(); |
| 169 | 169 |
| 170 // Calculates the ideal bounds. The bounds of each button corresponding to an | 170 // Calculates the ideal bounds. The bounds of each button corresponding to an |
| 171 // item in the model is set in |view_model_|. | 171 // item in the model is set in |view_model_|. |
| 172 void CalculateIdealBounds(IdealBounds* bounds); | 172 void CalculateIdealBounds(IdealBounds* bounds) const; |
| 173 | 173 |
| 174 // Returns the index of the last view whose max primary axis coordinate is | 174 // Returns the index of the last view whose max primary axis coordinate is |
| 175 // less than |max_value|. Returns -1 if nothing fits, or there are no views. | 175 // less than |max_value|. Returns -1 if nothing fits, or there are no views. |
| 176 int DetermineLastVisibleIndex(int max_value) const; | 176 int DetermineLastVisibleIndex(int max_value) const; |
| 177 | 177 |
| 178 // Returns the index of the first panel whose min primary axis coordinate is | 178 // Returns the index of the first panel whose min primary axis coordinate is |
| 179 // at least |min_value|. Returns the index past the last panel if none fit. | 179 // at least |min_value|. Returns the index past the last panel if none fit. |
| 180 int DetermineFirstVisiblePanelIndex(int min_value) const; | 180 int DetermineFirstVisiblePanelIndex(int min_value) const; |
| 181 | 181 |
| 182 // Animates the bounds of each view to its ideal bounds. | 182 // Animates the bounds of each view to its ideal bounds. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 196 void ContinueDrag(const ui::LocatedEvent& event); | 196 void ContinueDrag(const ui::LocatedEvent& event); |
| 197 | 197 |
| 198 // Handles ripping off an item from the shelf. Returns true when the item got | 198 // Handles ripping off an item from the shelf. Returns true when the item got |
| 199 // removed. | 199 // removed. |
| 200 bool HandleRipOffDrag(const ui::LocatedEvent& event); | 200 bool HandleRipOffDrag(const ui::LocatedEvent& event); |
| 201 | 201 |
| 202 // Finalize the rip off dragging by either |cancel| the action or validating. | 202 // Finalize the rip off dragging by either |cancel| the action or validating. |
| 203 void FinalizeRipOffDrag(bool cancel); | 203 void FinalizeRipOffDrag(bool cancel); |
| 204 | 204 |
| 205 // Check if an item can be ripped off or not. | 205 // Check if an item can be ripped off or not. |
| 206 RemovableState RemovableByRipOff(int index); | 206 RemovableState RemovableByRipOff(int index) const; |
| 207 | 207 |
| 208 // Returns true if |typea| and |typeb| should be in the same drag range. | 208 // Returns true if |typea| and |typeb| should be in the same drag range. |
| 209 bool SameDragType(ShelfItemType typea, ShelfItemType typeb) const; | 209 bool SameDragType(ShelfItemType typea, ShelfItemType typeb) const; |
| 210 | 210 |
| 211 // Returns the range (in the model) the item at the specified index can be | 211 // Returns the range (in the model) the item at the specified index can be |
| 212 // dragged to. | 212 // dragged to. |
| 213 std::pair<int, int> GetDragRange(int index); | 213 std::pair<int, int> GetDragRange(int index); |
| 214 | 214 |
| 215 // If there is a drag operation in progress it's canceled. If |modified_index| | 215 // If there is a drag operation in progress it's canceled. If |modified_index| |
| 216 // is valid, the new position of the corresponding item is returned. | 216 // is valid, the new position of the corresponding item is returned. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 231 // Toggles the overflow menu. | 231 // Toggles the overflow menu. |
| 232 void ToggleOverflowBubble(); | 232 void ToggleOverflowBubble(); |
| 233 | 233 |
| 234 // Invoked after the fading out animation for item deletion is ended. | 234 // Invoked after the fading out animation for item deletion is ended. |
| 235 void OnFadeOutAnimationEnded(); | 235 void OnFadeOutAnimationEnded(); |
| 236 | 236 |
| 237 // Fade in last visible item. | 237 // Fade in last visible item. |
| 238 void StartFadeInLastVisibleItem(); | 238 void StartFadeInLastVisibleItem(); |
| 239 | 239 |
| 240 // Updates the visible range of overflow items in |overflow_view|. | 240 // Updates the visible range of overflow items in |overflow_view|. |
| 241 void UpdateOverflowRange(ShelfView* overflow_view); | 241 void UpdateOverflowRange(ShelfView* overflow_view) const; |
| 242 | 242 |
| 243 // Overridden from views::View: | 243 // Overridden from views::View: |
| 244 virtual gfx::Size GetPreferredSize() OVERRIDE; | 244 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
| 245 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; | 245 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; |
| 246 virtual FocusTraversable* GetPaneFocusTraversable() OVERRIDE; | 246 virtual FocusTraversable* GetPaneFocusTraversable() OVERRIDE; |
| 247 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 247 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
| 248 | 248 |
| 249 // Overridden from ui::EventHandler: | 249 // Overridden from ui::EventHandler: |
| 250 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 250 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| 251 | 251 |
| 252 // Overridden from ShelfModelObserver: | 252 // Overridden from ShelfModelObserver: |
| 253 virtual void ShelfItemAdded(int model_index) OVERRIDE; | 253 virtual void ShelfItemAdded(int model_index) OVERRIDE; |
| 254 virtual void ShelfItemRemoved(int model_index, ShelfID id) OVERRIDE; | 254 virtual void ShelfItemRemoved(int model_index, ShelfID id) OVERRIDE; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 327 |
| 328 // Used to manage the set of active launcher buttons. There is a view per | 328 // Used to manage the set of active launcher buttons. There is a view per |
| 329 // item in |model_|. | 329 // item in |model_|. |
| 330 scoped_ptr<views::ViewModel> view_model_; | 330 scoped_ptr<views::ViewModel> view_model_; |
| 331 | 331 |
| 332 // Index of first visible launcher item. | 332 // Index of first visible launcher item. |
| 333 int first_visible_index_; | 333 int first_visible_index_; |
| 334 | 334 |
| 335 // Last index of a launcher button that is visible | 335 // Last index of a launcher button that is visible |
| 336 // (does not go into overflow). | 336 // (does not go into overflow). |
| 337 int last_visible_index_; | 337 mutable int last_visible_index_; |
| 338 | 338 |
| 339 scoped_ptr<views::BoundsAnimator> bounds_animator_; | 339 scoped_ptr<views::BoundsAnimator> bounds_animator_; |
| 340 | 340 |
| 341 OverflowButton* overflow_button_; | 341 OverflowButton* overflow_button_; |
| 342 | 342 |
| 343 scoped_ptr<OverflowBubble> overflow_bubble_; | 343 scoped_ptr<OverflowBubble> overflow_bubble_; |
| 344 | 344 |
| 345 OverflowBubble* owner_overflow_bubble_; | 345 OverflowBubble* owner_overflow_bubble_; |
| 346 | 346 |
| 347 scoped_ptr<ShelfTooltipManager> tooltip_; | 347 scoped_ptr<ShelfTooltipManager> tooltip_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 373 // alignment). | 373 // alignment). |
| 374 int leading_inset_; | 374 int leading_inset_; |
| 375 | 375 |
| 376 ShelfGestureHandler gesture_handler_; | 376 ShelfGestureHandler gesture_handler_; |
| 377 | 377 |
| 378 // True when an item being inserted or removed in the model cancels a drag. | 378 // True when an item being inserted or removed in the model cancels a drag. |
| 379 bool cancelling_drag_model_changed_; | 379 bool cancelling_drag_model_changed_; |
| 380 | 380 |
| 381 // Index of the last hidden launcher item. If there are no hidden items this | 381 // Index of the last hidden launcher item. If there are no hidden items this |
| 382 // will be equal to last_visible_index_ + 1. | 382 // will be equal to last_visible_index_ + 1. |
| 383 int last_hidden_index_; | 383 mutable int last_hidden_index_; |
| 384 | 384 |
| 385 // The timestamp of the event which closed the last menu - or 0. | 385 // The timestamp of the event which closed the last menu - or 0. |
| 386 base::TimeDelta closing_event_time_; | 386 base::TimeDelta closing_event_time_; |
| 387 | 387 |
| 388 // When this object gets deleted while a menu is shown, this pointed | 388 // When this object gets deleted while a menu is shown, this pointed |
| 389 // element will be set to false. | 389 // element will be set to false. |
| 390 bool* got_deleted_; | 390 bool* got_deleted_; |
| 391 | 391 |
| 392 // True if a drag and drop operation created/pinned the item in the launcher | 392 // True if a drag and drop operation created/pinned the item in the launcher |
| 393 // and it needs to be deleted/unpinned again if the operation gets cancelled. | 393 // and it needs to be deleted/unpinned again if the operation gets cancelled. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 | 433 |
| 434 // True when ripped item from overflow bubble is entered into Shelf. | 434 // True when ripped item from overflow bubble is entered into Shelf. |
| 435 bool dragged_off_from_overflow_to_shelf_; | 435 bool dragged_off_from_overflow_to_shelf_; |
| 436 | 436 |
| 437 DISALLOW_COPY_AND_ASSIGN(ShelfView); | 437 DISALLOW_COPY_AND_ASSIGN(ShelfView); |
| 438 }; | 438 }; |
| 439 | 439 |
| 440 } // namespace ash | 440 } // namespace ash |
| 441 | 441 |
| 442 #endif // ASH_SHELF_SHELF_VIEW_H_ | 442 #endif // ASH_SHELF_SHELF_VIEW_H_ |
| OLD | NEW |