| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_AURA_SHELL_LAUNCHER_TABBED_LAUNCHER_BUTTON_H_ | 5 #ifndef UI_AURA_SHELL_LAUNCHER_TABBED_LAUNCHER_BUTTON_H_ |
| 6 #define UI_AURA_SHELL_LAUNCHER_TABBED_LAUNCHER_BUTTON_H_ | 6 #define UI_AURA_SHELL_LAUNCHER_TABBED_LAUNCHER_BUTTON_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ui/aura_shell/launcher/launcher_types.h" | 9 #include "ui/aura_shell/launcher/launcher_types.h" |
| 10 #include "ui/views/controls/button/image_button.h" | 10 #include "ui/views/controls/button/custom_button.h" |
| 11 | 11 |
| 12 namespace aura_shell { | 12 namespace aura_shell { |
| 13 namespace internal { | 13 namespace internal { |
| 14 | 14 |
| 15 class LauncherButtonHost; | 15 class LauncherButtonHost; |
| 16 | 16 |
| 17 // Button used for items on the launcher corresponding to tabbed windows. | 17 // Button used for items on the launcher corresponding to tabbed windows. |
| 18 class TabbedLauncherButton : public views::ImageButton { | 18 class TabbedLauncherButton : public views::CustomButton { |
| 19 public: | 19 public: |
| 20 TabbedLauncherButton(views::ButtonListener* listener, | 20 TabbedLauncherButton(views::ButtonListener* listener, |
| 21 LauncherButtonHost* host); | 21 LauncherButtonHost* host); |
| 22 virtual ~TabbedLauncherButton(); | 22 virtual ~TabbedLauncherButton(); |
| 23 | 23 |
| 24 // Sets the images to display for this entry. | 24 // Sets the images to display for this entry. |
| 25 void SetImages(const LauncherTabbedImages& images); | 25 void SetImages(const LauncherTabbedImages& images); |
| 26 | 26 |
| 27 // View overrides: |
| 28 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 29 |
| 27 protected: | 30 protected: |
| 28 // View overrides: | 31 // View overrides: |
| 29 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 32 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 30 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | 33 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
| 31 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; | 34 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; |
| 32 virtual void OnMouseCaptureLost() OVERRIDE; | 35 virtual void OnMouseCaptureLost() OVERRIDE; |
| 33 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; | 36 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; |
| 34 | 37 |
| 35 private: | 38 private: |
| 36 struct ImageSet { | |
| 37 SkBitmap* normal_image; | |
| 38 SkBitmap* pushed_image; | |
| 39 SkBitmap* hot_image; | |
| 40 }; | |
| 41 | |
| 42 // Creates an ImageSet using the specified image ids. Caller owns the returned | |
| 43 // value. | |
| 44 static ImageSet* CreateImageSet(int normal_id, int pushed_id, int hot_id); | |
| 45 | |
| 46 LauncherTabbedImages images_; | 39 LauncherTabbedImages images_; |
| 47 | 40 |
| 48 LauncherButtonHost* host_; | 41 LauncherButtonHost* host_; |
| 49 | 42 |
| 50 // Background images. Which one is chosen depends upon how many images are | 43 // Background images. Which one is chosen depends upon how many images are |
| 51 // provided. | 44 // provided. |
| 52 static ImageSet* bg_image_1_; | 45 static SkBitmap* bg_image_1_; |
| 53 static ImageSet* bg_image_2_; | 46 static SkBitmap* bg_image_2_; |
| 54 static ImageSet* bg_image_3_; | 47 static SkBitmap* bg_image_3_; |
| 55 | 48 |
| 56 DISALLOW_COPY_AND_ASSIGN(TabbedLauncherButton); | 49 DISALLOW_COPY_AND_ASSIGN(TabbedLauncherButton); |
| 57 }; | 50 }; |
| 58 | 51 |
| 59 } // namespace internal | 52 } // namespace internal |
| 60 } // namespace aura_shell | 53 } // namespace aura_shell |
| 61 | 54 |
| 62 #endif // UI_AURA_SHELL_LAUNCHER_TABBED_LAUNCHER_BUTTON_H_ | 55 #endif // UI_AURA_SHELL_LAUNCHER_TABBED_LAUNCHER_BUTTON_H_ |
| OLD | NEW |