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;
415 if (last_item + 1 < end)
419 selectedIdx, button_shift);
421 if (buttonstate ==
nullptr)
427 if (*col_widths && width < (*col_widths)[col_idx])
428 width = (*col_widths)[col_idx];
431 if ((hsplit ? right_width : left_width + right_width) +
434 int total = hsplit ? right_width : left_width + right_width;
435 LOG(VB_GUI, LOG_DEBUG,
436 QString(
"button on right would exceed width: "
437 "%1+(%2)+%3 == %4 which is > %5")
452 row_height = std::max(row_height, height);
454 LOG(VB_GUI, LOG_DEBUG,
455 QString(
"Added button item %1 "
456 "R.width %2 height %3 total width %4+%5"
458 .arg(last_item).arg(width).arg(height)
459 .arg(left_width).arg(right_width).arg(max_width));
492 if (first_item > end)
494 buttonstate =
PrepareButton(first_button - 1, first_item - 1,
495 selectedIdx, button_shift);
497 if (buttonstate ==
nullptr)
503 if (*col_widths && width < (*col_widths)[col_idx])
504 width = (*col_widths)[col_idx];
507 if ((hsplit ? left_width : left_width + right_width) +
510 int total = hsplit ? left_width : left_width + right_width;
511 LOG(VB_GUI, LOG_DEBUG,
512 QString(
"button on left would exceed width: "
513 "%1+(%2)+%3 == %4 which is > %5")
528 row_height = std::max(row_height, height);
530 LOG(VB_GUI, LOG_DEBUG,
531 QString(
"Added button item %1 "
532 "L.width %2 height %3 total width %4+%5"
534 .arg(first_item).arg(width).arg(height)
535 .arg(left_width).arg(right_width).arg(max_width));
552 if (total_height > 0 &&
553 ((vsplit ? split_height : total_height) +
556 LOG(VB_GUI, LOG_DEBUG,
557 QString(
"%1 Height exceeded %2 + (%3) + %4 = %5 which is > %6")
558 .arg(vsplit ?
"Centering" :
"Total")
562 first_button = initial_first_button + button_shift;
563 last_button = initial_last_button + button_shift;
564 first_item = initial_first_item;
565 last_item = initial_last_item;
569 if (*col_widths ==
nullptr)
575 *col_widths =
new int[
static_cast<size_t>(col_cnt)];
577 for (col_idx = 0; col_idx < col_cnt; ++col_idx)
578 (*col_widths)[col_idx] = 0;
583 first_button += button_shift;
584 last_button += button_shift;
592 begin = first_button;
593 end = first_button + col_cnt;
597 end = last_button + 1;
598 begin = end - col_cnt;
601 for (buttonIdx = begin, col_idx = 0;
602 buttonIdx < end; ++buttonIdx, ++col_idx)
611 (*col_widths)[col_idx] = std::max((*col_widths)[col_idx], width);
614 if (selectedIdx == buttonIdx)
615 selected_column = col_idx;
622 if (total_height && underflow && col_cnt <
m_columns)
632 int &first_item,
int &last_item,
633 int &selected_column,
int &selected_row,
634 int &skip_cols,
int **col_widths,
635 QList<int> & row_heights,
636 int &top_height,
int &bottom_height,
670 if (last_item + 1 < end)
674 first_item, ++last_item, selected_column,
675 skip_cols,
false,
true, col_widths, height,
676 top_height + bottom_height, bottom_height,
682 if (selected_row == -1 && selected_column != -1)
683 selected_row = row_heights.size();
685 row_heights.push_back(height);
718 if (first_item > end)
722 --first_item, last_item, selected_column,
723 skip_cols,
true,
false, col_widths, height,
724 top_height + bottom_height, top_height,
730 if (selected_row == -1 && selected_column != -1)
731 selected_row = row_heights.size();
732 else if (selected_row != -1)
735 row_heights.push_front(height);
755 int first_button = 0;
757 int start_button = 0;
762 int *col_widths =
nullptr;
764 int selected_column = -1;
765 int selected_row = -1;
766 bool wrapped =
false;
767 bool grow_left =
true;
770 int bottom_height = 0;
772 QList<int> row_heights;
777 LOG(VB_GUI, LOG_DEBUG, QString(
"DistributeButtons: "
778 "selected item %1 total items %2")
799 first_item = last_item = start_item;
817 first_item = last_item = 0;
846 first_button = last_button = start_button;
851 first_item, last_item, selected_column,
852 skip_cols, grow_left,
true, &col_widths,
853 height, 0, 0, col_cnt, wrapped))
868 first_item = last_item = start_item;
874#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
877 start_button = std::max(
m_buttonList.size() / 2,
static_cast<qsizetype
>(0));
885 first_button = last_button = start_button;
888 selected_column = selected_row = -1;
891 first_item, last_item, selected_column,
892 skip_cols, grow_left,
true, &col_widths,
893 height, 0, 0, col_cnt, wrapped))
900 if (selected_column != -1)
903 row_heights.push_back(height);
906 top_height = bottom_height = (height / 2);
908 bottom_height = height;
915 first_item, last_item,
916 selected_column, selected_row,
917 skip_cols, &col_widths, row_heights,
918 top_height, bottom_height, wrapped))
922 col_widths =
nullptr;
928 m_rows = row_heights.size();
930 LOG(VB_GUI, LOG_DEBUG,
931 QString(
"%1 rows, %2 columns fit inside parent area %3x%4")
935 if (col_widths ==
nullptr)
939 int left_spacing = 0;
940 int right_spacing = 0;
942 int bottom_spacing = 0;
951 status_msg =
"Row heights: ";
953 for (
int row = 0; row <
m_rows; ++row)
958 if (row == selected_row)
961 top_height += (row_heights[row] / 2);
962 bottom_height += ((row_heights[row] / 2) + (row_heights[row] % 2));
978 status_msg += QString(
"%1").arg(row_heights[row]);
980 if (row == selected_row)
990 top_spacing = bottom_spacing = 0;
997 top_spacing = bottom_spacing =
1013 if (!
m_topRows || top_spacing > bottom_spacing)
1014 top_spacing = bottom_spacing;
1016 bottom_spacing = top_spacing;
1023 (top_height + bottom_height)) /
1029 top_height += (top_spacing *
m_topRows);
1043 y += std::max(bottom_height - top_height, 0);
1044 total = std::max(top_height, bottom_height) * 2;
1048 total = top_height + bottom_height;
1058 (top_height + bottom_height), 0);
1062 status_msg += QString(
" spacing top %1 bottom %2 fixed %3 offset %4")
1063 .arg(top_spacing).arg(bottom_spacing)
1066 LOG(VB_GUI, LOG_DEBUG, status_msg);
1072 int right_width = 0;
1075 status_msg =
"Col widths: ";
1077 for (
int col = 0; col <
m_columns; ++col)
1082 if (col == selected_column)
1085 left_width += (col_widths[col] / 2);
1086 right_width += ((col_widths[col] / 2) + (col_widths[col] % 2));
1102 status_msg += QString(
"%1").arg(col_widths[col]);
1104 if (col == selected_column)
1114 left_spacing = right_spacing = 0;
1121 left_spacing = right_spacing =
1138 left_spacing = right_spacing;
1140 right_spacing = left_spacing;
1147 (left_width + right_width)) /
1167 x_init += std::max(right_width - left_width, 0);
1168 total = std::max(left_width, right_width) * 2;
1172 total = left_width + right_width;
1182 (left_width + right_width), 0);
1184 min_rect.
setX(x_init);
1186 status_msg += QString(
" spacing left %1 right %2 fixed %3 offset %4")
1187 .arg(left_spacing).arg(right_spacing)
1189 LOG(VB_GUI, LOG_DEBUG, status_msg);
1197 int buttonIdx = first_button - skip_cols;
1202 int vertical_spacing = top_spacing;
1204 for (
int row = 0; row <
m_rows; ++row)
1207 int horizontal_spacing = left_spacing;
1209 for (
int col = 0; col <
m_columns && buttonIdx <= last_button; ++col)
1211 if (buttonIdx >= first_button)
1219 MythRect area = buttonstate->GetArea();
1222 if (alignment & Qt::AlignHCenter)
1224 else if (alignment & Qt::AlignRight)
1232 if (alignment & Qt::AlignVCenter)
1234 else if (alignment & Qt::AlignBottom)
1245 if (col == selected_column)
1247 horizontal_spacing = right_spacing;
1248 if (row == selected_row)
1252 x += col_widths[col] + horizontal_spacing;
1256 if (row == selected_row)
1257 vertical_spacing = bottom_spacing;
1259 y += row_heights[row] + vertical_spacing;
1261 min_rect.
setWidth(x - min_rect.x());
1267 for (buttonIdx = 0; buttonIdx < first_button; ++buttonIdx)
1271 for (buttonIdx =
m_maxVisible - 1; buttonIdx > last_button; --buttonIdx)
1287 delete[] col_widths;
1346 QList<MythUIButtonListItem *>::iterator it =
m_itemList.begin() +
1372 for (
int i = 0; i < button; ++i)
1375 bool seenSelected =
false;
1390 if (!realButton || !buttonItem)
1393 bool selected =
false;
1397 seenSelected =
true;
1446 QMap<int, MythUIButtonListItem*>::const_iterator i =
m_buttonToItem.constBegin();
1450 i.value()->setVisible(
false);
1502 if (listPosition >= 0 && listPosition <=
m_itemList.count())
1539 QMap<int, MythUIButtonListItem*>::iterator it =
m_buttonToItem.begin();
1542 if (it.value() == item)
1590 if (item->GetData() == data)
1645 return item->
GetText().toInt();
1693 return (++it !=
m_itemList.end()) ? *it :
nullptr;
1732 if (item->GetData() == data)
1754 QString name(
"buttonlist button 0");
1757 button->ConnectDependants(
true);
1797 for (; pos >= 0; --pos)
1806 if (buttonstate ==
nullptr)
1808 LOG(VB_GENERAL, LOG_ERR,
1809 "PageUp: Failed to query buttonlist state");
1814 (buttonstate->GetArea().width() / 2) >= max_width)
1850 for (; pos >= 0; pos -= dec)
1859 if (buttonstate ==
nullptr)
1861 LOG(VB_GENERAL, LOG_ERR,
1862 "PageUp: Failed to query buttonlist state");
1867 (buttonstate->GetArea().height() / 2) >= max_height)
1903 for (; pos < num_items; ++pos)
1912 if (buttonstate ==
nullptr)
1914 LOG(VB_GENERAL, LOG_ERR,
1915 "PageDown: Failed to query buttonlist state");
1920 (buttonstate->GetArea().width() / 2) >= max_width)
1930 return num_items - 1;
1956 for (; pos < num_items; pos += inc)
1967 LOG(VB_GENERAL, LOG_ERR,
1968 "PageDown: Failed to query buttonlist state");
1973 (buttonstate->GetArea().height() / 2) >= max_height)
1983 return num_items - 1;
2087 for (
uint i = 0; i < amount; ++i)
2121 if (m_selPosition < 0 || m_selPosition >=
m_itemList.size() ||
2166 if (m_selPosition < 0 || m_selPosition >=
m_itemList.size() ||
2305 for (
uint i = 0; i < amount; ++i)
2343 bool found_it =
false;
2344 int selectedPosition = 0;
2345 QList<MythUIButtonListItem *>::iterator it =
m_itemList.begin();
2349 if ((*it)->GetText() == position_name)
2379 bool dolast =
false;
2418 for (
const auto & it : std::as_const(
m_itemList)) {
2419 it->setChecked(state);
2447 LOG(VB_GENERAL, LOG_ERR, QString(
"(%1) Statetype buttonitem is "
2448 "required in mythuibuttonlist: %2")
2460 if (buttonActiveState)
2461 buttonItemArea = buttonActiveState->
GetArea();
2484 QString name = QString(
"buttonlist button %1").arg(i);
2487 button->ConnectDependants(
true);
2510 if (buttonSelectedState)
2546 QStringList actions;
2547 bool handled =
false;
2551 for (
const QString&
action : std::as_const(actions))
2560 QKeySequence a(key);
2564#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
2566 Qt::KeyboardModifiers modifiers = Qt::NoModifier;
2567 QStringList parts = key.split(
'+');
2568 for (
int j = 0; j < parts.count(); ++j)
2570 if (parts[j].toUpper() ==
"CTRL")
2571 modifiers |= Qt::ControlModifier;
2572 if (parts[j].toUpper() ==
"SHIFT")
2573 modifiers |= Qt::ShiftModifier;
2574 if (parts[j].toUpper() ==
"ALT")
2575 modifiers |= Qt::AltModifier;
2576 if (parts[j].toUpper() ==
"META")
2577 modifiers |= Qt::MetaModifier;
2580 int keyCode = a[0].key();
2581 Qt::KeyboardModifiers modifiers = a[0].keyboardModifiers();
2584 QCoreApplication::postEvent(
2586 new QKeyEvent(QEvent::KeyPress, keyCode, modifiers, key));
2587 QCoreApplication::postEvent(
2589 new QKeyEvent(QEvent::KeyRelease, keyCode, modifiers, key));
2595 for (
int i = 0; i < actions.size() && !handled; ++i)
2597 const QString&
action = actions[i];
2607 else if (
action ==
"DOWN")
2614 else if (
action ==
"RIGHT")
2632 else if (
action ==
"LEFT")
2650 else if (
action ==
"PAGEUP")
2654 else if (
action ==
"PAGEDOWN")
2658 else if (
action ==
"PAGETOP")
2662 else if (
action ==
"PAGEMIDDLE")
2666 else if (
action ==
"PAGEBOTTOM")
2670 else if (
action ==
"SELECT")
2677 else if (
action ==
"SEARCH")
2695 bool handled =
false;
2702 QPoint position =
event->GetPosition() -
2714 QString name =
object->objectName();
2716 if (name ==
"upscrollarrow")
2720 else if (name ==
"downscrollarrow")
2724 else if (name.startsWith(
"buttonlist button"))
2726 int pos = name.section(
' ', 2, 2).toInt();
2805 (QEvent::Type) QEvent::registerEventType();
2813 int cur = npe->m_start;
2814 for (; cur < npe->m_start + npe->m_pageSize && cur <
GetCount(); ++cur)
2816 const int loginterval = (cur < 1000 ? 100 : 500);
2817 if (cur > 200 && cur % loginterval == 0)
2818 LOG(VB_GUI, LOG_INFO,
2819 QString(
"Build background buttonlist item %1").arg(cur));
2909 const QString &
filename, QDomElement &element,
bool showWarnings)
2911 if (element.tagName() ==
"buttonarea")
2915 else if (element.tagName() ==
"layout")
2919 if (layout ==
"grid")
2921 else if (layout ==
"horizontal")
2926 else if (element.tagName() ==
"arrange")
2930 if (arrange ==
"fill")
2932 else if (arrange ==
"spread")
2934 else if (arrange ==
"stack")
2940 else if (element.tagName() ==
"align")
2945 else if (element.tagName() ==
"shadowalign")
2950 else if (element.tagName() ==
"scrollstyle")
2954 if (layout ==
"center")
2956 else if (layout ==
"groupcenter")
2958 else if (layout ==
"free")
2961 else if (element.tagName() ==
"wrapstyle")
2965 if (wrapstyle ==
"captive")
2967 else if (wrapstyle ==
"none")
2969 else if (wrapstyle ==
"selection")
2971 else if (wrapstyle ==
"flowing")
2973 else if (wrapstyle ==
"items")
2976 else if (element.tagName() ==
"showarrow")
2980 else if (element.tagName() ==
"showscrollbar")
2984 else if (element.tagName() ==
"spacing")
2989 else if (element.tagName() ==
"drawfrombottom")
2996 else if (element.tagName() ==
"shadowdrawfrombottom")
3003 else if (element.tagName() ==
"searchposition")
3007 else if (element.tagName() ==
"triggerevent")
3010 if (!trigger.isEmpty())
3012 QString
action = element.attribute(
"action",
"");
3019 QString context = element.attribute(
"context",
"");
3021 QStringList keys = keylist.split(
',', Qt::SkipEmptyParts);
3104 QString name = QString(
"buttonlist button %1").arg(i);
3136 if (lcddev ==
nullptr)
3140 QList<LCDMenuItem> menuItems;
3145 for (
int r = start; r < end; ++r)
3167 text +=
" ~ " + props.
text;
3175 text +=
" ~ " + item->
GetText();
3179 if (!text.isEmpty())
3180 menuItems.append(
LCDMenuItem(selected, state, text));
3185 if (!menuItems.isEmpty())
3202 QRect dialogArea = dlg->GetArea();
3205 x = (screenArea.width() - dialogArea.width()) / 2;
3208 y = (screenArea.height() - dialogArea.height()) / 2;
3210 dlg->SetPosition(x, y);
3225 return DoFind(
false,
true);
3230 return DoFind(
true,
true);
3235 return DoFind(
true,
false);
3247 int currPos = startPos;
3293 if (startPos == currPos)
3303 QString text, QString image,
3305 bool showArrow,
int listPosition)
3306 : m_parent(lbtype), m_text(std::move(text)), m_imageFilename(std::move(image)),
3307 m_checkable(checkable), m_state(state), m_showArrow(showArrow)
3310 LOG(VB_GENERAL, LOG_ERR,
"Cannot add a button to a non-existent list!");
3320 const QString &text,
3321 QVariant data,
int listPosition)
3324 LOG(VB_GENERAL, LOG_ERR,
"Cannot add a button to a non-existent list!");
3328 m_data = std::move(data);
3350 QMap<QString, MythImage*>::iterator it;
3360 const QString &state)
3362 if (!name.isEmpty())
3365 textprop.
text = text;
3379 const QString &state)
3381 InfoMap::const_iterator map_it = infoMap.begin();
3383 while (map_it != infoMap.end())
3386 textprop.
text = (*map_it);
3415 if (!result.isEmpty())
3430 if (!result.isEmpty())
3431 return {.text=result, .state=
""};
3439 bool startsWith)
const
3441 if (fieldList.isEmpty())
3444 return m_text.startsWith(searchStr, Qt::CaseInsensitive);
3445 return m_text.contains(searchStr, Qt::CaseInsensitive);
3447 if (fieldList ==
"**ALL**")
3451 if (
m_text.startsWith(searchStr, Qt::CaseInsensitive))
3456 if (
m_text.contains(searchStr, Qt::CaseInsensitive))
3460 QMap<QString, TextProperties>::const_iterator i =
m_strings.constBegin();
3466 if (i.value().text.startsWith(searchStr, Qt::CaseInsensitive))
3471 if (i.value().text.contains(searchStr, Qt::CaseInsensitive))
3480 QStringList fields = fieldList.split(
',', Qt::SkipEmptyParts);
3481 for (
int x = 0; x < fields.count(); ++x)
3483 if (
m_strings.contains(fields.at(x).trimmed()))
3487 if (
m_strings[fields.at(x)].text.startsWith(searchStr, Qt::CaseInsensitive))
3492 if (
m_strings[fields.at(x)].text.contains(searchStr, Qt::CaseInsensitive))
3503 const QString &name)
3505 if (!name.isEmpty())
3524 if (!name.isEmpty())
3526 QMap<QString, MythImage*>::iterator it =
m_images.find(name);
3565 if (!name.isEmpty())
3567 QMap<QString, MythImage*>::iterator it =
m_images.find(name);
3584 const QString &
filename,
const QString &name,
bool force_reload)
3586 bool do_update = force_reload;
3588 if (!name.isEmpty())
3621 if (!result.isEmpty())
3654 const QString &name)
3659 bool do_update =
false;
3660 InfoMap::iterator it =
m_states.find(name);
3667 else if (*it !=
state)
3696 if (!result.isEmpty())
3752 m_data = std::move(data);
3784 buttonimage->
Load();
3819 if (!buttonprogress)
3827 if (!buttonprogress)
3841 static const QRegularExpression re {R
"(%(([^\|%]+)?\||\|(.))?([\w#]+)(\|(.+?))?%)",
3842 QRegularExpression::DotMatchesEverythingOption};
3844 if (!newText.isEmpty() && newText.contains(re))
3846 QString tempString = newText;
3848 QRegularExpressionMatchIterator i = re.globalMatch(newText);
3849 while (i.hasNext()) {
3850 QRegularExpressionMatch match = i.next();
3851 QString key = match.captured(4).toLower().trimmed();
3852 QString replacement;
3855 if (!value.isEmpty())
3857 replacement = QString(
"%1%2%3%4")
3858 .arg(match.captured(2),
3864 tempString.replace(match.captured(0), replacement);
3867 newText = tempString;
3871 newText = textprop.
text;
3874 if (newText.isEmpty())
3951 else if (
state ==
"selectedinactive" &&
3952 button->
GetState(
"selectedshadow"))
3953 state =
"selectedshadow";
3960 LOG(VB_GUI, LOG_WARNING,
"Theme Error: Missing buttonlist state: disabled");
3966 LOG(VB_GUI, LOG_WARNING,
"Theme Error: Missing buttonlist state: inactive");
3974 LOG(VB_GENERAL, LOG_CRIT, QString(
"Theme Error: Missing buttonlist state: %1")
3979 buttonstate->Reset();
3981 QList<MythUIType *> descendants = buttonstate->GetAllDescendants();
3982 for (
MythUIType *obj : std::as_const(descendants))
3984 QString name = obj->objectName();
3985 if (name ==
"buttontext")
3987 else if (name ==
"buttonimage")
3989 else if (name ==
"buttonarrow")
3991 else if (name ==
"buttoncheck")
3993 else if (name ==
"buttonprogress1")
3995 else if (name ==
"buttonprogress2")
3999 if (!textprop.
text.isEmpty())
4010 if (!luState.isEmpty())
4035 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'MythSearchListDialog'");
4055 QStringList actions;
4058 for (
int i = 0; i < actions.size() && !handled; ++i)
4060 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)