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);
209 void SetDrawFromBottom(
bool draw);
211 void Reset()
override;
214 virtual void SetValue(
int value) { MoveToNamedPosition(QString::number(value)); }
215 virtual void SetValue(
const QString &value) { MoveToNamedPosition(value); }
216 void SetValueByData(
const QVariant& data);
217 virtual int GetIntValue()
const;
218 virtual QString GetValue()
const;
219 QVariant GetDataValue()
const;
223 void SetItemCurrent(
int current,
int topPos = -1);
230 uint ItemWidth(
void);
231 uint ItemHeight(
void);
241 int GetCount()
const;
242 int GetVisibleCount();
243 bool IsEmpty()
const;
245 virtual bool MoveDown(MovementUnit unit = MoveItem,
uint amount = 0);
246 virtual bool MoveUp(MovementUnit unit = MoveItem,
uint amount = 0);
247 bool MoveToNamedPosition(
const QString &position_name);
251 void SetLCDTitles(
const QString &title,
const QString &columnList =
"");
252 void updateLCD(
void);
255 void ShowSearchDialog(
void);
256 bool Find(
const QString &searchStr,
bool startsWith =
false);
260 void LoadInBackground(
int start = 0,
int pageSize = 20);
266 void ToggleEnabled();
276 enum ArrangeType { ArrangeFixed, ArrangeFill, ArrangeSpread, ArrangeStack };
277 enum WrapStyle { WrapCaptive = -1, WrapNone = 0, WrapSelect, WrapItems,
281 int alphaMod, QRect clipRect)
override;
287 int minButtonWidth(
const MythRect & area);
288 int minButtonHeight(
const MythRect & area);
291 MythUIGroup *PrepareButton(
int buttonIdx,
int itemIdx,
292 int & selectedIdx,
int & button_shift);
293 bool DistributeRow(
int & first_button,
int & last_button,
294 int & first_item,
int & last_item,
295 int & selected_column,
int & skip_cols,
296 bool grow_left,
bool grow_right,
297 int ** col_widths,
int & row_height,
298 int total_height,
int split_height,
299 int & col_cnt,
bool & wrapped);
300 bool DistributeCols(
int & first_button,
int & last_button,
301 int & first_item,
int & last_item,
302 int & selected_column,
int & selected_row,
303 int & skip_cols,
int ** col_widths,
304 QList<int> & row_heights,
305 int & top_height,
int & bottom_height,
307 bool DistributeButtons(
void);
308 void CalculateButtonPositions(
void);
309 void CalculateArrowStates(
void);
310 void SetScrollBarPosition(
void);
313 void SetActive(
bool active);
318 bool DoFind(
bool doMove,
bool searchForward);
320 void FindEnabledUp(MovementUnit unit);
321 void FindEnabledDown(MovementUnit unit);
324 virtual void CalculateVisibleItems(
void);
325 virtual QPoint GetButtonPosition(
int column,
int row)
const;
327 void SetButtonArea(
const MythRect &rect);
329 bool showWarnings)
override;
334 void SanitizePosition(
void);
342 int m_alignment {Qt::AlignLeft | Qt::AlignTop};
347 QString m_searchFields {
"**ALL**"};
349 bool m_searchStartsWith {
false};
352 int m_itemHeight {0};
353 int m_itemHorizSpacing {0};
354 int m_itemVertSpacing {0};
355 int m_itemsVisible {0};
356 int m_maxVisible {0};
359 int m_leftColumns {0};
360 int m_rightColumns {0};
362 int m_bottomRows {0};
364 bool m_active {
false};
365 bool m_showArrow {
true};
366 bool m_showScrollBar {
true};
378 bool m_initialized {
false};
379 bool m_needsUpdate {
false};
380 bool m_clearing {
false};
382 int m_selPosition {0};
383 int m_topPosition {0};
385 bool m_keepSelAtBottom {
false};
388 int m_nextItemLoaded {0};
390 bool m_drawFromBottom {
false};
406 m_parentList(parentList), m_searchText(
std::move(searchText)) {}
409 bool Create(
void)
override;
413 void searchChanged(
void);
414 void prevClicked(
void);
415 void nextClicked(
void);
418 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.
Q_DECLARE_METATYPE(StandardSetting *)
QHash< QString, QString > InfoMap
void(QObject::*)(void) MythUICallbackMF
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...