Go to the documentation of this file. 1 #ifndef MYTHUIBUTTONLIST_H_
2 #define MYTHUIBUTTONLIST_H_
38 QString image =
"",
bool checkable =
false,
39 CheckState state = CantCheck,
bool showArrow =
false,
40 int listPosition = -1);
42 QVariant data,
int listPosition = -1);
43 template <
typename SLOT>
45 const QString& text, SLOT slot,
int listPosition = -1)
47 template <
typename SLOT>
49 const QString& text, SLOT slot,
int listPosition = -1)
55 void SetText(
const QString &text,
const QString &name=
"",
56 const QString &state=
"");
57 void SetTextFromMap(
const InfoMap &infoMap,
const QString &state=
"");
58 void SetTextFromMap(
const QMap<QString, TextProperties> &stringMap);
59 QString GetText(
const QString &name=
"")
const;
61 bool FindText(
const QString &searchStr,
const QString &fieldList =
"**ALL**",
62 bool startsWith =
false)
const;
64 void SetFontState(
const QString &state,
const QString &name=
"");
69 void SetImage(
MythImage *image,
const QString &name=
"");
76 MythImage *GetImage(
const QString &name=
"");
91 void SetImage(
const QString &
filename,
const QString &name=
"",
92 bool force_reload =
false);
93 void SetImageFromMap(
const InfoMap &imageMap);
94 QString GetImageFilename(
const QString &name=
"")
const;
96 void DisplayState(
const QString &state,
const QString &name);
97 void SetStatesFromMap(
const InfoMap &stateMap);
102 bool checkable()
const;
103 void setCheckable(
bool flag);
105 bool isEnabled()
const;
106 void setEnabled(
bool flag);
108 CheckState state()
const;
109 void setChecked(CheckState state);
111 void setDrawArrow(
bool flag);
113 void SetData(QVariant data);
116 bool MoveUpDown(
bool flag);
126 bool m_checkable {
false};
129 bool m_showArrow {
false};
130 bool m_isVisible {
false};
131 bool m_enabled {
true};
157 QRect area,
bool showArrow =
true,
158 bool showScrollBar =
false);
169 void SetDrawFromBottom(
bool draw);
171 void Reset()
override;
174 virtual void SetValue(
int value) { MoveToNamedPosition(QString::number(value)); }
175 virtual void SetValue(
const QString &value) { MoveToNamedPosition(value); }
176 void SetValueByData(
const QVariant& data);
177 virtual int GetIntValue()
const;
178 virtual QString GetValue()
const;
179 QVariant GetDataValue()
const;
183 void SetItemCurrent(
int current,
int topPos = -1);
190 uint ItemWidth(
void);
191 uint ItemHeight(
void);
201 int GetCount()
const;
202 int GetVisibleCount();
203 bool IsEmpty()
const;
205 virtual bool MoveDown(MovementUnit unit = MoveItem,
uint amount = 0);
206 virtual bool MoveUp(MovementUnit unit = MoveItem,
uint amount = 0);
207 bool MoveToNamedPosition(
const QString &position_name);
211 void SetLCDTitles(
const QString &
title,
const QString &columnList =
"");
212 void updateLCD(
void);
215 void ShowSearchDialog(
void);
216 bool Find(
const QString &searchStr,
bool startsWith =
false);
220 void LoadInBackground(
int start = 0,
int pageSize = 20);
226 void ToggleEnabled();
236 enum ArrangeType { ArrangeFixed, ArrangeFill, ArrangeSpread, ArrangeStack };
237 enum WrapStyle { WrapCaptive = -1, WrapNone = 0, WrapSelect, WrapItems,
241 int alphaMod, QRect clipRect)
override;
247 int minButtonWidth(
const MythRect & area);
248 int minButtonHeight(
const MythRect & area);
251 MythUIGroup *PrepareButton(
int buttonIdx,
int itemIdx,
252 int & selectedIdx,
int & button_shift);
253 bool DistributeRow(
int & first_button,
int & last_button,
254 int & first_item,
int & last_item,
255 int & selected_column,
int & skip_cols,
256 bool grow_left,
bool grow_right,
257 int ** col_widths,
int & row_height,
258 int total_height,
int split_height,
259 int & col_cnt,
bool & wrapped);
260 bool DistributeCols(
int & first_button,
int & last_button,
261 int & first_item,
int & last_item,
262 int & selected_column,
int & selected_row,
263 int & skip_cols,
int ** col_widths,
264 QList<int> & row_heights,
265 int & top_height,
int & bottom_height,
267 bool DistributeButtons(
void);
268 void CalculateButtonPositions(
void);
269 void CalculateArrowStates(
void);
270 void SetScrollBarPosition(
void);
273 void SetActive(
bool active);
278 bool DoFind(
bool doMove,
bool searchForward);
280 void FindEnabledUp(MovementUnit unit);
281 void FindEnabledDown(MovementUnit unit);
284 virtual void CalculateVisibleItems(
void);
285 virtual QPoint GetButtonPosition(
int column,
int row)
const;
287 void SetButtonArea(
const MythRect &rect);
289 bool showWarnings)
override;
294 void SanitizePosition(
void);
302 int m_alignment {Qt::AlignLeft | Qt::AlignTop};
307 QString m_searchFields {
"**ALL**"};
309 bool m_searchStartsWith {
false};
312 int m_itemHeight {0};
313 int m_itemHorizSpacing {0};
314 int m_itemVertSpacing {0};
315 int m_itemsVisible {0};
316 int m_maxVisible {0};
319 int m_leftColumns {0};
320 int m_rightColumns {0};
322 int m_bottomRows {0};
324 bool m_active {
false};
325 bool m_showArrow {
true};
326 bool m_showScrollBar {
true};
338 bool m_initialized {
false};
339 bool m_needsUpdate {
false};
340 bool m_clearing {
false};
342 int m_selPosition {0};
343 int m_topPosition {0};
345 bool m_keepSelAtBottom {
false};
348 int m_nextItemLoaded {0};
350 bool m_drawFromBottom {
false};
366 m_parentList(parentList), m_searchText(
std::move(searchText)) {}
369 bool Create(
void)
override;
373 void searchChanged(
void);
374 void prevClicked(
void);
375 void nextClicked(
void);
378 bool m_startsWith {
false};
virtual bool keyPressEvent(QKeyEvent *event)
Key event handler.
Q_DECLARE_METATYPE(GrabberScript *)
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
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.
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...