Go to the documentation of this file. 1 #ifndef MYTHUIBUTTONLIST_H_
2 #define MYTHUIBUTTONLIST_H_
34 using muibCbFn = QString (*)(
const QString &name,
void *data);
52 QString image =
"",
bool checkable =
false,
53 CheckState state = CantCheck,
bool showArrow =
false,
54 int listPosition = -1);
56 QVariant data,
int listPosition = -1);
57 template <
typename SLOT>
59 const QString& text, SLOT slot,
int listPosition = -1)
61 template <
typename SLOT>
63 const QString& text, SLOT slot,
int listPosition = -1)
69 void SetText(
const QString &text,
const QString &name=
"",
70 const QString &state=
"");
71 void SetTextFromMap(
const InfoMap &infoMap,
const QString &state=
"");
72 void SetTextFromMap(
const QMap<QString, TextProperties> &stringMap);
73 void SetTextCb(
muibCbFn fn,
void *data);
74 QString GetText(
const QString &name=
"")
const;
77 bool FindText(
const QString &searchStr,
const QString &fieldList =
"**ALL**",
78 bool startsWith =
false)
const;
80 void SetFontState(
const QString &state,
const QString &name=
"");
85 void SetImage(
MythImage *image,
const QString &name=
"");
92 MythImage *GetImage(
const QString &name=
"");
107 void SetImage(
const QString &
filename,
const QString &name=
"",
108 bool force_reload =
false);
109 void SetImageFromMap(
const InfoMap &imageMap);
110 void SetImageCb(
muibCbFn fn,
void *data);
111 QString GetImageFilename(
const QString &name=
"")
const;
113 void SetProgress1(
int start,
int total,
int used);
114 void SetProgress2(
int start,
int total,
int used);
116 void DisplayState(
const QString &state,
const QString &name);
117 void SetStatesFromMap(
const InfoMap &stateMap);
118 void SetStateCb(
muibCbFn fn,
void *data);
119 QString
GetState(
const QString &name);
124 bool checkable()
const;
125 void setCheckable(
bool flag);
127 bool isEnabled()
const;
128 void setEnabled(
bool flag);
130 CheckState state()
const;
131 void setChecked(CheckState state);
133 void setDrawArrow(
bool flag);
135 void SetData(QVariant data);
138 bool MoveUpDown(
bool flag);
145 void DoButtonArrow(
MythUIImage *buttonarrow)
const;
152 static void DoButtonLookupState(
MythUIStateType *statetype,
const QString& name);
160 bool m_checkable {
false};
163 bool m_showArrow {
false};
164 bool m_isVisible {
false};
165 bool m_enabled {
true};
166 bool m_debugme {
false};
197 QRect area,
bool showArrow =
true,
198 bool showScrollBar =
false);
206 { MoveItem, MoveColumn,
MoveRow, MovePage, MoveMax,
211 void SetDrawFromBottom(
bool draw);
213 void Reset()
override;
216 virtual void SetValue(
int value) { MoveToNamedPosition(QString::number(value)); }
217 virtual void SetValue(
const QString &value) { MoveToNamedPosition(value); }
218 void SetValueByData(
const QVariant& data);
219 virtual int GetIntValue()
const;
220 virtual QString GetValue()
const;
221 QVariant GetDataValue()
const;
225 void SetItemCurrent(
int current,
int topPos = -1);
232 uint ItemWidth(
void);
233 uint ItemHeight(
void);
243 int GetCount()
const;
244 int GetVisibleCount();
245 bool IsEmpty()
const;
247 virtual bool MoveDown(MovementUnit unit = MoveItem,
uint amount = 0);
248 virtual bool MoveUp(MovementUnit unit = MoveItem,
uint amount = 0);
249 bool MoveToNamedPosition(
const QString &position_name);
253 void SetLCDTitles(
const QString &title,
const QString &columnList =
"");
254 void updateLCD(
void);
257 void ShowSearchDialog(
void);
258 bool Find(
const QString &searchStr,
bool startsWith =
false);
262 void LoadInBackground(
int start = 0,
int pageSize = 20);
268 void ToggleEnabled();
278 { ScrollFree, ScrollCenter, ScrollGroupCenter };
280 { ArrangeFixed, ArrangeFill, ArrangeSpread, ArrangeStack };
282 { WrapCaptive = -1, WrapNone = 0, WrapSelect = 1,
283 WrapItems = 2, WrapFlowing = 3 };
286 int alphaMod, QRect clipRect)
override;
292 int minButtonWidth(
const MythRect & area);
293 int minButtonHeight(
const MythRect & area);
296 MythUIGroup *PrepareButton(
int buttonIdx,
int itemIdx,
297 int & selectedIdx,
int & button_shift);
298 bool DistributeRow(
int & first_button,
int & last_button,
299 int & first_item,
int & last_item,
300 int & selected_column,
int & skip_cols,
301 bool grow_left,
bool grow_right,
302 int ** col_widths,
int & row_height,
303 int total_height,
int split_height,
304 int & col_cnt,
bool & wrapped);
305 bool DistributeCols(
int & first_button,
int & last_button,
306 int & first_item,
int & last_item,
307 int & selected_column,
int & selected_row,
308 int & skip_cols,
int ** col_widths,
309 QList<int> & row_heights,
310 int & top_height,
int & bottom_height,
312 bool DistributeButtons(
void);
313 void CalculateButtonPositions(
void);
314 void CalculateArrowStates(
void);
315 void SetScrollBarPosition(
void);
318 void SetActive(
bool active);
323 bool DoFind(
bool doMove,
bool searchForward);
325 void FindEnabledUp(MovementUnit unit);
326 void FindEnabledDown(MovementUnit unit);
329 virtual void CalculateVisibleItems(
void);
330 virtual QPoint GetButtonPosition(
int column,
int row)
const;
332 void SetButtonArea(
const MythRect &rect);
334 bool showWarnings)
override;
339 void SanitizePosition(
void);
347 int m_alignment {Qt::AlignLeft | Qt::AlignTop};
352 QString m_searchFields {
"**ALL**"};
354 bool m_searchStartsWith {
false};
357 int m_itemHeight {0};
358 int m_itemHorizSpacing {0};
359 int m_itemVertSpacing {0};
360 int m_itemsVisible {0};
361 int m_maxVisible {0};
364 int m_leftColumns {0};
365 int m_rightColumns {0};
367 int m_bottomRows {0};
369 bool m_active {
false};
370 bool m_showArrow {
true};
371 bool m_showScrollBar {
true};
383 bool m_initialized {
false};
384 bool m_needsUpdate {
false};
385 bool m_clearing {
false};
387 int m_selPosition {0};
388 int m_topPosition {0};
390 bool m_keepSelAtBottom {
false};
393 int m_nextItemLoaded {0};
395 bool m_drawFromBottom {
false};
411 m_parentList(parentList), m_searchText(std::move(searchText)) {}
414 bool Create(
void)
override;
418 void searchChanged(
void);
419 void prevClicked(
void);
420 void nextClicked(
void);
423 bool m_startsWith {
false};
virtual bool keyPressEvent(QKeyEvent *event)
Key event handler.
Image widget, displays a single image or multiple images in sequence.
virtual bool Create(void)
void customEvent(QEvent *event) override
A text entry and edit widget.
Create a group of widgets.
Screen in which all other widgets are contained and rendered.
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
virtual void CreateCopy(MythUIType *parent)
Copy the state of this widget to the one given, it must be of the same type.
virtual void DrawSelf(MythPainter *p, int xoffset, int yoffset, int alphaMod, QRect clipRect)
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
QHash< QString, QString > InfoMap
void(QObject::*)(void) MythUICallbackMF
Q_DECLARE_METATYPE(std::chrono::seconds)
int DecrRef(void) override
Decrements reference count and deletes on 0.
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
virtual void Reset(void)
Reset the widget to it's original state, should not reset changes made by the theme.
The base class on which all widgets and screens are based.
All purpose text widget, displays a text string.
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
virtual bool gestureEvent(MythGestureEvent *event)
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
A custom event that represents a mouse gesture.
void(QObject::*)(void) const MythUICallbackMFc
virtual bool ParseElement(const QString &filename, QDomElement &element, bool showWarnings)
Parse the xml definition of this widget setting the state of the object accordingly.
This widget is used for grouping other widgets for display when a particular named state is called....
virtual void Finalize(void)
Perform any post-xml parsing initialisation tasks.
Wrapper around QPoint allowing us to handle percentage and other relative values for positioning in m...