170c51973SJohn Scipione /* 270c51973SJohn Scipione * Copyright 2009-2010 Haiku Inc. All rights reserved. 370c51973SJohn Scipione * Distributed under the terms of the MIT License. 470c51973SJohn Scipione * 570c51973SJohn Scipione * Authors: 670c51973SJohn Scipione * John Scipione <jscipione@gmail.com> 770c51973SJohn Scipione * Alex Wilson <yourpalal2@gmail.com> 870c51973SJohn Scipione * Artur Wyszynski <harakash@gmail.com> 970c51973SJohn Scipione */ 1070c51973SJohn Scipione 1170c51973SJohn Scipione 1270c51973SJohn Scipione #include "InfoView.h" 1370c51973SJohn Scipione 14acbaa2b2SAlexander von Gluck IV #include <Box.h> 1570c51973SJohn Scipione #include <Catalog.h> 1670c51973SJohn Scipione #include <ControlLook.h> 1770c51973SJohn Scipione #include <GL/gl.h> 1870c51973SJohn Scipione #include <GL/glu.h> 1970c51973SJohn Scipione #include <GL/glut.h> 2070c51973SJohn Scipione #include <GridLayoutBuilder.h> 2170c51973SJohn Scipione #include <LayoutBuilder.h> 2270c51973SJohn Scipione #include <Locale.h> 2370c51973SJohn Scipione #include <Message.h> 2470c51973SJohn Scipione #include <String.h> 2570c51973SJohn Scipione #include <StringView.h> 2670c51973SJohn Scipione 2770c51973SJohn Scipione 28546208a5SOliver Tappe #undef B_TRANSLATION_CONTEXT 29546208a5SOliver Tappe #define B_TRANSLATION_CONTEXT "InfoView" 3070c51973SJohn Scipione 3170c51973SJohn Scipione 3270c51973SJohn Scipione const BAlignment kLabelAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET); 3370c51973SJohn Scipione const BAlignment kValueAlignment(B_ALIGN_RIGHT, B_ALIGN_VERTICAL_UNSET); 3470c51973SJohn Scipione 3570c51973SJohn Scipione InfoView()3670c51973SJohn ScipioneInfoView::InfoView() 3770c51973SJohn Scipione : 3870c51973SJohn Scipione BGroupView(B_TRANSLATE("Information"), B_HORIZONTAL) 3970c51973SJohn Scipione { 40*9293eadbSAlexander von Gluck IV const char* glRenderer = (const char*)glGetString(GL_RENDERER); 41*9293eadbSAlexander von Gluck IV if (glRenderer == NULL) 42*9293eadbSAlexander von Gluck IV glRenderer = B_TRANSLATE("Unknown or missing OpenGL renderer."); 43*9293eadbSAlexander von Gluck IV BStringView* rendererView = new BStringView(NULL, glRenderer); 4470c51973SJohn Scipione rendererView->SetExplicitAlignment(kLabelAlignment); 4570c51973SJohn Scipione rendererView->SetFont(be_bold_font); 4670c51973SJohn Scipione 47*9293eadbSAlexander von Gluck IV const char* glVendor = (const char*)glGetString(GL_VENDOR); 48*9293eadbSAlexander von Gluck IV if (glVendor == NULL) 49*9293eadbSAlexander von Gluck IV glVendor = B_TRANSLATE("Unknown vendor"); 50*9293eadbSAlexander von Gluck IV BStringView* vendorNameView = new BStringView(NULL, glVendor); 5170c51973SJohn Scipione vendorNameView->SetExplicitAlignment(kLabelAlignment); 5270c51973SJohn Scipione 53*9293eadbSAlexander von Gluck IV const char* glVersion = (const char*)glGetString(GL_VERSION); 54*9293eadbSAlexander von Gluck IV if (glVersion == NULL) 55*9293eadbSAlexander von Gluck IV glVersion = B_TRANSLATE("Unknown version"); 56*9293eadbSAlexander von Gluck IV BStringView* glVersionView = new BStringView(NULL, glVersion); 5770c51973SJohn Scipione glVersionView->SetExplicitAlignment(kLabelAlignment); 5870c51973SJohn Scipione 59acbaa2b2SAlexander von Gluck IV BString apiString("GLU "); 60acbaa2b2SAlexander von Gluck IV apiString << (const char*)gluGetString(GLU_VERSION); 61acbaa2b2SAlexander von Gluck IV apiString << ", GLUT "; 62acbaa2b2SAlexander von Gluck IV apiString << (int32)GLUT_API_VERSION; 63acbaa2b2SAlexander von Gluck IV BStringView* apiVersionView = new BStringView(NULL, apiString.String()); 64acbaa2b2SAlexander von Gluck IV apiVersionView->SetExplicitAlignment(kLabelAlignment); 6570c51973SJohn Scipione 6670c51973SJohn Scipione BLayoutBuilder::Group<>(this) 6770c51973SJohn Scipione .AddGroup(B_VERTICAL, 0) 6870c51973SJohn Scipione .Add(rendererView) 69acbaa2b2SAlexander von Gluck IV .Add(vendorNameView) 70acbaa2b2SAlexander von Gluck IV .Add(glVersionView) 71acbaa2b2SAlexander von Gluck IV .Add(apiVersionView) 7270c51973SJohn Scipione .End(); 7370c51973SJohn Scipione } 7470c51973SJohn Scipione 7570c51973SJohn Scipione ~InfoView()7670c51973SJohn ScipioneInfoView::~InfoView() 7770c51973SJohn Scipione { 7870c51973SJohn Scipione } 79