xref: /haiku/src/add-ons/translators/rtf/ConfigView.cpp (revision 4f00613311d0bd6b70fa82ce19931c41f071ea4e)
1 /*
2  * Copyright 2004-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 "RTFTranslator.h"
9 
10 #include <StringView.h>
11 
12 #include <stdio.h>
13 #include <string.h>
14 
15 
16 ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
17 	: BView(frame, "RTF-Translator Settings", resize, flags)
18 {
19 	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
20 
21 	font_height fontHeight;
22 	be_bold_font->GetHeight(&fontHeight);
23 	float height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
24 
25 	BRect rect(10, 10, 200, 10 + height);
26 	BStringView *stringView = new BStringView(rect, "title", "Rich Text Format (RTF) Files");
27 	stringView->SetFont(be_bold_font);
28 	stringView->ResizeToPreferred();
29 	AddChild(stringView);
30 
31 	rect.OffsetBy(0, height + 10);
32 	char version[256];
33 	sprintf(version, "Version %d.%d.%d, %s",
34 		int(B_TRANSLATION_MAJOR_VERSION(RTF_TRANSLATOR_VERSION)),
35 		int(B_TRANSLATION_MINOR_VERSION(RTF_TRANSLATOR_VERSION)),
36 		int(B_TRANSLATION_REVISION_VERSION(RTF_TRANSLATOR_VERSION)),
37 		__DATE__);
38 	stringView = new BStringView(rect, "version", version);
39 	stringView->ResizeToPreferred();
40 	AddChild(stringView);
41 
42 	GetFontHeight(&fontHeight);
43 	height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
44 
45 	rect.OffsetBy(0, height + 5);
46 	stringView = new BStringView(rect, "copyright", B_UTF8_COPYRIGHT "2004-2005 Haiku Inc.");
47 	stringView->ResizeToPreferred();
48 	AddChild(stringView);
49 }
50 
51 
52 ConfigView::~ConfigView()
53 {
54 }
55 
56