2 * Copyright 2010-2017, Haiku, Inc. All Rights Reserved.
3 * Copyright 2009, Pier Luigi Fiorini.
4 * Distributed under the terms of the MIT License.
7 * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com
8 * Brian Hill, supernova@tycho.email
12 #include <CardLayout.h>
13 #include <GroupLayout.h>
14 #include <GroupLayoutBuilder.h>
15 #include <LayoutItem.h>
19 #include "NotificationsView.h"
20 #include "PrefletView.h"
21 #include "SettingsHost.h"
24 #undef B_TRANSLATION_CONTEXT
25 #define B_TRANSLATION_CONTEXT "PrefletView"
28 PrefletView::PrefletView(SettingsHost
* host
)
30 BTabView("pages", B_WIDTH_FROM_WIDEST
)
33 fGeneralView
= new GeneralView(host
);
34 NotificationsView
* apps
= new NotificationsView(host
);
37 BTab
* tab
= new BTab();
38 AddTab(fGeneralView
, tab
);
39 tab
->SetLabel(B_TRANSLATE("General"));
43 tab
->SetLabel(B_TRANSLATE("Applications"));
48 PrefletView::CurrentPage()
50 return PageAt(FocusTab());
55 PrefletView::PageAt(int32 index
)
57 return TabAt(index
)->View();
62 PrefletView::Select(int32 index
)
64 if (index
== Selection())
67 BTabView::Select(index
);
69 SettingsPane
* pane
= dynamic_cast<SettingsPane
*>(PageAt(index
));
70 bool showButtons
= (pane
!= NULL
) && pane
->UseDefaultRevertButtons();
71 BMessage
showMessage(kShowButtons
);
72 showMessage
.AddBool(kShowButtonsKey
, showButtons
);
73 Window()->PostMessage(&showMessage
);