Update ICO Translator to use the Layout API. Fixes #6525
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38648 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -7,67 +7,72 @@
|
|||||||
#include "ConfigView.h"
|
#include "ConfigView.h"
|
||||||
#include "ICOTranslator.h"
|
#include "ICOTranslator.h"
|
||||||
|
|
||||||
#include <StringView.h>
|
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
|
#include <ControlLook.h>
|
||||||
|
#include <SpaceLayoutItem.h>
|
||||||
|
#include <StringView.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
|
ConfigView::ConfigView()
|
||||||
: BView(frame, "ICOTranslator Settings", resize, flags)
|
:
|
||||||
|
BGroupView("ICOTranslator Settings", B_VERTICAL, 0)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
BAlignment leftAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET);
|
||||||
|
|
||||||
font_height fontHeight;
|
BStringView* stringView = new BStringView("title", "Windows icon images");
|
||||||
be_bold_font->GetHeight(&fontHeight);
|
|
||||||
float height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
|
|
||||||
|
|
||||||
BRect rect(10, 10, 200, 10 + height);
|
|
||||||
BStringView *stringView = new BStringView(rect, "title", "Windows icon images");
|
|
||||||
stringView->SetFont(be_bold_font);
|
stringView->SetFont(be_bold_font);
|
||||||
stringView->ResizeToPreferred();
|
stringView->SetExplicitAlignment(leftAlignment);
|
||||||
AddChild(stringView);
|
AddChild(stringView);
|
||||||
|
|
||||||
rect.OffsetBy(0, height + 10);
|
float spacing = be_control_look->DefaultItemSpacing();
|
||||||
|
AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing));
|
||||||
|
|
||||||
char version[256];
|
char version[256];
|
||||||
sprintf(version, "Version %d.%d.%d, %s",
|
sprintf(version, "Version %d.%d.%d, %s",
|
||||||
int(B_TRANSLATION_MAJOR_VERSION(ICO_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_MAJOR_VERSION(ICO_TRANSLATOR_VERSION)),
|
||||||
int(B_TRANSLATION_MINOR_VERSION(ICO_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_MINOR_VERSION(ICO_TRANSLATOR_VERSION)),
|
||||||
int(B_TRANSLATION_REVISION_VERSION(ICO_TRANSLATOR_VERSION)),
|
int(B_TRANSLATION_REVISION_VERSION(ICO_TRANSLATOR_VERSION)),
|
||||||
__DATE__);
|
__DATE__);
|
||||||
stringView = new BStringView(rect, "version", version);
|
stringView = new BStringView("version", version);
|
||||||
stringView->ResizeToPreferred();
|
stringView->SetExplicitAlignment(leftAlignment);
|
||||||
AddChild(stringView);
|
AddChild(stringView);
|
||||||
|
|
||||||
GetFontHeight(&fontHeight);
|
stringView = new BStringView("copyright",
|
||||||
height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
|
B_UTF8_COPYRIGHT "2005-2006 Haiku Inc.");
|
||||||
|
stringView->SetExplicitAlignment(leftAlignment);
|
||||||
rect.OffsetBy(0, height + 5);
|
|
||||||
stringView = new BStringView(rect, "copyright", B_UTF8_COPYRIGHT "2005-2006 Haiku Inc.");
|
|
||||||
stringView->ResizeToPreferred();
|
|
||||||
AddChild(stringView);
|
AddChild(stringView);
|
||||||
|
|
||||||
rect.OffsetBy(0, height + 20);
|
AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing));
|
||||||
BCheckBox *checkBox = new BCheckBox(rect, "color", "Write 32 bit images on true color input", NULL);
|
|
||||||
checkBox->ResizeToPreferred();
|
BCheckBox *checkBox = new BCheckBox("color", "Write 32 bit images on"
|
||||||
|
" true color input", NULL);
|
||||||
|
checkBox->SetExplicitAlignment(leftAlignment);
|
||||||
AddChild(checkBox);
|
AddChild(checkBox);
|
||||||
|
|
||||||
rect.OffsetBy(0, height + 10);
|
checkBox = new BCheckBox("size", "Enforce valid icon sizes", NULL);
|
||||||
checkBox = new BCheckBox(rect, "size", "Enforce valid icon sizes", NULL);
|
|
||||||
checkBox->ResizeToPreferred();
|
|
||||||
checkBox->SetValue(1);
|
checkBox->SetValue(1);
|
||||||
|
checkBox->SetExplicitAlignment(leftAlignment);
|
||||||
AddChild(checkBox);
|
AddChild(checkBox);
|
||||||
|
|
||||||
rect.OffsetBy(0, height + 15);
|
AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing));
|
||||||
stringView = new BStringView(rect, "valid1", "Valid icon sizes are 16, 32, or 48");
|
|
||||||
stringView->ResizeToPreferred();
|
stringView = new BStringView("valid1", "Valid icon sizes are"
|
||||||
|
" 16, 32, or 48");
|
||||||
|
stringView->SetExplicitAlignment(leftAlignment);
|
||||||
AddChild(stringView);
|
AddChild(stringView);
|
||||||
|
|
||||||
rect.OffsetBy(0, height + 5);
|
stringView = new BStringView("valid2", "pixel in either direction.");
|
||||||
stringView = new BStringView(rect, "valid2", "pixel in either direction.");
|
stringView->SetExplicitAlignment(leftAlignment);
|
||||||
stringView->ResizeToPreferred();
|
|
||||||
AddChild(stringView);
|
AddChild(stringView);
|
||||||
|
|
||||||
|
AddChild(BSpaceLayoutItem::CreateGlue());
|
||||||
|
GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
|
||||||
|
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
|
||||||
|
|
||||||
|
SetExplicitPreferredSize(GroupLayout()->MinSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,13 +6,12 @@
|
|||||||
#define CONFIG_VIEW_H
|
#define CONFIG_VIEW_H
|
||||||
|
|
||||||
|
|
||||||
#include <View.h>
|
#include <GroupView.h>
|
||||||
|
|
||||||
|
|
||||||
class ConfigView : public BView {
|
class ConfigView : public BGroupView {
|
||||||
public:
|
public:
|
||||||
ConfigView(const BRect &frame, uint32 resize = B_FOLLOW_ALL,
|
ConfigView();
|
||||||
uint32 flags = B_WILL_DRAW);
|
|
||||||
virtual ~ConfigView();
|
virtual ~ConfigView();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ ICOTranslator::DerivedCanHandleImageSize(float width, float height) const
|
|||||||
BView *
|
BView *
|
||||||
ICOTranslator::NewConfigView(TranslatorSettings *settings)
|
ICOTranslator::NewConfigView(TranslatorSettings *settings)
|
||||||
{
|
{
|
||||||
return new ConfigView(BRect(0, 0, 225, 175));
|
return new ConfigView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user