Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / browser / ui / top_view_layout_views.h
1 // Copyright (c) 2013 Intel Corporation. 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 XWALK_RUNTIME_BROWSER_UI_TOP_VIEW_LAYOUT_VIEWS_H_
6 #define XWALK_RUNTIME_BROWSER_UI_TOP_VIEW_LAYOUT_VIEWS_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "ui/views/layout/layout_manager.h"
11
12 namespace xwalk {
13
14 // Layout manager that handle a main content view taking all the space and
15 // optionally an top view. The top view will always get its preferred
16 // height. Used for implementing Tizen Indicator when running fullscreen.
17 //
18 // This layout expects that the view it is managing have either one or two
19 // children, and that the setter methods are called accordingly.
20 class TopViewLayout : public views::LayoutManager {
21  public:
22   TopViewLayout();
23   virtual ~TopViewLayout();
24
25   // Must be set to the content view, that will fill all the remaining available
26   // space in the layout. The |content_view| must be child of the view that this
27   // layout manages.
28   void set_content_view(views::View* content_view) {
29     content_view_ = content_view;
30   }
31
32   // Optionally sets a top view, that will be positioned on the top and with its
33   // preferred height. The |top_view| must be children from the view that this
34   // layout manages.
35   void set_top_view(views::View* top_view) { top_view_ = top_view; }
36
37   views::View* top_view() const { return top_view_; }
38
39   // Set or check if the top_view_ is in overlay mode. It means that in overlay
40   // mode the top_view_ will be over the content_view_.
41   void SetUseOverlay(bool enable);
42   bool IsUsingOverlay() const;
43
44   // views::LayoutManager implementation.
45   void Layout(views::View* host) override;
46   gfx::Size GetPreferredSize(const views::View* host) const override;
47
48  private:
49   views::View* top_view_;
50   views::View* content_view_;
51   bool overlay_;
52
53   DISALLOW_COPY_AND_ASSIGN(TopViewLayout);
54 };
55
56 }  // namespace xwalk
57
58 #endif  // XWALK_RUNTIME_BROWSER_UI_TOP_VIEW_LAYOUT_VIEWS_H_