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;
207 void customEvent(QEvent *event)
override;
211 MoveMid, MoveByAmount };
213 { LayoutVertical, LayoutHorizontal, LayoutGrid };
216 void SetDrawFromBottom(
bool draw);
219 void Reset()
override;
222 virtual void SetValue(
int value) { MoveToNamedPosition(QString::number(value)); }
223 virtual void SetValue(
const QString &value) { MoveToNamedPosition(value); }
224 void SetValueByData(
const QVariant& data);
225 virtual int GetIntValue()
const;
226 virtual QString GetValue()
const;
227 QVariant GetDataValue()
const;
231 void SetItemCurrent(
int current,
int topPos = -1);
238 uint ItemWidth(
void);
239 uint ItemHeight(
void);
249 int GetCount()
const;
250 int GetVisibleCount();
251 bool IsEmpty()
const;
253 virtual bool MoveDown(MovementUnit unit = MoveItem,
uint amount = 0);
254 virtual bool MoveUp(MovementUnit unit = MoveItem,
uint amount = 0);
255 bool MoveToNamedPosition(
const QString &position_name);
259 bool IsShadowing(
void) {
return m_shadowListName == GetFocusedName(); }
260 void SetLCDTitles(
const QString &title,
const QString &columnList =
"");
261 void updateLCD(
void);
264 void ShowSearchDialog(
void);
265 bool Find(
const QString &searchStr,
bool startsWith =
false);
269 void LoadInBackground(
int start = 0,
int pageSize = 20);
275 void ToggleEnabled();
289 { WrapCaptive = -1, WrapNone = 0, WrapSelect = 1,
290 WrapItems = 2, WrapFlowing = 3 };
293 int alphaMod, QRect clipRect)
override;
299 int minButtonWidth(
const MythRect & area);
300 int minButtonHeight(
const MythRect & area);
303 MythUIGroup *PrepareButton(
int buttonIdx,
int itemIdx,
304 int & selectedIdx,
int & button_shift);
305 bool DistributeRow(
int & first_button,
int & last_button,
306 int & first_item,
int & last_item,
307 int & selected_column,
int & skip_cols,
308 bool grow_left,
bool grow_right,
309 int ** col_widths,
int & row_height,
310 int total_height,
int split_height,
311 int & col_cnt,
bool & wrapped);
312 bool DistributeCols(
int & first_button,
int & last_button,
313 int & first_item,
int & last_item,
314 int & selected_column,
int & selected_row,
315 int & skip_cols,
int ** col_widths,
316 QList<int> & row_heights,
317 int & top_height,
int & bottom_height,
319 bool DistributeButtons(
void);
320 void CalculateButtonPositions(
void);
321 void CalculateArrowStates(
void);
322 void SetScrollBarPosition(
void);
325 void SetActive(
bool active);
330 bool DoFind(
bool doMove,
bool searchForward);
332 void FindEnabledUp(MovementUnit unit);
333 void FindEnabledDown(MovementUnit unit);
336 virtual void CalculateVisibleItems(
void);
337 virtual QPoint GetButtonPosition(
int column,
int row)
const;
339 void SetButtonArea(
const MythRect &rect);
340 bool ParseElement(
const QString &
filename, QDomElement &element,
341 bool showWarnings)
override;
344 void Finalize(
void)
override;
346 void SanitizePosition(
void);
354 int m_defaultAlignment {Qt::AlignLeft | Qt::AlignTop};
355 std::optional<int> m_shadowAlignment {std::nullopt};
359 QString m_searchFields {
"**ALL**"};
361 bool m_searchStartsWith {
false};
364 int m_itemHeight {0};
365 int m_itemHorizSpacing {0};
366 int m_itemVertSpacing {0};
367 int m_itemsVisible {0};
368 int m_maxVisible {0};
371 int m_leftColumns {0};
372 int m_rightColumns {0};
374 int m_bottomRows {0};
378 bool m_active {
false};
379 bool m_showArrow {
true};
380 bool m_showScrollBar {
true};
392 bool m_initialized {
false};
393 bool m_needsUpdate {
false};
394 bool m_clearing {
false};
396 int m_selPosition {0};
397 int m_topPosition {0};
399 bool m_keepSelAtBottom {
false};
402 int m_nextItemLoaded {0};
404 bool m_defaultDrawFromBottom {
false};
405 std::optional<bool> m_shadowDrawFromBottom {std::nullopt};
421 m_parentList(parentList), m_searchText(std::move(searchText)) {}
424 bool Create(
void)
override;
425 bool keyPressEvent(QKeyEvent *event)
override;
428 void searchChanged(
void);
429 void prevClicked(
void);
430 void nextClicked(
void);
433 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.