15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef UI_VIEWS_NATIVE_THEME_DELEGATE_H_ 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define UI_VIEWS_NATIVE_THEME_DELEGATE_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/gfx/rect.h" 92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ui/native_theme/native_theme.h" 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/views_export.h" 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace views { 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// A delagate that supports animating transtions between different native 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// theme states. This delegate can be used to control a native theme Border 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// or Painter object. 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// If animation is ongoing, the native theme border or painter will 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// composite the foreground state over the backgroud state using an alpha 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// between 0 and 255 based on the current value of the animation. 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class VIEWS_EXPORT NativeThemeDelegate { 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public: 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual ~NativeThemeDelegate() {} 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Get the native theme part that should be drawn. 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual ui::NativeTheme::Part GetThemePart() const = 0; 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Get the rectangle that should be painted. 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual gfx::Rect GetThemePaintRect() const = 0; 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Get the state of the part, along with any extra data needed for drawing. 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual ui::NativeTheme::State GetThemeState( 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ui::NativeTheme::ExtraParams* params) const = 0; 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // If the native theme drawign should be animated, return the Animation object 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // that controlls it. If no animation is ongoing, NULL may be returned. 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual const ui::Animation* GetThemeAnimation() const = 0; 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // If animation is onging, this returns the background native theme state. 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual ui::NativeTheme::State GetBackgroundThemeState( 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ui::NativeTheme::ExtraParams* params) const = 0; 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // If animation is onging, this returns the foreground native theme state. 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // This state will be composited over the background using an alpha value 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // based on the current value of the animation. 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual ui::NativeTheme::State GetForegroundThemeState( 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ui::NativeTheme::ExtraParams* params) const = 0; 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace views 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // UI_VIEWS_NATIVE_THEME_DELEGATE_H_ 53