Put the InfoView in the main OpenGLView.
Take the InfoView out of the tabView and put it above the tabView in the OpenGLView. Change the format to a slightly altered version from what kallisti5 recommended. The width and height of the tabView are controlled by M's so if you change your font size it will fit accordingly. Therefore the window dimensions are sane defaults yet don't really affect the dimensions of the child views. The views know how to size themselves sanely. * Change the 3d Rendering Engine from a BMenu to a BPopUpMenu.
This commit is contained in:
parent
2ddd0a7965
commit
766c2899e6
@ -30,52 +30,58 @@ const BAlignment kLabelAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET);
|
||||
const BAlignment kValueAlignment(B_ALIGN_RIGHT, B_ALIGN_VERTICAL_UNSET);
|
||||
|
||||
|
||||
// <bold>Render name</bold>
|
||||
// Vendor Name GL Version
|
||||
// GLU version GLUT API version
|
||||
//
|
||||
// example:
|
||||
// Software rasterizer for X86/MMX/SSE2
|
||||
// Mesa Project 2.1 Mesa 8.1-devel (git-2402c0)
|
||||
// GLU 1.3 GLUT API 5
|
||||
|
||||
InfoView::InfoView()
|
||||
:
|
||||
BGridView(B_TRANSLATE("Information"))
|
||||
BGroupView(B_TRANSLATE("Information"), B_HORIZONTAL)
|
||||
{
|
||||
_AddString(B_TRANSLATE("GL version:"),
|
||||
(const char*)glGetString(GL_VERSION));
|
||||
_AddString(B_TRANSLATE("Vendor name:"),
|
||||
(const char*)glGetString(GL_VENDOR));
|
||||
_AddString(B_TRANSLATE("Renderer name:"),
|
||||
BStringView* rendererView = new BStringView(NULL,
|
||||
(const char*)glGetString(GL_RENDERER));
|
||||
_AddString(B_TRANSLATE("GLU version:"),
|
||||
(const char*)gluGetString(GLU_VERSION));
|
||||
_AddString(B_TRANSLATE("GLUT API version:"),
|
||||
BString() << (int32)GLUT_API_VERSION);
|
||||
rendererView->SetExplicitAlignment(kLabelAlignment);
|
||||
rendererView->SetFont(be_bold_font);
|
||||
|
||||
BGridLayout* layout = GridLayout();
|
||||
layout->SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
|
||||
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
|
||||
BStringView* vendorNameView = new BStringView(NULL,
|
||||
(const char*)glGetString(GL_VENDOR));
|
||||
vendorNameView->SetExplicitAlignment(kLabelAlignment);
|
||||
|
||||
layout->AddItem(BSpaceLayoutItem::CreateGlue(), 0, layout->CountRows(),
|
||||
layout->CountColumns(), 1);
|
||||
BStringView* glVersionView = new BStringView(NULL,
|
||||
(const char*)glGetString(GL_VERSION));
|
||||
glVersionView->SetExplicitAlignment(kLabelAlignment);
|
||||
|
||||
// Set horizontal spacing to 0, and use the middle column as
|
||||
// variable-width spacing (like layout 'glue').
|
||||
layout->SetHorizontalSpacing(0);
|
||||
layout->SetMinColumnWidth(1, be_control_look->DefaultLabelSpacing());
|
||||
layout->SetMaxColumnWidth(1, B_SIZE_UNLIMITED);
|
||||
BString gluString("GLU ");
|
||||
gluString << (const char*)gluGetString(GLU_VERSION);
|
||||
BStringView* gluVersionView = new BStringView(NULL, gluString.String());
|
||||
gluVersionView->SetExplicitAlignment(kLabelAlignment);
|
||||
|
||||
BString glutAPIString("GLUT API ");
|
||||
glutAPIString << (int32)GLUT_API_VERSION;
|
||||
BStringView* glutVersionView = new BStringView(NULL,
|
||||
glutAPIString.String());
|
||||
glutVersionView->SetExplicitAlignment(kLabelAlignment);
|
||||
|
||||
BLayoutBuilder::Group<>(this)
|
||||
.AddGroup(B_VERTICAL, 0)
|
||||
.Add(rendererView)
|
||||
.AddGroup(B_HORIZONTAL, 0)
|
||||
.Add(vendorNameView)
|
||||
.Add(glVersionView)
|
||||
.End()
|
||||
.AddGroup(B_HORIZONTAL, 0)
|
||||
.Add(gluVersionView)
|
||||
.Add(glutVersionView)
|
||||
.End()
|
||||
.End();
|
||||
}
|
||||
|
||||
|
||||
InfoView::~InfoView()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InfoView::_AddString(const char* label, const char* value)
|
||||
{
|
||||
BView* labelView = new BStringView(NULL, label);
|
||||
labelView->SetExplicitAlignment(kLabelAlignment);
|
||||
|
||||
BView* valueView = new BStringView(NULL, value);
|
||||
valueView->SetExplicitAlignment(kValueAlignment);
|
||||
|
||||
int32 rows = GridLayout()->CountRows();
|
||||
BLayoutBuilder::Grid<>(this)
|
||||
.Add(labelView, 0, rows)
|
||||
.Add(valueView, 2, rows);
|
||||
}
|
||||
|
@ -6,18 +6,13 @@
|
||||
#define INFO_VIEW_H
|
||||
|
||||
|
||||
#include <GridView.h>
|
||||
#include <GroupView.h>
|
||||
|
||||
|
||||
class InfoView : public BGridView {
|
||||
class InfoView : public BGroupView {
|
||||
public:
|
||||
InfoView();
|
||||
virtual ~InfoView();
|
||||
|
||||
private:
|
||||
void _AddString(const char* label,
|
||||
const char* value);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include <LayoutBuilder.h>
|
||||
#include <Locale.h>
|
||||
#include <MenuField.h>
|
||||
#include <PopUpMenu.h>
|
||||
#include <Size.h>
|
||||
#include <SpaceLayoutItem.h>
|
||||
#include <TabView.h>
|
||||
|
||||
@ -42,9 +44,7 @@ OpenGLView::OpenGLView()
|
||||
|
||||
glView->LockGL();
|
||||
|
||||
BMenu* menu = new BMenu(B_TRANSLATE("Automatic"));
|
||||
menu->SetRadioMode(true);
|
||||
menu->SetLabelFromMarked(true);
|
||||
BPopUpMenu* menu = new BPopUpMenu(B_TRANSLATE("Automatic"), true, true);
|
||||
menu->AddItem(new BMenuItem(B_TRANSLATE("Automatic"),
|
||||
new BMessage(MENU_AUTO_MESSAGE)));
|
||||
menu->AddSeparatorItem();
|
||||
@ -56,11 +56,16 @@ OpenGLView::OpenGLView()
|
||||
new BMessage(MENU_SWLLVM_MESSAGE)));
|
||||
BMenuField* menuField = new BMenuField("renderer",
|
||||
B_TRANSLATE("3D Rendering Engine:"), menu);
|
||||
menuField->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
|
||||
// TODO: Set current Renderer
|
||||
menuField->SetEnabled(false);
|
||||
|
||||
float tabViewWidth
|
||||
= this->StringWidth("MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM");
|
||||
float tabViewHeight = this->StringWidth("MMMMMMMMMMMMMMMMMMM");
|
||||
|
||||
BTabView *tabView = new BTabView("tab view", B_WIDTH_FROM_LABEL);
|
||||
tabView->AddTab(new InfoView());
|
||||
tabView->SetExplicitMinSize(BSize(tabViewWidth, tabViewHeight));
|
||||
tabView->AddTab(new CapabilitiesView());
|
||||
tabView->AddTab(new ExtensionsView());
|
||||
|
||||
@ -74,6 +79,7 @@ OpenGLView::OpenGLView()
|
||||
.SetInsets(0, B_USE_DEFAULT_SPACING,
|
||||
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
|
||||
.Add(menuField)
|
||||
.Add(new InfoView())
|
||||
.Add(tabView)
|
||||
.End()
|
||||
.AddGlue()
|
||||
|
Loading…
Reference in New Issue
Block a user