From 28ca7ae02155621cbfb022569cb51141f55a7912 Mon Sep 17 00:00:00 2001 From: anevilyak Date: Sat, 11 Jun 2011 20:51:27 +0000 Subject: [PATCH] Since the time preflet is now layout-aware, scrolling the zone list to the current time zone must be done after layouting has been done, else the view doesn't have a valid size to work with yet. Resolves #7681. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42106 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/time/TimeWindow.cpp | 5 +++-- src/preferences/time/ZoneView.cpp | 25 ++++++++++++------------- src/preferences/time/ZoneView.h | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/preferences/time/TimeWindow.cpp b/src/preferences/time/TimeWindow.cpp index ed0363cac2..949b79e59c 100644 --- a/src/preferences/time/TimeWindow.cpp +++ b/src/preferences/time/TimeWindow.cpp @@ -116,7 +116,7 @@ TTimeWindow::_InitWindow() tabView->AddTab(fDateTimeView); tabView->AddTab(fTimeZoneView); tabView->AddTab(fNetworkTimeView); - + fBaseView->AddChild(tabView); fRevertButton = new BButton("revert", B_TRANSLATE("Revert"), @@ -125,11 +125,12 @@ TTimeWindow::_InitWindow() fRevertButton->SetTarget(this); fRevertButton->SetExplicitAlignment( BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE)); - + BLayoutBuilder::Group<>(this, B_VERTICAL, 5) .Add(fBaseView) .Add(fRevertButton) .SetInsets(5, 5, 5, 5); + } diff --git a/src/preferences/time/ZoneView.cpp b/src/preferences/time/ZoneView.cpp index ff654d8f14..065053cea5 100644 --- a/src/preferences/time/ZoneView.cpp +++ b/src/preferences/time/ZoneView.cpp @@ -109,25 +109,24 @@ TimeZoneView::AttachedToWindow() BView::AttachedToWindow(); if (Parent()) SetViewColor(Parent()->ViewColor()); -} - -void -TimeZoneView::AllAttached() -{ - BView::AllAttached(); if (!fInitialized) { fInitialized = true; fSetZone->SetTarget(this); fZoneList->SetTarget(this); + } +} - // update displays - if (fCurrentZoneItem != NULL) { - fZoneList->Select(fZoneList->IndexOf(fCurrentZoneItem)); - fCurrent->SetText(fCurrentZoneItem->Text()); - fZoneList->ScrollToSelection(); - } + +void +TimeZoneView::DoLayout() +{ + BView::DoLayout(); + if (fCurrentZoneItem != NULL) { + fZoneList->Select(fZoneList->IndexOf(fCurrentZoneItem)); + fCurrent->SetText(fCurrentZoneItem->Text()); + fZoneList->ScrollToSelection(); } } @@ -248,7 +247,7 @@ TimeZoneView::_InitView() fSetZone->SetEnabled(false); fSetZone->SetExplicitAlignment( BAlignment(B_ALIGN_RIGHT, B_ALIGN_BOTTOM)); - + const float kInset = be_control_look->DefaultItemSpacing(); BLayoutBuilder::Group<>(this) .Add(scrollList) diff --git a/src/preferences/time/ZoneView.h b/src/preferences/time/ZoneView.h index 7838679f96..9bfde926d4 100644 --- a/src/preferences/time/ZoneView.h +++ b/src/preferences/time/ZoneView.h @@ -31,12 +31,12 @@ public: virtual ~TimeZoneView(); virtual void AttachedToWindow(); - virtual void AllAttached(); virtual void MessageReceived(BMessage* message); bool CheckCanRevert(); protected: virtual bool GetToolTipAt(BPoint point, BToolTip** _tip); + virtual void DoLayout(); private: void _UpdateDateTime(BMessage* message);