1*70c51973SJohn Scipione /* 2*70c51973SJohn Scipione * Copyright 2009-2012 Haiku Inc. All rights reserved. 3*70c51973SJohn Scipione * Distributed under the terms of the MIT License. 4*70c51973SJohn Scipione * 5*70c51973SJohn Scipione * Authors: 6*70c51973SJohn Scipione * Alex Wilson <yourpalal2@gmail.com> 7*70c51973SJohn Scipione * Artur Wyszynski <harakash@gmail.com> 8*70c51973SJohn Scipione */ 9*70c51973SJohn Scipione 10*70c51973SJohn Scipione 11*70c51973SJohn Scipione #include "OpenGLView.h" 12*70c51973SJohn Scipione 13*70c51973SJohn Scipione #include <stdio.h> 14*70c51973SJohn Scipione 15*70c51973SJohn Scipione #include <Catalog.h> 16*70c51973SJohn Scipione #include <GLView.h> 17*70c51973SJohn Scipione #include <LayoutBuilder.h> 18*70c51973SJohn Scipione #include <Locale.h> 19*70c51973SJohn Scipione #include <MenuField.h> 20*70c51973SJohn Scipione #include <PopUpMenu.h> 21*70c51973SJohn Scipione #include <Size.h> 22*70c51973SJohn Scipione #include <SpaceLayoutItem.h> 23*70c51973SJohn Scipione #include <TabView.h> 24*70c51973SJohn Scipione 25*70c51973SJohn Scipione #include "CapabilitiesView.h" 26*70c51973SJohn Scipione #include "ExtensionsView.h" 27*70c51973SJohn Scipione #include "InfoView.h" 28*70c51973SJohn Scipione #include "GearsView.h" 29*70c51973SJohn Scipione 30*70c51973SJohn Scipione 31*70c51973SJohn Scipione #undef B_TRANSLATE_CONTEXT 32*70c51973SJohn Scipione #define B_TRANSLATE_CONTEXT "OpenGLView" 33*70c51973SJohn Scipione 34*70c51973SJohn Scipione 35*70c51973SJohn Scipione OpenGLView::OpenGLView() 36*70c51973SJohn Scipione : 37*70c51973SJohn Scipione BGroupView("OpenGLView", B_VERTICAL) 38*70c51973SJohn Scipione { 39*70c51973SJohn Scipione 40*70c51973SJohn Scipione BGLView* glView = new BGLView(BRect(0, 0, 1, 1), "gl info", B_FOLLOW_NONE, 0, 41*70c51973SJohn Scipione BGL_RGB | BGL_DOUBLE); 42*70c51973SJohn Scipione glView->Hide(); 43*70c51973SJohn Scipione AddChild(glView); 44*70c51973SJohn Scipione 45*70c51973SJohn Scipione glView->LockGL(); 46*70c51973SJohn Scipione 47*70c51973SJohn Scipione BPopUpMenu* menu = new BPopUpMenu(B_TRANSLATE("Automatic"), true, true); 48*70c51973SJohn Scipione menu->AddItem(new BMenuItem(B_TRANSLATE("Automatic"), 49*70c51973SJohn Scipione new BMessage(MENU_AUTO_MESSAGE))); 50*70c51973SJohn Scipione menu->AddSeparatorItem(); 51*70c51973SJohn Scipione menu->AddItem(new BMenuItem(B_TRANSLATE("Software Rasterizer"), 52*70c51973SJohn Scipione new BMessage(MENU_SWRAST_MESSAGE))); 53*70c51973SJohn Scipione menu->AddItem(new BMenuItem(B_TRANSLATE("Gallium Software Pipe"), 54*70c51973SJohn Scipione new BMessage(MENU_SWPIPE_MESSAGE))); 55*70c51973SJohn Scipione menu->AddItem(new BMenuItem(B_TRANSLATE("Gallium LLVM Pipe"), 56*70c51973SJohn Scipione new BMessage(MENU_SWLLVM_MESSAGE))); 57*70c51973SJohn Scipione BMenuField* menuField = new BMenuField("renderer", 58*70c51973SJohn Scipione B_TRANSLATE("3D Rendering Engine:"), menu); 59*70c51973SJohn Scipione menuField->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); 60*70c51973SJohn Scipione // TODO: Set current Renderer 61*70c51973SJohn Scipione menuField->SetEnabled(false); 62*70c51973SJohn Scipione 63*70c51973SJohn Scipione float tabViewWidth = this->StringWidth("M") * 36; 64*70c51973SJohn Scipione float tabViewHeight = this->StringWidth("M") * 16; 65*70c51973SJohn Scipione 66*70c51973SJohn Scipione BTabView *tabView = new BTabView("tab view", B_WIDTH_FROM_LABEL); 67*70c51973SJohn Scipione tabView->SetExplicitMinSize(BSize(tabViewWidth, tabViewHeight)); 68*70c51973SJohn Scipione tabView->AddTab(new CapabilitiesView()); 69*70c51973SJohn Scipione tabView->AddTab(new ExtensionsView()); 70*70c51973SJohn Scipione 71*70c51973SJohn Scipione glView->UnlockGL(); 72*70c51973SJohn Scipione 73*70c51973SJohn Scipione GroupLayout()->SetSpacing(0); 74*70c51973SJohn Scipione BLayoutBuilder::Group<>(this) 75*70c51973SJohn Scipione .AddGroup(B_HORIZONTAL, 0) 76*70c51973SJohn Scipione .Add(new GearsView()) 77*70c51973SJohn Scipione .AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING) 78*70c51973SJohn Scipione .SetInsets(0, B_USE_DEFAULT_SPACING, 79*70c51973SJohn Scipione B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING) 80*70c51973SJohn Scipione .Add(menuField) 81*70c51973SJohn Scipione .Add(new InfoView()) 82*70c51973SJohn Scipione .Add(tabView) 83*70c51973SJohn Scipione .End() 84*70c51973SJohn Scipione .AddGlue() 85*70c51973SJohn Scipione .End(); 86*70c51973SJohn Scipione } 87*70c51973SJohn Scipione 88*70c51973SJohn Scipione OpenGLView::~OpenGLView() 89*70c51973SJohn Scipione { 90*70c51973SJohn Scipione } 91