native_theme_delegate.h 2.0 KB

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