* applied unchanged patch by PulkoMandy that converts the Locale prefs to
use layout management git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30634 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -8,11 +8,13 @@
|
|||||||
#include "LocaleWindow.h"
|
#include "LocaleWindow.h"
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Screen.h>
|
|
||||||
#include <TabView.h>
|
|
||||||
#include <ScrollView.h>
|
|
||||||
#include <ListView.h>
|
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
|
#include <GroupLayout.h>
|
||||||
|
#include <GroupLayoutBuilder.h>
|
||||||
|
#include <ListView.h>
|
||||||
|
#include <Screen.h>
|
||||||
|
#include <ScrollView.h>
|
||||||
|
#include <TabView.h>
|
||||||
|
|
||||||
|
|
||||||
const static uint32 kMsgSelectLanguage = 'slng';
|
const static uint32 kMsgSelectLanguage = 'slng';
|
||||||
@@ -24,59 +26,47 @@ LocaleWindow::LocaleWindow(BRect rect)
|
|||||||
: BWindow(rect, "Locale", B_TITLED_WINDOW,
|
: BWindow(rect, "Locale", B_TITLED_WINDOW,
|
||||||
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)
|
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)
|
||||||
{
|
{
|
||||||
rect = Bounds();
|
// Buttons at the bottom
|
||||||
BView *view = new BView(rect, "view", B_FOLLOW_ALL, 0);
|
|
||||||
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
|
||||||
AddChild(view);
|
|
||||||
|
|
||||||
BButton *button = new BButton(rect, "defaults", "Defaults",
|
BButton *button = new BButton("Defaults", new BMessage(kMsgDefaults));
|
||||||
new BMessage(kMsgDefaults), B_FOLLOW_NONE);
|
|
||||||
button->ResizeToPreferred();
|
|
||||||
button->MoveTo(10, rect.bottom - 10 - button->Bounds().Height());
|
|
||||||
view->AddChild(button);
|
|
||||||
|
|
||||||
fRevertButton = new BButton(rect, "revert", "Revert",
|
fRevertButton = new BButton("Revert", new BMessage(kMsgRevert));
|
||||||
new BMessage(kMsgRevert), B_FOLLOW_NONE);
|
|
||||||
fRevertButton->ResizeToPreferred();
|
|
||||||
fRevertButton->MoveTo(20 + button->Bounds().Width(), button->Frame().top);
|
|
||||||
fRevertButton->SetEnabled(false);
|
fRevertButton->SetEnabled(false);
|
||||||
view->AddChild(fRevertButton);
|
|
||||||
|
|
||||||
rect.InsetBy(10, 10);
|
// Tabs
|
||||||
rect.bottom -= 10 + button->Bounds().Height();
|
BTabView *tabView = new BTabView("tabview");
|
||||||
BTabView *tabView = new BTabView(rect, "tabview");
|
|
||||||
|
|
||||||
rect = tabView->ContainerView()->Bounds();
|
// Language tab
|
||||||
rect.InsetBy(2, 2);
|
|
||||||
BView *tab = new BView(rect, "Language", B_FOLLOW_NONE, B_WILL_DRAW);
|
BView *tab = new BView("Language", B_WILL_DRAW);
|
||||||
tab->SetViewColor(tabView->ViewColor());
|
tab->SetViewColor(tabView->ViewColor());
|
||||||
|
tab->SetLayout(new BGroupLayout(B_VERTICAL,10));
|
||||||
tabView->AddTab(tab);
|
tabView->AddTab(tab);
|
||||||
|
|
||||||
{
|
{
|
||||||
BRect frame = rect;
|
BListView *listView = new BListView("preferred", B_SINGLE_SELECTION_LIST);
|
||||||
frame.InsetBy(12, 12);
|
|
||||||
frame.right = 100 + B_V_SCROLL_BAR_WIDTH;
|
|
||||||
frame.bottom = 150;
|
|
||||||
|
|
||||||
BListView *listView = new BListView(frame, "preferred", B_SINGLE_SELECTION_LIST,
|
|
||||||
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
|
|
||||||
listView->SetSelectionMessage(new BMessage(kMsgSelectLanguage));
|
listView->SetSelectionMessage(new BMessage(kMsgSelectLanguage));
|
||||||
|
|
||||||
BScrollView *scrollView = new BScrollView("scroller", listView,
|
BScrollView *scrollView = new BScrollView("scroller", listView,
|
||||||
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP, 0, false, true, B_FANCY_BORDER);
|
0, false, true, B_FANCY_BORDER);
|
||||||
tab->AddChild(scrollView);
|
tab->AddChild(BGroupLayoutBuilder(B_HORIZONTAL,10)
|
||||||
|
.Add(scrollView)
|
||||||
|
.AddGlue()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
tab = new BView(rect, "Country", B_FOLLOW_NONE, B_WILL_DRAW);
|
// Country tab
|
||||||
|
|
||||||
|
tab = new BView("Country", B_WILL_DRAW);
|
||||||
tab->SetViewColor(tabView->ViewColor());
|
tab->SetViewColor(tabView->ViewColor());
|
||||||
tabView->AddTab(tab);
|
tabView->AddTab(tab);
|
||||||
|
|
||||||
tab = new BView(rect, "Keyboard", B_FOLLOW_NONE, B_WILL_DRAW);
|
// Keyboard tab
|
||||||
|
|
||||||
|
tab = new BView("Keyboard", B_WILL_DRAW);
|
||||||
tab->SetViewColor(tabView->ViewColor());
|
tab->SetViewColor(tabView->ViewColor());
|
||||||
tabView->AddTab(tab);
|
tabView->AddTab(tab);
|
||||||
|
|
||||||
view->AddChild(tabView);
|
|
||||||
|
|
||||||
// check if the window is on screen
|
// check if the window is on screen
|
||||||
|
|
||||||
rect = BScreen().Frame();
|
rect = BScreen().Frame();
|
||||||
@@ -90,6 +80,20 @@ LocaleWindow::LocaleWindow(BRect rect)
|
|||||||
position.y = (rect.Height() - Bounds().Height()) / 2;
|
position.y = (rect.Height() - Bounds().Height()) / 2;
|
||||||
}
|
}
|
||||||
MoveTo(position);
|
MoveTo(position);
|
||||||
|
|
||||||
|
// Layout management
|
||||||
|
|
||||||
|
SetLayout(new BGroupLayout(B_HORIZONTAL));
|
||||||
|
|
||||||
|
AddChild(BGroupLayoutBuilder(B_VERTICAL,10)
|
||||||
|
.Add(tabView)
|
||||||
|
.Add(BGroupLayoutBuilder(B_HORIZONTAL,10)
|
||||||
|
.Add(button)
|
||||||
|
.Add(fRevertButton)
|
||||||
|
.AddGlue()
|
||||||
|
)
|
||||||
|
.SetInsets(5,5,5,5)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user