mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-24 08:06:13 +00:00
Nel3DWidget is no longer in the GUI Editor namespace.
This commit is contained in:
parent
4201f3cd29
commit
f8004546db
3 changed files with 128 additions and 137 deletions
|
@ -27,13 +27,9 @@
|
|||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
namespace GUIEditor
|
||||
Nel3DWidget::Nel3DWidget( QWidget *parent ) :
|
||||
QWidget( parent )
|
||||
{
|
||||
Nel3DWidget::Nel3DWidget( QWidget *parent ) :
|
||||
QWidget( parent )
|
||||
{
|
||||
driver = NULL;
|
||||
textContext = NULL;
|
||||
|
||||
|
@ -43,10 +39,10 @@ namespace GUIEditor
|
|||
setAttribute( Qt::WA_PaintOnScreen, true );
|
||||
setAttribute( Qt::WA_OpaquePaintEvent, true );
|
||||
setAttribute( Qt::WA_NoSystemBackground, true );
|
||||
}
|
||||
}
|
||||
|
||||
Nel3DWidget::~Nel3DWidget()
|
||||
{
|
||||
Nel3DWidget::~Nel3DWidget()
|
||||
{
|
||||
if( driver != NULL )
|
||||
{
|
||||
if( textContext != NULL )
|
||||
|
@ -59,19 +55,19 @@ namespace GUIEditor
|
|||
delete driver;
|
||||
driver = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Nel3DWidget::init()
|
||||
{
|
||||
void Nel3DWidget::init()
|
||||
{
|
||||
nlassert( driver == NULL );
|
||||
|
||||
driver = NL3D::UDriver::createDriver( 0, false, 0 );
|
||||
driver->setMatrixMode2D11();
|
||||
driver->setDisplay( winId(), NL3D::UDriver::CMode( width(), height(), 32, true ) );
|
||||
}
|
||||
}
|
||||
|
||||
void Nel3DWidget::createTextContext( std::string fontFile )
|
||||
{
|
||||
void Nel3DWidget::createTextContext( std::string fontFile )
|
||||
{
|
||||
if( driver == NULL )
|
||||
return;
|
||||
|
||||
|
@ -94,30 +90,30 @@ namespace GUIEditor
|
|||
}
|
||||
|
||||
textContext = driver->createTextContext( font );
|
||||
}
|
||||
}
|
||||
|
||||
void Nel3DWidget::clear()
|
||||
{
|
||||
void Nel3DWidget::clear()
|
||||
{
|
||||
if( driver == NULL )
|
||||
return;
|
||||
driver->clearBuffers( NLMISC::CRGBA::Black );
|
||||
driver->swapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
void Nel3DWidget::showEvent( QShowEvent *evnt )
|
||||
{
|
||||
void Nel3DWidget::showEvent( QShowEvent *evnt )
|
||||
{
|
||||
QWidget::showEvent( evnt );
|
||||
|
||||
if( driver != NULL )
|
||||
driver->activate();
|
||||
}
|
||||
}
|
||||
|
||||
#if defined ( NL_OS_WINDOWS )
|
||||
|
||||
typedef bool ( *winProc )( NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
|
||||
typedef bool ( *winProc )( NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
|
||||
|
||||
bool Nel3DWidget::winEvent( MSG *message, long *result )
|
||||
{
|
||||
bool Nel3DWidget::winEvent( MSG *message, long *result )
|
||||
{
|
||||
if( driver != NULL )
|
||||
{
|
||||
NL3D::IDriver *iDriver = dynamic_cast< NL3D::CDriverUser* >( driver )->getDriver();
|
||||
|
@ -129,14 +125,14 @@ namespace GUIEditor
|
|||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined( NL_OS_MAC )
|
||||
|
||||
typedef bool ( *cocoaProc )( NL3D::IDriver *, const void *e );
|
||||
typedef bool ( *cocoaProc )( NL3D::IDriver *, const void *e );
|
||||
|
||||
bool Nel3DWidget::macEvent( EventHandlerCallRef caller, EventRef event )
|
||||
{
|
||||
bool Nel3DWidget::macEvent( EventHandlerCallRef caller, EventRef event )
|
||||
{
|
||||
if( caller )
|
||||
nlerror( "You are using QtCarbon! Only QtCocoa supported, please upgrade Qt" );
|
||||
|
||||
|
@ -151,14 +147,14 @@ namespace GUIEditor
|
|||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined( NL_OS_UNIX )
|
||||
|
||||
typedef bool ( *x11Proc )( NL3D::IDriver *drv, XEvent *e );
|
||||
typedef bool ( *x11Proc )( NL3D::IDriver *drv, XEvent *e );
|
||||
|
||||
bool Nel3DWidget::x11Event( XEvent *event )
|
||||
{
|
||||
bool Nel3DWidget::x11Event( XEvent *event )
|
||||
{
|
||||
if( driver != NULL )
|
||||
{
|
||||
NL3D::IDriver *iDriver = dynamic_cast< NL3D::CDriverUser* >( driver )->getDriver();
|
||||
|
@ -170,9 +166,6 @@ namespace GUIEditor
|
|||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,17 +28,15 @@ namespace NL3D
|
|||
class UTextContext;
|
||||
}
|
||||
|
||||
namespace GUIEditor
|
||||
/// Nel 3D interface to Qt
|
||||
class Nel3DWidget : public QWidget
|
||||
{
|
||||
/// Nel 3D interface to Qt
|
||||
class Nel3DWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
public:
|
||||
Nel3DWidget( QWidget *parent = NULL );
|
||||
virtual ~Nel3DWidget();
|
||||
|
||||
virtual void init();
|
||||
void init();
|
||||
void createTextContext( std::string fontFile );
|
||||
|
||||
NL3D::UDriver* getDriver() const{ return driver; }
|
||||
|
@ -50,26 +48,26 @@ namespace GUIEditor
|
|||
// disappearing when a widget is resized or shown on top of us
|
||||
QPaintEngine* paintEngine() const{ return NULL; }
|
||||
|
||||
public Q_SLOTS:
|
||||
public Q_SLOTS:
|
||||
void clear();
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
void showEvent( QShowEvent *evnt );
|
||||
|
||||
#if defined(NL_OS_WINDOWS)
|
||||
virtual bool winEvent( MSG *message, long *result );
|
||||
bool winEvent( MSG *message, long *result );
|
||||
#elif defined(NL_OS_MAC)
|
||||
virtual bool macEvent( EventHandlerCallRef caller, EventRef event );
|
||||
bool macEvent( EventHandlerCallRef caller, EventRef event );
|
||||
#elif defined(NL_OS_UNIX)
|
||||
virtual bool x11Event( XEvent *event );
|
||||
bool x11Event( XEvent *event );
|
||||
#endif
|
||||
|
||||
private:
|
||||
private:
|
||||
NL3D::UDriver *driver;
|
||||
NL3D::UTextContext *textContext;
|
||||
};
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "project_files.h"
|
||||
|
||||
class QWidget;
|
||||
class Nel3DWidget;
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
|
@ -31,7 +32,6 @@ namespace NLGUI
|
|||
namespace GUIEditor
|
||||
{
|
||||
class CEditorSelectionWatcher;
|
||||
class Nel3DWidget;
|
||||
|
||||
/// Qt viewport controller for the Nel GUI library
|
||||
class NelGUICtrl : public QObject
|
||||
|
|
Loading…
Reference in a new issue