mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 09:19:01 +00:00
Moved the event listener from the 3d widget to the gui control class.
This commit is contained in:
parent
29526906c4
commit
5d71cdd56d
4 changed files with 25 additions and 13 deletions
|
@ -21,8 +21,7 @@
|
||||||
#include "nel/3d/driver_user.h"
|
#include "nel/3d/driver_user.h"
|
||||||
#include "nel/misc/rgba.h"
|
#include "nel/misc/rgba.h"
|
||||||
#include "nel/misc/path.h"
|
#include "nel/misc/path.h"
|
||||||
#include "nel/misc/event_listener.h"
|
//#include "nel/misc/event_listener.h"
|
||||||
#include "nel/gui/event_listener.h"
|
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
@ -42,7 +41,6 @@ namespace GUIEditor
|
||||||
// so that we can render the widget normally ourselves, without the image
|
// so that we can render the widget normally ourselves, without the image
|
||||||
// disappearing when a widget is resized or shown on top of us
|
// disappearing when a widget is resized or shown on top of us
|
||||||
setAttribute( Qt::WA_PaintOnScreen, true );
|
setAttribute( Qt::WA_PaintOnScreen, true );
|
||||||
eventListener = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Nel3DWidget::~Nel3DWidget()
|
Nel3DWidget::~Nel3DWidget()
|
||||||
|
@ -59,7 +57,6 @@ namespace GUIEditor
|
||||||
delete driver;
|
delete driver;
|
||||||
driver = NULL;
|
driver = NULL;
|
||||||
}
|
}
|
||||||
delete eventListener;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Nel3DWidget::init()
|
void Nel3DWidget::init()
|
||||||
|
@ -69,8 +66,6 @@ namespace GUIEditor
|
||||||
driver = NL3D::UDriver::createDriver( 0, false, 0 );
|
driver = NL3D::UDriver::createDriver( 0, false, 0 );
|
||||||
driver->setMatrixMode2D11();
|
driver->setMatrixMode2D11();
|
||||||
driver->setDisplay( winId(), NL3D::UDriver::CMode( width(), height(), 32, true ) );
|
driver->setDisplay( winId(), NL3D::UDriver::CMode( width(), height(), 32, true ) );
|
||||||
eventListener = new NLGUI::CEventListener();
|
|
||||||
eventListener->addToServer( &driver->EventServer );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Nel3DWidget::createTextContext( std::string fontFile )
|
void Nel3DWidget::createTextContext( std::string fontFile )
|
||||||
|
|
|
@ -22,11 +22,6 @@
|
||||||
#include "nel/misc/types_nl.h"
|
#include "nel/misc/types_nl.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace NLGUI
|
|
||||||
{
|
|
||||||
class CEventListener;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace NL3D
|
namespace NL3D
|
||||||
{
|
{
|
||||||
class UDriver;
|
class UDriver;
|
||||||
|
@ -71,7 +66,6 @@ namespace GUIEditor
|
||||||
private:
|
private:
|
||||||
NL3D::UDriver *driver;
|
NL3D::UDriver *driver;
|
||||||
NL3D::UTextContext *textContext;
|
NL3D::UTextContext *textContext;
|
||||||
NLGUI::CEventListener *eventListener;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "nel/gui/widget_manager.h"
|
#include "nel/gui/widget_manager.h"
|
||||||
#include "nel/gui/action_handler.h"
|
#include "nel/gui/action_handler.h"
|
||||||
#include "nel/gui/lua_manager.h"
|
#include "nel/gui/lua_manager.h"
|
||||||
|
#include "nel/gui/event_listener.h"
|
||||||
#include "nel/misc/path.h"
|
#include "nel/misc/path.h"
|
||||||
#include "nel/misc/i18n.h"
|
#include "nel/misc/i18n.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
|
@ -42,6 +43,8 @@ namespace GUIEditor
|
||||||
guiLoaded = false;
|
guiLoaded = false;
|
||||||
watcher = NULL;
|
watcher = NULL;
|
||||||
w = new Nel3DWidget();
|
w = new Nel3DWidget();
|
||||||
|
eventListener = new NLGUI::CEventListener();
|
||||||
|
listening = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
NelGUICtrl::~NelGUICtrl()
|
NelGUICtrl::~NelGUICtrl()
|
||||||
|
@ -157,6 +160,12 @@ namespace GUIEditor
|
||||||
{
|
{
|
||||||
if( timerID == 0 )
|
if( timerID == 0 )
|
||||||
timerID = startTimer( 200 );
|
timerID = startTimer( 200 );
|
||||||
|
|
||||||
|
if( !listening )
|
||||||
|
{
|
||||||
|
eventListener->addToServer( &w->getDriver()->EventServer );
|
||||||
|
listening = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NelGUICtrl::hide()
|
void NelGUICtrl::hide()
|
||||||
|
@ -166,6 +175,12 @@ namespace GUIEditor
|
||||||
killTimer( timerID );
|
killTimer( timerID );
|
||||||
timerID = 0;
|
timerID = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( listening )
|
||||||
|
{
|
||||||
|
eventListener->removeFromServer();
|
||||||
|
listening = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget* NelGUICtrl::getViewPort()
|
QWidget* NelGUICtrl::getViewPort()
|
||||||
|
|
|
@ -23,6 +23,11 @@
|
||||||
|
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
|
namespace NLGUI
|
||||||
|
{
|
||||||
|
class CEventListener;
|
||||||
|
}
|
||||||
|
|
||||||
namespace GUIEditor
|
namespace GUIEditor
|
||||||
{
|
{
|
||||||
class CEditorSelectionWatcher;
|
class CEditorSelectionWatcher;
|
||||||
|
@ -58,8 +63,11 @@ Q_SIGNALS:
|
||||||
bool guiLoaded;
|
bool guiLoaded;
|
||||||
CEditorSelectionWatcher *watcher;
|
CEditorSelectionWatcher *watcher;
|
||||||
|
|
||||||
|
NLGUI::CEventListener *eventListener;
|
||||||
|
|
||||||
Nel3DWidget *w;
|
Nel3DWidget *w;
|
||||||
|
|
||||||
|
bool listening;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue