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