• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
7 //    * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 //    * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
12 // distribution.
13 //    * Neither the name of Google Inc. nor the name Chromium Embedded
14 // Framework nor the names of its contributors may be used to endorse
15 // or promote products derived from this software without specific prior
16 // written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // ---------------------------------------------------------------------------
31 //
32 // The contents of this file must follow a specific format in order to
33 // support the CEF translator tool. See the translator.README.txt file in the
34 // tools directory for more information.
35 //
36 
37 #ifndef CEF_INCLUDE_VIEWS_CEF_PANEL_H_
38 #define CEF_INCLUDE_VIEWS_CEF_PANEL_H_
39 #pragma once
40 
41 #include "include/views/cef_panel_delegate.h"
42 #include "include/views/cef_view.h"
43 
44 class CefBoxLayout;
45 class CefFillLayout;
46 class CefLayout;
47 class CefWindow;
48 
49 ///
50 // A Panel is a container in the views hierarchy that can contain other Views
51 // as children. Methods must be called on the browser process UI thread unless
52 // otherwise indicated.
53 ///
54 /*--cef(source=library)--*/
55 class CefPanel : public CefView {
56  public:
57   ///
58   // Create a new Panel.
59   ///
60   /*--cef(optional_param=delegate)--*/
61   static CefRefPtr<CefPanel> CreatePanel(CefRefPtr<CefPanelDelegate> delegate);
62 
63   ///
64   // Returns this Panel as a Window or NULL if this is not a Window.
65   ///
66   /*--cef()--*/
67   virtual CefRefPtr<CefWindow> AsWindow() = 0;
68 
69   ///
70   // Set this Panel's Layout to FillLayout and return the FillLayout object.
71   ///
72   /*--cef()--*/
73   virtual CefRefPtr<CefFillLayout> SetToFillLayout() = 0;
74 
75   ///
76   // Set this Panel's Layout to BoxLayout and return the BoxLayout object.
77   ///
78   /*--cef()--*/
79   virtual CefRefPtr<CefBoxLayout> SetToBoxLayout(
80       const CefBoxLayoutSettings& settings) = 0;
81 
82   ///
83   // Get the Layout.
84   ///
85   /*--cef()--*/
86   virtual CefRefPtr<CefLayout> GetLayout() = 0;
87 
88   ///
89   // Lay out the child Views (set their bounds based on sizing heuristics
90   // specific to the current Layout).
91   ///
92   /*--cef()--*/
93   virtual void Layout() = 0;
94 
95   ///
96   // Add a child View.
97   ///
98   /*--cef()--*/
99   virtual void AddChildView(CefRefPtr<CefView> view) = 0;
100 
101   ///
102   // Add a child View at the specified |index|. If |index| matches the result of
103   // GetChildCount() then the View will be added at the end.
104   ///
105   /*--cef(index_param=index)--*/
106   virtual void AddChildViewAt(CefRefPtr<CefView> view, int index) = 0;
107 
108   ///
109   // Move the child View to the specified |index|. A negative value for |index|
110   // will move the View to the end.
111   ///
112   /*--cef()--*/
113   virtual void ReorderChildView(CefRefPtr<CefView> view, int index) = 0;
114 
115   ///
116   // Remove a child View. The View can then be added to another Panel.
117   ///
118   /*--cef()--*/
119   virtual void RemoveChildView(CefRefPtr<CefView> view) = 0;
120 
121   ///
122   // Remove all child Views. The removed Views will be deleted if the client
123   // holds no references to them.
124   ///
125   /*--cef()--*/
126   virtual void RemoveAllChildViews() = 0;
127 
128   ///
129   // Returns the number of child Views.
130   ///
131   /*--cef()--*/
132   virtual size_t GetChildViewCount() = 0;
133 
134   ///
135   // Returns the child View at the specified |index|.
136   ///
137   /*--cef(index_param=index)--*/
138   virtual CefRefPtr<CefView> GetChildViewAt(int index) = 0;
139 };
140 
141 #endif  // CEF_INCLUDE_VIEWS_CEF_PANEL_H_
142