xref: /haiku/src/preferences/notifications/PrefletView.cpp (revision 46d4471af7fad4e52cfbd09174598cf5318aceed)
1 /*
2  * Copyright 2010, Haiku, Inc. All Rights Reserved.
3  * Copyright 2009, Pier Luigi Fiorini.
4  * Distributed under the terms of the MIT License.
5  *
6  * Authors:
7  *		Pier Luigi Fiorini, pierluigi.fiorini@gmail.com
8  */
9 
10 #include <Catalog.h>
11 #include <Message.h>
12 #include <GroupLayout.h>
13 #include <GroupLayoutBuilder.h>
14 #include <CardLayout.h>
15 #include <LayoutItem.h>
16 
17 #include "SettingsHost.h"
18 #include "PrefletView.h"
19 #include "GeneralView.h"
20 #include "DisplayView.h"
21 #include "NotificationsView.h"
22 
23 
24 #undef B_TRANSLATION_CONTEXT
25 #define B_TRANSLATION_CONTEXT "PrefletView"
26 
27 
28 const int32 kPageSelected = '_LCH';
29 
30 
31 PrefletView::PrefletView(SettingsHost* host)
32 	:
33 	BTabView("pages")
34 {
35 	// Pages
36 	GeneralView* general = new GeneralView(host);
37 	DisplayView* display = new DisplayView(host);
38 	NotificationsView* apps = new NotificationsView(host);
39 
40 	// Page selector
41 	BTab* tab = new BTab();
42 	AddTab(general, tab);
43 	tab->SetLabel(B_TRANSLATE("General"));
44 
45 	tab = new BTab();
46 	AddTab(display, tab);
47 	tab->SetLabel(B_TRANSLATE("Display"));
48 
49 	tab = new BTab();
50 	AddTab(apps, tab);
51 	tab->SetLabel(B_TRANSLATE("Notifications"));
52 }
53 
54 
55 BView*
56 PrefletView::CurrentPage()
57 {
58 	return PageAt(FocusTab());
59 }
60 
61 
62 int32
63 PrefletView::CountPages() const
64 {
65 	return 3;
66 }
67 
68 
69 BView*
70 PrefletView::PageAt(int32 index)
71 {
72 	return TabAt(index)->View();
73 }
74