Screensaver: Update Default Settings View to use Layout

and standard insets so that they match other screen savers
This commit is contained in:
John Scipione 2016-04-13 12:56:44 -07:00
parent 63d59e1081
commit 3801c37b90
2 changed files with 28 additions and 22 deletions

View File

@ -1,22 +1,24 @@
/*
* Copyright 2009, Haiku.
* Copyright 2009 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Ryan Leavengood, leavengood@gmail.com
*/
#ifndef BUILD_SCREEN_SAVER_DEFAULT_SETTINGS_VIEW
#define BUILD_SCREEN_SAVER_DEFAULT_SETTINGS_VIEW
#ifndef _BUILD_SCREEN_SAVER_DEFAULT_SETTINGS_VIEW_H
#define _BUILD_SCREEN_SAVER_DEFAULT_SETTINGS_VIEW_H
class BView;
namespace BPrivate {
void BuildScreenSaverDefaultSettingsView(BView* view, const char* moduleName, const char* info);
void
BuildScreenSaverDefaultSettingsView(BView* view, const char* moduleName,
const char* info);
}
} // namespace BPrivate
#endif // BUILD_SCREEN_SAVER_DEFAULT_SETTINGS_VIEW
#endif // _BUILD_SCREEN_SAVER_DEFAULT_SETTINGS_VIEW_H

View File

@ -1,36 +1,40 @@
/*
* Copyright 2009, Haiku.
* Copyright 2009-2016 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Ryan Leavengood, leavengood@gmail.com
* John Scipione, jscipione@gmail.com
*/
#include <BuildScreenSaverDefaultSettingsView.h>
#include <LayoutBuilder.h>
#include <StringView.h>
#include <View.h>
namespace BPrivate {
// This is used to provide a consistent look for the settings view for screen
// savers without any configuration.
// Provides a consistent look for the settings view for screen savers
// that don't provide any configuration settings.
void
BuildScreenSaverDefaultSettingsView(BView* view, const char* moduleName, const char* info)
BuildScreenSaverDefaultSettingsView(BView* view, const char* moduleName,
const char* info)
{
BRect rect(15, 15, 20, 20);
BStringView* stringView = new BStringView(rect, "module", moduleName);
stringView->SetFont(be_bold_font);
stringView->ResizeToPreferred();
view->AddChild(stringView);
rect.OffsetBy(0, stringView->Bounds().Height() + 4);
stringView = new BStringView(rect, "info", info);
stringView->ResizeToPreferred();
view->AddChild(stringView);
}
view->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BStringView* nameStringView = new BStringView("module", moduleName);
nameStringView->SetFont(be_bold_font);
BStringView* infoStringView = new BStringView("info", info);
BLayoutBuilder::Group<>(view, B_VERTICAL, B_USE_SMALL_SPACING)
.Add(nameStringView)
.Add(infoStringView)
.AddGlue()
.SetInsets(B_USE_DEFAULT_SPACING)
.End();
}
} // namespace BPrivate