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