Appearance preflet: Add a double scrollbar arrows setting.
Rename the 'Decorators' tab to 'Look and feel'. Fixes #8926.
This commit is contained in:
parent
f25372e2d2
commit
4143336284
@ -55,7 +55,7 @@ APRWindow::APRWindow(BRect frame)
|
||||
fColorsView = new APRView(B_TRANSLATE("Colors"));
|
||||
|
||||
fDecorSettings = new DecorSettingsView(
|
||||
B_TRANSLATE("Decorators"));
|
||||
B_TRANSLATE("Look and feel"));
|
||||
|
||||
fAntialiasingSettings = new AntialiasingSettingsView(
|
||||
B_TRANSLATE("Antialiasing"));
|
||||
|
@ -17,8 +17,10 @@
|
||||
#include <Box.h>
|
||||
#include <Button.h>
|
||||
#include <Catalog.h>
|
||||
#include <CheckBox.h>
|
||||
#include <GridLayoutBuilder.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <InterfaceDefs.h>
|
||||
#include <Locale.h>
|
||||
#include <MenuField.h>
|
||||
#include <MenuItem.h>
|
||||
@ -36,6 +38,9 @@
|
||||
|
||||
static const int32 kMsgSetDecor = 'deco';
|
||||
static const int32 kMsgDecorInfo = 'idec';
|
||||
static const int32 kMsgDoubleScrollbarArrows = 'dsba';
|
||||
|
||||
static const bool kDefaultDoubleScrollbarArrowsSetting = false;
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
@ -43,7 +48,11 @@ static const int32 kMsgDecorInfo = 'idec';
|
||||
|
||||
DecorSettingsView::DecorSettingsView(const char* name)
|
||||
:
|
||||
BView(name, 0)
|
||||
BView(name, 0),
|
||||
fDecorInfoButton(NULL),
|
||||
fDecorMenuField(NULL),
|
||||
fDecorMenu(NULL),
|
||||
fDoubleScrollbarArrowsCheckBox(NULL)
|
||||
{
|
||||
// Decorator menu
|
||||
_BuildDecorMenu();
|
||||
@ -53,6 +62,13 @@ DecorSettingsView::DecorSettingsView(const char* name)
|
||||
fDecorInfoButton = new BButton(B_TRANSLATE("About"),
|
||||
new BMessage(kMsgDecorInfo));
|
||||
|
||||
fDoubleScrollbarArrowsCheckBox = new BCheckBox("doubleScrollbarArrows",
|
||||
B_TRANSLATE("Use double scrollbar arrows"),
|
||||
new BMessage(kMsgDoubleScrollbarArrows));
|
||||
|
||||
fSavedDoubleArrowsValue = _GetDoubleScrollbarArrowsSetting();
|
||||
fDoubleScrollbarArrowsCheckBox->SetValue(fSavedDoubleArrowsValue);
|
||||
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
|
||||
// control layout
|
||||
@ -61,9 +77,10 @@ DecorSettingsView::DecorSettingsView(const char* name)
|
||||
.Add(fDecorMenuField->CreateMenuBarLayoutItem(), 1, 0)
|
||||
.Add(fDecorInfoButton, 2, 0)
|
||||
|
||||
.Add(BSpaceLayoutItem::CreateGlue(), 0, 3, 2)
|
||||
.SetInsets(10, 10, 10, 10)
|
||||
);
|
||||
.Add(fDoubleScrollbarArrowsCheckBox, 0, 3, 2)
|
||||
.Add(BSpaceLayoutItem::CreateGlue(), 0, 4, 2)
|
||||
.SetInsets(10, 10, 10, 10)
|
||||
);
|
||||
// TODO : Decorator Preview Image?
|
||||
}
|
||||
|
||||
@ -83,6 +100,7 @@ DecorSettingsView::AttachedToWindow()
|
||||
|
||||
fDecorMenu->SetTargetForItems(this);
|
||||
fDecorInfoButton->SetTarget(this);
|
||||
fDoubleScrollbarArrowsCheckBox->SetTarget(this);
|
||||
}
|
||||
|
||||
|
||||
@ -125,6 +143,9 @@ DecorSettingsView::MessageReceived(BMessage *msg)
|
||||
|
||||
break;
|
||||
}
|
||||
case kMsgDoubleScrollbarArrows:
|
||||
_SetDoubleScrollbarArrowsSetting(fDoubleScrollbarArrowsCheckBox->Value());
|
||||
break;
|
||||
|
||||
default:
|
||||
BView::MessageReceived(msg);
|
||||
@ -197,24 +218,53 @@ DecorSettingsView::_AdoptInterfaceToCurrentDecor()
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DecorSettingsView::_GetDoubleScrollbarArrowsSetting()
|
||||
{
|
||||
scroll_bar_info info;
|
||||
get_scroll_bar_info(&info);
|
||||
|
||||
return info.double_arrows;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DecorSettingsView::_SetDoubleScrollbarArrowsSetting(bool value)
|
||||
{
|
||||
scroll_bar_info info;
|
||||
get_scroll_bar_info(&info);
|
||||
|
||||
info.double_arrows = value;
|
||||
set_scroll_bar_info(&info);
|
||||
|
||||
Window()->PostMessage(kMsgUpdate);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DecorSettingsView::SetDefaults()
|
||||
{
|
||||
_SetDecor(fDecorUtility.DefaultDecorator());
|
||||
_SetDoubleScrollbarArrowsSetting(kDefaultDoubleScrollbarArrowsSetting);
|
||||
fDoubleScrollbarArrowsCheckBox->SetValue(
|
||||
kDefaultDoubleScrollbarArrowsSetting);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DecorSettingsView::IsDefaultable()
|
||||
{
|
||||
return fCurrentDecor != fDecorUtility.DefaultDecorator()->Name();
|
||||
return fCurrentDecor != fDecorUtility.DefaultDecorator()->Name() ||
|
||||
fDoubleScrollbarArrowsCheckBox->Value() !=
|
||||
kDefaultDoubleScrollbarArrowsSetting;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DecorSettingsView::IsRevertable()
|
||||
{
|
||||
return fCurrentDecor != fSavedDecor;
|
||||
return fCurrentDecor != fSavedDecor ||
|
||||
fDoubleScrollbarArrowsCheckBox->Value() != fSavedDoubleArrowsValue;
|
||||
}
|
||||
|
||||
|
||||
@ -222,4 +272,6 @@ void
|
||||
DecorSettingsView::Revert()
|
||||
{
|
||||
_SetDecor(fSavedDecor);
|
||||
_SetDoubleScrollbarArrowsSetting(fSavedDoubleArrowsValue);
|
||||
fDoubleScrollbarArrowsCheckBox->SetValue(fSavedDoubleArrowsValue);
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
|
||||
class BButton;
|
||||
class BCheckBox;
|
||||
class BMenuField;
|
||||
class BPopUpMenu;
|
||||
|
||||
@ -40,6 +41,8 @@ private:
|
||||
void _BuildDecorMenu();
|
||||
void _AdoptToCurrentDecor();
|
||||
void _AdoptInterfaceToCurrentDecor();
|
||||
bool _GetDoubleScrollbarArrowsSetting();
|
||||
void _SetDoubleScrollbarArrowsSetting(bool value);
|
||||
|
||||
private:
|
||||
DecorInfoUtility fDecorUtility;
|
||||
@ -47,9 +50,11 @@ private:
|
||||
BButton* fDecorInfoButton;
|
||||
BMenuField* fDecorMenuField;
|
||||
BPopUpMenu* fDecorMenu;
|
||||
BCheckBox* fDoubleScrollbarArrowsCheckBox;
|
||||
|
||||
BString fSavedDecor;
|
||||
BString fCurrentDecor;
|
||||
bool fSavedDoubleArrowsValue;
|
||||
};
|
||||
|
||||
#endif // DECOR_SETTINGS_VIEW_H
|
||||
|
Loading…
Reference in New Issue
Block a user