| 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_SYSTEM_TRAY_TRAY_VIEWS_H_ | 5 #ifndef ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ |
| 6 #define ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ | 6 #define ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ui/gfx/font.h" | 9 #include "ui/gfx/font.h" |
| 10 #include "ui/gfx/size.h" | 10 #include "ui/gfx/size.h" |
| 11 #include "ui/views/controls/image_view.h" | 11 #include "ui/views/controls/image_view.h" |
| 12 #include "ui/views/controls/scroll_view.h" | 12 #include "ui/views/controls/scroll_view.h" |
| 13 #include "ui/views/controls/slider.h" |
| 13 #include "ui/views/view.h" | 14 #include "ui/views/view.h" |
| 14 | 15 |
| 15 class SkBitmap; | 16 class SkBitmap; |
| 16 typedef unsigned int SkColor; | 17 typedef unsigned int SkColor; |
| 17 | 18 |
| 18 namespace views { | 19 namespace views { |
| 19 class Label; | 20 class Label; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace ash { | 23 namespace ash { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 48 | 49 |
| 49 protected: | 50 protected: |
| 50 // Performs an action when user clicks on the view (on mouse-press event), or | 51 // Performs an action when user clicks on the view (on mouse-press event), or |
| 51 // presses a key when this view is in focus. Returns true if the event has | 52 // presses a key when this view is in focus. Returns true if the event has |
| 52 // been handled and an action was performed. Returns false otherwise. | 53 // been handled and an action was performed. Returns false otherwise. |
| 53 virtual bool PerformAction(const views::Event& event) = 0; | 54 virtual bool PerformAction(const views::Event& event) = 0; |
| 54 | 55 |
| 55 // Overridden from views::View. | 56 // Overridden from views::View. |
| 56 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; | 57 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; |
| 57 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | 58 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
| 59 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; |
| 58 | 60 |
| 59 private: | 61 private: |
| 60 DISALLOW_COPY_AND_ASSIGN(ActionableView); | 62 DISALLOW_COPY_AND_ASSIGN(ActionableView); |
| 61 }; | 63 }; |
| 62 | 64 |
| 63 class ViewClickListener { | 65 class ViewClickListener { |
| 64 public: | 66 public: |
| 65 virtual ~ViewClickListener() {} | 67 virtual ~ViewClickListener() {} |
| 66 virtual void ClickedOn(views::View* sender) = 0; | 68 virtual void ClickedOn(views::View* sender) = 0; |
| 67 }; | 69 }; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 virtual gfx::Size GetPreferredSize() OVERRIDE; | 125 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 124 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; | 126 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; |
| 125 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; | 127 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; |
| 126 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; | 128 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; |
| 127 | 129 |
| 128 gfx::Size fixed_size_; | 130 gfx::Size fixed_size_; |
| 129 | 131 |
| 130 DISALLOW_COPY_AND_ASSIGN(FixedSizedScrollView); | 132 DISALLOW_COPY_AND_ASSIGN(FixedSizedScrollView); |
| 131 }; | 133 }; |
| 132 | 134 |
| 135 // A slider with a custom focus border (with greater accessibility). |
| 136 class AccessibleSlider : public views::Slider { |
| 137 public: |
| 138 AccessibleSlider(views::SliderListener* listener, Orientation orientation); |
| 139 virtual ~AccessibleSlider(); |
| 140 |
| 141 private: |
| 142 // Overridden from views::View. |
| 143 void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; |
| 144 |
| 145 DISALLOW_COPY_AND_ASSIGN(AccessibleSlider); |
| 146 }; |
| 147 |
| 133 // Creates a container for the various detailed popups. Clicking on the view | 148 // Creates a container for the various detailed popups. Clicking on the view |
| 134 // triggers the callback in ViewClickListener. | 149 // triggers the callback in ViewClickListener. |
| 135 views::View* CreateDetailedHeaderEntry(int string_id, | 150 views::View* CreateDetailedHeaderEntry(int string_id, |
| 136 ViewClickListener* listener); | 151 ViewClickListener* listener); |
| 137 | 152 |
| 138 // Sets up a Label properly for the tray (sets color, font etc.). | 153 // Sets up a Label properly for the tray (sets color, font etc.). |
| 139 void SetupLabelForTray(views::Label* label); | 154 void SetupLabelForTray(views::Label* label); |
| 140 | 155 |
| 141 } // namespace internal | 156 } // namespace internal |
| 142 } // namespace ash | 157 } // namespace ash |
| 143 | 158 |
| 144 #endif // ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ | 159 #endif // ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ |
| OLD | NEW |