1 #ifndef MYTHUIBUTTONLIST_H_ 2 #define MYTHUIBUTTONLIST_H_ 34 QString image =
"",
bool checkable =
false,
35 CheckState state = CantCheck,
bool showArrow =
false,
36 int listPosition = -1);
38 QVariant data,
int listPosition = -1);
43 void SetText(
const QString &text,
const QString &name=
"",
44 const QString &state=
"");
45 void SetTextFromMap(
const InfoMap &infoMap,
const QString &state=
"");
46 void SetTextFromMap(
const QMap<QString, TextProperties> &stringMap);
47 QString GetText(
const QString &name=
"")
const;
49 bool FindText(
const QString &searchStr,
const QString &fieldList =
"**ALL**",
50 bool startsWith =
false)
const;
52 void SetFontState(
const QString &state,
const QString &name=
"");
57 void SetImage(
MythImage *image,
const QString &name=
"");
64 MythImage *GetImage(
const QString &name=
"");
79 void SetImage(
const QString &
filename,
const QString &name=
"",
80 bool force_reload =
false);
81 void SetImageFromMap(
const InfoMap &imageMap);
82 QString GetImageFilename(
const QString &name=
"")
const;
84 void DisplayState(
const QString &state,
const QString &name);
85 void SetStatesFromMap(
const InfoMap &stateMap);
90 bool checkable()
const;
91 void setCheckable(
bool flag);
93 bool isEnabled()
const;
94 void setEnabled(
bool flag);
96 CheckState state()
const;
97 void setChecked(CheckState state);
99 void setDrawArrow(
bool flag);
101 void SetData(QVariant data);
104 bool MoveUpDown(
bool flag);
117 bool m_showArrow {
false};
118 bool m_isVisible {
false};
119 bool m_enabled {
true};
145 const QRect &area,
bool showArrow =
true,
146 bool showScrollBar =
false);
157 void SetDrawFromBottom(
bool draw);
159 void Reset()
override;
162 virtual void SetValue(
int value) { MoveToNamedPosition(QString::number(value)); }
163 virtual void SetValue(
const QString &value) { MoveToNamedPosition(value); }
164 void SetValueByData(
const QVariant& data);
165 virtual int GetIntValue()
const;
166 virtual QString GetValue()
const;
167 QVariant GetDataValue()
const;
171 void SetItemCurrent(
int current,
int topPos = -1);
178 uint ItemWidth(
void);
179 uint ItemHeight(
void);
189 int GetCount()
const;
190 uint GetVisibleCount();
191 bool IsEmpty()
const;
193 virtual bool MoveDown(MovementUnit unit = MoveItem,
uint amount = 0);
194 virtual bool MoveUp(MovementUnit unit = MoveItem,
uint amount = 0);
195 bool MoveToNamedPosition(
const QString &position_name);
199 void SetLCDTitles(
const QString &title,
const QString &columnList =
"");
200 void updateLCD(
void);
203 void ShowSearchDialog(
void);
204 bool Find(
const QString &searchStr,
bool startsWith =
false);
208 void LoadInBackground(
int start = 0,
int pageSize = 20);
214 void ToggleEnabled();
224 enum ArrangeType { ArrangeFixed, ArrangeFill, ArrangeSpread, ArrangeStack };
225 enum WrapStyle { WrapCaptive = -1, WrapNone = 0, WrapSelect, WrapItems,
229 int alphaMod, QRect clipRect)
override;
235 int minButtonWidth(
const MythRect & area);
236 int minButtonHeight(
const MythRect & area);
239 MythUIGroup *PrepareButton(
int buttonIdx,
int itemIdx,
240 int & selectedIdx,
int & button_shift);
241 bool DistributeRow(
int & first_button,
int & last_button,
242 int & first_item,
int & last_item,
243 int & selected_column,
int & skip_cols,
244 bool grow_left,
bool grow_right,
245 int ** col_widths,
int & row_height,
246 int total_height,
int split_height,
247 int & col_cnt,
bool & wrapped);
248 bool DistributeCols(
int & first_button,
int & last_button,
249 int & first_item,
int & last_item,
250 int & selected_column,
int & selected_row,
251 int & skip_cols,
int ** col_widths,
252 QList<int> & row_heights,
253 int & top_height,
int & bottom_height,
255 bool DistributeButtons(
void);
256 void CalculateButtonPositions(
void);
257 void CalculateArrowStates(
void);
258 void SetScrollBarPosition(
void);
261 void SetActive(
bool active);
266 bool DoFind(
bool doMove,
bool searchForward);
268 void FindEnabledUp(MovementUnit unit);
269 void FindEnabledDown(MovementUnit unit);
272 virtual void CalculateVisibleItems(
void);
273 virtual QPoint GetButtonPosition(
int column,
int row)
const;
275 void SetButtonArea(
const MythRect &rect);
277 bool showWarnings)
override;
282 void SanitizePosition(
void);
290 int m_alignment {Qt::AlignLeft | Qt::AlignTop};
295 QString m_searchFields {
"**ALL**"};
297 bool m_searchStartsWith {
false};
300 int m_itemHeight {0};
301 int m_itemHorizSpacing {0};
302 int m_itemVertSpacing {0};
304 int m_maxVisible {0};
307 int m_leftColumns {0};
308 int m_rightColumns {0};
310 int m_bottomRows {0};
312 bool m_active {
false};
313 bool m_showArrow {
true};
314 bool m_showScrollBar {
true};
326 bool m_initialized {
false};
327 bool m_needsUpdate {
false};
328 bool m_clearing {
false};
330 int m_selPosition {0};
331 int m_topPosition {0};
333 bool m_keepSelAtBottom {
false};
336 int m_nextItemLoaded {0};
338 bool m_drawFromBottom {
false};
354 m_parentList(parentList), m_searchText(searchText) {}
357 bool Create(
void)
override;
361 void searchChanged(
void);
362 void prevClicked(
void);
363 void nextClicked(
void);
366 bool m_startsWith {
false};
This widget is used for grouping other widgets for display when a particular named state is called.
virtual bool keyPressEvent(QKeyEvent *event)
Key event handler.
void customEvent(QEvent *event) override
QHash< QString, QString > InfoMap
int DecrRef(void) override
Decrements reference count and deletes on 0.
virtual bool gestureEvent(MythGestureEvent *event)
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
virtual bool Create(void)
Q_DECLARE_METATYPE(GrabberScript *)
The base class on which all widgets and screens are based.
virtual void CreateCopy(MythUIType *parent)
Copy the state of this widget to the one given, it must be of the same type.
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
A text entry and edit widget.
Create a group of widgets.
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
virtual void DrawSelf(MythPainter *p, int xoffset, int yoffset, int alphaMod, QRect clipRect)
A custom event that represents a mouse gesture.
bool keyPressEvent(QKeyEvent *) override
Key event handler.
virtual void Reset(void)
Reset the widget to it's original state, should not reset changes made by the theme.
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
Wrapper around QPoint allowing us to handle percentage and other relative values for positioning in m...
Screen in which all other widgets are contained and rendered.
virtual bool ParseElement(const QString &filename, QDomElement &element, bool showWarnings)
Parse the xml definition of this widget setting the state of the object accordingly.
virtual void Finalize(void)
Perform any post-xml parsing initialisation tasks.