8#include <QCoreApplication>
11#include <QRegularExpression>
29#define LOC QString("MythUIButtonList(%1): ").arg(objectName())
34 , m_shadowListName(
std::move(shadow))
44 const QRect area,
bool showArrow,
47 m_showArrow(showArrow), m_showScrollBar(showScrollBar)
100void MythUIButtonList::SetDrawFromBottom(
bool draw)
102 m_drawFromBottom = draw;
160 int width = area.width();
168 width += ((area.x() * 2) - 1);
190 int height = area.height();
198 height += ((area.y() * 2) - 1);
221 buttonIdx += button_shift;
225 QString name = QString(
"buttonlist button %1").arg(
m_maxVisible);
228 button->ConnectDependants(
true);
240 if (selectedIdx >= 0)
258 selectedIdx = buttonIdx;
267 int &first_item,
int &last_item,
268 int &selected_column,
int &skip_cols,
269 bool grow_left,
bool grow_right,
270 int **col_widths,
int &row_height,
271 int total_height,
int split_height,
272 int &col_cnt,
bool &wrapped)
279 bool underflow =
false;
281 int selectedIdx = -1;
282 int button_shift = 0;
286 if (last_item + 1 >
m_itemCount || last_item < 0 || first_item < 0)
296 selectedIdx, button_shift);
301 selectedIdx, button_shift);
304 if (buttonstate ==
nullptr)
306 LOG(VB_GENERAL, LOG_ERR, QString(
"Failed to query buttonlist state: %1")
322 bool hsplit = vsplit && grow_left && grow_right;
327 left_width = right_width = (width / 2);
351 if (total_height > 0 &&
352 ((vsplit ? split_height : total_height) +
355 LOG(VB_GUI, LOG_DEBUG,
356 QString(
"%1 Height exceeded %2 + (%3) + %4 = %5 which is > %6")
357 .arg(vsplit ?
"Centering" :
"Total")
361 first_button += button_shift;
362 last_button += button_shift;
366 LOG(VB_GUI, LOG_DEBUG, QString(
"Added button item %1 width %2 height %3")
367 .arg(grow_right ? last_item : first_item)
368 .arg(width).arg(row_height));
370 int initial_first_button = first_button;
371 int initial_last_button = last_button;
372 int initial_first_item = first_item;
373 int initial_last_item = last_item;
413 if (last_item + 1 < end)
417 selectedIdx, button_shift);
419 if (buttonstate ==
nullptr)
425 if (*col_widths && width < (*col_widths)[col_idx])
426 width = (*col_widths)[col_idx];
429 if ((hsplit ? right_width : left_width + right_width) +
432 int total = hsplit ? right_width : left_width + right_width;
433 LOG(VB_GUI, LOG_DEBUG,
434 QString(
"button on right would exceed width: "
435 "%1+(%2)+%3 == %4 which is > %5")
450 row_height = std::max(row_height, height);
452 LOG(VB_GUI, LOG_DEBUG,
453 QString(
"Added button item %1 "
454 "R.width %2 height %3 total width %4+%5"
456 .arg(last_item).arg(width).arg(height)
457 .arg(left_width).arg(right_width).arg(max_width));
488 if (first_item > end)
490 buttonstate =
PrepareButton(first_button - 1, first_item - 1,
491 selectedIdx, button_shift);
493 if (buttonstate ==
nullptr)
499 if (*col_widths && width < (*col_widths)[col_idx])
500 width = (*col_widths)[col_idx];
503 if ((hsplit ? left_width : left_width + right_width) +
506 int total = hsplit ? left_width : left_width + right_width;
507 LOG(VB_GUI, LOG_DEBUG,
508 QString(
"button on left would exceed width: "
509 "%1+(%2)+%3 == %4 which is > %5")
524 row_height = std::max(row_height, height);
526 LOG(VB_GUI, LOG_DEBUG,
527 QString(
"Added button item %1 "
528 "L.width %2 height %3 total width %4+%5"
530 .arg(first_item).arg(width).arg(height)
531 .arg(left_width).arg(right_width).arg(max_width));
548 if (total_height > 0 &&
549 ((vsplit ? split_height : total_height) +
552 LOG(VB_GUI, LOG_DEBUG,
553 QString(
"%1 Height exceeded %2 + (%3) + %4 = %5 which is > %6")
554 .arg(vsplit ?
"Centering" :
"Total")
558 first_button = initial_first_button + button_shift;
559 last_button = initial_last_button + button_shift;
560 first_item = initial_first_item;
561 last_item = initial_last_item;
565 if (*col_widths ==
nullptr)
571 *col_widths =
new int[
static_cast<size_t>(col_cnt)];
573 for (col_idx = 0; col_idx < col_cnt; ++col_idx)
574 (*col_widths)[col_idx] = 0;
579 first_button += button_shift;
580 last_button += button_shift;
588 begin = first_button;
589 end = first_button + col_cnt;
593 end = last_button + 1;
594 begin = end - col_cnt;
597 for (buttonIdx = begin, col_idx = 0;
598 buttonIdx < end; ++buttonIdx, ++col_idx)
607 (*col_widths)[col_idx] = std::max((*col_widths)[col_idx], width);
610 if (selectedIdx == buttonIdx)
611 selected_column = col_idx;
618 if (total_height && underflow && col_cnt <
m_columns)
628 int &first_item,
int &last_item,
629 int &selected_column,
int &selected_row,
630 int &skip_cols,
int **col_widths,
631 QList<int> & row_heights,
632 int &top_height,
int &bottom_height,
664 if (last_item + 1 < end)
668 first_item, ++last_item, selected_column,
669 skip_cols,
false,
true, col_widths, height,
670 top_height + bottom_height, bottom_height,
676 if (selected_row == -1 && selected_column != -1)
677 selected_row = row_heights.size();
679 row_heights.push_back(height);
710 if (first_item > end)
714 --first_item, last_item, selected_column,
715 skip_cols,
true,
false, col_widths, height,
716 top_height + bottom_height, top_height,
722 if (selected_row == -1 && selected_column != -1)
723 selected_row = row_heights.size();
724 else if (selected_row != -1)
727 row_heights.push_front(height);
747 int first_button = 0;
749 int start_button = 0;
754 int *col_widths =
nullptr;
756 int selected_column = -1;
757 int selected_row = -1;
758 bool wrapped =
false;
759 bool grow_left =
true;
762 int bottom_height = 0;
764 QList<int> row_heights;
769 LOG(VB_GUI, LOG_DEBUG, QString(
"DistributeButtons: "
770 "selected item %1 total items %2")
791 first_item = last_item = start_item;
809 first_item = last_item = 0;
838 first_button = last_button = start_button;
843 first_item, last_item, selected_column,
844 skip_cols, grow_left,
true, &col_widths,
845 height, 0, 0, col_cnt, wrapped))
860 first_item = last_item = start_item;
866#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
869 start_button = std::max(
m_buttonList.size() / 2,
static_cast<qsizetype
>(0));
877 first_button = last_button = start_button;
880 selected_column = selected_row = -1;
883 first_item, last_item, selected_column,
884 skip_cols, grow_left,
true, &col_widths,
885 height, 0, 0, col_cnt, wrapped))
892 if (selected_column != -1)
895 row_heights.push_back(height);
898 top_height = bottom_height = (height / 2);
900 bottom_height = height;
907 first_item, last_item,
908 selected_column, selected_row,
909 skip_cols, &col_widths, row_heights,
910 top_height, bottom_height, wrapped))
914 col_widths =
nullptr;
920 m_rows = row_heights.size();
922 LOG(VB_GUI, LOG_DEBUG,
923 QString(
"%1 rows, %2 columns fit inside parent area %3x%4")
927 if (col_widths ==
nullptr)
931 int left_spacing = 0;
932 int right_spacing = 0;
934 int bottom_spacing = 0;
943 status_msg =
"Row heights: ";
945 for (
int row = 0; row <
m_rows; ++row)
950 if (row == selected_row)
953 top_height += (row_heights[row] / 2);
954 bottom_height += ((row_heights[row] / 2) + (row_heights[row] % 2));
970 status_msg += QString(
"%1").arg(row_heights[row]);
972 if (row == selected_row)
982 top_spacing = bottom_spacing = 0;
989 top_spacing = bottom_spacing =
1005 if (!
m_topRows || top_spacing > bottom_spacing)
1006 top_spacing = bottom_spacing;
1008 bottom_spacing = top_spacing;
1015 (top_height + bottom_height)) /
1021 top_height += (top_spacing *
m_topRows);
1035 y += std::max(bottom_height - top_height, 0);
1036 total = std::max(top_height, bottom_height) * 2;
1040 total = top_height + bottom_height;
1050 (top_height + bottom_height), 0);
1054 status_msg += QString(
" spacing top %1 bottom %2 fixed %3 offset %4")
1055 .arg(top_spacing).arg(bottom_spacing)
1058 LOG(VB_GUI, LOG_DEBUG, status_msg);
1064 int right_width = 0;
1067 status_msg =
"Col widths: ";
1069 for (
int col = 0; col <
m_columns; ++col)
1074 if (col == selected_column)
1077 left_width += (col_widths[col] / 2);
1078 right_width += ((col_widths[col] / 2) + (col_widths[col] % 2));
1094 status_msg += QString(
"%1").arg(col_widths[col]);
1096 if (col == selected_column)
1106 left_spacing = right_spacing = 0;
1113 left_spacing = right_spacing =
1130 left_spacing = right_spacing;
1132 right_spacing = left_spacing;
1139 (left_width + right_width)) /
1159 x_init += std::max(right_width - left_width, 0);
1160 total = std::max(left_width, right_width) * 2;
1164 total = left_width + right_width;
1174 (left_width + right_width), 0);
1176 min_rect.
setX(x_init);
1178 status_msg += QString(
" spacing left %1 right %2 fixed %3 offset %4")
1179 .arg(left_spacing).arg(right_spacing)
1181 LOG(VB_GUI, LOG_DEBUG, status_msg);
1189 int buttonIdx = first_button - skip_cols;
1194 int vertical_spacing = top_spacing;
1196 for (
int row = 0; row <
m_rows; ++row)
1199 int horizontal_spacing = left_spacing;
1201 for (
int col = 0; col <
m_columns && buttonIdx <= last_button; ++col)
1203 if (buttonIdx >= first_button)
1211 MythRect area = buttonstate->GetArea();
1214 if (alignment & Qt::AlignHCenter)
1216 else if (alignment & Qt::AlignRight)
1224 if (alignment & Qt::AlignVCenter)
1226 else if (alignment & Qt::AlignBottom)
1237 if (col == selected_column)
1239 horizontal_spacing = right_spacing;
1240 if (row == selected_row)
1244 x += col_widths[col] + horizontal_spacing;
1248 if (row == selected_row)
1249 vertical_spacing = bottom_spacing;
1251 y += row_heights[row] + vertical_spacing;
1253 min_rect.
setWidth(x - min_rect.x());
1259 for (buttonIdx = 0; buttonIdx < first_button; ++buttonIdx)
1263 for (buttonIdx =
m_maxVisible - 1; buttonIdx > last_button; --buttonIdx)
1279 delete[] col_widths;
1338 QList<MythUIButtonListItem *>::iterator it =
m_itemList.begin() +
1364 for (
int i = 0; i < button; ++i)
1367 bool seenSelected =
false;
1382 if (!realButton || !buttonItem)
1385 bool selected =
false;
1389 seenSelected =
true;
1438 QMap<int, MythUIButtonListItem*>::const_iterator i =
m_buttonToItem.constBegin();
1442 i.value()->setVisible(
false);
1494 if (listPosition >= 0 && listPosition <=
m_itemList.count())
1531 QMap<int, MythUIButtonListItem*>::iterator it =
m_buttonToItem.begin();
1534 if (it.value() == item)
1582 if (item->GetData() == data)
1637 return item->
GetText().toInt();
1685 return (++it !=
m_itemList.end()) ? *it :
nullptr;
1724 if (item->GetData() == data)
1746 QString name(
"buttonlist button 0");
1749 button->ConnectDependants(
true);
1789 for (; pos >= 0; --pos)
1798 if (buttonstate ==
nullptr)
1800 LOG(VB_GENERAL, LOG_ERR,
1801 "PageUp: Failed to query buttonlist state");
1806 (buttonstate->GetArea().width() / 2) >= max_width)
1842 for (; pos >= 0; pos -= dec)
1851 if (buttonstate ==
nullptr)
1853 LOG(VB_GENERAL, LOG_ERR,
1854 "PageUp: Failed to query buttonlist state");
1859 (buttonstate->GetArea().height() / 2) >= max_height)
1895 for (; pos < num_items; ++pos)
1904 if (buttonstate ==
nullptr)
1906 LOG(VB_GENERAL, LOG_ERR,
1907 "PageDown: Failed to query buttonlist state");
1912 (buttonstate->GetArea().width() / 2) >= max_width)
1922 return num_items - 1;
1948 for (; pos < num_items; pos += inc)
1959 LOG(VB_GENERAL, LOG_ERR,
1960 "PageDown: Failed to query buttonlist state");
1965 (buttonstate->GetArea().height() / 2) >= max_height)
1975 return num_items - 1;
2079 for (
uint i = 0; i < amount; ++i)
2113 if (m_selPosition < 0 || m_selPosition >=
m_itemList.size() ||
2158 if (m_selPosition < 0 || m_selPosition >=
m_itemList.size() ||
2297 for (
uint i = 0; i < amount; ++i)
2335 bool found_it =
false;
2336 int selectedPosition = 0;
2337 QList<MythUIButtonListItem *>::iterator it =
m_itemList.begin();
2341 if ((*it)->GetText() == position_name)
2371 bool dolast =
false;
2410 for (
const auto & it : std::as_const(
m_itemList)) {
2411 it->setChecked(state);
2439 LOG(VB_GENERAL, LOG_ERR, QString(
"(%1) Statetype buttonitem is "
2440 "required in mythuibuttonlist: %2")
2452 if (buttonActiveState)
2453 buttonItemArea = buttonActiveState->
GetArea();
2476 QString name = QString(
"buttonlist button %1").arg(i);
2479 button->ConnectDependants(
true);
2502 if (buttonSelectedState)
2538 QStringList actions;
2539 bool handled =
false;
2543 for (
const QString&
action : std::as_const(actions))
2552 QKeySequence a(key);
2556#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
2558 Qt::KeyboardModifiers modifiers = Qt::NoModifier;
2559 QStringList parts = key.split(
'+');
2560 for (
int j = 0; j < parts.count(); ++j)
2562 if (parts[j].toUpper() ==
"CTRL")
2563 modifiers |= Qt::ControlModifier;
2564 if (parts[j].toUpper() ==
"SHIFT")
2565 modifiers |= Qt::ShiftModifier;
2566 if (parts[j].toUpper() ==
"ALT")
2567 modifiers |= Qt::AltModifier;
2568 if (parts[j].toUpper() ==
"META")
2569 modifiers |= Qt::MetaModifier;
2572 int keyCode = a[0].key();
2573 Qt::KeyboardModifiers modifiers = a[0].keyboardModifiers();
2576 QCoreApplication::postEvent(
2578 new QKeyEvent(QEvent::KeyPress, keyCode, modifiers, key));
2579 QCoreApplication::postEvent(
2581 new QKeyEvent(QEvent::KeyRelease, keyCode, modifiers, key));
2587 for (
int i = 0; i < actions.size() && !handled; ++i)
2589 const QString&
action = actions[i];
2599 else if (
action ==
"DOWN")
2606 else if (
action ==
"RIGHT")
2622 else if (
action ==
"LEFT")
2638 else if (
action ==
"PAGEUP")
2642 else if (
action ==
"PAGEDOWN")
2646 else if (
action ==
"PAGETOP")
2650 else if (
action ==
"PAGEMIDDLE")
2654 else if (
action ==
"PAGEBOTTOM")
2658 else if (
action ==
"SELECT")
2665 else if (
action ==
"SEARCH")
2683 bool handled =
false;
2690 QPoint position =
event->GetPosition() -
2702 QString name =
object->objectName();
2704 if (name ==
"upscrollarrow")
2708 else if (name ==
"downscrollarrow")
2712 else if (name.startsWith(
"buttonlist button"))
2714 int pos = name.section(
' ', 2, 2).toInt();
2789 (QEvent::Type) QEvent::registerEventType();
2797 int cur = npe->m_start;
2798 for (; cur < npe->m_start + npe->m_pageSize && cur <
GetCount(); ++cur)
2800 const int loginterval = (cur < 1000 ? 100 : 500);
2801 if (cur > 200 && cur % loginterval == 0)
2802 LOG(VB_GUI, LOG_INFO,
2803 QString(
"Build background buttonlist item %1").arg(cur));
2893 const QString &
filename, QDomElement &element,
bool showWarnings)
2895 if (element.tagName() ==
"buttonarea")
2897 else if (element.tagName() ==
"layout")
2901 if (layout ==
"grid")
2903 else if (layout ==
"horizontal")
2908 else if (element.tagName() ==
"arrange")
2912 if (arrange ==
"fill")
2914 else if (arrange ==
"spread")
2916 else if (arrange ==
"stack")
2922 else if (element.tagName() ==
"align")
2927 else if (element.tagName() ==
"shadowalign")
2932 else if (element.tagName() ==
"scrollstyle")
2936 if (layout ==
"center")
2938 else if (layout ==
"groupcenter")
2940 else if (layout ==
"free")
2943 else if (element.tagName() ==
"wrapstyle")
2947 if (wrapstyle ==
"captive")
2949 else if (wrapstyle ==
"none")
2951 else if (wrapstyle ==
"selection")
2953 else if (wrapstyle ==
"flowing")
2955 else if (wrapstyle ==
"items")
2958 else if (element.tagName() ==
"showarrow")
2962 else if (element.tagName() ==
"showscrollbar")
2966 else if (element.tagName() ==
"spacing")
2971 else if (element.tagName() ==
"drawfrombottom")
2978 else if (element.tagName() ==
"shadowdrawfrombottom")
2985 else if (element.tagName() ==
"searchposition")
2989 else if (element.tagName() ==
"triggerevent")
2992 if (!trigger.isEmpty())
2994 QString
action = element.attribute(
"action",
"");
3001 QString context = element.attribute(
"context",
"");
3003 QStringList keys = keylist.split(
',', Qt::SkipEmptyParts);
3086 QString name = QString(
"buttonlist button %1").arg(i);
3118 if (lcddev ==
nullptr)
3122 QList<LCDMenuItem> menuItems;
3127 for (
int r = start; r < end; ++r)
3149 text +=
" ~ " + props.
text;
3157 text +=
" ~ " + item->
GetText();
3161 if (!text.isEmpty())
3162 menuItems.append(
LCDMenuItem(selected, state, text));
3167 if (!menuItems.isEmpty())
3184 QRect dialogArea = dlg->GetArea();
3187 x = (screenArea.width() - dialogArea.width()) / 2;
3190 y = (screenArea.height() - dialogArea.height()) / 2;
3192 dlg->SetPosition(x, y);
3207 return DoFind(
false,
true);
3212 return DoFind(
true,
true);
3217 return DoFind(
true,
false);
3229 int currPos = startPos;
3275 if (startPos == currPos)
3285 QString text, QString image,
3287 bool showArrow,
int listPosition)
3288 : m_parent(lbtype), m_text(
std::move(text)), m_imageFilename(
std::move(image)),
3289 m_checkable(checkable), m_state(state), m_showArrow(showArrow)
3292 LOG(VB_GENERAL, LOG_ERR,
"Cannot add a button to a non-existent list!");
3302 const QString &text,
3303 QVariant data,
int listPosition)
3306 LOG(VB_GENERAL, LOG_ERR,
"Cannot add a button to a non-existent list!");
3310 m_data = std::move(data);
3332 QMap<QString, MythImage*>::iterator it;
3342 const QString &state)
3344 if (!name.isEmpty())
3347 textprop.
text = text;
3361 const QString &state)
3363 InfoMap::const_iterator map_it = infoMap.begin();
3365 while (map_it != infoMap.end())
3368 textprop.
text = (*map_it);
3397 if (!result.isEmpty())
3412 if (!result.isEmpty())
3413 return {result,
""};
3421 bool startsWith)
const
3423 if (fieldList.isEmpty())
3426 return m_text.startsWith(searchStr, Qt::CaseInsensitive);
3427 return m_text.contains(searchStr, Qt::CaseInsensitive);
3429 if (fieldList ==
"**ALL**")
3433 if (
m_text.startsWith(searchStr, Qt::CaseInsensitive))
3438 if (
m_text.contains(searchStr, Qt::CaseInsensitive))
3442 QMap<QString, TextProperties>::const_iterator i =
m_strings.constBegin();
3448 if (i.value().text.startsWith(searchStr, Qt::CaseInsensitive))
3453 if (i.value().text.contains(searchStr, Qt::CaseInsensitive))
3462 QStringList fields = fieldList.split(
',', Qt::SkipEmptyParts);
3463 for (
int x = 0; x < fields.count(); ++x)
3465 if (
m_strings.contains(fields.at(x).trimmed()))
3469 if (
m_strings[fields.at(x)].text.startsWith(searchStr, Qt::CaseInsensitive))
3474 if (
m_strings[fields.at(x)].text.contains(searchStr, Qt::CaseInsensitive))
3485 const QString &name)
3487 if (!name.isEmpty())
3506 if (!name.isEmpty())
3508 QMap<QString, MythImage*>::iterator it =
m_images.find(name);
3547 if (!name.isEmpty())
3549 QMap<QString, MythImage*>::iterator it =
m_images.find(name);
3566 const QString &
filename,
const QString &name,
bool force_reload)
3568 bool do_update = force_reload;
3570 if (!name.isEmpty())
3603 if (!result.isEmpty())
3636 const QString &name)
3641 bool do_update =
false;
3642 InfoMap::iterator it =
m_states.find(name);
3649 else if (*it !=
state)
3678 if (!result.isEmpty())
3734 m_data = std::move(data);
3766 buttonimage->
Load();
3801 if (!buttonprogress)
3809 if (!buttonprogress)
3823 static const QRegularExpression re {R
"(%(([^\|%]+)?\||\|(.))?([\w#]+)(\|(.+?))?%)",
3824 QRegularExpression::DotMatchesEverythingOption};
3826 if (!newText.isEmpty() && newText.contains(re))
3828 QString tempString = newText;
3830 QRegularExpressionMatchIterator i = re.globalMatch(newText);
3831 while (i.hasNext()) {
3832 QRegularExpressionMatch match = i.next();
3833 QString key = match.captured(4).toLower().trimmed();
3834 QString replacement;
3837 if (!value.isEmpty())
3839 replacement = QString(
"%1%2%3%4")
3840 .arg(match.captured(2),
3846 tempString.replace(match.captured(0), replacement);
3849 newText = tempString;
3853 newText = textprop.
text;
3856 if (newText.isEmpty())
3931 else if (
state ==
"selectedinactive" &&
3932 button->
GetState(
"selectedshadow"))
3933 state =
"selectedshadow";
3940 LOG(VB_GUI, LOG_WARNING,
"Theme Error: Missing buttonlist state: disabled");
3946 LOG(VB_GUI, LOG_WARNING,
"Theme Error: Missing buttonlist state: inactive");
3954 LOG(VB_GENERAL, LOG_CRIT, QString(
"Theme Error: Missing buttonlist state: %1")
3959 buttonstate->Reset();
3961 QList<MythUIType *> descendants = buttonstate->GetAllDescendants();
3962 for (
MythUIType *obj : std::as_const(descendants))
3964 QString name = obj->objectName();
3965 if (name ==
"buttontext")
3967 else if (name ==
"buttonimage")
3969 else if (name ==
"buttonarrow")
3971 else if (name ==
"buttoncheck")
3973 else if (name ==
"buttonprogress1")
3975 else if (name ==
"buttonprogress2")
3979 if (!textprop.
text.isEmpty())
3990 if (!luState.isEmpty())
4015 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'MythSearchListDialog'");
4035 QStringList actions;
4038 for (
int i = 0; i < actions.size() && !handled; ++i)
4040 const QString&
action = actions[i];
void switchToMenu(QList< LCDMenuItem > &menuItems, const QString &app_name="", bool popMenu=true)
int getLCDHeight(void) const
A custom event that represents a mouse gesture.
Gesture GetGesture() const
int DecrRef(void) override
Decrements reference count and deletes on 0.
int IncrRef(void) override
Increments reference count.
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
MythScreenStack * GetStack(const QString &Stackname)
static QString GetKey(const QString &Context, const QString &Action)
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
MythPoint topLeft(void) const
void setY(const QString &sY)
void setX(const QString &sX)
void setWidth(const QString &sWidth)
void setHeight(const QString &sHeight)
void CalculateArea(QRect parentArea)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
void BuildFocusList(void)
MythUIType * GetFocusWidget(void) const
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Create a group of widgets.
Image widget, displays a single image or multiple images in sequence.
bool Load(bool allowLoadInBackground=true, bool forceStat=false)
Load the image(s), wraps ImageLoader::LoadImage()
void SetFilename(const QString &filename)
Must be followed by a call to Load() to load the image.
void SetImage(MythImage *img)
Should not be used unless absolutely necessary since it bypasses the image caching and threaded loade...
void Reset(void) override
Reset the image back to the default defined in the theme.
void Set(int start, int total, int used)
This widget is used for grouping other widgets for display when a particular named state is called.
MythUIType * GetState(const QString &name)
MythUIType * GetCurrentState()
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
bool DisplayState(const QString &name)
QString GetText(void) const
void SetText(const QString &text, bool moveCursor=true)
All purpose text widget, displays a text string.
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
QString GetTemplateText(void) const
void SetFontState(const QString &state)
virtual void SetText(const QString &text)
The base class on which all widgets and screens are based.
bool IsEnabled(void) const
void SetCanTakeFocus(bool set=true)
Set whether this widget can take focus.
virtual void SetVisible(bool visible)
QString GetXMLLocation(void) const
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
virtual void Finalize(void)
Perform any post-xml parsing initialisation tasks.
MythUIType * GetChildAt(QPoint p, bool recursive=true, bool focusable=true) const
Return the first MythUIType at the given coordinates.
virtual void SetMinArea(const MythRect &rect)
Set the minimum area based on the given size.
static int NormY(int height)
virtual MythRect GetArea(void) const
If the object has a minimum area defined, return it, other wise return the default area.
virtual MythRect GetFullArea(void) const
void SetPosition(int x, int y)
Convenience method, calls SetPosition(const MythPoint&) Override that instead to change functionality...
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
void DeleteChild(const QString &name)
Delete a named child of this UIType.
void DependChanged(bool isDefault)
virtual void Reset(void)
Reset the widget to it's original state, should not reset changes made by the theme.
virtual bool ParseElement(const QString &filename, QDomElement &element, bool showWarnings)
Parse the xml definition of this widget setting the state of the object accordingly.
static int NormX(int width)
NextButtonListPageEvent(int start, int pageSize)
static const Type kEventType
static MythRect parseRect(const QString &text, bool normalize=true)
static MythPoint parsePoint(const QString &text, bool normalize=true)
static int parseAlignment(const QString &text)
static bool CopyWindowFromBase(const QString &windowname, MythScreenType *win)
static QString getFirstText(QDomElement &element)
static bool parseBool(const QString &text)
static pid_list_t::iterator find(const PIDInfoMap &map, pid_list_t &list, pid_list_t::iterator begin, pid_list_t::iterator end, bool find_open)
A C++ ripoff of the stroke library for MythTV.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
MythMainWindow * GetMythMainWindow(void)
QHash< QString, QString > InfoMap
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)