xref: /haiku/src/tests/kits/opengl/glinfo/InfoView.cpp (revision a3e794ae459fec76826407f8ba8c94cd3535f128)
1 /*
2  * Copyright 2009-2010 Haiku Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		John Scipione <jscipione@gmail.com>
7  *		Alex Wilson <yourpalal2@gmail.com>
8  *		Artur Wyszynski <harakash@gmail.com>
9  */
10 
11 
12 #include "InfoView.h"
13 
14 #include <Box.h>
15 #include <Catalog.h>
16 #include <ControlLook.h>
17 #include <GL/gl.h>
18 #include <GL/glu.h>
19 #include <GL/glut.h>
20 #include <GridLayoutBuilder.h>
21 #include <LayoutBuilder.h>
22 #include <Locale.h>
23 #include <Message.h>
24 #include <String.h>
25 #include <StringView.h>
26 
27 
28 #undef B_TRANSLATION_CONTEXT
29 #define B_TRANSLATION_CONTEXT "InfoView"
30 
31 
32 const BAlignment kLabelAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET);
33 const BAlignment kValueAlignment(B_ALIGN_RIGHT, B_ALIGN_VERTICAL_UNSET);
34 
35 
36 InfoView::InfoView()
37 	:
38 	BGroupView(B_TRANSLATE("Information"), B_HORIZONTAL)
39 {
40 	BStringView* rendererView = new BStringView(NULL,
41 		(const char*)glGetString(GL_RENDERER));
42 	rendererView->SetExplicitAlignment(kLabelAlignment);
43 	rendererView->SetFont(be_bold_font);
44 
45 	BStringView* vendorNameView = new BStringView(NULL,
46 		(const char*)glGetString(GL_VENDOR));
47 		vendorNameView->SetExplicitAlignment(kLabelAlignment);
48 
49 	BStringView* glVersionView = new BStringView(NULL,
50 		(const char*)glGetString(GL_VERSION));
51 	glVersionView->SetExplicitAlignment(kLabelAlignment);
52 
53 	BString apiString("GLU ");
54 	apiString << (const char*)gluGetString(GLU_VERSION);
55 	apiString << ", GLUT ";
56 	apiString << (int32)GLUT_API_VERSION;
57 	BStringView* apiVersionView = new BStringView(NULL, apiString.String());
58 	apiVersionView->SetExplicitAlignment(kLabelAlignment);
59 
60 	BLayoutBuilder::Group<>(this)
61 		.AddGroup(B_VERTICAL, 0)
62 			.Add(rendererView)
63 			.Add(vendorNameView)
64 			.Add(glVersionView)
65 			.Add(apiVersionView)
66 			.End();
67 }
68 
69 
70 InfoView::~InfoView()
71 {
72 }
73