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 CGUIListItemPtr 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,
float posY, CGUIListItemPtr& item,
bool focused,
unsigned int currentTime, CDirtyRegionList &dirtyregions);
105 void Render()
override;
106 virtual void RenderItem(
float posX,
float posY,
CGUIListItem *item,
bool focused);
107 virtual void Scroll(
int amount);
108 virtual bool MoveDown(
bool wrapAround);
109 virtual bool MoveUp(
bool wrapAround);
110 virtual bool GetOffsetRange(
int &minOffset,
int &maxOffset)
const;
111 virtual void ValidateOffset();
112 virtual int CorrectOffset(
int offset,
int cursor)
const;
113 virtual void UpdateLayout(
bool refreshAllItems =
false);
114 virtual void SetPageControlRange();
115 virtual void UpdatePageControl(
int offset);
116 virtual void CalculateLayout();
117 virtual void SelectItem(
int item) {}
118 virtual bool SelectItemFromPoint(
const CPoint& point) {
return false; }
119 virtual int GetCursorFromPoint(
const CPoint& point,
CPoint* itemPoint = NULL)
const {
return -1; }
120 virtual void Reset();
121 virtual size_t GetNumItems()
const {
return m_items.size(); }
122 virtual int GetCurrentPage()
const;
124 void OnFocus()
override;
125 void OnUnFocus()
override;
126 void UpdateListProvider(
bool forceRefresh =
false);
128 int ScrollCorrectionRange()
const;
129 inline float Size()
const;
130 void FreeMemory(
int keepStart,
int keepEnd);
131 void GetCurrentLayouts();
136 float m_analogScrollCount;
137 unsigned int m_lastHoldTime;
139 ORIENTATION m_orientation;
142 std::vector< CGUIListItemPtr > m_items;
143 typedef std::vector<CGUIListItemPtr> ::iterator iItems;
144 CGUIListItemPtr m_lastItem;
148 std::list<CGUIListItemLayout> m_layouts;
149 std::list<CGUIListItemLayout> m_focusedLayouts;
153 bool m_layoutCondition =
false;
154 bool m_focusedLayoutCondition =
false;
156 void ScrollToOffset(
int offset);
157 void SetContainerMoving(
int direction);
158 void UpdateScrollOffset(
unsigned int currentTime);
162 std::unique_ptr<IListProvider> m_listProvider;
169 void UpdateScrollByLetter();
170 void GetCacheOffsets(
int &cacheBefore,
int &cacheAfter)
const;
171 int GetCacheCount()
const {
return m_cacheItems; }
172 bool ScrollingDown()
const {
return m_scroller.IsScrollingDown(); }
173 bool ScrollingUp()
const {
return m_scroller.IsScrollingUp(); }
176 void OnJumpLetter(
const std::string& letter,
bool skip =
false);
177 void OnJumpSMS(
int letter);
178 std::vector< std::pair<int, std::string> > m_letterOffsets;
185 inline int GetCursor()
const {
return m_cursor; }
204 INFO::InfoPtr m_autoScrollCondition;
205 int m_autoScrollMoveTime;
206 unsigned int m_autoScrollDelayTime;
207 bool m_autoScrollIsReversed;
209 unsigned int m_lastRenderTime;
212 bool OnContextMenu();
228 float m_scrollItemsPerFrame;
229 static const int letter_match_timeout = 1000;
231 bool m_gestureActive =
false;
234 bool m_waitForScrollEnd =
false;
235 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:758
Definition: Stopwatch.h:14
An interface for providing lists to UI containers.
Definition: IListProvider.h:22
virtual void SetCursor(int cursor)
Set the cursor position Should be used by all base classes rather than directly setting it...
Definition: GUIBaseContainer.cpp:1466
Definition: GUIListItem.h:30
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:196
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:1281
void SetOffset(int offset)
Set the container offset Should be used by all base classes rather than directly setting it...
Definition: GUIBaseContainer.cpp:1473
Definition: GUIBaseContainer.h:34
EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event) override
Perform a mouse action.
Definition: GUIBaseContainer.cpp:766
Definition: GUIListItemLayout.h:20
Definition: IGUIContainer.h:22
CPoint m_renderOffset
render offset of the first item in the list
Definition: GUIBaseContainer.h:134
EVENT_RESULT
Results of OnMouseEvent() Any value not equal to EVENT_RESULT_UNHANDLED indicates that the event was ...
Definition: GUIControl.h:60
class encapsulating information regarding a particular user action to be sent to windows and controls...
Definition: Action.h:22
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:201
Definition: GUIMessage.h:365
void SetListProvider(std::unique_ptr< IListProvider > provider)
Set the list provider for this container (for python).
Definition: GUIBaseContainer.cpp:1275
Simple class for mouse events.
Definition: Key.h:114
Class containing vector of condition->(action/navigation route) and handling its execution.
Definition: GUIAction.h:21