1c0ca6ec2d93d6daf747c6d25f4d924a913fccb2
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / web-view / web-back-forward-list.h
1 #ifndef DALI_TOOLKIT_WEB_BACK_FORWARD_LIST_H
2 #define DALI_TOOLKIT_WEB_BACK_FORWARD_LIST_H
3
4 /*
5  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/devel-api/adaptor-framework/web-engine/web-engine-back-forward-list-item.h>
23 #include <vector>
24 #include <memory>
25
26 // INTERNAL INCLUDES
27 #include <dali-toolkit/public-api/dali-toolkit-common.h>
28
29 namespace Dali
30 {
31 class WebEngineBackForwardList;
32
33 namespace Toolkit
34 {
35 class WebBackForwardListItem;
36
37 /**
38  * @addtogroup dali_toolkit_controls_web_view
39  * @{
40  */
41
42 /**
43  * @brief WebBackForwardList is a class for back-forward list item of WebView.
44  *
45  *
46  * For working WebBackForwardList, a Dali::WebBackForwardList should be provided.
47  *
48  */
49 class DALI_TOOLKIT_API WebBackForwardList
50 {
51 public:
52   /**
53    * @brief Creates a WebBackForwardList.
54    */
55   WebBackForwardList(Dali::WebEngineBackForwardList& list);
56
57   /**
58    * @brief Destructor.
59    */
60   virtual ~WebBackForwardList() final;
61
62   /**
63    * @brief Returns the current item in the @a list.
64    * @return The current item in list.
65    */
66   std::unique_ptr<Dali::WebEngineBackForwardListItem> GetCurrentItem();
67
68   /**
69    * @brief Returns the previous item in the @a list.
70    * @return The previous item in list.
71    */
72   std::unique_ptr<Dali::WebEngineBackForwardListItem> GetPreviousItem();
73
74   /**
75    * @brief Returns the next item in the @a list.
76    * @return The next item in list.
77    */
78   std::unique_ptr<Dali::WebEngineBackForwardListItem> GetNextItem();
79
80   /**
81    * @brief Returns the item at a given @a index relative to the current item.
82    * @param[in] index The index of the item
83    * @return The current item in list.
84    */
85   std::unique_ptr<Dali::WebEngineBackForwardListItem> GetItemAtIndex(uint32_t index);
86
87   /**
88    * @brief Returns the length of the back-forward list including the current
89    *        item.
90    * @return The length of the back-forward list including the current item,
91    *         otherwise 0 in case of an error
92    */
93   uint32_t GetItemCount() const;
94
95   /**
96    * @brief Creates a list containing the items preceding the current item limited
97    *        by @a limit.
98    *
99    * @details The WebEngineBackForwardListItem elements are located in the result
100               list starting with the oldest one.\n
101    *          If @a limit is equal to @c -1 all the items preceding the current
102    *          item are returned.
103    *
104    * @param[in] limit The number of items to retrieve
105    *
106    * @return @c vector containing @c WebEngineBackForwardListItem elements,\n
107    */
108   std::vector<std::unique_ptr<Dali::WebEngineBackForwardListItem>> GetBackwardItems(int limit);
109
110   /**
111    * @brief Creates the list containing the items following the current item
112    *        limited by @a limit.
113    *
114    * @details The @c WebEngineBackForwardListItem elements are located in the result
115    *          list starting with the oldest one.\n
116    *          If @a limit is equal to @c -1 all the items preceding the current
117    *          item are returned.
118    *
119    * @param[in] limit The number of items to retrieve
120    *
121    * @return @c vector containing @c WebEngineBackForwardListItem elements,\n
122    */
123   std::vector<std::unique_ptr<Dali::WebEngineBackForwardListItem>> GetForwardItems(int limit);
124
125 private:
126   Dali::WebEngineBackForwardList& mWebEngineBackForwardList;
127 };
128
129 /**
130  * @}
131  */
132
133 } // namespace Toolkit
134
135 } // namespace Dali
136
137 #endif // DALI_TOOLKIT_WEB_BACK_FORWARD_LIST_H