| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_AURA_SHELL_APP_LIST_DROP_SHADOW_LABEL_H_ | |
| 6 #define UI_AURA_SHELL_APP_LIST_DROP_SHADOW_LABEL_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "ui/gfx/font.h" | |
| 10 #include "ui/views/controls/label.h" | |
| 11 | |
| 12 namespace aura_shell { | |
| 13 | |
| 14 ///////////////////////////////////////////////////////////////////////////// | |
| 15 // | |
| 16 // DropShadowLabel class | |
| 17 // | |
| 18 // A drop shadow label is a view subclass that can display a string | |
| 19 // with a drop shadow. | |
| 20 // | |
| 21 ///////////////////////////////////////////////////////////////////////////// | |
| 22 class DropShadowLabel : public views::Label { | |
| 23 public: | |
| 24 DropShadowLabel(); | |
| 25 | |
| 26 // Sets the size of the drop shadow drawn under the text. | |
| 27 // Defaults to two. Note that this is a really simplistic drop | |
| 28 // shadow -- it gets more expensive to draw the larger it gets, | |
| 29 // since it simply draws more copies of the string. For instance, | |
| 30 // for a value of two, the string is draw seven times. In general, | |
| 31 // it is drawn three extra times for each increment of |size|. | |
| 32 void SetDropShadowSize(int size); | |
| 33 | |
| 34 // Return the size of the drop shadow in pixels. | |
| 35 int drop_shadow_size() const { return drop_shadow_size_; } | |
| 36 | |
| 37 // Overridden to paint the text differently from the base class. | |
| 38 virtual void PaintText(gfx::Canvas* canvas, | |
| 39 const string16& text, | |
| 40 const gfx::Rect& text_bounds, | |
| 41 int flags) OVERRIDE; | |
| 42 | |
| 43 protected: | |
| 44 virtual gfx::Size GetTextSize() const OVERRIDE; | |
| 45 | |
| 46 private: | |
| 47 int drop_shadow_size_; | |
| 48 | |
| 49 DISALLOW_COPY_AND_ASSIGN(DropShadowLabel); | |
| 50 }; | |
| 51 | |
| 52 } // namespace aura_shell | |
| 53 | |
| 54 #endif // UI_AURA_SHELL_APP_LIST_DROP_SHADOW_LABEL_H_ | |
| OLD | NEW |