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.
5 #ifndef ASH_SHELF_SHELF_WIDGET_H_
6 #define ASH_SHELF_SHELF_WIDGET_H_
8 #include "ash/ash_export.h"
9 #include "ash/shelf/background_animator.h"
10 #include "ash/shelf/shelf_types.h"
11 #include "ui/views/widget/widget.h"
12 #include "ui/views/widget/widget_observer.h"
23 class StatusAreaWidget
;
24 class ShelfLayoutManager
;
25 class WorkspaceController
;
28 class ASH_EXPORT ShelfWidget
: public views::Widget
,
29 public views::WidgetObserver
{
32 aura::Window
* shelf_container
,
33 aura::Window
* status_container
,
34 internal::WorkspaceController
* workspace_controller
);
35 virtual ~ShelfWidget();
37 void SetAlignment(ShelfAlignment alignmnet
);
38 ShelfAlignment
GetAlignment() const;
40 // Sets whether the shelf paints a background. Default is false, but is set
41 // to true if a window overlaps the shelf.
42 void SetPaintsBackground(
44 internal::BackgroundAnimator::ChangeType change_type
);
45 bool paints_background() const {
46 return background_animator_
.paints_background();
49 // Causes shelf items to be slightly dimmed (eg when a window is maximized).
50 void SetDimsShelf(bool dimming
);
51 bool GetDimsShelf() const;
53 internal::ShelfLayoutManager
* shelf_layout_manager() {
54 return shelf_layout_manager_
;
56 Launcher
* launcher() const { return launcher_
.get(); }
57 internal::StatusAreaWidget
* status_area_widget() const {
58 return status_area_widget_
;
61 void CreateLauncher();
63 // Set visibility of the launcher component of the shelf.
64 void SetLauncherVisibility(bool visible
);
65 bool IsLauncherVisible() const;
67 // Sets the focus cycler. Also adds the launcher to the cycle.
68 void SetFocusCycler(internal::FocusCycler
* focus_cycler
);
69 internal::FocusCycler
* GetFocusCycler();
71 // Called by the activation delegate, before the launcher is activated
72 // when no other windows are visible.
73 void WillActivateAsFallback() { activating_as_fallback_
= true; }
75 aura::Window
* window_container() { return window_container_
; }
77 // TODO(harrym): Remove when Status Area Widget is a child view.
78 void ShutdownStatusAreaWidget();
80 // Set the bounds of the widget and the dim shelf overlay.
81 void SetWidgetBounds(const gfx::Rect
& rect
);
83 // Force the shelf to be presented in an undimmed state.
84 void ForceUndimming(bool force
);
86 // Overridden from views::WidgetObserver:
87 virtual void OnWidgetActivationChanged(
88 views::Widget
* widget
, bool active
) OVERRIDE
;
90 // A function to test the current alpha used by the dimming bar. If there is
91 // no dimmer active, the function will return -1.
92 int GetDimmingAlphaForTest();
94 // A function to test the bounds of the dimming bar. Returns gfx::Rect() if
95 // the dimmer is inactive.
96 gfx::Rect
GetDimmerBoundsForTest();
98 // Disable dimming animations for running tests.
99 void DisableDimmingAnimationsForTest();
104 internal::ShelfLayoutManager
* shelf_layout_manager_
;
105 scoped_ptr
<Launcher
> launcher_
;
106 internal::StatusAreaWidget
* status_area_widget_
;
108 // delegate_view_ is attached to window_container_ and is cleaned up
109 // during CloseChildWindows of the associated RootWindowController.
110 DelegateView
* delegate_view_
;
111 internal::BackgroundAnimator background_animator_
;
112 bool activating_as_fallback_
;
113 aura::Window
* window_container_
;
118 #endif // ASH_SHELF_SHELF_WIDGET_H_