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 3 // found in the LICENSE file. 4 5 #ifndef UI_VIEWS_NATIVE_THEME_DELEGATE_H_ 6 #define UI_VIEWS_NATIVE_THEME_DELEGATE_H_ 7 8 #include "ui/gfx/rect.h" 9 #include "ui/native_theme/native_theme.h" 10 #include "ui/views/views_export.h" 11 12 namespace views { 13 14 // A delagate that supports animating transtions between different native 15 // theme states. This delegate can be used to control a native theme Border 16 // or Painter object. 17 // 18 // If animation is ongoing, the native theme border or painter will 19 // composite the foreground state over the backgroud state using an alpha 20 // between 0 and 255 based on the current value of the animation. 21 class VIEWS_EXPORT NativeThemeDelegate { 22 public: 23 virtual ~NativeThemeDelegate() {} 24 25 // Get the native theme part that should be drawn. 26 virtual ui::NativeTheme::Part GetThemePart() const = 0; 27 28 // Get the rectangle that should be painted. 29 virtual gfx::Rect GetThemePaintRect() const = 0; 30 31 // Get the state of the part, along with any extra data needed for drawing. 32 virtual ui::NativeTheme::State GetThemeState( 33 ui::NativeTheme::ExtraParams* params) const = 0; 34 35 // If the native theme drawign should be animated, return the Animation object 36 // that controlls it. If no animation is ongoing, NULL may be returned. 37 virtual const ui::Animation* GetThemeAnimation() const = 0; 38 39 // If animation is onging, this returns the background native theme state. 40 virtual ui::NativeTheme::State GetBackgroundThemeState( 41 ui::NativeTheme::ExtraParams* params) const = 0; 42 43 // If animation is onging, this returns the foreground native theme state. 44 // This state will be composited over the background using an alpha value 45 // based on the current value of the animation. 46 virtual ui::NativeTheme::State GetForegroundThemeState( 47 ui::NativeTheme::ExtraParams* params) const = 0; 48 }; 49 50 } // namespace views 51 52 #endif // UI_VIEWS_NATIVE_THEME_DELEGATE_H_ 53