| 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 UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ |
| 6 #define UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // Returns the icon bounds relative to AppListItemView. | 74 // Returns the icon bounds relative to AppListItemView. |
| 75 const gfx::Rect& GetIconBounds() const; | 75 const gfx::Rect& GetIconBounds() const; |
| 76 | 76 |
| 77 // Sets UI state to dragging state. | 77 // Sets UI state to dragging state. |
| 78 void SetDragUIState(); | 78 void SetDragUIState(); |
| 79 | 79 |
| 80 // Returns the icon bounds for the given |target_bounds| as | 80 // Returns the icon bounds for the given |target_bounds| as |
| 81 // the assuming bounds of this view. | 81 // the assuming bounds of this view. |
| 82 gfx::Rect GetIconBoundsForTargetViewBounds(const gfx::Rect& target_bounds); | 82 gfx::Rect GetIconBoundsForTargetViewBounds(const gfx::Rect& target_bounds); |
| 83 | 83 |
| 84 // If the item is not in a folder, not highlighted, not being dragged, and not |
| 85 // having something dropped onto it, enables subpixel AA for the title. |
| 86 void SetTitleSubpixelAA(); |
| 87 |
| 84 // views::CustomButton overrides: | 88 // views::CustomButton overrides: |
| 85 void OnGestureEvent(ui::GestureEvent* event) override; | 89 void OnGestureEvent(ui::GestureEvent* event) override; |
| 86 | 90 |
| 87 // views::View overrides: | 91 // views::View overrides: |
| 88 bool GetTooltipText(const gfx::Point& p, | 92 bool GetTooltipText(const gfx::Point& p, |
| 89 base::string16* tooltip) const override; | 93 base::string16* tooltip) const override; |
| 90 | 94 |
| 91 private: | 95 private: |
| 92 enum UIState { | 96 enum UIState { |
| 93 UI_STATE_NORMAL, // Normal UI (icon + label) | 97 UI_STATE_NORMAL, // Normal UI (icon + label) |
| 94 UI_STATE_DRAGGING, // Dragging UI (scaled icon only) | 98 UI_STATE_DRAGGING, // Dragging UI (scaled icon only) |
| 95 UI_STATE_DROPPING_IN_FOLDER, // Folder dropping preview UI | 99 UI_STATE_DROPPING_IN_FOLDER, // Folder dropping preview UI |
| 96 }; | 100 }; |
| 97 | 101 |
| 98 // Get icon from |item_| and schedule background processing. | 102 // Get icon from |item_| and schedule background processing. |
| 99 void UpdateIcon(); | 103 void UpdateIcon(); |
| 100 | 104 |
| 101 // Update the tooltip text from |item_|. | 105 // Update the tooltip text from |item_|. |
| 102 void UpdateTooltip(); | 106 void UpdateTooltip(); |
| 103 | 107 |
| 104 void SetUIState(UIState state); | 108 void SetUIState(UIState state); |
| 105 | 109 |
| 106 // Sets |touch_dragging_| flag and updates UI. | 110 // Sets |touch_dragging_| flag and updates UI. |
| 107 void SetTouchDragging(bool touch_dragging); | 111 void SetTouchDragging(bool touch_dragging); |
| 108 | 112 |
| 109 // Invoked when |mouse_drag_timer_| fires to show dragging UI. | 113 // Invoked when |mouse_drag_timer_| fires to show dragging UI. |
| 110 void OnMouseDragTimer(); | 114 void OnMouseDragTimer(); |
| 111 | 115 |
| 112 // If the item is not in a folder, not highlighted, not being dragged, and not | |
| 113 // having something dropped onto it, enables subpixel AA for the title. | |
| 114 void SetTitleSubpixelAA(); | |
| 115 | |
| 116 // views::View overrides: | 116 // views::View overrides: |
| 117 const char* GetClassName() const override; | 117 const char* GetClassName() const override; |
| 118 void Layout() override; | 118 void Layout() override; |
| 119 void OnPaint(gfx::Canvas* canvas) override; | 119 void OnPaint(gfx::Canvas* canvas) override; |
| 120 | 120 |
| 121 // views::ContextMenuController overrides: | 121 // views::ContextMenuController overrides: |
| 122 void ShowContextMenuForView(views::View* source, | 122 void ShowContextMenuForView(views::View* source, |
| 123 const gfx::Point& point, | 123 const gfx::Point& point, |
| 124 ui::MenuSourceType source_type) override; | 124 ui::MenuSourceType source_type) override; |
| 125 | 125 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 // A timer to defer showing drag UI when mouse is pressed. | 166 // A timer to defer showing drag UI when mouse is pressed. |
| 167 base::OneShotTimer<AppListItemView> mouse_drag_timer_; | 167 base::OneShotTimer<AppListItemView> mouse_drag_timer_; |
| 168 | 168 |
| 169 DISALLOW_COPY_AND_ASSIGN(AppListItemView); | 169 DISALLOW_COPY_AND_ASSIGN(AppListItemView); |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 } // namespace app_list | 172 } // namespace app_list |
| 173 | 173 |
| 174 #endif // UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ | 174 #endif // UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ |
| OLD | NEW |