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 
204 {
205  QList<MythUIType *>::iterator it;
206 
207  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
208  if (*it)
209  delete *it;
210 
211  m_childrenList.clear();
212 }
213 
222 MythUIType *MythUIType::GetChildAt(const QPoint p, bool recursive,
223  bool focusable) const
224 {
225  if (GetArea().contains(p))
226  {
227  if (!IsVisible() || !IsEnabled())
228  return nullptr;
229 
230  if (m_childrenList.isEmpty())
231  return nullptr;
232 
233  /* check all children */
234  QList<MythUIType *>::const_iterator it;
235 
236  for (it = m_childrenList.end() - 1; it != m_childrenList.begin() - 1; --it)
237  {
238  if (!(*it))
239  continue;
240 
241  // If this point doesn't fall within the child's area then move on
242  // This requires that the area is actually accurate and in some
243  // cases this still isn't true
244  if (!(*it)->GetArea().contains(p - GetArea().topLeft()))
245  continue;
246 
247 
248  MythUIType *child = *it;
249 
250  if (recursive && (focusable && !child->CanTakeFocus()))
251  child = child->GetChildAt(p - GetArea().topLeft(), recursive,
252  focusable);
253 
254  if (child)
255  {
256  // NOTE: Assumes no selectible ui type will contain another
257  // selectible ui type.
258  if (focusable && !child->CanTakeFocus())
259  continue;
260 
261  return child;
262  }
263  }
264  }
265 
266  return nullptr;
267 }
268 
270 {
271  for (MythUIAnimation* animation : qAsConst(m_animations))
272  if (animation->GetTrigger() == trigger)
273  animation->Activate();
274 
275  for (MythUIType* uiType : qAsConst(m_childrenList))
276  uiType->ActivateAnimations(trigger);
277 }
278 
279 bool MythUIType::NeedsRedraw(void) const
280 {
281  return m_needsRedraw;
282 }
283 
285 {
286  m_needsRedraw = false;
287 
288  QList<MythUIType *>::Iterator it;
289 
290  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
291  (*it)->ResetNeedsRedraw();
292 }
293 
295 {
296  if (m_area.width() == 0 || m_area.height() == 0)
297  return;
298 
299  m_needsRedraw = true;
300 
301  if (m_dirtyRegion.isEmpty())
302  m_dirtyRegion = QRegion(m_area.toQRect());
303  else
304  m_dirtyRegion = m_dirtyRegion.united(QRegion(m_area.toQRect()));
305 
306  if (m_parent)
308 }
309 
311 {
312  QRegion childRegion = child->GetDirtyArea();
313 
314  if (childRegion.isEmpty())
315  return;
316 
317  childRegion.translate(m_area.x(), m_area.y());
318 
319  childRegion = childRegion.intersected(m_area.toQRect());
320 
321  m_needsRedraw = true;
322 
323  if (m_dirtyRegion.isEmpty())
324  m_dirtyRegion = childRegion;
325  else
326  m_dirtyRegion = m_dirtyRegion.united(childRegion);
327 
328  if (m_parent)
330 }
331 
335 bool MythUIType::CanTakeFocus(void) const
336 {
337  return m_canHaveFocus;
338 }
339 
344 {
345  m_canHaveFocus = set;
346 }
347 
354 {
355  if (!GetPainter()->SupportsAnimation())
356  return;
357 
358  if (!m_moving)
359  return;
360 
361  QPoint curXY = m_area.topLeft().toQPoint();
363 
364  int xdir = m_xyDestination.x() - curXY.x();
365  int ydir = m_xyDestination.y() - curXY.y();
366 
367  curXY.setX(curXY.x() + m_xySpeed.x());
368  curXY.setY(curXY.y() + m_xySpeed.y());
369 
370  if ((xdir > 0 && curXY.x() >= m_xyDestination.x()) ||
371  (xdir < 0 && curXY.x() <= m_xyDestination.x()) ||
372  (xdir == 0))
373  {
374  m_xySpeed.setX(0);
375  }
376 
377  if ((ydir > 0 && curXY.y() >= m_xyDestination.y()) ||
378  (ydir <= 0 && curXY.y() <= m_xyDestination.y()) ||
379  (ydir == 0))
380  {
381  m_xySpeed.setY(0);
382  }
383 
384  SetRedraw();
385 
386  if (m_xySpeed.x() == 0 && m_xySpeed.y() == 0)
387  {
388  m_moving = false;
389  emit FinishedMoving();
390  }
391 
392  m_area.moveTopLeft(curXY);
393 }
394 
401 {
402  if (!GetPainter()->SupportsAlpha() ||
403  !GetPainter()->SupportsAnimation())
404  return;
405 
406  if (m_alphaChangeMode == 0)
407  return;
408 
410 
413 
416 
417  // Reached limits so change direction
419  {
420  if (m_alphaChangeMode == 2)
421  {
422  m_alphaChange *= -1;
423  }
424  else
425  {
426  m_alphaChangeMode = 0;
427  m_alphaChange = 0;
428  emit FinishedFading();
429  }
430  }
431 
432  SetRedraw();
433 }
434 
442 {
443  if (!m_visible || m_vanished)
444  return;
445 
448 
449  QList<MythUIAnimation*>::Iterator i;
450  for (i = m_animations.begin(); i != m_animations.end(); ++i)
451  (*i)->IncrementCurrentTime();
452 
453  QList<MythUIType *>::Iterator it;
454 
455  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
456  (*it)->Pulse();
457 }
458 
459 int MythUIType::CalcAlpha(int alphamod) const
460 {
461  return (int)(m_effects.m_alpha * (alphamod / 255.0));
462 }
463 
464 void MythUIType::DrawSelf(MythPainter * /*p*/, int /*xoffset*/, int /*yoffset*/,
465  int /*alphaMod*/, QRect /*clipRect*/)
466 {
467 }
468 
469 void MythUIType::Draw(MythPainter *p, int xoffset, int yoffset, int alphaMod,
470  QRect clipRect)
471 {
472  // NB m_dirtyRegion may be extended by HandleMovementPulse, SetRedraw
473  // or SetChildNeedsRedraw etc _AFTER_ GetDirtyArea is called.
474  // So clipRect may not include the whole of m_dirtyRegion
475  m_dirtyRegion -= QRegion(clipRect); // NB Qt >= 4.2
476 
477  if (!m_visible || m_vanished)
478  return;
479 
480  QRect realArea = m_area.toQRect();
481  realArea.translate(xoffset, yoffset);
482 
483  if (!realArea.intersects(clipRect))
484  return;
485 
486  p->PushTransformation(m_effects, m_effects.GetCentre(m_area, xoffset, yoffset));
487 
488  DrawSelf(p, xoffset, yoffset, alphaMod, clipRect);
489 
490  QList<MythUIType *>::Iterator it;
491 
492  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
493  {
494  (*it)->Draw(p, xoffset + m_area.x(), yoffset + m_area.y(),
495  CalcAlpha(alphaMod), clipRect);
496  }
497 
498  if (p->ShowBorders())
499  {
500  static const QBrush kNullBrush(Qt::NoBrush);
501  QPen pen(m_borderColor);
502  pen.setWidth(1);
503  p->DrawRect(realArea, kNullBrush, pen, 255);
504 
505  if (p->ShowTypeNames())
506  {
507  MythFontProperties font;
508  font.SetFace(QFont("Droid Sans"));
509  font.SetColor(m_borderColor);
510  font.SetPointSize(8);
511  p->DrawText(realArea, objectName(), 0, font, 255, realArea);
512  }
513  }
514 
515  p->PopTransformation();
516 }
517 
518 void MythUIType::SetPosition(int x, int y)
519 {
520  SetPosition(MythPoint(x, y));
521 }
522 
523 void MythUIType::SetPosition(QPoint point)
524 {
525  SetPosition(MythPoint(point));
526 }
527 
529 {
530  MythPoint pos(point);
531 
532  if (m_parent)
534  else
535  pos.CalculatePoint(GetMythMainWindow()->GetUIScreenRect());
536 
537  if (m_area.topLeft() == pos)
538  return;
539 
540  m_dirtyRegion = QRegion(m_area.toQRect());
541 
542  m_area.moveTopLeft(pos);
543 
544  RecalculateArea(false);
545 
546  SetRedraw();
547 }
548 
550 {
551  return m_area.topLeft();
552 }
553 
554 void MythUIType::SetSize(const QSize size)
555 {
556  if (size == m_area.size())
557  return;
558 
559  m_dirtyRegion = QRegion(m_area.toQRect());
560 
561  m_area.setSize(size);
562  RecalculateArea();
563 
564  if (m_parent)
566 
567  SetRedraw();
568 }
569 
575 void MythUIType::SetMinSize(const MythPoint &minsize)
576 {
577  MythPoint point(minsize);
578 
579  if (m_parent)
581 
582  m_minSize = point;
583 
584  SetRedraw();
585 }
586 
587 QSize MythUIType::GetMinSize(void) const
588 {
589  if (!m_minSize.isValid())
590  return m_area.size();
591 
592  return {m_minSize.x(), m_minSize.y()};
593 }
594 
595 void MythUIType::SetArea(const MythRect &rect)
596 {
597  if (rect == m_area)
598  return;
599 
600  m_dirtyRegion = QRegion(m_area.toQRect());
601 
602  m_area = rect;
603  RecalculateArea();
604 
605  if (m_parent)
607 
608  SetRedraw();
609 }
610 
614 void MythUIType::AdjustMinArea(int delta_x, int delta_y,
615  int delta_w, int delta_h)
616 {
617  // If a minsize is not set, don't use MinArea
618  if (!m_minSize.isValid())
619  return;
620 
621  // Delta's are negative values; knock down the area
622  QRect bounded(m_area.x() - delta_x,
623  m_area.y() - delta_y,
624  m_area.width() + delta_w,
625  m_area.height() + delta_h);
626 
627  // Make sure we have not violated the min size
628  if (!bounded.isNull() || !m_vanish)
629  {
630  QPoint center = bounded.center();
631 
632  if (bounded.isNull())
633  bounded.setSize(GetMinSize());
634  else
635  bounded.setSize(bounded.size().expandedTo(GetMinSize()));
636 
637  bounded.moveCenter(center);
638  }
639 
640  if (bounded.x() + bounded.width() > m_area.x() + m_area.width())
641  bounded.moveRight(m_area.x() + m_area.width());
642  if (bounded.y() + bounded.height() > m_area.y() + m_area.height())
643  bounded.moveBottom(m_area.y() + m_area.height());
644  if (bounded.x() < m_area.x())
645  {
646  bounded.moveLeft(m_area.x());
647  if (bounded.width() > m_area.width())
648  bounded.setWidth(m_area.width());
649  }
650  if (bounded.y() < m_area.y())
651  {
652  bounded.moveTop(m_area.y());
653  if (bounded.height() > m_area.height())
654  bounded.setHeight(m_area.height());
655  }
656 
657  m_minArea = bounded;
658  m_vanished = false;
659 
660  QList<MythUIType *>::iterator it;
661 
662  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
663  {
664  if (!(*it)->m_initiator)
665  (*it)->AdjustMinArea(delta_x, delta_y, delta_w, delta_h);
666  }
667 }
668 
670 {
671  if (!m_minSize.isValid() || !m_vanish)
672  return;
673 
674  m_minArea.moveLeft(0);
675  m_minArea.moveTop(0);
676  m_minArea.setWidth(0);
677  m_minArea.setHeight(0);
678  m_vanished = true;
679 
680  QList<MythUIType *>::iterator it;
681 
682  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
683  {
684  if (!(*it)->m_initiator)
685  (*it)->VanishSibling();
686  }
687 }
688 
692 void MythUIType::SetMinAreaParent(MythRect actual_area, MythRect allowed_area,
693  MythUIType *calling_child)
694 {
695  int delta_x = 0;
696  int delta_y = 0;
697  int delta_w = 0;
698  int delta_h = 0;
699  MythRect area;
700 
701  // If a minsize is not set, don't use MinArea
702  if (!m_minSize.isValid())
703  return;
704 
705  if (calling_child->m_vanished)
706  {
707  actual_area.moveLeft(0);
708  actual_area.moveTop(0);
709  allowed_area.moveLeft(0);
710  allowed_area.moveTop(0);
711  }
712 
713  actual_area.translate(m_area.x(), m_area.y());
714  allowed_area.translate(m_area.x(), m_area.y());
715 
716  QList<MythUIType *>::iterator it;
717 
718  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
719  {
720  if (*it == calling_child || !(*it)->m_initiator)
721  continue;
722 
723  if (!(*it)->m_vanished)
724  {
725  // Find union of area(s)
726  area = (*it)->GetArea();
727  area.translate(m_area.x(), m_area.y());
728  actual_area = actual_area.united(area);
729 
730  area = (*it)->m_area;
731  area.translate(m_area.x(), m_area.y());
732  allowed_area = allowed_area.united(area);
733  }
734  }
735 
736  // Make sure it is not larger than the area allowed
737  actual_area = actual_area.intersected(m_area);
738  allowed_area = allowed_area.intersected(m_area);
739 
740  if (m_vanish && actual_area.size().isNull())
741  {
742  m_vanished = true;
743  }
744  else
745  {
746  if (calling_child->m_vanished)
747  {
748  delta_x = m_area.x() - actual_area.x();
749  delta_y = m_area.y() - actual_area.y();
750  delta_w = actual_area.width() - m_area.width();
751  delta_h = actual_area.height() - m_area.height();
752  }
753  else
754  {
755  delta_x = allowed_area.x() - actual_area.x();
756  delta_y = allowed_area.y() - actual_area.y();
757  delta_w = actual_area.width() - allowed_area.width();
758  delta_h = actual_area.height() - allowed_area.height();
759  }
760 
761  m_vanished = false;
762  }
763 
764  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
765  {
766  if (*it == calling_child)
767  continue;
768 
769  if (!(*it)->m_initiator)
770  {
771  if (m_vanished)
772  (*it)->VanishSibling();
773  else
774  (*it)->AdjustMinArea(delta_x, delta_y, delta_w, delta_h);
775  }
776 
777  area = (*it)->GetArea();
778  area.translate(m_area.topLeft());
779  actual_area = actual_area.united(area);
780  }
781 
782  if (m_vanished)
783  {
784  m_minArea.setRect(0, 0, 0, 0);
785  actual_area.setRect(0, 0, 0, 0);
786  }
787  else
788  {
789  QSize bound(actual_area.width(), actual_area.height());
790 
791  bound = bound.expandedTo(GetMinSize());
792  m_minArea.setRect(actual_area.x(),
793  actual_area.y(),
794  actual_area.x() + bound.width(),
795  actual_area.y() + bound.height());
796  }
797 
798  if (m_parent)
799  m_parent->SetMinAreaParent(actual_area, m_area, this);
800 }
801 
806 {
807  // If a minsize is not set, don't use MinArea
808  if (!m_initiator || !m_minSize.isValid())
809  return;
810 
811  QRect bounded(rect);
812  bool vanish = (m_vanish && rect.isNull());
813 
814  if (vanish)
815  {
816  bounded.moveLeft(0);
817  bounded.moveTop(0);
818  }
819  else
820  {
821  QPoint center = bounded.center();
822 
823  if (bounded.isNull())
824  bounded.setSize(GetMinSize());
825  else
826  bounded.setSize(bounded.size().expandedTo(GetMinSize()));
827 
828  bounded.moveCenter(center);
829  if (bounded.x() + bounded.width() > m_area.x() + m_area.width())
830  bounded.moveRight(m_area.x() + m_area.width());
831  if (bounded.y() + bounded.height() > m_area.y() + m_area.height())
832  bounded.moveBottom(m_area.y() + m_area.height());
833  if (bounded.x() < m_area.x())
834  {
835  bounded.moveLeft(m_area.x());
836  if (bounded.width() > m_area.width())
837  bounded.setWidth(m_area.width());
838  }
839  if (bounded.y() < m_area.y())
840  {
841  bounded.moveTop(m_area.y());
842  if (bounded.height() > m_area.height())
843  bounded.setHeight(m_area.height());
844  }
845  }
846 
847  m_minArea = bounded;
848  m_vanished = vanish;
849 
850  if (m_parent)
852 }
853 
854 void MythUIType::ExpandArea(const QRect rect)
855 {
856  QSize childSize = rect.size();
857  QSize size = m_area.size();
858 
859  if (childSize == size)
860  return;
861 
862  SetSize(size.expandedTo(childSize));
863  SetRedraw();
864 }
865 
871 {
872  if (m_vanished || m_minArea.isValid())
873  return m_minArea;
874 
875  return m_area;
876 }
877 
879 {
880  return m_area;
881 }
882 
883 QRegion MythUIType::GetDirtyArea(void) const
884 {
885  return m_dirtyRegion;
886 }
887 
888 bool MythUIType::IsVisible(bool recurse) const
889 {
890  if (recurse)
891  {
892  if (m_parent && !m_parent->IsVisible(recurse))
893  return false;
894  }
895 
896  return m_visible;
897 }
898 
899 void MythUIType::MoveTo(QPoint destXY, QPoint speedXY)
900 {
901  if (!GetPainter()->SupportsAnimation())
902  return;
903 
904  if (destXY.x() == m_area.x() && destXY.y() == m_area.y())
905  return;
906 
907  m_moving = true;
908 
909  m_xyDestination = destXY;
910  m_xySpeed = speedXY;
911 }
912 
913 void MythUIType::AdjustAlpha(int mode, int alphachange, int minalpha,
914  int maxalpha)
915 {
916  if (!GetPainter()->SupportsAlpha())
917  return;
918 
919  m_alphaChangeMode = mode;
920  m_alphaChange = alphachange;
921  m_alphaMin = minalpha;
922  m_alphaMax = maxalpha;
923 
926 
929 }
930 
931 void MythUIType::SetAlpha(int newalpha)
932 {
933  if (m_effects.m_alpha == newalpha)
934  return;
935 
936  m_effects.m_alpha = newalpha;
937  SetRedraw();
938 }
939 
940 int MythUIType::GetAlpha(void) const
941 {
942  return m_effects.m_alpha;
943 }
944 
946 {
947  m_effects.m_centre = centre;
948 }
949 
950 void MythUIType::SetZoom(float zoom)
951 {
952  SetHorizontalZoom(zoom);
953  SetVerticalZoom(zoom);
954 }
955 
957 {
958  m_effects.m_hzoom = zoom;
959  SetRedraw();
960 }
961 
963 {
964  m_effects.m_vzoom = zoom;
965  SetRedraw();
966 }
967 
968 void MythUIType::SetAngle(float angle)
969 {
970  m_effects.m_angle = angle;
971  SetRedraw();
972 }
973 
978 bool MythUIType::keyPressEvent(QKeyEvent * /*event*/)
979 {
980  return false;
981 }
982 
983 
984 void MythUIType::customEvent(QEvent *event)
985 {
986  QObject::customEvent(event);
987 }
988 
995 {
996  return false;
997 }
998 
1004 {
1005 }
1006 
1008 {
1009  if (!m_canHaveFocus || !m_hasFocus)
1010  return;
1011 
1012  emit LosingFocus();
1013  m_hasFocus = false;
1014  Refresh();
1015 }
1016 
1018 {
1019  if (!m_canHaveFocus || m_hasFocus)
1020  return false;
1021 
1022  m_hasFocus = true;
1023  Refresh();
1024  emit TakingFocus();
1025  return true;
1026 }
1027 
1029 {
1030 }
1031 
1033 {
1034  SetRedraw();
1035 }
1036 
1037 void MythUIType::UpdateDependState(MythUIType *dependee, bool isDefault)
1038 {
1039  bool visible = false;
1040 
1041  if (dependee)
1042  {
1043  bool reverse = m_reverseDepend[dependee];
1044  visible = reverse ? !isDefault : isDefault;
1045  // NOLINTNEXTLINE(modernize-loop-convert)
1046  for (int i = 0; i < m_dependsValue.size(); i++)
1047  {
1048  if (m_dependsValue[i].first != dependee)
1049  continue;
1050  m_dependsValue[i].second = visible;
1051  break;
1052  }
1053  }
1054 
1055  if (!m_dependsValue.empty())
1056  visible = m_dependsValue[0].second;
1057  for (int i = 1; i < m_dependsValue.size(); i++)
1058  {
1059  bool v = m_dependsValue[i].second;
1060 
1061  if (((i-1) < m_dependOperator.size()) &&
1062  m_dependOperator[i-1] == 1)
1063  {
1064  // OR operator
1065  visible = visible && v;
1066  }
1067  else
1068  {
1069  // AND operator
1070  visible = visible || v;
1071  }
1072  }
1073 
1074  m_isDependDefault = visible;
1075 
1077 }
1078 
1079 void MythUIType::UpdateDependState(bool isDefault)
1080 {
1081  auto *dependee = qobject_cast<MythUIType*>(sender());
1082 
1083  UpdateDependState(dependee, isDefault);
1084 }
1085 
1086 void MythUIType::SetVisible(bool visible)
1087 {
1088  if (visible == m_visible)
1089  return;
1090 
1091  if (visible && m_isDependDefault)
1092  return;
1093 
1094  m_visible = visible;
1095  SetRedraw();
1096 
1097  if (m_visible)
1098  emit Showing();
1099  else
1100  emit Hiding();
1102 }
1103 
1105 {
1106  m_isDependDefault = isDefault;
1107 }
1108 
1109 void MythUIType::SetEnabled(bool enable)
1110 {
1111  if (m_enabled != enable)
1112  m_enabled = enable;
1113 
1114  if (enable)
1115  emit Enabling();
1116  else
1117  emit Disabling();
1118 }
1119 
1121 {
1122  SetVisible(false);
1123 }
1124 
1126 {
1127  SetVisible(true);
1128 }
1129 
1131 {
1132  if (m_canHaveFocus)
1133  focusList.insert(m_focusOrder, this);
1134 
1135  for (auto it = m_childrenList.crbegin(); it != m_childrenList.crend(); ++it)
1136  (*it)->AddFocusableChildrenToList(focusList);
1137 }
1138 
1139 int MythUIType::NormX(const int width)
1140 {
1141  return GetMythMainWindow()->NormX(width);
1142 }
1143 
1144 int MythUIType::NormY(const int height)
1145 {
1146  return GetMythMainWindow()->NormY(height);
1147 }
1148 
1153 {
1154  m_xmlName = base->m_xmlName;
1155  m_xmlLocation = base->m_xmlLocation;
1156  m_visible = base->m_visible;
1157  m_enabled = base->m_enabled;
1159  m_focusOrder = base->m_focusOrder;
1160 
1161  m_area = base->m_area;
1162  RecalculateArea();
1163 
1165  m_minSize = base->m_minSize;
1166  m_vanish = base->m_vanish;
1167  m_vanished = false;
1168  m_effects = base->m_effects;
1170  m_alphaChange = base->m_alphaChange;
1171  m_alphaMin = base->m_alphaMin;
1172  m_alphaMax = base->m_alphaMax;
1173 
1174  m_moving = base->m_moving;
1176  m_xySpeed = base->m_xySpeed;
1177  m_deferload = base->m_deferload;
1178 
1179  QList<MythUIAnimation*>::Iterator i;
1180  for (i = base->m_animations.begin(); i != base->m_animations.end(); ++i)
1181  {
1182  auto* animation = new MythUIAnimation(this);
1183  animation->CopyFrom(*i);
1184  m_animations.push_back(animation);
1185  }
1186 
1187  QList<MythUIType *>::Iterator it;
1188 
1189  for (it = base->m_childrenList.begin(); it != base->m_childrenList.end();
1190  ++it)
1191  {
1192  MythUIType *child = GetChild((*it)->objectName());
1193 
1194  if (child)
1195  child->CopyFrom(*it);
1196  else
1197  (*it)->CreateCopy(this);
1198  }
1199 
1200  m_dependsMap = base->m_dependsMap;
1201 
1202  SetMinArea(base->m_minArea);
1203 }
1204 
1210 {
1211  // Calling CreateCopy on base type is not valid
1212 }
1213 
1219  const QString &filename, QDomElement &element, bool showWarnings)
1220 {
1221  //FIXME add movement etc.
1222 
1223  if (element.tagName() == "position")
1224  SetPosition(parsePoint(element));
1225  else if (element.tagName() == "area")
1226  {
1227  SetArea(parseRect(element));
1228  }
1229  else if (element.tagName() == "minsize")
1230  {
1231  // Use parsePoint so percentages can be used
1232  if (element.hasAttribute("initiator"))
1233  m_enableInitiator = parseBool(element.attribute("initiator"));
1234 
1235  if (element.hasAttribute("vanish"))
1236  m_vanish = parseBool(element.attribute("vanish"));
1237 
1238  SetMinSize(parsePoint(element));
1239  }
1240  else if (element.tagName() == "alpha")
1241  {
1242  m_effects.m_alpha = getFirstText(element).toInt();
1243  m_alphaChangeMode = 0;
1244  }
1245  else if (element.tagName() == "alphapulse")
1246  {
1247  m_alphaChangeMode = 2;
1248  m_alphaMin = element.attribute("min", "0").toInt();
1249  m_effects.m_alpha = m_alphaMax = element.attribute("max", "255").toInt();
1250 
1251  if (m_alphaMax > 255)
1252  m_effects.m_alpha = m_alphaMax = 255;
1253 
1254  if (m_alphaMin < 0)
1255  m_alphaMin = 0;
1256 
1257  m_alphaChange = element.attribute("change", "5").toInt();
1258  }
1259  else if (element.tagName() == "focusorder")
1260  {
1261  int order = getFirstText(element).toInt();
1262  SetFocusOrder(order);
1263  }
1264  else if (element.tagName() == "loadondemand")
1265  {
1266  SetDeferLoad(parseBool(element));
1267  }
1268  else if (element.tagName() == "helptext")
1269  {
1270  m_helptext = getFirstText(element);
1271  }
1272  else if (element.tagName() == "animation")
1273  {
1274  MythUIAnimation::ParseElement(element, this);
1275  }
1276  else {
1277  if (showWarnings) {
1278  VERBOSE_XML(VB_GENERAL, LOG_ERR, filename, element,
1279  QString("Unknown widget type '%1'").arg(element.tagName()));
1280  }
1281  return false;
1282  }
1283 
1284  return true;
1285 }
1286 
1295 {
1296 }
1297 
1298 MythFontProperties *MythUIType::GetFont(const QString &text) const
1299 {
1300  MythFontProperties *ret = m_fonts->GetFont(text);
1301 
1302  if (!ret && m_parent)
1303  return m_parent->GetFont(text);
1304 
1305  return ret;
1306 }
1307 
1309 {
1310  return m_fonts->AddFont(text, fontProp);
1311 }
1312 
1314 {
1315  if (m_parent)
1317  else
1318  m_area.CalculateArea(GetMythMainWindow()->GetUIScreenRect());
1319 
1320  if (recurse)
1321  {
1322  QList<MythUIType *>::iterator it;
1323 
1324  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
1325  {
1326  (*it)->RecalculateArea(recurse);
1327  }
1328  }
1329 }
1330 
1332 {
1333  m_focusOrder = order;
1334 }
1335 
1337 {
1338  if (!child)
1339  return false;
1340 
1341  int i = m_childrenList.indexOf(child);
1342 
1343  if (i != -1 || i != m_childrenList.size() - 1)
1344  {
1345  m_childrenList.removeAt(i);
1346  m_childrenList.append(child);
1347  child->SetRedraw();
1348  return true;
1349  }
1350 
1351  return false;
1352 }
1353 
1354 
1356 {
1357  if (m_parent)
1358  {
1359  return m_parent->MoveChildToTop(this);
1360  }
1361 
1362  return false;
1363 }
1364 
1365 bool MythUIType::IsDeferredLoading(bool recurse) const
1366 {
1367  if (m_deferload)
1368  return true;
1369 
1370  if (recurse && m_parent)
1371  return m_parent->IsDeferredLoading(recurse);
1372 
1373  return false;
1374 }
1375 
1382 {
1383  QList<MythUIType *>::Iterator it;
1384 
1385  for (it = m_childrenList.begin(); it != m_childrenList.end(); ++it)
1386  (*it)->LoadNow();
1387 }
1388 
1394 bool MythUIType::ContainsPoint(const QPoint point) const
1395 {
1396  return m_area.contains(point);
1397 }
1398 
1400 {
1401  if (m_painter)
1402  return m_painter;
1403 
1404  if (m_parent)
1405  return m_parent->GetPainter();
1406 
1407  return GetMythPainter();
1408 }
1409 
1410 void MythUIType::SetDependsMap(QMap<QString, QString> dependsMap)
1411 {
1412  m_dependsMap = std::move(dependsMap);
1413 }
1414 
1415 void MythUIType::SetReverseDependence(MythUIType *dependee, bool reverse)
1416 {
1417  m_reverseDepend.insert(dependee, reverse);
1418 }
1419 
1421 {
1422  QMapIterator<QString, QString> it(m_dependsMap);
1423  QStringList dependees;
1424  QList<int> operators;
1425  while(it.hasNext())
1426  {
1427  it.next();
1428 
1429  // build list of operators and dependeees.
1430  dependees.clear();
1431  operators.clear();
1432  QString name = it.value();
1433  QStringList tmp1 = name.split("&");
1434  for (int i = 0; i < tmp1.size(); i++)
1435  {
1436  QStringList tmp2 = tmp1[i].split("|");
1437 
1438  dependees.append(tmp2[0]);
1439  for (int j = 1; j < tmp2.size(); j++)
1440  {
1441  dependees.append(tmp2[j]);
1442  operators.append(1); // 1 is OR
1443  }
1444  operators.append(2); // 2 is AND
1445  }
1446 
1447  MythUIType *dependant = GetChild(it.key());
1448  if (dependant)
1449  {
1450  dependant->m_dependOperator = operators;
1451  for (QString dependeeName : qAsConst(dependees))
1452  {
1453  bool reverse = false;
1454  if (dependeeName.startsWith('!'))
1455  {
1456  reverse = true;
1457  dependeeName.remove(0,1);
1458  }
1459  MythUIType *dependee = GetChild(dependeeName);
1460 
1461  if (dependee)
1462  {
1463  QObject::connect(dependee, &MythUIType::DependChanged,
1464  dependant, qOverload<bool>(&MythUIType::UpdateDependState));
1465  dependant->SetReverseDependence(dependee, reverse);
1466  dependant->m_dependsValue.append(QPair<MythUIType *, bool>(dependee, false));
1467  dependant->UpdateDependState(dependee, true);
1468  }
1469  else
1470  {
1471  dependant->m_dependsValue.append(QPair<MythUIType *, bool>(dependee, !reverse));
1472  dependant->UpdateDependState(dependee, reverse);
1473  }
1474  }
1475  }
1476  }
1477 
1478  if (recurse)
1479  {
1480  QList<MythUIType *>::iterator child;
1481  for (child = m_childrenList.begin(); child != m_childrenList.end(); ++child)
1482  {
1483  if (*child)
1484  (*child)->ConnectDependants(recurse);
1485  }
1486  }
1487 }
MythUIType::m_xySpeed
QPoint m_xySpeed
Definition: mythuitype.h:287
MythUIType::keyPressEvent
virtual bool keyPressEvent(QKeyEvent *event)
Key event handler.
Definition: mythuitype.cpp:978
MythUIType::m_area
MythRect m_area
Definition: mythuitype.h:271
MythUIType::SetReverseDependence
void SetReverseDependence(MythUIType *dependee, bool reverse)
Definition: mythuitype.cpp:1415
UIEffects::m_angle
float m_angle
Definition: mythuianimation.h:38
MythUIType::CanTakeFocus
bool CanTakeFocus(void) const
Return if this widget can accept input focus.
Definition: mythuitype.cpp:335
MythUIType::AddFocusableChildrenToList
void AddFocusableChildrenToList(FocusInfoType &focusList)
Definition: mythuitype.cpp:1130
MythUIType::m_helptext
QString m_helptext
Definition: mythuitype.h:295
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:1003
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:1420
MythUIType::SetDependIsDefault
void SetDependIsDefault(bool isDefault)
Definition: mythuitype.cpp:1104
MythUIType::GetChildAt
MythUIType * GetChildAt(QPoint p, bool recursive=true, bool focusable=true) const
Return the first MythUIType at the given coordinates.
Definition: mythuitype.cpp:222
MythUIType::GetDirtyArea
virtual QRegion GetDirtyArea(void) const
Definition: mythuitype.cpp:883
MythUIType::GetFullArea
virtual MythRect GetFullArea(void) const
Definition: mythuitype.cpp:878
MythUIType::CalcAlpha
int CalcAlpha(int alphamod) const
Definition: mythuitype.cpp:459
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:1079
MythUIType::m_fonts
FontMap * m_fonts
Definition: mythuitype.h:289
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:32
MythUIType::m_animations
QList< MythUIAnimation * > m_animations
Definition: mythuitype.h:294
MythPoint::toQPoint
QPoint toQPoint(void) const
Definition: mythrect.cpp:595
arg
arg(title).arg(filename).arg(doDelete))
MythUIType::GetPainter
virtual MythPainter * GetPainter(void)
Definition: mythuitype.cpp:1399
MythUIType::m_visible
bool m_visible
Definition: mythuitype.h:258
MythUIType::SetCanTakeFocus
void SetCanTakeFocus(bool set=true)
Set whether this widget can take focus.
Definition: mythuitype.cpp:343
MythUIType::customEvent
void customEvent(QEvent *event) override
Definition: mythuitype.cpp:984
MythUIType::AddFont
bool AddFont(const QString &text, MythFontProperties *fontProp)
Definition: mythuitype.cpp:1308
MythUIType::SetArea
virtual void SetArea(const MythRect &rect)
Definition: mythuitype.cpp:595
MythUIAnimation::ParseElement
static void ParseElement(const QDomElement &element, MythUIType *parent)
Definition: mythuianimation.cpp:194
MythUIType::m_focusOrder
int m_focusOrder
Definition: mythuitype.h:269
MythUIType::m_alphaChangeMode
int m_alphaChangeMode
Definition: mythuitype.h:280
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:47
MythUIType::MythUIType
MythUIType(QObject *parent, const QString &name)
Definition: mythuitype.cpp:42
MythUIAnimation::Trigger
Trigger
Definition: mythuianimation.h:46
MythUIType::ResetNeedsRedraw
void ResetNeedsRedraw(void)
Definition: mythuitype.cpp:284
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:18
MythUIType::Pulse
virtual void Pulse(void)
Pulse is called 70 times a second to trigger a single frame of an animation.
Definition: mythuitype.cpp:441
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:1209
MythUIType::FinishedFading
void FinishedFading()
mythuibuttonlist.h
MythUIType::m_xyDestination
QPoint m_xyDestination
Definition: mythuitype.h:286
MythUIType::DrawSelf
virtual void DrawSelf(MythPainter *p, int xoffset, int yoffset, int alphaMod, QRect clipRect)
Definition: mythuitype.cpp:464
mythuiimage.h
MythUIType::DeleteAllChildren
void DeleteAllChildren(void)
Delete all child widgets.
Definition: mythuitype.cpp:203
MythUIType::VanishSibling
virtual void VanishSibling(void)
Definition: mythuitype.cpp:669
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:614
MythUIType::ExpandArea
void ExpandArea(QRect rect)
Definition: mythuitype.cpp:854
FontMap
Definition: mythfontproperties.h:87
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:870
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:278
MythUIType::m_alphaChange
int m_alphaChange
Definition: mythuitype.h:281
MythUIType::ActivateAnimations
void ActivateAnimations(MythUIAnimation::Trigger trigger)
Definition: mythuitype.cpp:269
MythUIType::SetAlpha
void SetAlpha(int newalpha)
Definition: mythuitype.cpp:931
MythUIType::Show
void Show(void)
Definition: mythuitype.cpp:1125
MythUIType::m_hasFocus
bool m_hasFocus
Definition: mythuitype.h:259
mythfontproperties.h
mythlogging.h
MythUIType::Refresh
void Refresh(void)
Definition: mythuitype.cpp:1032
MythUIType::SetZoom
void SetZoom(float zoom)
Definition: mythuitype.cpp:950
MythUIType::Activate
void Activate()
Definition: mythuitype.cpp:1028
MythUIType::LoseFocus
void LoseFocus()
Definition: mythuitype.cpp:1007
MythUIType::SetMinArea
virtual void SetMinArea(const MythRect &rect)
Set the minimum area based on the given size.
Definition: mythuitype.cpp:805
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:518
MythUIType::IsEnabled
bool IsEnabled(void) const
Definition: mythuitype.h:115
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:14
MythUIType::m_alphaMin
int m_alphaMin
Definition: mythuitype.h:282
MythUIType::m_alphaMax
int m_alphaMax
Definition: mythuitype.h:283
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:913
MythMediaEvent
Definition: mythmedia.h:184
XMLParseBase::getFirstText
static QString getFirstText(QDomElement &element)
Definition: xmlparsebase.cpp:53
MythUIType::GetMinSize
virtual QSize GetMinSize(void) const
Definition: mythuitype.cpp:587
MythUIType::GetPosition
virtual MythPoint GetPosition(void) const
Definition: mythuitype.cpp:549
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:291
MythUIType::NormY
static int NormY(int height)
Definition: mythuitype.cpp:1144
UIEffects::GetCentre
QPointF GetCentre(const QRect rect, int xoff, int yoff) const
Definition: mythuianimation.h:18
MythRect::CalculateArea
void CalculateArea(QRect parentArea)
Definition: mythrect.cpp:64
MythUIType::m_childrenList
QList< MythUIType * > m_childrenList
Definition: mythuitype.h:250
filename
QString filename
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:637
MythUIType::CopyFrom
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
Definition: mythuitype.cpp:1152
xmlparsebase.h
MythUIType::SetEnabled
void SetEnabled(bool enable)
Definition: mythuitype.cpp:1109
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:300
MythUIType::m_minArea
MythRect m_minArea
Definition: mythuitype.h:272
MythUIType::Hiding
void Hiding()
MythUIType::TakeFocus
bool TakeFocus()
Definition: mythuitype.cpp:1017
MythUIType::m_dirtyRegion
QRegion m_dirtyRegion
Definition: mythuitype.h:275
UIEffects::m_centre
Centre m_centre
Definition: mythuianimation.h:39
MythUIType::MoveToTop
bool MoveToTop(void)
Definition: mythuitype.cpp:1355
mythgesture.h
A C++ ripoff of the stroke library for MythTV.
UIEffects::m_alpha
int m_alpha
Definition: mythuianimation.h:35
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:498
MythUIType::RecalculateArea
virtual void RecalculateArea(bool recurse=true)
Definition: mythuitype.cpp:1313
MythUIType::Hide
void Hide(void)
Definition: mythuitype.cpp:1120
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:85
MythUIType::IsDeferredLoading
bool IsDeferredLoading(bool recurse=false) const
Definition: mythuitype.cpp:1365
MythUIType::SetDependsMap
void SetDependsMap(QMap< QString, QString > dependsMap)
Definition: mythuitype.cpp:1410
mythuispinbox.h
MythUIScreenBounds::NormX
int NormX(int X) const
Definition: mythuiscreenbounds.cpp:221
MythRandom
MBASE_PUBLIC uint32_t MythRandom()
Definition: mythmiscutil.h:24
MythUIType::FinishedMoving
void FinishedMoving()
UIEffects::m_vzoom
float m_vzoom
Definition: mythuianimation.h:37
mythimage.h
MythUIType::m_dependOperator
QList< int > m_dependOperator
Definition: mythuitype.h:256
MythUIType::m_initiator
bool m_initiator
Definition: mythuitype.h:263
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:692
mythmiscutil.h
MythPoint::isValid
bool isValid(void) const
Definition: mythrect.h:102
MythUIType::m_dependsMap
QMap< QString, QString > m_dependsMap
Definition: mythuitype.h:251
MythUIAnimation
Definition: mythuianimation.h:43
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:266
MythUIType::LoadNow
virtual void LoadNow(void)
Cause images in this and child widgets to be loaded.
Definition: mythuitype.cpp:1381
MythPainter
Definition: mythpainter.h:33
MythUIType::gestureEvent
virtual bool gestureEvent(MythGestureEvent *event)
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
Definition: mythuitype.cpp:994
FocusInfoType
QMultiMap< int, MythUIType * > FocusInfoType
Definition: mythuitype.h:38
MythUIType::m_canHaveFocus
bool m_canHaveFocus
Definition: mythuitype.h:260
MythUIType::SetSize
virtual void SetSize(QSize size)
Definition: mythuitype.cpp:554
MythUIType::SetDeferLoad
void SetDeferLoad(bool defer)
Definition: mythuitype.h:183
MythUIType::HandleAlphaPulse
void HandleAlphaPulse()
Handle one frame of an alpha (transparency) change animation.
Definition: mythuitype.cpp:400
MythUIType::m_minSize
MythPoint m_minSize
Definition: mythuitype.h:273
MythUIType::m_vanish
bool m_vanish
Definition: mythuitype.h:264
MythUIType::SetVisible
virtual void SetVisible(bool visible)
Definition: mythuitype.cpp:1086
MythUIType::SetChildNeedsRedraw
void SetChildNeedsRedraw(MythUIType *child)
Definition: mythuitype.cpp:310
MythUIType::m_borderColor
QColor m_borderColor
Definition: mythuitype.h:302
MythUIType::m_dependsValue
QList< QPair< MythUIType *, bool > > m_dependsValue
Definition: mythuitype.h:255
MythUIType::m_needsRedraw
bool m_needsRedraw
Definition: mythuitype.h:276
MythUIType::m_painter
MythPainter * m_painter
Definition: mythuitype.h:292
GetMythMainWindow
MythMainWindow * GetMythMainWindow(void)
Definition: mythmainwindow.cpp:108
UIEffects::Centre
Centre
Definition: mythuianimation.h:12
MythUIType::m_enabled
bool m_enabled
Definition: mythuitype.h:261
MythUIType::m_reverseDepend
QMap< MythUIType *, bool > m_reverseDepend
Definition: mythuitype.h:267
MythUIType::ContainsPoint
bool ContainsPoint(QPoint point) const
Check if the given point falls within this widgets area.
Definition: mythuitype.cpp:1394
MythUIType::SetMinSize
virtual void SetMinSize(const MythPoint &size)
Set the minimum size of this widget, for widgets which can be rescaled.
Definition: mythuitype.cpp:575
MythUIType::GetAlpha
int GetAlpha(void) const
Definition: mythuitype.cpp:940
mythuibutton.h
MythUIType::m_xmlName
QString m_xmlName
Definition: mythuitype.h:297
MythUIType::SetHorizontalZoom
void SetHorizontalZoom(float zoom)
Definition: mythuitype.cpp:956
MythUIType::GetFont
MythFontProperties * GetFont(const QString &text) const
Definition: mythuitype.cpp:1298
MythUIType::SetCentre
void SetCentre(UIEffects::Centre centre)
Definition: mythuitype.cpp:945
MythGestureEvent
A custom event that represents a mouse gesture.
Definition: mythgesture.h:40
MythUIType::Draw
void Draw(MythPainter *p, int xoffset, int yoffset, int alphaMod=255, QRect clipRect=QRect())
Definition: mythuitype.cpp:469
MythUIType::SetAngle
void SetAngle(float angle)
Definition: mythuitype.cpp:968
UIEffects::m_hzoom
float m_hzoom
Definition: mythuianimation.h:36
MythUIType::NormX
static int NormX(int width)
Definition: mythuitype.cpp:1139
MythRect::moveTopLeft
void moveTopLeft(QPoint point)
Definition: mythrect.cpp:296
GetMythPainter
MythPainter * GetMythPainter(void)
Definition: mythmainwindow.cpp:123
MythUIType::SetVerticalZoom
void SetVerticalZoom(float zoom)
Definition: mythuitype.cpp:962
mythuicheckbox.h
MythUIType::LosingFocus
void LosingFocus()
MythUIType::SetFocusOrder
void SetFocusOrder(int order)
Definition: mythuitype.cpp:1331
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:1218
MythUIType::VisibilityChanged
void VisibilityChanged(bool Visible)
MythFontProperties::SetPointSize
void SetPointSize(uint points)
Definition: mythfontproperties.cpp:154
MythUIScreenBounds::NormY
int NormY(int Y) const
Definition: mythuiscreenbounds.cpp:226
MythUIType::MoveChildToTop
bool MoveChildToTop(MythUIType *child)
Definition: mythuitype.cpp:1336
mythmainwindow.h
MythUIType::NeedsRedraw
bool NeedsRedraw(void) const
Definition: mythuitype.cpp:279
FontMap::AddFont
bool AddFont(const QString &text, MythFontProperties *fontProp)
Definition: mythfontproperties.cpp:508
MythUIType::SetRedraw
void SetRedraw(void)
Definition: mythuitype.cpp:294
XMLParseBase::parseBool
static bool parseBool(const QString &text)
Definition: xmlparsebase.cpp:65
MythUIType::IsVisible
bool IsVisible(bool recurse=false) const
Definition: mythuitype.cpp:888
MythUIType::m_enableInitiator
bool m_enableInitiator
Definition: mythuitype.h:262
MythUIType::m_moving
bool m_moving
Definition: mythuitype.h:285
MythUIType::Finalize
virtual void Finalize(void)
Perform any post-xml parsing initialisation tasks.
Definition: mythuitype.cpp:1294
mythuitype.h
MythUIType::HandleMovementPulse
void HandleMovementPulse()
Handle one frame of a movement animation.
Definition: mythuitype.cpp:353
MythUIType::m_xmlLocation
QString m_xmlLocation
Definition: mythuitype.h:298
MythUIType::m_vanished
bool m_vanished
Definition: mythuitype.h:265
MythPoint
Wrapper around QPoint allowing us to handle percentage and other relative values for positioning in m...
Definition: mythrect.h:89
MythUIType::MoveTo
void MoveTo(QPoint destXY, QPoint speedXY)
Definition: mythuitype.cpp:899