|
1 | | - |
2 | 1 | // Own header |
3 | 2 | #include "mythuistatetype.h" |
| 3 | +#include "mythuibuttonlist.h" |
4 | 4 |
|
5 | 5 | // Qt headers |
6 | 6 | #include <QDomDocument> |
@@ -48,11 +48,7 @@ bool MythUIStateType::AddObject(const QString &name, MythUIType *object) |
48 | 48 | m_ObjectsByName[key] = object; |
49 | 49 |
|
50 | 50 | MythRect objectArea = object->GetArea(); |
51 | | - |
52 | | - if (m_Parent) |
53 | | - objectArea.CalculateArea(m_Parent->GetFullArea()); |
54 | | - else |
55 | | - objectArea.CalculateArea(GetMythMainWindow()->GetUIScreenRect()); |
| 51 | + objectArea.CalculateArea(m_ParentArea); |
56 | 52 |
|
57 | 53 | ExpandArea(objectArea); |
58 | 54 |
|
@@ -81,11 +77,7 @@ bool MythUIStateType::AddObject(StateType type, MythUIType *object) |
81 | 77 | m_ObjectsByState[(int)type] = object; |
82 | 78 |
|
83 | 79 | MythRect objectArea = object->GetArea(); |
84 | | - |
85 | | - if (m_Parent) |
86 | | - objectArea.CalculateArea(m_Parent->GetFullArea()); |
87 | | - else |
88 | | - objectArea.CalculateArea(GetMythMainWindow()->GetUIScreenRect()); |
| 80 | + objectArea.CalculateArea(m_ParentArea); |
89 | 81 |
|
90 | 82 | ExpandArea(objectArea); |
91 | 83 |
|
@@ -342,3 +334,31 @@ void MythUIStateType::LoadNow(void) |
342 | 334 | MythUIType::LoadNow(); |
343 | 335 | } |
344 | 336 |
|
| 337 | +void MythUIStateType::RecalculateArea(bool recurse) |
| 338 | +{ |
| 339 | + if (m_Parent) |
| 340 | + { |
| 341 | + if (objectName().startsWith("buttonlist button")) |
| 342 | + { |
| 343 | + MythUIButtonList *list = dynamic_cast<MythUIButtonList *>(m_Parent); |
| 344 | + m_ParentArea = list->GetButtonArea(); |
| 345 | + } |
| 346 | + else |
| 347 | + m_ParentArea = m_Parent->GetFullArea(); |
| 348 | + } |
| 349 | + else |
| 350 | + m_ParentArea = GetMythMainWindow()->GetUIScreenRect(); |
| 351 | + |
| 352 | + m_Area.CalculateArea(m_ParentArea); |
| 353 | + |
| 354 | + if (recurse) |
| 355 | + { |
| 356 | + QList<MythUIType *>::iterator it; |
| 357 | + |
| 358 | + for (it = m_ChildrenList.begin(); it != m_ChildrenList.end(); ++it) |
| 359 | + { |
| 360 | + (*it)->RecalculateArea(recurse); |
| 361 | + } |
| 362 | + } |
| 363 | +} |
| 364 | + |
0 commit comments