1#ifndef MYTHUIBUTTONLIST_H_
2#define MYTHUIBUTTONLIST_H_
35using muibCbFn = QString (*)(
const QString &name,
void *data);
53 QString image =
"",
bool checkable =
false,
54 CheckState state = CantCheck,
bool showArrow =
false,
55 int listPosition = -1);
57 QVariant data,
int listPosition = -1);
58 template <
typename SLOT>
60 const QString& text, SLOT slot,
int listPosition = -1)
63 template <
typename SLOT>
65 const QString& text, SLOT slot,
int listPosition = -1)
72 void SetText(
const QString &text,
const QString &name=
"",
73 const QString &state=
"");
74 void SetTextFromMap(
const InfoMap &infoMap,
const QString &state=
"");
75 void SetTextFromMap(
const QMap<QString, TextProperties> &stringMap);
76 void SetTextCb(
muibCbFn fn,
void *data);
77 QString GetText(
const QString &name=
"")
const;
80 bool FindText(
const QString &searchStr,
const QString &fieldList =
"**ALL**",
81 bool startsWith =
false)
const;
83 void SetFontState(
const QString &state,
const QString &name=
"");
88 void SetImage(
MythImage *image,
const QString &name=
"");
95 MythImage *GetImage(
const QString &name=
"");
110 void SetImage(
const QString &
filename,
const QString &name=
"",
111 bool force_reload =
false);
112 void SetImageFromMap(
const InfoMap &imageMap);
113 void SetImageCb(
muibCbFn fn,
void *data);
114 QString GetImageFilename(
const QString &name=
"")
const;
116 void SetProgress1(
int start,
int total,
int used);
117 void SetProgress2(
int start,
int total,
int used);
119 void DisplayState(
const QString &state,
const QString &name);
120 void SetStatesFromMap(
const InfoMap &stateMap);
121 void SetStateCb(
muibCbFn fn,
void *data);
122 QString
GetState(
const QString &name);
127 bool checkable()
const;
128 void setCheckable(
bool flag);
130 bool isEnabled()
const;
131 void setEnabled(
bool flag);
133 CheckState state()
const;
134 void setChecked(CheckState state);
136 void setDrawArrow(
bool flag);
138 void SetData(QVariant data);
141 bool MoveUpDown(
bool flag);
148 void DoButtonArrow(
MythUIImage *buttonarrow)
const;
155 static void DoButtonLookupState(
MythUIStateType *statetype,
const QString& name);
163 bool m_checkable {
false};
166 bool m_showArrow {
false};
167 bool m_isVisible {
false};
168 bool m_enabled {
true};
169 bool m_debugme {
false};
199 QString shadow =
"");
201 QRect area,
bool showArrow =
true,
202 bool showScrollBar =
false);
205 bool keyPressEvent(QKeyEvent *event)
override;
210 MoveMid, MoveByAmount };
212 { LayoutVertical, LayoutHorizontal, LayoutGrid };
215 void SetDrawFromBottom(
bool draw);
218 void Reset()
override;
221 virtual void SetValue(
int value) { MoveToNamedPosition(QString::number(value)); }
222 virtual void SetValue(
const QString &value) { MoveToNamedPosition(value); }
223 void SetValueByData(
const QVariant& data);
224 virtual int GetIntValue()
const;
225 virtual QString GetValue()
const;
226 QVariant GetDataValue()
const;
230 void SetItemCurrent(
int current,
int topPos = -1);
237 uint ItemWidth(
void);
238 uint ItemHeight(
void);
248 int GetCount()
const;
249 int GetVisibleCount();
250 bool IsEmpty()
const;
252 virtual bool MoveDown(MovementUnit unit = MoveItem,
uint amount = 0);
253 virtual bool MoveUp(MovementUnit unit = MoveItem,
uint amount = 0);
254 bool MoveToNamedPosition(
const QString &position_name);
258 bool IsShadowing(
void) {
return m_shadowListName == GetFocusedName(); }
259 void SetLCDTitles(
const QString &title,
const QString &columnList =
"");
260 void updateLCD(
void);
263 void ShowSearchDialog(
void);
264 bool Find(
const QString &searchStr,
bool startsWith =
false);
268 void LoadInBackground(
int start = 0,
int pageSize = 20);
274 void ToggleEnabled();
283 void customEvent(QEvent *event)
override;
290 { WrapCaptive = -1, WrapNone = 0, WrapSelect = 1,
291 WrapItems = 2, WrapFlowing = 3 };
294 int alphaMod, QRect clipRect)
override;
300 int minButtonWidth(
const MythRect & area);
301 int minButtonHeight(
const MythRect & area);
304 MythUIGroup *PrepareButton(
int buttonIdx,
int itemIdx,
305 int & selectedIdx,
int & button_shift);
306 bool DistributeRow(
int & first_button,
int & last_button,
307 int & first_item,
int & last_item,
308 int & selected_column,
int & skip_cols,
309 bool grow_left,
bool grow_right,
310 int ** col_widths,
int & row_height,
311 int total_height,
int split_height,
312 int & col_cnt,
bool & wrapped);
313 bool DistributeCols(
int & first_button,
int & last_button,
314 int & first_item,
int & last_item,
315 int & selected_column,
int & selected_row,
316 int & skip_cols,
int ** col_widths,
317 QList<int> & row_heights,
318 int & top_height,
int & bottom_height,
320 bool DistributeButtons(
void);
321 void CalculateButtonPositions(
void);
322 void CalculateArrowStates(
void);
323 void SetScrollBarPosition(
void);
326 void SetActive(
bool active);
331 bool DoFind(
bool doMove,
bool searchForward);
333 void FindEnabledUp(MovementUnit unit);
334 void FindEnabledDown(MovementUnit unit);
337 virtual void CalculateVisibleItems(
void);
338 virtual QPoint GetButtonPosition(
int column,
int row)
const;
340 void SetButtonArea(
const MythRect &rect);
341 bool ParseElement(
const QString &
filename, QDomElement &element,
342 bool showWarnings)
override;
345 void Finalize(
void)
override;
347 void SanitizePosition(
void);
355 int m_defaultAlignment {Qt::AlignLeft | Qt::AlignTop};
356 std::optional<int> m_shadowAlignment {std::nullopt};
360 QString m_searchFields {
"**ALL**"};
362 bool m_searchStartsWith {
false};
365 int m_itemHeight {0};
366 int m_itemHorizSpacing {0};
367 int m_itemVertSpacing {0};
368 int m_itemsVisible {0};
369 int m_maxVisible {0};
372 int m_leftColumns {0};
373 int m_rightColumns {0};
375 int m_bottomRows {0};
379 bool m_active {
false};
380 bool m_showArrow {
true};
381 bool m_showScrollBar {
true};
393 bool m_initialized {
false};
394 bool m_needsUpdate {
false};
395 bool m_clearing {
false};
397 int m_selPosition {0};
398 int m_topPosition {0};
400 bool m_keepSelAtBottom {
false};
403 int m_nextItemLoaded {0};
405 bool m_defaultDrawFromBottom {
false};
406 std::optional<bool> m_shadowDrawFromBottom {std::nullopt};
422 m_parentList(parentList), m_searchText(std::move(searchText)) {}
425 bool Create(
void)
override;
426 bool keyPressEvent(QKeyEvent *event)
override;
429 void searchChanged(
void);
430 void prevClicked(
void);
431 void nextClicked(
void);
434 bool m_startsWith {
false};
A custom event that represents a mouse gesture.
int DecrRef(void) override
Decrements reference count and deletes on 0.
Wrapper around QPoint allowing us to handle percentage and other relative values for positioning in m...
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
Screen in which all other widgets are contained and rendered.
Create a group of widgets.
Image widget, displays a single image or multiple images in sequence.
This widget is used for grouping other widgets for display when a particular named state is called.
A text entry and edit widget.
All purpose text widget, displays a text string.
The base class on which all widgets and screens are based.
Q_DECLARE_METATYPE(std::chrono::seconds)
QHash< QString, QString > InfoMap
void(QObject::*)(void) const MythUICallbackMFc
void(QObject::*)(void) MythUICallbackMF
constexpr bool is_nonconst_member_func_v
constexpr bool is_const_member_func_v
QDateTime current(bool stripped)
Returns current Date and Time in UTC.