2010-05-07 04:47:10 -05:00
|
|
|
/*
|
|
|
|
* Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Pier Luigi Fiorini, pierluigi.fiorini@gmail.com
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <Button.h>
|
|
|
|
#include <ControlLook.h>
|
2010-10-24 01:27:09 -05:00
|
|
|
#include <LayoutBuilder.h>
|
2010-05-07 04:47:10 -05:00
|
|
|
#include <TabView.h>
|
|
|
|
|
|
|
|
#include "PreferencesDialog.h"
|
|
|
|
#include "PreferencesAccounts.h"
|
2010-05-19 13:05:30 -05:00
|
|
|
#include "PreferencesBehavior.h"
|
2012-03-01 20:23:21 -06:00
|
|
|
#include "PreferencesChatWindow.h"
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2010-05-09 01:27:48 -05:00
|
|
|
const uint32 kApply = 'SAVE';
|
2010-05-07 04:47:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
PreferencesDialog::PreferencesDialog()
|
2012-03-01 20:23:21 -06:00
|
|
|
: BWindow(BRect(0, 0, 500, 500), "Preferences", B_TITLED_WINDOW,
|
2010-05-07 04:47:10 -05:00
|
|
|
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_CLOSE_ON_ESCAPE)
|
|
|
|
{
|
|
|
|
BTabView* tabView = new BTabView("tabView", B_WIDTH_AS_USUAL);
|
|
|
|
tabView->AddTab(new PreferencesAccounts());
|
2010-05-19 13:05:30 -05:00
|
|
|
tabView->AddTab(new PreferencesBehavior());
|
2012-03-01 20:23:21 -06:00
|
|
|
tabView->AddTab(new PreferencesChatWindow());
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2010-05-09 01:27:48 -05:00
|
|
|
BButton* ok = new BButton("OK", new BMessage(kApply));
|
2010-05-07 04:47:10 -05:00
|
|
|
|
|
|
|
const float spacing = be_control_look->DefaultItemSpacing();
|
2010-10-24 01:27:09 -05:00
|
|
|
BLayoutBuilder::Group<>(this, B_VERTICAL)
|
2010-05-07 04:47:10 -05:00
|
|
|
.Add(tabView)
|
|
|
|
.AddGroup(B_HORIZONTAL)
|
|
|
|
.AddGlue()
|
|
|
|
.Add(ok)
|
|
|
|
.SetInsets(spacing, spacing, 0, 0)
|
|
|
|
.End()
|
2010-10-24 01:27:09 -05:00
|
|
|
.SetInsets(spacing, spacing, spacing, spacing);
|
2010-05-07 04:47:10 -05:00
|
|
|
|
|
|
|
CenterOnScreen();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
PreferencesDialog::MessageReceived(BMessage* msg)
|
|
|
|
{
|
|
|
|
switch (msg->what) {
|
2010-05-09 01:27:48 -05:00
|
|
|
case kApply:
|
2010-05-07 04:47:10 -05:00
|
|
|
Close();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
BWindow::MessageReceived(msg);
|
|
|
|
}
|
|
|
|
}
|