16 #include "GUIAction.h" 17 #include "IGUIContainer.h" 18 #include "utils/Stopwatch.h" 37 CGUIBaseContainer(
int parentID,
int controlID,
float posX,
float posY,
float width,
float height, ORIENTATION orientation,
const CScroller& scroller,
int preloadItems);
41 bool OnAction(
const CAction &action)
override;
42 void OnDown()
override;
44 void OnLeft()
override;
45 void OnRight()
override;
47 bool CanFocus()
const override;
49 void SetFocus(
bool bOnOff)
override;
50 void AllocResources()
override;
51 void FreeResources(
bool immediately =
false)
override;
52 void UpdateVisibility(
const CGUIListItem *item = NULL)
override;
54 virtual unsigned int GetRows()
const;
56 virtual bool HasNextPage()
const;
57 virtual bool HasPreviousPage()
const;
59 void SetPageControl(
int id);
61 std::string GetDescription()
const override;
62 void SaveStates(std::vector<CControlState> &states)
override;
63 virtual int GetSelectedItem()
const;
65 void DoProcess(
unsigned int currentTime, CDirtyRegionList &dirtyregions)
override;
66 void Process(
unsigned int currentTime, CDirtyRegionList &dirtyregions)
override;
68 void LoadLayout(TiXmlElement *layout);
69 void LoadListProvider(TiXmlElement *content,
int defaultItem,
bool defaultAlways);
71 std::shared_ptr<CGUIListItem> GetListItem(
int offset,
unsigned int flag = 0)
const override;
73 bool GetCondition(
int condition,
int data)
const override;
74 std::string GetLabel(
int info)
const override;
88 void SetClickActions(
const CGUIAction& clickActions) { m_clickActions = clickActions; }
89 void SetFocusActions(
const CGUIAction& focusActions) { m_focusActions = focusActions; }
90 void SetUnFocusActions(
const CGUIAction& unfocusActions) { m_unfocusActions = unfocusActions; }
92 void SetAutoScrolling(
const TiXmlNode *node);
93 void ResetAutoScrolling();
94 void UpdateAutoScrolling(
unsigned int currentTime);
97 void DumpTextureUse()
override;
101 bool OnClick(
int actionID);
103 virtual void ProcessItem(
float posX,
105 std::shared_ptr<CGUIListItem>& item,
107 unsigned int currentTime,
108 CDirtyRegionList& dirtyregions);
110 void Render()
override;
111 virtual void RenderItem(
float posX,
float posY,
CGUIListItem *item,
bool focused);
112 virtual void Scroll(
int amount);
113 virtual bool MoveDown(
bool wrapAround);
114 virtual bool MoveUp(
bool wrapAround);
115 virtual bool GetOffsetRange(
int &minOffset,
int &maxOffset)
const;
116 virtual void ValidateOffset();
117 virtual int CorrectOffset(
int offset,
int cursor)
const;
118 virtual void UpdateLayout(
bool refreshAllItems =
false);
119 virtual void SetPageControlRange();
120 virtual void UpdatePageControl(
int offset);
121 virtual void CalculateLayout();
122 virtual void SelectItem(
int item) {}
123 virtual bool SelectItemFromPoint(
const CPoint& point) {
return false; }
124 virtual int GetCursorFromPoint(
const CPoint& point,
CPoint* itemPoint = NULL)
const {
return -1; }
125 virtual void Reset();
126 virtual size_t GetNumItems()
const {
return m_items.size(); }
127 virtual int GetCurrentPage()
const;
129 void OnFocus()
override;
130 void OnUnFocus()
override;
131 void UpdateListProvider(
bool forceRefresh =
false);
133 int ScrollCorrectionRange()
const;
134 inline float Size()
const;
135 void FreeMemory(
int keepStart,
int keepEnd);
136 void GetCurrentLayouts();
141 float m_analogScrollCount;
142 unsigned int m_lastHoldTime;
144 ORIENTATION m_orientation;
147 std::vector<std::shared_ptr<CGUIListItem>> m_items;
148 typedef std::vector<std::shared_ptr<CGUIListItem>>::iterator iItems;
149 std::shared_ptr<CGUIListItem> m_lastItem;
153 std::list<CGUIListItemLayout> m_layouts;
154 std::list<CGUIListItemLayout> m_focusedLayouts;
158 bool m_layoutCondition =
false;
159 bool m_focusedLayoutCondition =
false;
161 virtual void ScrollToOffset(
int offset);
162 void SetContainerMoving(
int direction);
163 void UpdateScrollOffset(
unsigned int currentTime);
167 std::unique_ptr<IListProvider> m_listProvider;
174 void UpdateScrollByLetter();
175 void GetCacheOffsets(
int &cacheBefore,
int &cacheAfter)
const;
176 int GetCacheCount()
const {
return m_cacheItems; }
177 bool ScrollingDown()
const {
return m_scroller.IsScrollingDown(); }
178 bool ScrollingUp()
const {
return m_scroller.IsScrollingUp(); }
181 void OnJumpLetter(
const std::string& letter,
bool skip =
false);
182 void OnJumpSMS(
int letter);
183 std::vector< std::pair<int, std::string> > m_letterOffsets;
190 inline int GetCursor()
const {
return m_cursor; }
209 INFO::InfoPtr m_autoScrollCondition;
210 int m_autoScrollMoveTime;
211 unsigned int m_autoScrollDelayTime;
212 bool m_autoScrollIsReversed;
214 unsigned int m_lastRenderTime;
217 bool OnContextMenu();
233 float m_scrollItemsPerFrame;
234 static const int letter_match_timeout = 1000;
236 bool m_gestureActive =
false;
239 bool m_waitForScrollEnd =
false;
240 float m_lastScrollValue = 0.0f;
bool OnMouseOver(const CPoint &point) override
Called when the mouse is over the control. Default implementation selects the control.
Definition: GUIBaseContainer.cpp:771
Definition: Stopwatch.h:14
An interface for providing lists to UI containers.
Definition: IListProvider.h:21
virtual void SetCursor(int cursor)
Set the cursor position Should be used by all base classes rather than directly setting it...
Definition: GUIBaseContainer.cpp:1485
Definition: GUIListItem.h:29
int GetOffset() const
Returns the index of the first visible row returns the first row. This may be outside of the range of...
Definition: GUIBaseContainer.h:201
void SetRenderOffset(const CPoint &offset)
Set the offset of the first item in the container from the container's position Useful for lists/pane...
Definition: GUIBaseContainer.cpp:1300
void SetOffset(int offset)
Set the container offset Should be used by all base classes rather than directly setting it...
Definition: GUIBaseContainer.cpp:1492
Definition: GUIBaseContainer.h:34
Definition: GUIListItemLayout.h:20
Definition: IGUIContainer.h:20
CPoint m_renderOffset
render offset of the first item in the list
Definition: GUIBaseContainer.h:139
EVENT_RESULT
Results of OnMouseEvent() Any value not equal to EVENT_RESULT_UNHANDLED indicates that the event was ...
Definition: GUIControl.h:68
EVENT_RESULT OnMouseEvent(const CPoint &point, const KODI::MOUSE::CMouseEvent &event) override
Perform a mouse action.
Definition: GUIBaseContainer.cpp:779
Class encapsulating information regarding a particular user action to be sent to windows and controls...
Definition: Action.h:21
int GetItemOffset() const
Returns the index of the first visible item returns the first visible item. This will always be in th...
Definition: GUIBaseContainer.h:206
Definition: GUIMessage.h:365
void SetListProvider(std::unique_ptr< IListProvider > provider)
Set the list provider for this container (for python).
Definition: GUIBaseContainer.cpp:1294
Simple class for mouse events.
Definition: MouseEvent.h:20
Class containing vector of condition->(action/navigation route) and handling its execution.
Definition: GUIAction.h:21