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 "ash/ash_export.h" | 9 #include "ash/ash_export.h" |
10 #include "ui/gfx/font.h" | 10 #include "ui/gfx/font.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // Overridden from views::View. | 246 // Overridden from views::View. |
247 virtual gfx::Size GetPreferredSize() OVERRIDE; | 247 virtual gfx::Size GetPreferredSize() OVERRIDE; |
248 virtual void Layout() OVERRIDE; | 248 virtual void Layout() OVERRIDE; |
249 | 249 |
250 views::View* content_; | 250 views::View* content_; |
251 views::View* button_container_; | 251 views::View* button_container_; |
252 views::Label* text_label_; | 252 views::Label* text_label_; |
253 DISALLOW_COPY_AND_ASSIGN(SpecialPopupRow); | 253 DISALLOW_COPY_AND_ASSIGN(SpecialPopupRow); |
254 }; | 254 }; |
255 | 255 |
256 // A view for closable notification views, laid out like: | |
257 // ------------------- | |
258 // | icon contents x | | |
259 // ----------------v-- | |
260 // The close button will call OnClose() when clicked. | |
261 class TrayNotificationView : public views::View, | |
262 public views::ButtonListener { | |
263 public: | |
264 // If icon_id is 0, no icon image will be set. SetIconImage can be called | |
265 // to later set the icon image. | |
266 explicit TrayNotificationView(int icon_id); | |
267 virtual ~TrayNotificationView(); | |
268 | |
269 // InitView must be called once with the contents to be displayed. | |
270 void InitView(views::View* contents); | |
271 | |
272 // Sets/updates the icon image. | |
273 void SetIconImage(const gfx::ImageSkia& image); | |
274 | |
275 // Replaces the contents view. | |
276 void UpdateView(views::View* new_contents); | |
277 | |
278 // Replaces the contents view and updates the icon image. | |
279 void UpdateViewAndImage(views::View* new_contents, | |
280 const gfx::ImageSkia& image); | |
281 | |
282 // Overridden from ButtonListener. | |
283 virtual void ButtonPressed(views::Button* sender, | |
284 const views::Event& event) OVERRIDE; | |
285 | |
286 protected: | |
287 // Called when the closed button is pressed. | |
288 virtual void OnClose() = 0; | |
289 | |
290 private: | |
291 int icon_id_; | |
292 views::ImageView* icon_; | |
293 | |
294 DISALLOW_COPY_AND_ASSIGN(TrayNotificationView); | |
295 }; | |
296 | |
297 // Sets up a Label properly for the tray (sets color, font etc.). | 256 // Sets up a Label properly for the tray (sets color, font etc.). |
298 void SetupLabelForTray(views::Label* label); | 257 void SetupLabelForTray(views::Label* label); |
299 | 258 |
300 } // namespace internal | 259 } // namespace internal |
301 } // namespace ash | 260 } // namespace ash |
302 | 261 |
303 #endif // ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ | 262 #endif // ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ |
OLD | NEW |