MythTV  master
mythuitype.cpp
Go to the documentation of this file.
1 
2 // Own header
3 #include "mythuitype.h"
4 
5 // C++ headers
6 #include <utility>
7 
8 // QT headers
9 #include <QDomDocument>
10 #include <QEvent>
11 #include <QKeyEvent>
12 #include <QInputMethodEvent>
13 #include <QDomDocument>
14 
15 // XML headers
16 #include "xmlparsebase.h"
17 
18 // Mythbase headers
19 #include "mythlogging.h"
20 #include "mythrandom.h"
21 #include "mythmedia.h"
22 
23 // MythUI headers
24 #include "mythgesture.h"
25 #include "mythimage.h"
26 #include "mythpainter.h"
27 #include "mythmainwindow.h"
28 #include "mythfontproperties.h"
29 #include "mythuitext.h"
30 #include "mythuiimage.h"
31 #include "mythuibutton.h"
32 #include "mythuicheckbox.h"
33 #include "mythuibuttonlist.h"
34 #include "mythuitextedit.h"
35 #include "mythuiprogressbar.h"
36 #include "mythuispinbox.h"
37 #include "mythuigroup.h"
38 #include "mythgesture.h"
39 
40 #ifdef _MSC_VER
41 # include "compat.h" // random
42 #endif
43 
44 #define LOC QString("MythUIType: ")
45 
46 MythUIType::MythUIType(QObject *parent, const QString &name)
47  : QObject(parent)
48 {
49  setObjectName(name);
50 
51  if (parent)
52  {
53  m_parent = qobject_cast<MythUIType *>(parent);
54 
55  if (m_parent)
56  m_parent->AddChild(this);
57  }
58 
59  m_fonts = new FontMap();
60 
61 #if QT_VERSION < QT_VERSION_CHECK(5,10,0)
62  m_borderColor = QColor(MythRandom() % 255, MythRandom() % 255, MythRandom() % 255);
63 #else
64  // for debugging/theming
65  m_borderColor = QColor(MythRandom(0, 255), MythRandom(0, 255), MythRandom(0, 255));
66 #endif
67 }
68 
70 {
71  delete m_fonts;
72  qDeleteAll(m_animations);
73 }
74 
80 {
81  // Reset all children
82  QMutableListIterator<MythUIType *> it(m_childrenList);
83 
84  while (it.hasNext())
85  {
86  it.next();
87  MythUIType *type = it.value();
88  type->Reset();
89  }
90 }
91 
96 {
97  if (!child)
98  return;
99 
100  m_childrenList.push_back(child);
101 }
102 
103 static QObject *qChildHelper(const char *objName, const char *inheritsClass,
104  bool recursiveSearch, const QObjectList &children)
105 {
106  if (children.isEmpty())
107  return nullptr;
108 
109  bool onlyWidgets = (inheritsClass
110  && qstrcmp(inheritsClass, "QWidget") == 0);
111  const QLatin1String oName(objName);
112 
113  for (auto *obj : qAsConst(children))
114  {
115  if (onlyWidgets)
116  {
117  if (obj->isWidgetType() && (!objName || obj->objectName() == oName))
118  return obj;
119  }
120  else if ((!inheritsClass || obj->inherits(inheritsClass))
121  && (!objName || obj->objectName() == oName))
122  return obj;
123 
124  if (recursiveSearch && (qobject_cast<MythUIGroup *>(obj) != nullptr)
125  && (obj = qChildHelper(objName, inheritsClass,
126  recursiveSearch,
127  obj->children())))
128  return obj;
129  }
130 
131  return nullptr;
132 }
133 
140 MythUIType *MythUIType::GetChild(const QString &name) const
141 {
142  QObject *ret = qChildHelper(name.toLatin1().constData(), nullptr, true, children());
143 
144  if (ret)
145  return qobject_cast<MythUIType *>(ret);
146 
147  return nullptr;
148 }
149 
155 void MythUIType::DeleteChild(const QString &name)
156 {
157  QMutableListIterator<MythUIType *> it(m_childrenList);
158 
159  while (it.hasNext())
160  {
161  it.next();
162  MythUIType *type = it.value();
163 
164  if (type->objectName() == name)
165  {
166  delete type;
167  it.remove();
168  return;
169  }
170  }
171 }
172 
180 {
181  if (!child)
182  return;
183 
184  QMutableListIterator<MythUIType *> it(m_childrenList);
185 
186  while (it.hasNext())
187  {
188  it.next();
189  MythUIType *type = it.value();
190 
191  if (type == child)
192  {
193  delete type;
194  it.remove();
195  child = nullptr;
196  return;
197  }
198  }
199 }
200 
204 QList<MythUIType *> *MythUIType::GetAllChildren(void)
205 {
206  return &m_childrenList;
207 }
208 
209 QList<MythUIType *> MythUIType::GetAllDescendants(void)
210 {
211  QList<MythUIType *> descendants {};
212 
213  for (const auto & item :qAsConst(m_childrenList))
214  {
215  descendants += item;
216  descendants += item->GetAllDescendants();
217  }
218  return descendants;
219 }
220 
225 {
226  QList<MythUIType *>::iterator it;
227 
228  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
229  if (*it)
230  delete *it;
231 
232  m_childrenList.clear();
233 }
234 
243 MythUIType *MythUIType::GetChildAt(const QPoint p, bool recursive,
244  bool focusable) const
245 {
246  if (GetArea().contains(p))
247  {
248  if (!IsVisible() || !IsEnabled())
249  return nullptr;
250 
251  if (m_childrenList.isEmpty())
252  return nullptr;
253 
254  /* check all children */
255  QList<MythUIType *>::const_iterator it;
256 
257  for (it = m_childrenList.end() - 1; it != m_childrenList.begin() - 1; --it)
258  {
259  if (!(*it))
260  continue;
261 
262  // If this point doesn't fall within the child's area then move on
263  // This requires that the area is actually accurate and in some
264  // cases this still isn't true
265  if (!(*it)->GetArea().contains(p - GetArea().topLeft()))
266  continue;
267 
268 
269  MythUIType *child = *it;
270 
271  if (recursive && (focusable && !child->CanTakeFocus()))
272  child = child->GetChildAt(p - GetArea().topLeft(), recursive,
273  focusable);
274 
275  if (child)
276  {
277  // NOTE: Assumes no selectible ui type will contain another
278  // selectible ui type.
279  if (focusable && !child->CanTakeFocus())
280  continue;
281 
282  return child;
283  }
284  }
285  }
286 
287  return nullptr;
288 }
289 
291 {
292  for (MythUIAnimation* animation : qAsConst(m_animations))
293  if (animation->GetTrigger() == trigger)
294  animation->Activate();
295 
296  for (MythUIType* uiType : qAsConst(m_childrenList))
297  uiType->ActivateAnimations(trigger);
298 }
299 
300 bool MythUIType::NeedsRedraw(void) const
301 {
302  return m_needsRedraw;
303 }
304 
306 {
307  m_needsRedraw = false;
308 
309  QList<MythUIType *>::Iterator it;
310 
311  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
312  (*it)->ResetNeedsRedraw();
313 }
314 
316 {
317  if (m_area.width() == 0 || m_area.height() == 0)
318  return;
319 
320  m_needsRedraw = true;
321 
322  if (m_dirtyRegion.isEmpty())
323  m_dirtyRegion = QRegion(m_area.toQRect());
324  else
325  m_dirtyRegion = m_dirtyRegion.united(QRegion(m_area.toQRect()));
326 
327  if (m_parent)
329 }
330 
332 {
333  QRegion childRegion = child->GetDirtyArea();
334 
335  if (childRegion.isEmpty())
336  return;
337 
338  childRegion.translate(m_area.x(), m_area.y());
339 
340  childRegion = childRegion.intersected(m_area.toQRect());
341 
342  m_needsRedraw = true;
343 
344  if (m_dirtyRegion.isEmpty())
345  m_dirtyRegion = childRegion;
346  else
347  m_dirtyRegion = m_dirtyRegion.united(childRegion);
348 
349  if (m_parent)
351 }
352 
356 bool MythUIType::CanTakeFocus(void) const
357 {
358  return m_canHaveFocus;
359 }
360 
365 {
366  m_canHaveFocus = set;
367 }
368 
375 {
376  if (!GetPainter()->SupportsAnimation())
377  return;
378 
379  if (!m_moving)
380  return;
381 
382  QPoint curXY = m_area.topLeft().toQPoint();
384 
385  int xdir = m_xyDestination.x() - curXY.x();
386  int ydir = m_xyDestination.y() - curXY.y();
387 
388  curXY.setX(curXY.x() + m_xySpeed.x());
389  curXY.setY(curXY.y() + m_xySpeed.y());
390 
391  if ((xdir > 0 && curXY.x() >= m_xyDestination.x()) ||
392  (xdir < 0 && curXY.x() <= m_xyDestination.x()) ||
393  (xdir == 0))
394  {
395  m_xySpeed.setX(0);
396  }
397 
398  if ((ydir > 0 && curXY.y() >= m_xyDestination.y()) ||
399  (ydir <= 0 && curXY.y() <= m_xyDestination.y()) ||
400  (ydir == 0))
401  {
402  m_xySpeed.setY(0);
403  }
404 
405  SetRedraw();
406 
407  if (m_xySpeed.x() == 0 && m_xySpeed.y() == 0)
408  {
409  m_moving = false;
410  emit FinishedMoving();
411  }
412 
413  m_area.moveTopLeft(curXY);
414 }
415 
422 {
423  if (!GetPainter()->SupportsAlpha() ||
424  !GetPainter()->SupportsAnimation())
425  return;
426 
427  if (m_alphaChangeMode == 0)
428  return;
429 
431 
434 
437 
438  // Reached limits so change direction
440  {
441  if (m_alphaChangeMode == 2)
442  {
443  m_alphaChange *= -1;
444  }
445  else
446  {
447  m_alphaChangeMode = 0;
448  m_alphaChange = 0;
449  emit FinishedFading();
450  }
451  }
452 
453  SetRedraw();
454 }
455 
463 {
464  if (!m_visible || m_vanished)
465  return;
466 
469 
470  QList<MythUIAnimation*>::Iterator i;
471  for (i = m_animations.begin(); i != m_animations.end(); ++i)
472  (*i)->IncrementCurrentTime();
473 
474  QList<MythUIType *>::Iterator it;
475 
476  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
477  (*it)->Pulse();
478 }
479 
480 int MythUIType::CalcAlpha(int alphamod) const
481 {
482  return (int)(m_effects.m_alpha * (alphamod / 255.0));
483 }
484 
485 void MythUIType::DrawSelf(MythPainter * /*p*/, int /*xoffset*/, int /*yoffset*/,
486  int /*alphaMod*/, QRect /*clipRect*/)
487 {
488 }
489 
490 void MythUIType::Draw(MythPainter *p, int xoffset, int yoffset, int alphaMod,
491  QRect clipRect)
492 {
493  // NB m_dirtyRegion may be extended by HandleMovementPulse, SetRedraw
494  // or SetChildNeedsRedraw etc _AFTER_ GetDirtyArea is called.
495  // So clipRect may not include the whole of m_dirtyRegion
496  m_dirtyRegion -= QRegion(clipRect); // NB Qt >= 4.2
497 
498  if (!m_visible || m_vanished)
499  return;
500 
501  QRect realArea = m_area.toQRect();
502  realArea.translate(xoffset, yoffset);
503 
504  if (!realArea.intersects(clipRect))
505  return;
506 
507  p->PushTransformation(m_effects, m_effects.GetCentre(m_area, xoffset, yoffset));
508 
509  DrawSelf(p, xoffset, yoffset, alphaMod, clipRect);
510 
511  QList<MythUIType *>::Iterator it;
512 
513  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
514  {
515  (*it)->Draw(p, xoffset + m_area.x(), yoffset + m_area.y(),
516  CalcAlpha(alphaMod), clipRect);
517  }
518 
519  if (p->ShowBorders())
520  {
521  static const QBrush kNullBrush(Qt::NoBrush);
522  QPen pen(m_borderColor);
523  pen.setWidth(1);
524  p->DrawRect(realArea, kNullBrush, pen, 255);
525 
526  if (p->ShowTypeNames())
527  {
528  MythFontProperties font;
529  font.SetFace(QFont("Droid Sans"));
530  font.SetColor(m_borderColor);
531  font.SetPointSize(8);
532  p->DrawText(realArea, objectName(), 0, font, 255, realArea);
533  }
534  }
535 
536  p->PopTransformation();
537 }
538 
539 void MythUIType::SetPosition(int x, int y)
540 {
541  SetPosition(MythPoint(x, y));
542 }
543 
544 void MythUIType::SetPosition(QPoint point)
545 {
546  SetPosition(MythPoint(point));
547 }
548 
550 {
551  MythPoint pos(point);
552 
553  if (m_parent)
555  else
556  pos.CalculatePoint(GetMythMainWindow()->GetUIScreenRect());
557 
558  if (m_area.topLeft() == pos)
559  return;
560 
561  m_dirtyRegion = QRegion(m_area.toQRect());
562 
563  m_area.moveTopLeft(pos);
564 
565  RecalculateArea(false);
566 
567  SetRedraw();
568 }
569 
571 {
572  return m_area.topLeft();
573 }
574 
575 void MythUIType::SetSize(const QSize size)
576 {
577  if (size == m_area.size())
578  return;
579 
580  m_dirtyRegion = QRegion(m_area.toQRect());
581 
582  m_area.setSize(size);
583  RecalculateArea();
584 
585  if (m_parent)
587 
588  SetRedraw();
589 }
590 
596 void MythUIType::SetMinSize(const MythPoint &minsize)
597 {
598  MythPoint point(minsize);
599 
600  if (m_parent)
602 
603  m_minSize = point;
604 
605  SetRedraw();
606 }
607 
608 QSize MythUIType::GetMinSize(void) const
609 {
610  if (!m_minSize.isValid())
611  return m_area.size();
612 
613  return {m_minSize.x(), m_minSize.y()};
614 }
615 
616 void MythUIType::SetArea(const MythRect &rect)
617 {
618  if (rect == m_area)
619  return;
620 
621  m_dirtyRegion = QRegion(m_area.toQRect());
622 
623  m_area = rect;
624  RecalculateArea();
625 
626  if (m_parent)
628 
629  SetRedraw();
630 }
631 
635 void MythUIType::AdjustMinArea(int delta_x, int delta_y,
636  int delta_w, int delta_h)
637 {
638  // If a minsize is not set, don't use MinArea
639  if (!m_minSize.isValid())
640  return;
641 
642  // Delta's are negative values; knock down the area
643  QRect bounded(m_area.x() - delta_x,
644  m_area.y() - delta_y,
645  m_area.width() + delta_w,
646  m_area.height() + delta_h);
647 
648  // Make sure we have not violated the min size
649  if (!bounded.isNull() || !m_vanish)
650  {
651  QPoint center = bounded.center();
652 
653  if (bounded.isNull())
654  bounded.setSize(GetMinSize());
655  else
656  bounded.setSize(bounded.size().expandedTo(GetMinSize()));
657 
658  bounded.moveCenter(center);
659  }
660 
661  if (bounded.x() + bounded.width() > m_area.x() + m_area.width())
662  bounded.moveRight(m_area.x() + m_area.width());
663  if (bounded.y() + bounded.height() > m_area.y() + m_area.height())
664  bounded.moveBottom(m_area.y() + m_area.height());
665  if (bounded.x() < m_area.x())
666  {
667  bounded.moveLeft(m_area.x());
668  if (bounded.width() > m_area.width())
669  bounded.setWidth(m_area.width());
670  }
671  if (bounded.y() < m_area.y())
672  {
673  bounded.moveTop(m_area.y());
674  if (bounded.height() > m_area.height())
675  bounded.setHeight(m_area.height());
676  }
677 
678  m_minArea = bounded;
679  m_vanished = false;
680 
681  QList<MythUIType *>::iterator it;
682 
683  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
684  {
685  if (!(*it)->m_initiator)
686  (*it)->AdjustMinArea(delta_x, delta_y, delta_w, delta_h);
687  }
688 }
689 
691 {
692  if (!m_minSize.isValid() || !m_vanish)
693  return;
694 
695  m_minArea.moveLeft(0);
696  m_minArea.moveTop(0);
697  m_minArea.setWidth(0);
698  m_minArea.setHeight(0);
699  m_vanished = true;
700 
701  QList<MythUIType *>::iterator it;
702 
703  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
704  {
705  if (!(*it)->m_initiator)
706  (*it)->VanishSibling();
707  }
708 }
709 
713 void MythUIType::SetMinAreaParent(MythRect actual_area, MythRect allowed_area,
714  MythUIType *calling_child)
715 {
716  int delta_x = 0;
717  int delta_y = 0;
718  int delta_w = 0;
719  int delta_h = 0;
720  MythRect area;
721 
722  // If a minsize is not set, don't use MinArea
723  if (!m_minSize.isValid())
724  return;
725 
726  if (calling_child->m_vanished)
727  {
728  actual_area.moveLeft(0);
729  actual_area.moveTop(0);
730  allowed_area.moveLeft(0);
731  allowed_area.moveTop(0);
732  }
733 
734  actual_area.translate(m_area.x(), m_area.y());
735  allowed_area.translate(m_area.x(), m_area.y());
736 
737  QList<MythUIType *>::iterator it;
738 
739  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
740  {
741  if (*it == calling_child || !(*it)->m_initiator)
742  continue;
743 
744  if (!(*it)->m_vanished)
745  {
746  // Find union of area(s)
747  area = (*it)->GetArea();
748  area.translate(m_area.x(), m_area.y());
749  actual_area = actual_area.united(area);
750 
751  area = (*it)->m_area;
752  area.translate(m_area.x(), m_area.y());
753  allowed_area = allowed_area.united(area);
754  }
755  }
756 
757  // Make sure it is not larger than the area allowed
758  actual_area = actual_area.intersected(m_area);
759  allowed_area = allowed_area.intersected(m_area);
760 
761  if (m_vanish && actual_area.size().isNull())
762  {
763  m_vanished = true;
764  }
765  else
766  {
767  if (calling_child->m_vanished)
768  {
769  delta_x = m_area.x() - actual_area.x();
770  delta_y = m_area.y() - actual_area.y();
771  delta_w = actual_area.width() - m_area.width();
772  delta_h = actual_area.height() - m_area.height();
773  }
774  else
775  {
776  delta_x = allowed_area.x() - actual_area.x();
777  delta_y = allowed_area.y() - actual_area.y();
778  delta_w = actual_area.width() - allowed_area.width();
779  delta_h = actual_area.height() - allowed_area.height();
780  }
781 
782  m_vanished = false;
783  }
784 
785  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
786  {
787  if (*it == calling_child)
788  continue;
789 
790  if (!(*it)->m_initiator)
791  {
792  if (m_vanished)
793  (*it)->VanishSibling();
794  else
795  (*it)->AdjustMinArea(delta_x, delta_y, delta_w, delta_h);
796  }
797 
798  area = (*it)->GetArea();
799  area.translate(m_area.topLeft());
800  actual_area = actual_area.united(area);
801  }
802 
803  if (m_vanished)
804  {
805  m_minArea.setRect(0, 0, 0, 0);
806  actual_area.setRect(0, 0, 0, 0);
807  }
808  else
809  {
810  QSize bound(actual_area.width(), actual_area.height());
811 
812  bound = bound.expandedTo(GetMinSize());
813  m_minArea.setRect(actual_area.x(),
814  actual_area.y(),
815  actual_area.x() + bound.width(),
816  actual_area.y() + bound.height());
817  }
818 
819  if (m_parent)
820  m_parent->SetMinAreaParent(actual_area, m_area, this);
821 }
822 
827 {
828  // If a minsize is not set, don't use MinArea
829  if (!m_initiator || !m_minSize.isValid())
830  return;
831 
832  QRect bounded(rect);
833  bool vanish = (m_vanish && rect.isNull());
834 
835  if (vanish)
836  {
837  bounded.moveLeft(0);
838  bounded.moveTop(0);
839  }
840  else
841  {
842  QPoint center = bounded.center();
843 
844  if (bounded.isNull())
845  bounded.setSize(GetMinSize());
846  else
847  bounded.setSize(bounded.size().expandedTo(GetMinSize()));
848 
849  bounded.moveCenter(center);
850  if (bounded.x() + bounded.width() > m_area.x() + m_area.width())
851  bounded.moveRight(m_area.x() + m_area.width());
852  if (bounded.y() + bounded.height() > m_area.y() + m_area.height())
853  bounded.moveBottom(m_area.y() + m_area.height());
854  if (bounded.x() < m_area.x())
855  {
856  bounded.moveLeft(m_area.x());
857  if (bounded.width() > m_area.width())
858  bounded.setWidth(m_area.width());
859  }
860  if (bounded.y() < m_area.y())
861  {
862  bounded.moveTop(m_area.y());
863  if (bounded.height() > m_area.height())
864  bounded.setHeight(m_area.height());
865  }
866  }
867 
868  m_minArea = bounded;
869  m_vanished = vanish;
870 
871  if (m_parent)
873 }
874 
875 void MythUIType::ExpandArea(const QRect rect)
876 {
877  QSize childSize = rect.size();
878  QSize size = m_area.size();
879 
880  if (childSize == size)
881  return;
882 
883  SetSize(size.expandedTo(childSize));
884  SetRedraw();
885 }
886 
892 {
893  if (m_vanished || m_minArea.isValid())
894  return m_minArea;
895 
896  return m_area;
897 }
898 
900 {
901  return m_area;
902 }
903 
904 QRegion MythUIType::GetDirtyArea(void) const
905 {
906  return m_dirtyRegion;
907 }
908 
909 bool MythUIType::IsVisible(bool recurse) const
910 {
911  if (recurse)
912  {
913  if (m_parent && !m_parent->IsVisible(recurse))
914  return false;
915  }
916 
917  return m_visible;
918 }
919 
920 void MythUIType::MoveTo(QPoint destXY, QPoint speedXY)
921 {
922  if (!GetPainter()->SupportsAnimation())
923  return;
924 
925  if (destXY.x() == m_area.x() && destXY.y() == m_area.y())
926  return;
927 
928  m_moving = true;
929 
930  m_xyDestination = destXY;
931  m_xySpeed = speedXY;
932 }
933 
934 void MythUIType::AdjustAlpha(int mode, int alphachange, int minalpha,
935  int maxalpha)
936 {
937  if (!GetPainter()->SupportsAlpha())
938  return;
939 
940  m_alphaChangeMode = mode;
941  m_alphaChange = alphachange;
942  m_alphaMin = minalpha;
943  m_alphaMax = maxalpha;
944 
947 
950 }
951 
952 void MythUIType::SetAlpha(int newalpha)
953 {
954  if (m_effects.m_alpha == newalpha)
955  return;
956 
957  m_effects.m_alpha = newalpha;
958  SetRedraw();
959 }
960 
961 int MythUIType::GetAlpha(void) const
962 {
963  return m_effects.m_alpha;
964 }
965 
967 {
968  m_effects.m_centre = centre;
969 }
970 
971 void MythUIType::SetZoom(float zoom)
972 {
973  SetHorizontalZoom(zoom);
974  SetVerticalZoom(zoom);
975 }
976 
978 {
979  m_effects.m_hzoom = zoom;
980  SetRedraw();
981 }
982 
984 {
985  m_effects.m_vzoom = zoom;
986  SetRedraw();
987 }
988 
989 void MythUIType::SetAngle(float angle)
990 {
991  m_effects.m_angle = angle;
992  SetRedraw();
993 }
994 
999 bool MythUIType::keyPressEvent(QKeyEvent * /*event*/)
1000 {
1001  return false;
1002 }
1003 
1008 bool MythUIType::inputMethodEvent(QInputMethodEvent * /*event*/)
1009 {
1010  return false;
1011 }
1012 
1013 void MythUIType::customEvent(QEvent *event)
1014 {
1015  QObject::customEvent(event);
1016 }
1017 
1024 {
1025  return false;
1026 }
1027 
1033 {
1034 }
1035 
1037 {
1038  if (!m_canHaveFocus || !m_hasFocus)
1039  return;
1040 
1041  emit LosingFocus();
1042  m_hasFocus = false;
1043  Refresh();
1044 }
1045 
1047 {
1048  if (!m_canHaveFocus || m_hasFocus)
1049  return false;
1050 
1051  m_hasFocus = true;
1052  Refresh();
1053  emit TakingFocus();
1054  return true;
1055 }
1056 
1058 {
1059 }
1060 
1062 {
1063  SetRedraw();
1064 }
1065 
1066 void MythUIType::UpdateDependState(MythUIType *dependee, bool isDefault)
1067 {
1068  bool visible = false;
1069 
1070  if (dependee)
1071  {
1072  bool reverse = m_reverseDepend[dependee];
1073  visible = reverse ? !isDefault : isDefault;
1074  // NOLINTNEXTLINE(modernize-loop-convert)
1075  for (int i = 0; i < m_dependsValue.size(); i++)
1076  {
1077  if (m_dependsValue[i].first != dependee)
1078  continue;
1079  m_dependsValue[i].second = visible;
1080  break;
1081  }
1082  }
1083 
1084  if (!m_dependsValue.empty())
1085  visible = m_dependsValue[0].second;
1086  for (int i = 1; i < m_dependsValue.size(); i++)
1087  {
1088  bool v = m_dependsValue[i].second;
1089 
1090  if (((i-1) < m_dependOperator.size()) &&
1091  m_dependOperator[i-1] == 1)
1092  {
1093  // OR operator
1094  visible = visible && v;
1095  }
1096  else
1097  {
1098  // AND operator
1099  visible = visible || v;
1100  }
1101  }
1102 
1103  m_isDependDefault = visible;
1104 
1106 }
1107 
1108 void MythUIType::UpdateDependState(bool isDefault)
1109 {
1110  auto *dependee = qobject_cast<MythUIType*>(sender());
1111 
1112  UpdateDependState(dependee, isDefault);
1113 }
1114 
1115 void MythUIType::SetVisible(bool visible)
1116 {
1117  if (visible == m_visible)
1118  return;
1119 
1120  if (visible && m_isDependDefault)
1121  return;
1122 
1123  m_visible = visible;
1124  SetRedraw();
1125 
1126  if (m_visible)
1127  emit Showing();
1128  else
1129  emit Hiding();
1131 }
1132 
1134 {
1135  m_isDependDefault = isDefault;
1136 }
1137 
1138 void MythUIType::SetEnabled(bool enable)
1139 {
1140  if (m_enabled != enable)
1141  m_enabled = enable;
1142 
1143  if (enable)
1144  emit Enabling();
1145  else
1146  emit Disabling();
1147 }
1148 
1150 {
1151  SetVisible(false);
1152 }
1153 
1155 {
1156  SetVisible(true);
1157 }
1158 
1160 {
1161  if (m_canHaveFocus)
1162  focusList.insert(m_focusOrder, this);
1163 
1164  for (auto it = m_childrenList.crbegin(); it != m_childrenList.crend(); ++it)
1165  (*it)->AddFocusableChildrenToList(focusList);
1166 }
1167 
1168 int MythUIType::NormX(const int width)
1169 {
1170  return GetMythMainWindow()->NormX(width);
1171 }
1172 
1173 int MythUIType::NormY(const int height)
1174 {
1175  return GetMythMainWindow()->NormY(height);
1176 }
1177 
1182 {
1183  m_xmlName = base->m_xmlName;
1184  m_xmlLocation = base->m_xmlLocation;
1185  m_visible = base->m_visible;
1186  m_enabled = base->m_enabled;
1188  m_focusOrder = base->m_focusOrder;
1189 
1190  m_area = base->m_area;
1191  RecalculateArea();
1192 
1194  m_minSize = base->m_minSize;
1195  m_vanish = base->m_vanish;
1196  m_vanished = false;
1197  m_effects = base->m_effects;
1199  m_alphaChange = base->m_alphaChange;
1200  m_alphaMin = base->m_alphaMin;
1201  m_alphaMax = base->m_alphaMax;
1202 
1203  m_moving = base->m_moving;
1205  m_xySpeed = base->m_xySpeed;
1206  m_deferload = base->m_deferload;
1207 
1208  QList<MythUIAnimation*>::Iterator i;
1209  for (i = base->m_animations.begin(); i != base->m_animations.end(); ++i)
1210  {
1211  auto* animation = new MythUIAnimation(this);
1212  animation->CopyFrom(*i);
1213  m_animations.push_back(animation);
1214  }
1215 
1216  QList<MythUIType *>::Iterator it;
1217 
1218  for (it = base->m_childrenList.begin(); it != base->m_childrenList.end();
1219  ++it)
1220  {
1221  MythUIType *child = GetChild((*it)->objectName());
1222 
1223  if (child)
1224  child->CopyFrom(*it);
1225  else
1226  (*it)->CreateCopy(this);
1227  }
1228 
1229  m_dependsMap = base->m_dependsMap;
1230 
1231  SetMinArea(base->m_minArea);
1232 }
1233 
1239 {
1240  // Calling CreateCopy on base type is not valid
1241 }
1242 
1248  const QString &filename, QDomElement &element, bool showWarnings)
1249 {
1250  //FIXME add movement etc.
1251 
1252  if (element.tagName() == "position")
1253  SetPosition(parsePoint(element));
1254  else if (element.tagName() == "area")
1255  {
1256  SetArea(parseRect(element));
1257  }
1258  else if (element.tagName() == "minsize")
1259  {
1260  // Use parsePoint so percentages can be used
1261  if (element.hasAttribute("initiator"))
1262  m_enableInitiator = parseBool(element.attribute("initiator"));
1263 
1264  if (element.hasAttribute("vanish"))
1265  m_vanish = parseBool(element.attribute("vanish"));
1266 
1267  SetMinSize(parsePoint(element));
1268  }
1269  else if (element.tagName() == "alpha")
1270  {
1271  m_effects.m_alpha = getFirstText(element).toInt();
1272  m_alphaChangeMode = 0;
1273  }
1274  else if (element.tagName() == "alphapulse")
1275  {
1276  m_alphaChangeMode = 2;
1277  m_alphaMin = element.attribute("min", "0").toInt();
1278  m_effects.m_alpha = m_alphaMax = element.attribute("max", "255").toInt();
1279 
1280  if (m_alphaMax > 255)
1281  m_effects.m_alpha = m_alphaMax = 255;
1282 
1283  if (m_alphaMin < 0)
1284  m_alphaMin = 0;
1285 
1286  m_alphaChange = element.attribute("change", "5").toInt();
1287  }
1288  else if (element.tagName() == "focusorder")
1289  {
1290  int order = getFirstText(element).toInt();
1291  SetFocusOrder(order);
1292  }
1293  else if (element.tagName() == "loadondemand")
1294  {
1295  SetDeferLoad(parseBool(element));
1296  }
1297  else if (element.tagName() == "helptext")
1298  {
1299  m_helptext = getFirstText(element);
1300  }
1301  else if (element.tagName() == "animation")
1302  {
1303  MythUIAnimation::ParseElement(element, this);
1304  }
1305  else {
1306  if (showWarnings) {
1307  VERBOSE_XML(VB_GENERAL, LOG_ERR, filename, element,
1308  QString("Unknown widget type '%1'").arg(element.tagName()));
1309  }
1310  return false;
1311  }
1312 
1313  return true;
1314 }
1315 
1324 {
1325 }
1326 
1327 MythFontProperties *MythUIType::GetFont(const QString &text) const
1328 {
1329  MythFontProperties *ret = m_fonts->GetFont(text);
1330 
1331  if (!ret && m_parent)
1332  return m_parent->GetFont(text);
1333 
1334  return ret;
1335 }
1336 
1338 {
1339  return m_fonts->AddFont(text, fontProp);
1340 }
1341 
1343 {
1344  if (m_parent)
1346  else
1347  m_area.CalculateArea(GetMythMainWindow()->GetUIScreenRect());
1348 
1349  if (recurse)
1350  {
1351  QList<MythUIType *>::iterator it;
1352 
1353  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
1354  {
1355  (*it)->RecalculateArea(recurse);
1356  }
1357  }
1358 }
1359 
1361 {
1362  m_focusOrder = order;
1363 }
1364 
1366 {
1367  if (!child)
1368  return false;
1369 
1370  int i = m_childrenList.indexOf(child);
1371 
1372  if (i != -1 || i != m_childrenList.size() - 1)
1373  {
1374  m_childrenList.removeAt(i);
1375  m_childrenList.append(child);
1376  child->SetRedraw();
1377  return true;
1378  }
1379 
1380  return false;
1381 }
1382 
1383 
1385 {
1386  if (m_parent)
1387  {
1388  return m_parent->MoveChildToTop(this);
1389  }
1390 
1391  return false;
1392 }
1393 
1394 bool MythUIType::IsDeferredLoading(bool recurse) const
1395 {
1396  if (m_deferload)
1397  return true;
1398 
1399  if (recurse && m_parent)
1400  return m_parent->IsDeferredLoading(recurse);
1401 
1402  return false;
1403 }
1404 
1411 {
1412  QList<MythUIType *>::Iterator it;
1413 
1414  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
1415  (*it)->LoadNow();
1416 }
1417 
1423 bool MythUIType::ContainsPoint(const QPoint point) const
1424 {
1425  return m_area.contains(point);
1426 }
1427 
1429 {
1430  if (m_painter)
1431  return m_painter;
1432 
1433  if (m_parent)
1434  return m_parent->GetPainter();
1435 
1436  return GetMythPainter();
1437 }
1438 
1439 void MythUIType::SetDependsMap(QMap<QString, QString> dependsMap)
1440 {
1441  m_dependsMap = std::move(dependsMap);
1442 }
1443 
1444 void MythUIType::SetReverseDependence(MythUIType *dependee, bool reverse)
1445 {
1446  m_reverseDepend.insert(dependee, reverse);
1447 }
1448 
1450 {
1451  QMapIterator<QString, QString> it(m_dependsMap);
1452  QStringList dependees;
1453  QList<int> operators;
1454  while(it.hasNext())
1455  {
1456  it.next();
1457 
1458  // build list of operators and dependeees.
1459  dependees.clear();
1460  operators.clear();
1461  QString name = it.value();
1462  QStringList tmp1 = name.split("&");
1463  for (const QString& t1 : qAsConst(tmp1))
1464  {
1465  QStringList tmp2 = t1.split("|");
1466 
1467  dependees.append(tmp2[0]);
1468  for (int j = 1; j < tmp2.size(); j++)
1469  {
1470  dependees.append(tmp2[j]);
1471  operators.append(1); // 1 is OR
1472  }
1473  operators.append(2); // 2 is AND
1474  }
1475 
1476  MythUIType *dependant = GetChild(it.key());
1477  if (dependant)
1478  {
1479  dependant->m_dependOperator = operators;
1480  for (QString dependeeName : qAsConst(dependees))
1481  {
1482  bool reverse = false;
1483  if (dependeeName.startsWith('!'))
1484  {
1485  reverse = true;
1486  dependeeName.remove(0,1);
1487  }
1488  MythUIType *dependee = GetChild(dependeeName);
1489 
1490  if (dependee)
1491  {
1492  QObject::connect(dependee, &MythUIType::DependChanged,
1493  dependant, qOverload<bool>(&MythUIType::UpdateDependState));
1494  dependant->SetReverseDependence(dependee, reverse);
1495  dependant->m_dependsValue.append(QPair<MythUIType *, bool>(dependee, false));
1496  dependant->UpdateDependState(dependee, true);
1497  }
1498  else
1499  {
1500  dependant->m_dependsValue.append(QPair<MythUIType *, bool>(dependee, !reverse));
1501  dependant->UpdateDependState(dependee, reverse);
1502  }
1503  }
1504  }
1505  }
1506 
1507  if (recurse)
1508  {
1509  QList<MythUIType *>::iterator child;
1510  for (child = m_childrenList.begin(); child != m_childrenList.end(); ++child)
1511  {
1512  if (*child)
1513  (*child)->ConnectDependants(recurse);
1514  }
1515  }
1516 }
MythUIType::m_xySpeed
QPoint m_xySpeed
Definition: mythuitype.h:290
MythUIType::keyPressEvent
virtual bool keyPressEvent(QKeyEvent *event)
Key event handler.
Definition: mythuitype.cpp:999
MythUIType::m_area
MythRect m_area
Definition: mythuitype.h:274
MythUIType::SetReverseDependence
void SetReverseDependence(MythUIType *dependee, bool reverse)
Definition: mythuitype.cpp:1444
UIEffects::m_angle
float m_angle
Definition: mythuianimation.h:41
MythUIType::CanTakeFocus
bool CanTakeFocus(void) const
Return if this widget can accept input focus.
Definition: mythuitype.cpp:356
MythUIType::AddFocusableChildrenToList
void AddFocusableChildrenToList(FocusInfoType &focusList)
Definition: mythuitype.cpp:1159
MythUIType::m_helptext
QString m_helptext
Definition: mythuitype.h:298
mythuitext.h
mythuiprogressbar.h
MythUIType::inputMethodEvent
virtual bool inputMethodEvent(QInputMethodEvent *event)
Input Method event handler.
Definition: mythuitype.cpp:1008
XMLParseBase::parsePoint
static MythPoint parsePoint(const QString &text, bool normalize=true)
Definition: xmlparsebase.cpp:77
MythUIType::mediaEvent
virtual void mediaEvent(MythMediaEvent *event)
Media/Device status event handler, received from MythMediaMonitor.
Definition: mythuitype.cpp:1032
MythUIType::DeleteChild
void DeleteChild(const QString &name)
Delete a named child of this UIType.
Definition: mythuitype.cpp:155
MythUIType::ConnectDependants
void ConnectDependants(bool recurse=false)
Definition: mythuitype.cpp:1449
MythUIType::SetDependIsDefault
void SetDependIsDefault(bool isDefault)
Definition: mythuitype.cpp:1133
mythrandom.h
MythUIType::GetChildAt
MythUIType * GetChildAt(QPoint p, bool recursive=true, bool focusable=true) const
Return the first MythUIType at the given coordinates.
Definition: mythuitype.cpp:243
MythUIType::GetDirtyArea
virtual QRegion GetDirtyArea(void) const
Definition: mythuitype.cpp:904
MythUIType::GetFullArea
virtual MythRect GetFullArea(void) const
Definition: mythuitype.cpp:899
MythUIType::CalcAlpha
int CalcAlpha(int alphamod) const
Definition: mythuitype.cpp:480
MythRect::setRect
void setRect(const QString &sX, const QString &sY, const QString &sWidth, const QString &sHeight, const QString &baseRes=QString())
Definition: mythrect.cpp:139
MythUIType::Enabling
void Enabling()
MythRect::toQRect
QRect toQRect(void) const
Definition: mythrect.cpp:405
MythUIType::UpdateDependState
void UpdateDependState(bool isDefault)
Definition: mythuitype.cpp:1108
MythUIType::m_fonts
FontMap * m_fonts
Definition: mythuitype.h:292
MythUIType::GetChild
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
Definition: mythuitype.cpp:140
MythFontProperties::SetFace
void SetFace(const QFont &face)
Definition: mythfontproperties.cpp:34
MythUIType::m_animations
QList< MythUIAnimation * > m_animations
Definition: mythuitype.h:297
MythPoint::toQPoint
QPoint toQPoint(void) const
Definition: mythrect.cpp:594
MythUIType::GetPainter
virtual MythPainter * GetPainter(void)
Definition: mythuitype.cpp:1428
MythUIType::m_visible
bool m_visible
Definition: mythuitype.h:261
MythUIType::SetCanTakeFocus
void SetCanTakeFocus(bool set=true)
Set whether this widget can take focus.
Definition: mythuitype.cpp:364
MythUIType::customEvent
void customEvent(QEvent *event) override
Definition: mythuitype.cpp:1013
MythUIType::AddFont
bool AddFont(const QString &text, MythFontProperties *fontProp)
Definition: mythuitype.cpp:1337
MythUIType::SetArea
virtual void SetArea(const MythRect &rect)
Definition: mythuitype.cpp:616
MythUIAnimation::ParseElement
static void ParseElement(const QDomElement &element, MythUIType *parent)
Definition: mythuianimation.cpp:193
MythUIType::m_focusOrder
int m_focusOrder
Definition: mythuitype.h:272
MythUIType::m_alphaChangeMode
int m_alphaChangeMode
Definition: mythuitype.h:283
MythUIType::GetAllChildren
QList< MythUIType * > * GetAllChildren(void)
Return a list of all child widgets.
Definition: mythuitype.cpp:204
MythFontProperties::SetColor
void SetColor(const QColor &color)
Definition: mythfontproperties.cpp:49
MythUIType::MythUIType
MythUIType(QObject *parent, const QString &name)
Definition: mythuitype.cpp:46
MythUIAnimation::Trigger
Trigger
Definition: mythuianimation.h:49
MythUIType::ResetNeedsRedraw
void ResetNeedsRedraw(void)
Definition: mythuitype.cpp:305
MythPoint::CalculatePoint
void CalculatePoint(QRect parentArea)
Definition: mythrect.cpp:444
MythRect
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
Definition: mythrect.h:17
MythUIType::Pulse
virtual void Pulse(void)
Pulse is called 70 times a second to trigger a single frame of an animation.
Definition: mythuitype.cpp:462
MythUIType::CreateCopy
virtual void CreateCopy(MythUIType *parent)
Copy the state of this widget to the one given, it must be of the same type.
Definition: mythuitype.cpp:1238
MythUIType::FinishedFading
void FinishedFading()
mythuibuttonlist.h
MythUIType::m_xyDestination
QPoint m_xyDestination
Definition: mythuitype.h:289
MythUIType::DrawSelf
virtual void DrawSelf(MythPainter *p, int xoffset, int yoffset, int alphaMod, QRect clipRect)
Definition: mythuitype.cpp:485
mythuiimage.h
MythUIType::DeleteAllChildren
void DeleteAllChildren(void)
Delete all child widgets.
Definition: mythuitype.cpp:224
MythUIType::VanishSibling
virtual void VanishSibling(void)
Definition: mythuitype.cpp:690
MythUIType::AdjustMinArea
virtual void AdjustMinArea(int delta_x, int delta_y, int delta_w, int delta_h)
Adjust the size of a sibling.
Definition: mythuitype.cpp:635
MythUIType::ExpandArea
void ExpandArea(QRect rect)
Definition: mythuitype.cpp:875
FontMap
Definition: mythfontproperties.h:86
MythRect::moveLeft
void moveLeft(const QString &sX)
Definition: mythrect.cpp:309
MythUIType::TakingFocus
void TakingFocus()
MythUIType::GetArea
virtual MythRect GetArea(void) const
If the object has a minimum area defined, return it, other wise return the default area.
Definition: mythuitype.cpp:891
qChildHelper
static QObject * qChildHelper(const char *objName, const char *inheritsClass, bool recursiveSearch, const QObjectList &children)
Definition: mythuitype.cpp:103
MythUIType::AddChild
void AddChild(MythUIType *child)
Add a child UIType.
Definition: mythuitype.cpp:95
MythUIType::m_effects
UIEffects m_effects
Definition: mythuitype.h:281
MythUIType::m_alphaChange
int m_alphaChange
Definition: mythuitype.h:284
MythUIType::ActivateAnimations
void ActivateAnimations(MythUIAnimation::Trigger trigger)
Definition: mythuitype.cpp:290
MythUIType::SetAlpha
void SetAlpha(int newalpha)
Definition: mythuitype.cpp:952
MythUIType::Show
void Show(void)
Definition: mythuitype.cpp:1154
MythUIType::m_hasFocus
bool m_hasFocus
Definition: mythuitype.h:262
mythfontproperties.h
mythlogging.h
MythUIType::Refresh
void Refresh(void)
Definition: mythuitype.cpp:1061
MythUIType::SetZoom
void SetZoom(float zoom)
Definition: mythuitype.cpp:971
MythUIType::Activate
void Activate()
Definition: mythuitype.cpp:1057
MythUIType::LoseFocus
void LoseFocus()
Definition: mythuitype.cpp:1036
MythUIType::SetMinArea
virtual void SetMinArea(const MythRect &rect)
Set the minimum area based on the given size.
Definition: mythuitype.cpp:826
MythUIType::DependChanged
void DependChanged(bool isDefault)
MythUIType::SetPosition
void SetPosition(int x, int y)
Convenience method, calls SetPosition(const MythPoint&) Override that instead to change functionality...
Definition: mythuitype.cpp:539
MythUIType::IsEnabled
bool IsEnabled(void) const
Definition: mythuitype.h:117
hardwareprofile.config.p
p
Definition: config.py:33
MythUIType::Showing
void Showing()
MythUIType::Disabling
void Disabling()
compat.h
VERBOSE_XML
#define VERBOSE_XML(type, level, filename, element, msg)
Definition: xmlparsebase.h:14
MythFontProperties
Definition: mythfontproperties.h:13
MythUIType::m_alphaMin
int m_alphaMin
Definition: mythuitype.h:285
MythUIType::m_alphaMax
int m_alphaMax
Definition: mythuitype.h:286
MythRect::moveTop
void moveTop(const QString &sY)
Definition: mythrect.cpp:319
MythUIType::AdjustAlpha
void AdjustAlpha(int mode, int alphachange, int minalpha=0, int maxalpha=255)
Definition: mythuitype.cpp:934
MythMediaEvent
Definition: mythmedia.h:183
XMLParseBase::getFirstText
static QString getFirstText(QDomElement &element)
Definition: xmlparsebase.cpp:54
MythUIType::GetMinSize
virtual QSize GetMinSize(void) const
Definition: mythuitype.cpp:608
MythUIType::GetPosition
virtual MythPoint GetPosition(void) const
Definition: mythuitype.cpp:570
fontProp
Definition: mythfontproperties.h:108
MythRect::setHeight
void setHeight(const QString &sHeight)
Definition: mythrect.cpp:277
mythmedia.h
MythUIType::m_parent
MythUIType * m_parent
Definition: mythuitype.h:294
MythUIType::NormY
static int NormY(int height)
Definition: mythuitype.cpp:1173
UIEffects::GetCentre
QPointF GetCentre(const QRect rect, int xoff, int yoff) const
Definition: mythuianimation.h:21
MythRect::CalculateArea
void CalculateArea(QRect parentArea)
Definition: mythrect.cpp:64
MythUIType::m_childrenList
QList< MythUIType * > m_childrenList
Definition: mythuitype.h:253
MythUIType::CopyFrom
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
Definition: mythuitype.cpp:1181
xmlparsebase.h
MythUIType::SetEnabled
void SetEnabled(bool enable)
Definition: mythuitype.cpp:1138
mythpainter.h
XMLParseBase::parseRect
static MythRect parseRect(const QString &text, bool normalize=true)
Definition: xmlparsebase.cpp:138
MythUIType::m_deferload
bool m_deferload
Definition: mythuitype.h:303
MythUIType::m_minArea
MythRect m_minArea
Definition: mythuitype.h:275
MythUIType::Hiding
void Hiding()
MythUIType::TakeFocus
bool TakeFocus()
Definition: mythuitype.cpp:1046
MythUIType::m_dirtyRegion
QRegion m_dirtyRegion
Definition: mythuitype.h:278
UIEffects::m_centre
Centre m_centre
Definition: mythuianimation.h:42
MythUIType::MoveToTop
bool MoveToTop(void)
Definition: mythuitype.cpp:1384
mythgesture.h
A C++ ripoff of the stroke library for MythTV.
UIEffects::m_alpha
int m_alpha
Definition: mythuianimation.h:38
MythUIType::Reset
virtual void Reset(void)
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: mythuitype.cpp:79
FontMap::GetFont
MythFontProperties * GetFont(const QString &text)
Definition: mythfontproperties.cpp:523
MythUIType::RecalculateArea
virtual void RecalculateArea(bool recurse=true)
Definition: mythuitype.cpp:1342
MythUIType::Hide
void Hide(void)
Definition: mythuitype.cpp:1149
mythuigroup.h
MythUIType::~MythUIType
~MythUIType() override
Definition: mythuitype.cpp:69
MythUIType
The base class on which all widgets and screens are based.
Definition: mythuitype.h:85
MythUIType::IsDeferredLoading
bool IsDeferredLoading(bool recurse=false) const
Definition: mythuitype.cpp:1394
MythUIType::SetDependsMap
void SetDependsMap(QMap< QString, QString > dependsMap)
Definition: mythuitype.cpp:1439
mythuispinbox.h
MythUIScreenBounds::NormX
int NormX(int X) const
Definition: mythuiscreenbounds.cpp:224
MythUIType::FinishedMoving
void FinishedMoving()
UIEffects::m_vzoom
float m_vzoom
Definition: mythuianimation.h:40
mythimage.h
MythUIType::m_dependOperator
QList< int > m_dependOperator
Definition: mythuitype.h:259
MythUIType::m_initiator
bool m_initiator
Definition: mythuitype.h:266
MythUIType::SetMinAreaParent
virtual void SetMinAreaParent(MythRect actual_area, MythRect allowed_area, MythUIType *child)
Adjust the size of sibling objects within the button.
Definition: mythuitype.cpp:713
MythPoint::isValid
bool isValid(void) const
Definition: mythrect.h:102
MythUIType::m_dependsMap
QMap< QString, QString > m_dependsMap
Definition: mythuitype.h:254
MythUIAnimation
Definition: mythuianimation.h:45
MythRect::topLeft
MythPoint topLeft(void) const
Definition: mythrect.cpp:288
MythRect::setWidth
void setWidth(const QString &sWidth)
Definition: mythrect.cpp:266
mythuitextedit.h
MythUIType::m_isDependDefault
bool m_isDependDefault
Definition: mythuitype.h:269
MythUIType::LoadNow
virtual void LoadNow(void)
Cause images in this and child widgets to be loaded.
Definition: mythuitype.cpp:1410
MythPainter
Definition: mythpainter.h:34
MythUIType::gestureEvent
virtual bool gestureEvent(MythGestureEvent *event)
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
Definition: mythuitype.cpp:1023
FocusInfoType
QMultiMap< int, MythUIType * > FocusInfoType
Definition: mythuitype.h:39
MythUIType::m_canHaveFocus
bool m_canHaveFocus
Definition: mythuitype.h:263
MythUIType::SetSize
virtual void SetSize(QSize size)
Definition: mythuitype.cpp:575
MythUIType::SetDeferLoad
void SetDeferLoad(bool defer)
Definition: mythuitype.h:186
MythUIType::HandleAlphaPulse
void HandleAlphaPulse()
Handle one frame of an alpha (transparency) change animation.
Definition: mythuitype.cpp:421
MythUIType::m_minSize
MythPoint m_minSize
Definition: mythuitype.h:276
MythUIType::m_vanish
bool m_vanish
Definition: mythuitype.h:267
MythRandom
uint32_t MythRandom()
generate 32 random bits
Definition: mythrandom.h:22
MythUIType::SetVisible
virtual void SetVisible(bool visible)
Definition: mythuitype.cpp:1115
MythUIType::SetChildNeedsRedraw
void SetChildNeedsRedraw(MythUIType *child)
Definition: mythuitype.cpp:331
MythUIType::m_borderColor
QColor m_borderColor
Definition: mythuitype.h:305
MythUIType::m_dependsValue
QList< QPair< MythUIType *, bool > > m_dependsValue
Definition: mythuitype.h:258
MythUIType::m_needsRedraw
bool m_needsRedraw
Definition: mythuitype.h:279
MythUIType::m_painter
MythPainter * m_painter
Definition: mythuitype.h:295
GetMythMainWindow
MythMainWindow * GetMythMainWindow(void)
Definition: mythmainwindow.cpp:102
UIEffects::Centre
Centre
Definition: mythuianimation.h:15
MythUIType::m_enabled
bool m_enabled
Definition: mythuitype.h:264
MythUIType::m_reverseDepend
QMap< MythUIType *, bool > m_reverseDepend
Definition: mythuitype.h:270
MythUIType::ContainsPoint
bool ContainsPoint(QPoint point) const
Check if the given point falls within this widgets area.
Definition: mythuitype.cpp:1423
MythUIType::SetMinSize
virtual void SetMinSize(const MythPoint &size)
Set the minimum size of this widget, for widgets which can be rescaled.
Definition: mythuitype.cpp:596
MythUIType::GetAlpha
int GetAlpha(void) const
Definition: mythuitype.cpp:961
mythuibutton.h
MythUIType::m_xmlName
QString m_xmlName
Definition: mythuitype.h:300
MythUIType::SetHorizontalZoom
void SetHorizontalZoom(float zoom)
Definition: mythuitype.cpp:977
MythUIType::GetFont
MythFontProperties * GetFont(const QString &text) const
Definition: mythuitype.cpp:1327
MythUIType::SetCentre
void SetCentre(UIEffects::Centre centre)
Definition: mythuitype.cpp:966
MythGestureEvent
A custom event that represents a mouse gesture.
Definition: mythgesture.h:39
MythUIType::Draw
void Draw(MythPainter *p, int xoffset, int yoffset, int alphaMod=255, QRect clipRect=QRect())
Definition: mythuitype.cpp:490
MythUIType::SetAngle
void SetAngle(float angle)
Definition: mythuitype.cpp:989
UIEffects::m_hzoom
float m_hzoom
Definition: mythuianimation.h:39
MythUIType::NormX
static int NormX(int width)
Definition: mythuitype.cpp:1168
MythRect::moveTopLeft
void moveTopLeft(QPoint point)
Definition: mythrect.cpp:296
GetMythPainter
MythPainter * GetMythPainter(void)
Definition: mythmainwindow.cpp:117
MythUIType::SetVerticalZoom
void SetVerticalZoom(float zoom)
Definition: mythuitype.cpp:983
mythuicheckbox.h
MythUIType::LosingFocus
void LosingFocus()
MythUIType::SetFocusOrder
void SetFocusOrder(int order)
Definition: mythuitype.cpp:1360
MythUIType::ParseElement
virtual bool ParseElement(const QString &filename, QDomElement &element, bool showWarnings)
Parse the xml definition of this widget setting the state of the object accordingly.
Definition: mythuitype.cpp:1247
MythUIType::VisibilityChanged
void VisibilityChanged(bool Visible)
build_compdb.filename
filename
Definition: build_compdb.py:21
MythFontProperties::SetPointSize
void SetPointSize(uint points)
Definition: mythfontproperties.cpp:156
MythUIScreenBounds::NormY
int NormY(int Y) const
Definition: mythuiscreenbounds.cpp:229
MythUIType::MoveChildToTop
bool MoveChildToTop(MythUIType *child)
Definition: mythuitype.cpp:1365
mythmainwindow.h
MythUIType::NeedsRedraw
bool NeedsRedraw(void) const
Definition: mythuitype.cpp:300
MythUIType::GetAllDescendants
QList< MythUIType * > GetAllDescendants(void)
Definition: mythuitype.cpp:209
FontMap::AddFont
bool AddFont(const QString &text, MythFontProperties *fontProp)
Definition: mythfontproperties.cpp:533
MythUIType::SetRedraw
void SetRedraw(void)
Definition: mythuitype.cpp:315
XMLParseBase::parseBool
static bool parseBool(const QString &text)
Definition: xmlparsebase.cpp:66
MythUIType::IsVisible
bool IsVisible(bool recurse=false) const
Definition: mythuitype.cpp:909
MythUIType::m_enableInitiator
bool m_enableInitiator
Definition: mythuitype.h:265
MythUIType::m_moving
bool m_moving
Definition: mythuitype.h:288
MythUIType::Finalize
virtual void Finalize(void)
Perform any post-xml parsing initialisation tasks.
Definition: mythuitype.cpp:1323
mythuitype.h
MythUIType::HandleMovementPulse
void HandleMovementPulse()
Handle one frame of a movement animation.
Definition: mythuitype.cpp:374
MythUIType::m_xmlLocation
QString m_xmlLocation
Definition: mythuitype.h:301
MythUIType::m_vanished
bool m_vanished
Definition: mythuitype.h:268
MythPoint
Wrapper around QPoint allowing us to handle percentage and other relative values for positioning in m...
Definition: mythrect.h:88
MythUIType::MoveTo
void MoveTo(QPoint destXY, QPoint speedXY)
Definition: mythuitype.cpp:920