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_VIEWS_TABS_TAB_STRIP_H__ | 5 #ifndef CHROME_BROWSER_VIEWS_TABS_TAB_STRIP_H_ |
6 #define CHROME_BROWSER_VIEWS_TABS_TAB_STRIP_H__ | 6 #define CHROME_BROWSER_VIEWS_TABS_TAB_STRIP_H_ |
7 | 7 |
8 #include "base/gfx/point.h" | 8 #include "base/gfx/point.h" |
9 #include "base/message_loop.h" | |
9 #include "chrome/browser/tabs/tab_strip_model.h" | 10 #include "chrome/browser/tabs/tab_strip_model.h" |
10 #include "chrome/browser/views/tabs/tab.h" | 11 #include "chrome/browser/views/tabs/tab.h" |
11 #include "views/controls/button/image_button.h" | 12 #include "views/controls/button/image_button.h" |
12 #include "views/controls/menu/menu.h" | 13 #include "views/controls/menu/menu.h" |
13 #include "views/view.h" | 14 #include "views/view.h" |
15 #if defined(OS_WIN) | |
14 #include "views/widget/widget_win.h" | 16 #include "views/widget/widget_win.h" |
17 #endif | |
15 | 18 |
16 class DraggedTabController; | 19 class DraggedTabController; |
17 class ScopedMouseCloseWidthCalculator; | 20 class ScopedMouseCloseWidthCalculator; |
18 class TabStripModel; | 21 class TabStripModel; |
19 | 22 |
20 namespace views { | 23 namespace views { |
21 class ImageView; | 24 class ImageView; |
22 } | 25 } |
23 | 26 |
24 /////////////////////////////////////////////////////////////////////////////// | 27 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 virtual void StopAllHighlighting(); | 137 virtual void StopAllHighlighting(); |
135 virtual void MaybeStartDrag(Tab* tab, const views::MouseEvent& event); | 138 virtual void MaybeStartDrag(Tab* tab, const views::MouseEvent& event); |
136 virtual void ContinueDrag(const views::MouseEvent& event); | 139 virtual void ContinueDrag(const views::MouseEvent& event); |
137 virtual bool EndDrag(bool canceled); | 140 virtual bool EndDrag(bool canceled); |
138 virtual bool HasAvailableDragActions() const; | 141 virtual bool HasAvailableDragActions() const; |
139 | 142 |
140 // views::ButtonListener implementation: | 143 // views::ButtonListener implementation: |
141 virtual void ButtonPressed(views::Button* sender); | 144 virtual void ButtonPressed(views::Button* sender); |
142 | 145 |
143 // MessageLoop::Observer implementation: | 146 // MessageLoop::Observer implementation: |
147 #if defined(OS_WIN) | |
144 virtual void WillProcessMessage(const MSG& msg); | 148 virtual void WillProcessMessage(const MSG& msg); |
145 virtual void DidProcessMessage(const MSG& msg); | 149 virtual void DidProcessMessage(const MSG& msg); |
150 #else | |
151 virtual void WillProcessEvent(GdkEvent* event); | |
152 #endif | |
146 | 153 |
147 private: | 154 private: |
155 class InsertTabAnimation; | |
156 class MoveTabAnimation; | |
157 class RemoveTabAnimation; | |
158 class ResizeLayoutAnimation; | |
159 class TabAnimation; | |
160 | |
148 friend class DraggedTabController; | 161 friend class DraggedTabController; |
149 friend class InsertTabAnimation; | 162 friend class InsertTabAnimation; |
150 friend class MoveTabAnimation; | 163 friend class MoveTabAnimation; |
151 friend class RemoveTabAnimation; | 164 friend class RemoveTabAnimation; |
152 friend class ResizeLayoutAnimation; | 165 friend class ResizeLayoutAnimation; |
153 friend class SuspendAnimationsTask; | |
154 friend class TabAnimation; | 166 friend class TabAnimation; |
155 | 167 |
156 TabStrip(); | 168 TabStrip(); |
157 void Init(); | 169 void Init(); |
158 | 170 |
159 // Retrieves the Tab at the specified index. Take care in using this, you may | 171 // Retrieves the Tab at the specified index. Take care in using this, you may |
160 // need to use GetTabAtAdjustForAnimation. | 172 // need to use GetTabAtAdjustForAnimation. |
161 Tab* GetTabAt(int index) const; | 173 Tab* GetTabAt(int index) const; |
162 | 174 |
163 // Returns the tab at the specified index. If a remove animation is on going | 175 // Returns the tab at the specified index. If a remove animation is on going |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 void StartMoveTabAnimation(int from_index, int to_index); | 256 void StartMoveTabAnimation(int from_index, int to_index); |
245 | 257 |
246 // Returns true if detach or select changes in the model should be reflected | 258 // Returns true if detach or select changes in the model should be reflected |
247 // in the TabStrip. This returns false if we're closing all tabs in the | 259 // in the TabStrip. This returns false if we're closing all tabs in the |
248 // TabStrip and so we should prevent updating. This is not const because we | 260 // TabStrip and so we should prevent updating. This is not const because we |
249 // use this as a signal to cancel any active animations. | 261 // use this as a signal to cancel any active animations. |
250 bool CanUpdateDisplay(); | 262 bool CanUpdateDisplay(); |
251 | 263 |
252 // Notifies the TabStrip that the specified TabAnimation has completed. | 264 // Notifies the TabStrip that the specified TabAnimation has completed. |
253 // Optionally a full Layout will be performed, specified by |layout|. | 265 // Optionally a full Layout will be performed, specified by |layout|. |
254 class TabAnimation; | |
255 void FinishAnimation(TabAnimation* animation, bool layout); | 266 void FinishAnimation(TabAnimation* animation, bool layout); |
256 | 267 |
257 // Finds the index of the TabContents corresponding to |tab| in our | 268 // Finds the index of the TabContents corresponding to |tab| in our |
258 // associated TabStripModel, or -1 if there is none (e.g. the specified |tab| | 269 // associated TabStripModel, or -1 if there is none (e.g. the specified |tab| |
259 // is being animated closed). | 270 // is being animated closed). |
260 int GetIndexOfTab(const Tab* tab) const; | 271 int GetIndexOfTab(const Tab* tab) const; |
261 | 272 |
262 // Calculates the available width for tabs, assuming a Tab is to be closed. | 273 // Calculates the available width for tabs, assuming a Tab is to be closed. |
263 int GetAvailableWidthForTabs(Tab* last_tab) const; | 274 int GetAvailableWidthForTabs(Tab* last_tab) const; |
264 | 275 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
324 int drop_index; | 335 int drop_index; |
325 bool drop_before; | 336 bool drop_before; |
326 | 337 |
327 // Direction the arrow should point in. If true, the arrow is displayed | 338 // Direction the arrow should point in. If true, the arrow is displayed |
328 // above the tab and points down. If false, the arrow is displayed beneath | 339 // above the tab and points down. If false, the arrow is displayed beneath |
329 // the tab and points up. | 340 // the tab and points up. |
330 bool point_down; | 341 bool point_down; |
331 | 342 |
332 // Renders the drop indicator. | 343 // Renders the drop indicator. |
333 // TODO(beng): should be views::Widget. | 344 // TODO(beng): should be views::Widget. |
345 #if defined(OS_WIN) | |
Ben Goodger (Google)
2009/05/18 19:25:23
Move the TODO above under this ifdef
| |
334 views::WidgetWin* arrow_window; | 346 views::WidgetWin* arrow_window; |
347 #endif | |
335 views::ImageView* arrow_view; | 348 views::ImageView* arrow_view; |
336 | 349 |
337 private: | 350 private: |
338 DISALLOW_EVIL_CONSTRUCTORS(DropInfo); | 351 DISALLOW_COPY_AND_ASSIGN(DropInfo); |
339 }; | 352 }; |
340 | 353 |
341 // Valid for the lifetime of a drag over us. | 354 // Valid for the lifetime of a drag over us. |
342 scoped_ptr<DropInfo> drop_info_; | 355 scoped_ptr<DropInfo> drop_info_; |
343 | 356 |
344 // The controller for a drag initiated from a Tab. Valid for the lifetime of | 357 // The controller for a drag initiated from a Tab. Valid for the lifetime of |
345 // the drag session. | 358 // the drag session. |
346 scoped_ptr<DraggedTabController> drag_controller_; | 359 scoped_ptr<DraggedTabController> drag_controller_; |
347 | 360 |
348 // The Tabs we contain, and their last generated "good" bounds. | 361 // The Tabs we contain, and their last generated "good" bounds. |
349 struct TabData { | 362 struct TabData { |
350 Tab* tab; | 363 Tab* tab; |
351 gfx::Rect ideal_bounds; | 364 gfx::Rect ideal_bounds; |
352 }; | 365 }; |
353 std::vector<TabData> tab_data_; | 366 std::vector<TabData> tab_data_; |
354 | 367 |
355 // The currently running animation. | 368 // The currently running animation. |
356 scoped_ptr<TabAnimation> active_animation_; | 369 scoped_ptr<TabAnimation> active_animation_; |
357 | 370 |
358 DISALLOW_EVIL_CONSTRUCTORS(TabStrip); | 371 DISALLOW_COPY_AND_ASSIGN(TabStrip); |
359 }; | 372 }; |
360 | 373 |
361 #endif // CHROME_BROWSER_VIEWS_TABS_TAB_STRIP_H__ | 374 #endif // CHROME_BROWSER_VIEWS_TABS_TAB_STRIP_H_ |
OLD | NEW |