2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef GENLISTMANAGER_H_
18 #define GENLISTMANAGER_H_
20 #include <Elementary.h>
22 #include "BrowserLogger.h"
23 #include "WidgetListManager.h"
27 namespace tizen_browser {
30 class GenlistManagerCallbacks;
31 class UrlMatchesStyler;
32 typedef shared_ptr<UrlMatchesStyler> UrlMatchesStylerPtr;
34 class GenlistManager: public WidgetListManager
36 friend class GenlistManagerCallbacks;
39 virtual ~GenlistManager();
41 virtual Evas_Object* createWidget(Evas_Object* parentLayout);
42 virtual Evas_Object* getWidget();
44 virtual void showWidget(const string& editedUrl,
45 shared_ptr<services::HistoryItemVector> matchedEntries);
46 virtual void hideWidget();
49 bool isWidgetHidden();
52 * Add empty list elements to allow scroll in effect.
61 static Evas_Object* m_contentGet(void *data, Evas_Object *obj,
65 return m_genlist != nullptr;
67 void prepareUrlsVector(const string& editedUrl,
68 shared_ptr<services::HistoryItemVector> matchedEntries);
70 void startScrollOut();
71 void setLastEdgeTop(bool edgeTop);
72 bool getLastEdgeTop();
73 void onMouseFocusChange(bool mouseInsideWidget);
75 Evas_Object* m_parentLayout = nullptr;
76 Evas_Object* m_genlist = nullptr;
77 const bool genlistShowScrollbar = false;
79 // don't know how to get from edc:
80 const int historyItemH = 82;
81 const int historyItemsVisibleMax = 5;
82 // don't know how to calculate:
83 const int genlistH = historyItemH * historyItemsVisibleMax;
86 * Set to true, whenever hide request occurs. Set to false, whenever show
87 * request occurs. Needed to indicate when genlist should slide in.
89 bool widgetPreviouslyHidden = true;
91 * If mouse click received and mouse is outside widget, hide it.
93 bool mouseInsideWidget = true;
95 * needed to indicate direction of the scroll in 'anim,stop' callback
97 bool lastEdgeTop = true;
99 Elm_Gengrid_Item_Class * m_historyItemClass;
100 Elm_Gengrid_Item_Class * m_historyItemSpaceClass;
101 Elm_Object_Item* m_itemUrlFirst = nullptr;
102 Elm_Object_Item* m_itemUrlLast = nullptr;
103 Elm_Object_Item* m_itemSpaceFirst = nullptr;
104 Elm_Object_Item* m_itemSpaceLast = nullptr;
107 * keeps shared pointers to strings, that are ready to be displayed, so they can be
108 * passed through EFL, until they're not needed. IMPORTANT: it has to be
109 * assured, that list is not cleared until all EFL items has created their
110 * labels from these pointers in m_contentGet(). in case of segfaults, delete copy of pointers
111 * manually in m_contentGet().
113 vector<shared_ptr<string>> m_readyUrls;
114 UrlMatchesStylerPtr m_urlMatchesStyler;
118 } /* namespace services */
119 } /* namespace tizen_browser */
121 #endif /* GENLISTMANAGER_H_ */