OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_H_ |
| 6 #define ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_H_ |
| 7 |
| 8 #include "ash/ash_export.h" |
| 9 #include "ash/sticky_keys/sticky_keys_state.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "ui/compositor/layer_animation_observer.h" |
| 12 #include "ui/events/event_constants.h" |
| 13 #include "ui/gfx/geometry/size.h" |
| 14 |
| 15 namespace gfx { |
| 16 class Rect; |
| 17 } |
| 18 |
| 19 namespace views { |
| 20 class Widget; |
| 21 } |
| 22 |
| 23 namespace ash { |
| 24 |
| 25 class StickyKeysOverlayView; |
| 26 |
| 27 // Controls the overlay UI for sticky keys, an accessibility feature allowing |
| 28 // use of modifier keys without holding them down. This overlay will appear as |
| 29 // a transparent window on the top left of the screen, showing the state of |
| 30 // each sticky key modifier. |
| 31 class ASH_EXPORT StickyKeysOverlay : public ui::LayerAnimationObserver { |
| 32 public: |
| 33 StickyKeysOverlay(); |
| 34 virtual ~StickyKeysOverlay(); |
| 35 |
| 36 // Shows or hides the overlay. |
| 37 void Show(bool visible); |
| 38 |
| 39 // Updates the overlay with the current state of a sticky key modifier. |
| 40 void SetModifierKeyState(ui::EventFlags modifier, |
| 41 StickyKeyState state); |
| 42 |
| 43 // Get the current state of the sticky key modifier in the overlay. |
| 44 StickyKeyState GetModifierKeyState(ui::EventFlags modifier); |
| 45 |
| 46 // Returns true if the overlay is currently visible. If the overlay is |
| 47 // animating, the returned value is the target of the animation. |
| 48 bool is_visible() { return is_visible_; } |
| 49 |
| 50 private: |
| 51 // Returns the current bounds of the overlay, which is based on visibility. |
| 52 gfx::Rect CalculateOverlayBounds(); |
| 53 |
| 54 // gfx::LayerAnimationObserver overrides: |
| 55 virtual void OnLayerAnimationEnded( |
| 56 ui::LayerAnimationSequence* sequence) OVERRIDE; |
| 57 virtual void OnLayerAnimationAborted( |
| 58 ui::LayerAnimationSequence* sequence) OVERRIDE; |
| 59 virtual void OnLayerAnimationScheduled( |
| 60 ui::LayerAnimationSequence* sequence) OVERRIDE; |
| 61 |
| 62 bool is_visible_; |
| 63 scoped_ptr<views::Widget> overlay_widget_; |
| 64 // Ownership of |overlay_view_| is passed to the view heirarchy. |
| 65 StickyKeysOverlayView* overlay_view_; |
| 66 gfx::Size widget_size_; |
| 67 }; |
| 68 |
| 69 } // namespace ash |
| 70 |
| 71 #endif // ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_H_ |
OLD | NEW |