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