mirror of
https://review.haiku-os.org/haiku
synced 2025-02-21 21:19:09 +01:00
Complete the implemention of Gears in GLRendering
* Add the gears_64.png resource to GLRendering.rdef * Add GearsView.cpp and header * Add to Jamfile * Add a GearsView to the OpenGLView * Make the default window width wider to fit the gears
This commit is contained in:
parent
b5adb259c3
commit
58c352015a
@ -1,8 +1,10 @@
|
||||
|
||||
resource(1, "BEOS:APP_SIG") #'MIMS' "application/x-vnd.Haiku-3DRendering";
|
||||
resource app_signature "application/x-vnd.Haiku-3DRendering";
|
||||
|
||||
resource app_name_catalog_entry "x-vnd.Haiku-3DRendering:System name:3D Rendering";
|
||||
|
||||
resource(1, "gears_64.png") #'PNG ' import "gears_64.png";
|
||||
|
||||
resource app_flags B_SINGLE_LAUNCH;
|
||||
|
||||
resource app_version {
|
||||
@ -32,4 +34,3 @@ resource vector_icon {
|
||||
$"02000A0001051001178422040A0203050403000A000203041810FF0215810004"
|
||||
$"178222040A030103000A04010400"
|
||||
};
|
||||
|
||||
|
66
src/preferences/3drendering/GearsView.cpp
Normal file
66
src/preferences/3drendering/GearsView.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2012 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* John Scipione <jscipione@gmail.com>
|
||||
*/
|
||||
|
||||
|
||||
#include "GearsView.h"
|
||||
|
||||
#include <Catalog.h>
|
||||
#include <Locale.h>
|
||||
#include <Size.h>
|
||||
#include <TranslationUtils.h>
|
||||
#include <TranslatorFormats.h>
|
||||
|
||||
|
||||
#undef B_TRANSLATE_CONTEXT
|
||||
#define B_TRANSLATE_CONTEXT "GearsView"
|
||||
|
||||
|
||||
static const float kStripeWidth = 30.0;
|
||||
|
||||
GearsView::GearsView()
|
||||
:
|
||||
BView("GearsView", B_WILL_DRAW),
|
||||
fGears(NULL)
|
||||
{
|
||||
SetExplicitPreferredSize(BSize(64 + 5, B_SIZE_UNLIMITED));
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
_InitGearsBitmap();
|
||||
}
|
||||
|
||||
|
||||
GearsView::~GearsView()
|
||||
{
|
||||
delete fGears;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GearsView::_InitGearsBitmap()
|
||||
{
|
||||
fGears = BTranslationUtils::GetBitmap(B_PNG_FORMAT, "gears_64.png");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GearsView::Draw(BRect updateRect)
|
||||
{
|
||||
SetHighColor(ViewColor());
|
||||
FillRect(updateRect);
|
||||
|
||||
BRect stripeRect = Bounds();
|
||||
stripeRect.right = kStripeWidth;
|
||||
SetHighColor(tint_color(ViewColor(), B_DARKEN_1_TINT));
|
||||
FillRect(stripeRect);
|
||||
|
||||
if (fGears == NULL)
|
||||
return;
|
||||
|
||||
SetDrawingMode(B_OP_ALPHA);
|
||||
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
|
||||
DrawBitmapAsync(fGears, BPoint(5, 70));
|
||||
}
|
30
src/preferences/3drendering/GearsView.h
Normal file
30
src/preferences/3drendering/GearsView.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2012 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef GEARS_VIEW_H
|
||||
#define GEARS_VIEW_H
|
||||
|
||||
|
||||
#include <View.h>
|
||||
|
||||
|
||||
class BBitmap;
|
||||
|
||||
|
||||
class GearsView : public BView {
|
||||
public:
|
||||
GearsView();
|
||||
virtual ~GearsView();
|
||||
|
||||
virtual void Draw(BRect updateRect);
|
||||
|
||||
protected:
|
||||
void _InitGearsBitmap();
|
||||
|
||||
private:
|
||||
BBitmap* fGears;
|
||||
};
|
||||
|
||||
|
||||
#endif /* OPENGL_VIEW_H */
|
@ -17,6 +17,7 @@ local sources =
|
||||
ExtensionsList.cpp
|
||||
ExtensionsView.cpp
|
||||
InfoView.cpp
|
||||
GearsView.cpp
|
||||
;
|
||||
|
||||
Includes [ FGristFiles $(sources) ] : $(HAIKU_MESA_HEADERS_DEPENDENCY) ;
|
||||
@ -28,7 +29,6 @@ Preference 3DRendering
|
||||
: be GL translation libcolumnlistview.a $(HAIKU_LOCALE_LIBS)
|
||||
$(TARGET_LIBSUPC++)
|
||||
: 3DRendering.rdef
|
||||
: Gears.rdef
|
||||
;
|
||||
|
||||
DoCatalogs 3DRendering :
|
||||
@ -38,6 +38,7 @@ DoCatalogs 3DRendering :
|
||||
ExtensionsList.cpp
|
||||
ExtensionsView.cpp
|
||||
InfoView.cpp
|
||||
GearsView.cpp
|
||||
OpenGLWindow.cpp
|
||||
;
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
* Artur Wyszynski <harakash@gmail.com>
|
||||
*/
|
||||
|
||||
|
||||
#include "OpenGLView.h"
|
||||
|
||||
#include <stdio.h>
|
||||
@ -67,20 +68,17 @@ OpenGLView::OpenGLView()
|
||||
|
||||
GroupLayout()->SetSpacing(0);
|
||||
BLayoutBuilder::Group<>(this)
|
||||
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
|
||||
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
|
||||
.Add(menuField)
|
||||
.AddGroup(B_HORIZONTAL, 0)
|
||||
.Add(new GearsView())
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING)
|
||||
.SetInsets(0, B_USE_DEFAULT_SPACING,
|
||||
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
|
||||
.Add(menuField)
|
||||
.Add(tabView)
|
||||
.SetInsets(0, B_USE_DEFAULT_SPACING, 0, 0)
|
||||
.End()
|
||||
.End();
|
||||
}
|
||||
|
||||
|
||||
OpenGLView::~OpenGLView()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -26,4 +26,5 @@ public:
|
||||
virtual ~OpenGLView();
|
||||
};
|
||||
|
||||
|
||||
#endif /* OPENGL_VIEW_H */
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
OpenGLWindow::OpenGLWindow()
|
||||
:
|
||||
BWindow(BRect(50, 50, 450, 400), B_TRANSLATE_SYSTEM_NAME("3D Rendering"),
|
||||
BWindow(BRect(50, 50, 450 + 64, 400), B_TRANSLATE_SYSTEM_NAME("3D Rendering"),
|
||||
B_TITLED_WINDOW, B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS
|
||||
| B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
|
||||
{
|
||||
|
BIN
src/preferences/3drendering/gears_64.png
Normal file
BIN
src/preferences/3drendering/gears_64.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
Loading…
x
Reference in New Issue
Block a user