xref: /haiku/src/add-ons/translators/ico/ConfigView.cpp (revision 3be9edf8da228afd9fec0390f408c964766122aa)
1 /*
2  * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include "ConfigView.h"
8 #include "ICOTranslator.h"
9 
10 #include <StringView.h>
11 #include <CheckBox.h>
12 
13 #include <stdio.h>
14 #include <string.h>
15 
16 
17 ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
18 	: BView(frame, "ICOTranslator Settings", resize, flags)
19 {
20 	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
21 
22 	font_height fontHeight;
23 	be_bold_font->GetHeight(&fontHeight);
24 	float height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
25 
26 	BRect rect(10, 10, 200, 10 + height);
27 	BStringView *stringView = new BStringView(rect, "title", "Windows Icon Images");
28 	stringView->SetFont(be_bold_font);
29 	stringView->ResizeToPreferred();
30 	AddChild(stringView);
31 
32 	rect.OffsetBy(0, height + 10);
33 	char version[256];
34 	sprintf(version, "Version %d.%d.%d, %s",
35 		int(B_TRANSLATION_MAJOR_VERSION(ICO_TRANSLATOR_VERSION)),
36 		int(B_TRANSLATION_MINOR_VERSION(ICO_TRANSLATOR_VERSION)),
37 		int(B_TRANSLATION_REVISION_VERSION(ICO_TRANSLATOR_VERSION)),
38 		__DATE__);
39 	stringView = new BStringView(rect, "version", version);
40 	stringView->ResizeToPreferred();
41 	AddChild(stringView);
42 
43 	GetFontHeight(&fontHeight);
44 	height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
45 
46 	rect.OffsetBy(0, height + 5);
47 	stringView = new BStringView(rect, "copyright", B_UTF8_COPYRIGHT "2005-2006 Haiku Inc.");
48 	stringView->ResizeToPreferred();
49 	AddChild(stringView);
50 
51 	rect.OffsetBy(0, height + 20);
52 	BCheckBox *checkBox = new BCheckBox(rect, "color", "Write 32 bit images on true color input", NULL);
53 	checkBox->ResizeToPreferred();
54 	AddChild(checkBox);
55 
56 	rect.OffsetBy(0, height + 10);
57 	checkBox = new BCheckBox(rect, "size", "Enforce valid icon sizes", NULL);
58 	checkBox->ResizeToPreferred();
59 	checkBox->SetValue(1);
60 	AddChild(checkBox);
61 
62 	rect.OffsetBy(0, height + 15);
63 	stringView = new BStringView(rect, "valid1", "Valid icon sizes are 16, 32, or 48");
64 	stringView->ResizeToPreferred();
65 	AddChild(stringView);
66 
67 	rect.OffsetBy(0, height + 5);
68 	stringView = new BStringView(rect, "valid2", "pixel in either direction.");
69 	stringView->ResizeToPreferred();
70 	AddChild(stringView);
71 }
72 
73 
74 ConfigView::~ConfigView()
75 {
76 }
77 
78