Added TSafeDataPointer<T> and now SafeDataPointer implements TSafeDataPointer<Uint8>.

Renamed: Node::onMouseEnter and Node::onMouseExit in favor of: Node::onMouseOver and Node::onMouseLeave.
Renamed events NodeMessage::MouseEnter and NodeMessage::MouseExit for: NodeMessage::MouseOver and NodeMessage::MouseLeave.
Renamed events Event::MouseEnter and Event::MouseExit for: Event::MouseOver and Event::MouseLeave.
Node::onMouseOver and Node::onMouseLeave now reports the message to its parent tree.
Node flags now all passed as `const Uint32&`.

--HG--
branch : dev
This commit is contained in:
Martín Lucas Golini
2019-01-19 04:13:25 -03:00
parent 343d386d7a
commit 41e1fbf2fc
36 changed files with 156 additions and 154 deletions

View File

@@ -17,8 +17,8 @@ class EE_API Event {
MouseClick,
MouseDoubleClick,
MouseUp,
MouseEnter,
MouseExit,
MouseOver,
MouseLeave,
OnFocus,
OnFocusLoss,
OnVisibleChange,

View File

@@ -357,19 +357,19 @@ class EE_API Node : public Transformable {
virtual Uint32 onKeyUp( const KeyEvent& Event );
virtual Uint32 onMouseMove( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseMove( const Vector2i& position, const Uint32& flags );
virtual Uint32 onMouseDown( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseDown( const Vector2i& position, const Uint32& flags );
virtual Uint32 onMouseClick( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseClick( const Vector2i& position, const Uint32& flags );
virtual Uint32 onMouseDoubleClick( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseDoubleClick( const Vector2i& position, const Uint32& flags );
virtual Uint32 onMouseUp( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseUp( const Vector2i& position, const Uint32& flags );
virtual Uint32 onMouseEnter( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseOver( const Vector2i& position, const Uint32& flags );
virtual Uint32 onMouseExit( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseLeave( const Vector2i& position, const Uint32& flags );
virtual Uint32 onCalculateDrag( const Vector2f& position, const Uint32& flags );

View File

@@ -13,8 +13,8 @@ class EE_API NodeMessage {
{
Click = 0,
DoubleClick,
MouseEnter,
MouseExit,
MouseOver,
MouseLeave,
MouseDown,
MouseUp,
MouseMove,

View File

@@ -2,30 +2,67 @@
#define EE_SYSTEM_SAFEDATAPOINTER
#include <eepp/config.hpp>
#include <eepp/core/memorymanager.hpp>
#include <cstddef>
namespace EE { namespace System {
/** @brief Keep a pointer and release it in the SafeDataPointer destructor */
class EE_API SafeDataPointer {
template <typename T>
class TSafeDataPointer {
public:
SafeDataPointer();
TSafeDataPointer();
SafeDataPointer( Uint32 size );
TSafeDataPointer( Uint32 size );
SafeDataPointer( Uint8 * data, Uint32 size );
TSafeDataPointer( T * data, Uint32 size );
/** @brief The destructor deletes the buffer */
~SafeDataPointer();
~TSafeDataPointer();
void clear();
/** Pointer to the buffer */
Uint8 * data;
T * data;
/** Buffer size */
Uint32 size;
};
template <typename T>
TSafeDataPointer<T>::TSafeDataPointer() :
data( NULL ),
size( 0 )
{
}
template <typename T>
TSafeDataPointer<T>::TSafeDataPointer( Uint32 size ) :
data( eeNewArray( T, size ) ),
size( size )
{
}
template <typename T>
TSafeDataPointer<T>::TSafeDataPointer( T * data, Uint32 size ) :
data( data ),
size( size )
{
}
template <typename T>
TSafeDataPointer<T>::~TSafeDataPointer() {
clear();
}
template <typename T>
void TSafeDataPointer<T>::clear() {
eeSAFE_DELETE_ARRAY( data );
}
typedef TSafeDataPointer<Uint8> SafeDataPointer;
}}
#endif

View File

@@ -60,9 +60,9 @@ class EE_API UIDropDownList : public UITextInput {
virtual void hide();
Uint32 onMouseUp( const Vector2i& position, const Uint32 flags );
Uint32 onMouseUp( const Vector2i& position, const Uint32& flags );
Uint32 onMouseClick( const Vector2i& position, const Uint32 flags );
Uint32 onMouseClick( const Vector2i& position, const Uint32& flags );
virtual void onItemClicked( const Event * Event );

View File

@@ -32,11 +32,11 @@ class EE_API UIListBoxItem : public UITextView {
virtual void onStateChange();
virtual Uint32 onMouseUp( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseUp( const Vector2i& position, const Uint32& flags );
virtual Uint32 onMouseClick( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseClick( const Vector2i& position, const Uint32& flags );
virtual Uint32 onMouseExit( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseLeave( const Vector2i& position, const Uint32& flags );
};
}}

View File

@@ -31,7 +31,7 @@ class EE_API UIMenuCheckBox : public UIMenuItem {
UISkin * mSkinActive;
UISkin * mSkinInactive;
virtual Uint32 onMouseUp( const Vector2i &position, const Uint32 flags );
virtual Uint32 onMouseUp( const Vector2i& position, const Uint32& flags );
virtual void onStateChange();
};

View File

@@ -21,7 +21,7 @@ class EE_API UIMenuItem : public UIPushButton {
protected:
explicit UIMenuItem( const std::string& tag );
virtual Uint32 onMouseEnter( const Vector2i &position, const Uint32 flags );
virtual Uint32 onMouseOver( const Vector2i& position, const Uint32& flags );
};
}}

View File

@@ -43,9 +43,9 @@ class EE_API UIMenuSubMenu : public UIMenuItem {
Uint32 mCbId;
Uint32 mCbId2;
virtual Uint32 onMouseExit( const Vector2i &position, const Uint32 flags );
virtual Uint32 onMouseLeave( const Vector2i& position, const Uint32& flags );
virtual Uint32 onMouseMove( const Vector2i &position, const Uint32 getFlags );
virtual Uint32 onMouseMove( const Vector2i& position, const Uint32& flags );
virtual void onStateChange();

View File

@@ -214,9 +214,9 @@ class EE_API UINode : public Node {
Vector2f mDragPoint;
Uint32 mDragButton;
virtual Uint32 onMouseDown( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseDown( const Vector2i& position, const Uint32& flags );
virtual Uint32 onMouseUp( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseUp( const Vector2i& position, const Uint32& flags );
virtual Uint32 onValueChange();
@@ -246,9 +246,9 @@ class EE_API UINode : public Node {
virtual Uint32 onDragStop( const Vector2i& position );
virtual Uint32 onMouseEnter( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseOver( const Vector2i& position, const Uint32& flags );
virtual Uint32 onMouseExit( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseLeave( const Vector2i& position, const Uint32& flags );
virtual Uint32 onFocus();

View File

@@ -34,9 +34,9 @@ class EE_API UITab : public UISelectButton {
Node * mControlOwned;
std::string mOwnedName;
virtual Uint32 onMouseUp( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseUp( const Vector2i& position, const Uint32& flags );
virtual Uint32 onMouseClick( const Vector2i &position, const Uint32 flags );
virtual Uint32 onMouseClick( const Vector2i& position, const Uint32& flags );
virtual void onStateChange();

View File

@@ -39,7 +39,7 @@ class EE_API UITableCell : public UIWidget {
void fixCell();
virtual Uint32 onMouseExit( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseLeave( const Vector2i& position, const Uint32 flags );
virtual void onStateChange();

View File

@@ -71,11 +71,11 @@ class EE_API UITextInput : public UITextView {
void autoPadding();
virtual Uint32 onMouseClick( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseClick( const Vector2i& position, const Uint32& flags );
virtual Uint32 onMouseDoubleClick( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseDoubleClick( const Vector2i& position, const Uint32& flags );
virtual Uint32 onMouseExit( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseLeave( const Vector2i& position, const Uint32& flags );
virtual Uint32 onFocus();

View File

@@ -122,11 +122,11 @@ class EE_API UITextView : public UIWidget {
virtual Uint32 onFocusLoss();
virtual Uint32 onMouseDoubleClick( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseDoubleClick( const Vector2i& position, const Uint32& flags );
virtual Uint32 onMouseClick( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseClick( const Vector2i& position, const Uint32& flags );
virtual Uint32 onMouseDown( const Vector2i& position, const Uint32 flags );
virtual Uint32 onMouseDown( const Vector2i& position, const Uint32& flags );
virtual void selCurInit( const Int32& init );

View File

@@ -166,9 +166,9 @@ class EE_API UIWidget : public UINode, public CSS::StyleSheetElement {
void createTooltip();
virtual Uint32 onMouseMove( const Vector2i& Pos, const Uint32 Flags );
virtual Uint32 onMouseMove( const Vector2i& Pos, const Uint32& Flags );
virtual Uint32 onMouseExit( const Vector2i& Pos, const Uint32 Flags );
virtual Uint32 onMouseLeave( const Vector2i& Pos, const Uint32& Flags );
virtual void onParentSizeChange( const Vector2f& SizeChange );

View File

@@ -705,7 +705,6 @@
../../src/eepp/system/platform/win/threadlocalimpl.hpp
../../src/eepp/system/rc4.cpp
../../src/eepp/system/resourceloader.cpp
../../src/eepp/system/safedatapointer.cpp
../../src/eepp/system/sys.cpp
../../src/eepp/system/thread.cpp
../../src/eepp/system/threadlocal.cpp

View File

@@ -73,30 +73,25 @@ Uint64 SoundFileReaderMp3::read(Int16* samples, Uint64 maxCount) {
while (count < maxCount) {
const int samplesToRead = static_cast<int>(maxCount - count);
int frames = samplesToRead / mChannelCount;
float * rSamples = eeNewArray( float, samplesToRead );
TSafeDataPointer<float> rSamples( samplesToRead );
long framesRead = drmp3_read_pcm_frames_f32( mMp3, frames, rSamples );
long framesRead = drmp3_read_pcm_frames_f32( mMp3, frames, rSamples.data );
if (framesRead > 0) {
long samplesRead = framesRead * mChannelCount;
for ( int i = 0; i < samplesRead; i++ )
samples[i] = rSamples[i] * 32768.f;
samples[i] = rSamples.data[i] * 32768.f;
count += samplesRead;
samples += samplesRead;
if (framesRead != frames) {
eeSAFE_DELETE(rSamples);
if (framesRead != frames)
break;
}
} else {
// error or end of file
eeSAFE_DELETE(rSamples);
break;
}
eeSAFE_DELETE(rSamples);
}
return count;

View File

@@ -337,7 +337,7 @@ void UIMap::onSizeChange() {
UIWindow::onSizeChange();
}
Uint32 UIMap::onMouseMove( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 UIMap::onMouseMove( const Vector2i& Pos, const Uint32& Flags ) {
if ( NULL != mMap ) {
if ( EDITING_LIGHT == mEditingMode && NULL != mAddLight ) {
mAddLight->setPosition( mMap->getMouseMapPosf() );

View File

@@ -135,7 +135,7 @@ class EE_API UIMap : public UIWindow {
virtual Uint32 onMessage( const NodeMessage * Msg );
virtual Uint32 onMouseMove( const Vector2i& getPosition, const Uint32 flags );
virtual Uint32 onMouseMove( const Vector2i& position, const Uint32& flags );
virtual void onSizeChange();

View File

@@ -62,15 +62,15 @@ void EventDispatcher::update( const Time& time ) {
if ( pOver != mOverControl ) {
if ( NULL != mOverControl ) {
mOverControl->onMouseExit( mMousePosi, 0 );
sendMsg( mOverControl, NodeMessage::MouseExit );
mOverControl->onMouseLeave( mMousePosi, 0 );
sendMsg( mOverControl, NodeMessage::MouseLeave );
}
mOverControl = pOver;
if ( NULL != mOverControl ) {
mOverControl->onMouseEnter( mMousePosi, 0 );
sendMsg( mOverControl, NodeMessage::MouseEnter );
mOverControl->onMouseOver( mMousePosi, 0 );
sendMsg( mOverControl, NodeMessage::MouseOver );
}
} else {
if ( NULL != mOverControl ) {

View File

@@ -315,22 +315,22 @@ Uint32 Node::onKeyUp( const KeyEvent& Event ) {
return 0;
}
Uint32 Node::onMouseMove( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 Node::onMouseMove( const Vector2i& Pos, const Uint32& Flags ) {
sendMouseEvent( Event::MouseMove, Pos, Flags );
return 1;
}
Uint32 Node::onMouseDown( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 Node::onMouseDown( const Vector2i& Pos, const Uint32& Flags ) {
sendMouseEvent( Event::MouseDown, Pos, Flags );
return 1;
}
Uint32 Node::onMouseUp( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 Node::onMouseUp( const Vector2i& Pos, const Uint32& Flags ) {
sendMouseEvent( Event::MouseUp, Pos, Flags );
return 1;
}
Uint32 Node::onMouseClick( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 Node::onMouseClick( const Vector2i& Pos, const Uint32& Flags ) {
sendMouseEvent( Event::MouseClick, Pos, Flags );
return 1;
}
@@ -343,23 +343,39 @@ bool Node::isMouseOverMeOrChilds() const {
return 0 != ( mNodeFlags & NODE_FLAG_MOUSEOVER_ME_OR_CHILD );
}
Uint32 Node::onMouseDoubleClick( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 Node::onMouseDoubleClick( const Vector2i& Pos, const Uint32& Flags ) {
sendMouseEvent( Event::MouseDoubleClick, Pos, Flags );
return 1;
}
Uint32 Node::onMouseEnter( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 Node::onMouseOver( const Vector2i& Pos, const Uint32& Flags ) {
Node * parent = mParentCtrl;
while ( NULL != parent ) {
parent->onMouseOver( Pos, Flags );
parent = parent->getParent();
}
writeNodeFlag( NODE_FLAG_MOUSEOVER, 1 );
sendMouseEvent( Event::MouseEnter, Pos, Flags );
sendMouseEvent( Event::MouseOver, Pos, Flags );
return 1;
}
Uint32 Node::onMouseExit( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 Node::onMouseLeave( const Vector2i& Pos, const Uint32& Flags ) {
Node * parent = mParentCtrl;
while ( NULL != parent ) {
parent->onMouseLeave( Pos, Flags );
parent = parent->getParent();
}
writeNodeFlag( NODE_FLAG_MOUSEOVER, 0 );
sendMouseEvent( Event::MouseExit, Pos, Flags );
sendMouseEvent( Event::MouseLeave, Pos, Flags );
return 1;
}

View File

@@ -1,33 +0,0 @@
#include <eepp/system/safedatapointer.hpp>
#include <eepp/core/memorymanager.hpp>
#include <cstddef>
namespace EE { namespace System {
SafeDataPointer::SafeDataPointer() :
data( NULL ),
size( 0 )
{
}
SafeDataPointer::SafeDataPointer( Uint32 size ) :
data( eeNewArray( Uint8, size ) ),
size( size )
{
}
SafeDataPointer::SafeDataPointer( Uint8 *data, Uint32 size ) :
data( data ),
size( size )
{
}
SafeDataPointer::~SafeDataPointer() {
clear();
}
void SafeDataPointer::clear() {
eeSAFE_DELETE_ARRAY( data );
}
}}

View File

@@ -85,7 +85,7 @@ UIListBox * UIDropDownList::getListBox() const {
return mListBox;
}
Uint32 UIDropDownList::onMouseUp( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 UIDropDownList::onMouseUp( const Vector2i& Pos, const Uint32& Flags ) {
if ( mEnabled && mVisible && isMouseOver() ) {
if ( Flags & EE_BUTTONS_WUWD ) {
if ( Flags & EE_BUTTON_WUMASK ) {
@@ -103,7 +103,7 @@ Uint32 UIDropDownList::onMouseUp( const Vector2i& Pos, const Uint32 Flags ) {
return UITextInput::onMouseUp( Pos, Flags );
}
Uint32 UIDropDownList::onMouseClick( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 UIDropDownList::onMouseClick( const Vector2i& Pos, const Uint32& Flags ) {
if ( ( Flags & EE_BUTTON_LMASK ) && NULL == mFriendCtrl )
showList();

View File

@@ -42,7 +42,7 @@ void UIListBoxItem::setTheme( UITheme * Theme ) {
onThemeLoaded();
}
Uint32 UIListBoxItem::onMouseUp( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 UIListBoxItem::onMouseUp( const Vector2i& Pos, const Uint32& Flags ) {
UITextView::onMouseUp( Pos, Flags );
if ( mEnabled && mVisible ) {
@@ -57,7 +57,7 @@ Uint32 UIListBoxItem::onMouseUp( const Vector2i& Pos, const Uint32 Flags ) {
return 1;
}
Uint32 UIListBoxItem::onMouseClick( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 UIListBoxItem::onMouseClick( const Vector2i& Pos, const Uint32& Flags ) {
if ( Flags & EE_BUTTONS_LRM ) {
reinterpret_cast<UIListBox*> ( getParent()->getParent() )->itemClicked( this );
@@ -100,8 +100,8 @@ void UIListBoxItem::select() {
}
}
Uint32 UIListBoxItem::onMouseExit( const Vector2i& Pos, const Uint32 Flags ) {
UINode::onMouseExit( Pos, Flags );
Uint32 UIListBoxItem::onMouseLeave( const Vector2i& Pos, const Uint32& Flags ) {
UINode::onMouseLeave( Pos, Flags );
if ( mNodeFlags & NODE_FLAG_SELECTED )
pushState( UIState::StateSelected );

View File

@@ -93,7 +93,7 @@ void UIMenuCheckBox::switchActive() {
setActive( !mActive );
}
Uint32 UIMenuCheckBox::onMouseUp( const Vector2i &Pos, const Uint32 Flags ) {
Uint32 UIMenuCheckBox::onMouseUp( const Vector2i &Pos, const Uint32& Flags ) {
UIMenuItem::onMouseUp( Pos, Flags );
if ( getParent()->isVisible() && ( Flags & EE_BUTTONS_LRM ) )

View File

@@ -36,8 +36,8 @@ void UIMenuItem::setTheme( UITheme * Theme ) {
onThemeLoaded();
}
Uint32 UIMenuItem::onMouseEnter( const Vector2i &Pos, const Uint32 Flags ) {
UIPushButton::onMouseEnter( Pos, Flags );
Uint32 UIMenuItem::onMouseOver( const Vector2i& Pos, const Uint32& Flags ) {
UIPushButton::onMouseOver( Pos, Flags );
reinterpret_cast<UIMenu*> ( getParent() )->setItemSelected( this );

View File

@@ -85,7 +85,7 @@ UIMenu * UIMenuSubMenu::getSubMenu() const {
return mSubMenu;
}
Uint32 UIMenuSubMenu::onMouseMove( const Vector2i &Pos, const Uint32 Flags ) {
Uint32 UIMenuSubMenu::onMouseMove( const Vector2i &Pos, const Uint32& Flags ) {
UIMenuItem::onMouseMove( Pos, Flags );
if ( NULL != mSceneNode && NULL != mSubMenu && !mSubMenu->isVisible() ) {
@@ -116,8 +116,8 @@ void UIMenuSubMenu::showSubMenu() {
}
}
Uint32 UIMenuSubMenu::onMouseExit( const Vector2i &Pos, const Uint32 Flags ) {
UIMenuItem::onMouseExit( Pos, Flags );
Uint32 UIMenuSubMenu::onMouseLeave( const Vector2i &Pos, const Uint32& Flags ) {
UIMenuItem::onMouseLeave( Pos, Flags );
mTimeOver = 0;

View File

@@ -279,7 +279,7 @@ void UINode::draw() {
}
}
Uint32 UINode::onMouseDown( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 UINode::onMouseDown( const Vector2i& Pos, const Uint32& Flags ) {
if ( NULL != getEventDispatcher() && !getEventDispatcher()->isNodeDragging() && !( getEventDispatcher()->getLastPressTrigger() & mDragButton ) && ( Flags & mDragButton ) && isDragEnabled() && !isDragging() ) {
setDragging( true );
@@ -294,7 +294,7 @@ Uint32 UINode::onMouseDown( const Vector2i& Pos, const Uint32 Flags ) {
return Node::onMouseDown( Pos, Flags );
}
Uint32 UINode::onMouseUp( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 UINode::onMouseUp( const Vector2i& Pos, const Uint32& Flags ) {
if ( isDragEnabled() && isDragging() && ( Flags & mDragButton ) ) {
setDragging( false );
@@ -989,17 +989,17 @@ Uint32 UINode::onDragStop( const Vector2i& ) {
return 1;
}
Uint32 UINode::onMouseEnter(const Vector2i & position, const Uint32 flags) {
Uint32 UINode::onMouseOver(const Vector2i& position, const Uint32& flags) {
pushState( UIState::StateHover );
return Node::onMouseEnter( position, flags );
return Node::onMouseOver( position, flags );
}
Uint32 UINode::onMouseExit(const Vector2i & position, const Uint32 flags) {
Uint32 UINode::onMouseLeave(const Vector2i& position, const Uint32& flags) {
popState( UIState::StateHover );
popState( UIState::StatePressed );
return Node::onMouseExit( position, flags );
return Node::onMouseLeave( position, flags );
}
bool UINode::isDragEnabled() const {

View File

@@ -66,7 +66,7 @@ void UITab::setTheme( UITheme * Theme ) {
onStateChange();
}
Uint32 UITab::onMouseClick( const Vector2i &Pos, const Uint32 Flags ) {
Uint32 UITab::onMouseClick( const Vector2i &Pos, const Uint32& Flags ) {
UISelectButton::onMouseClick( Pos, Flags );
UITabWidget * tTabW = getTabWidget();
@@ -160,7 +160,7 @@ bool UITab::setAttribute( const NodeAttribute& attribute, const Uint32& state )
return true;
}
Uint32 UITab::onMouseUp( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 UITab::onMouseUp( const Vector2i& Pos, const Uint32& Flags ) {
if ( mEnabled && mVisible ) {
if ( NULL == mControlOwned && !mOwnedName.empty() ) {
setOwnedControl();

View File

@@ -104,8 +104,8 @@ bool UITableCell::isSelected() const {
return 0 != ( mNodeFlags & NODE_FLAG_SELECTED );
}
Uint32 UITableCell::onMouseExit( const Vector2i& Pos, const Uint32 Flags ) {
UINode::onMouseExit( Pos, Flags );
Uint32 UITableCell::onMouseLeave( const Vector2i& Pos, const Uint32 Flags ) {
UINode::onMouseLeave( Pos, Flags );
if ( mNodeFlags & NODE_FLAG_SELECTED )
pushState( UIState::StateSelected );
@@ -115,16 +115,6 @@ Uint32 UITableCell::onMouseExit( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 UITableCell::onMessage( const NodeMessage * Msg ) {
switch( Msg->getMsg() ) {
case NodeMessage::MouseEnter:
{
onMouseEnter( Vector2i(), Msg->getFlags() );
break;
}
case NodeMessage::MouseExit:
{
onMouseExit( Vector2i(), Msg->getFlags() );
break;
}
case NodeMessage::Click:
{
if ( Msg->getFlags() & EE_BUTTONS_LRM ) {

View File

@@ -277,7 +277,7 @@ void UITextInput::shrinkText( const Uint32& MaxWidth ) {
void UITextInput::updateText() {
}
Uint32 UITextInput::onMouseClick( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 UITextInput::onMouseClick( const Vector2i& Pos, const Uint32& Flags ) {
if ( Flags & EE_BUTTON_LMASK ) {
Vector2f controlPos( Vector2f( Pos.x, Pos.y ) );
worldToNode( controlPos );
@@ -294,7 +294,7 @@ Uint32 UITextInput::onMouseClick( const Vector2i& Pos, const Uint32 Flags ) {
return UITextView::onMouseClick( Pos, Flags );
}
Uint32 UITextInput::onMouseDoubleClick( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 UITextInput::onMouseDoubleClick( const Vector2i& Pos, const Uint32& Flags ) {
UITextView::onMouseDoubleClick( Pos, Flags );
if ( isTextSelectionEnabled() && ( Flags & EE_BUTTON_LMASK ) && selCurEnd() != -1 ) {
@@ -305,8 +305,8 @@ Uint32 UITextInput::onMouseDoubleClick( const Vector2i& Pos, const Uint32 Flags
return 1;
}
Uint32 UITextInput::onMouseExit( const Vector2i& Pos, const Uint32 Flags ) {
UINode::onMouseExit( Pos, Flags );
Uint32 UITextInput::onMouseLeave( const Vector2i& Pos, const Uint32& Flags ) {
UINode::onMouseLeave( Pos, Flags );
if ( NULL != mSceneNode )
mSceneNode->setCursor( Cursor::Arrow );

View File

@@ -358,7 +358,7 @@ const Vector2f& UITextView::getAlignOffset() const {
return mAlignOffset;
}
Uint32 UITextView::onMouseDoubleClick( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 UITextView::onMouseDoubleClick( const Vector2i& Pos, const Uint32& Flags ) {
if ( isTextSelectionEnabled() && ( Flags & EE_BUTTON_LMASK ) ) {
Vector2f controlPos( Vector2f( Pos.x, Pos.y ) );
worldToNode( controlPos );
@@ -382,7 +382,7 @@ Uint32 UITextView::onMouseDoubleClick( const Vector2i& Pos, const Uint32 Flags )
return UIWidget::onMouseDoubleClick( Pos, Flags );
}
Uint32 UITextView::onMouseClick( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 UITextView::onMouseClick( const Vector2i& Pos, const Uint32& Flags ) {
if ( isTextSelectionEnabled() && ( Flags & EE_BUTTON_LMASK ) ) {
if ( selCurInit() == selCurEnd() ) {
selCurInit( -1 );
@@ -396,7 +396,7 @@ Uint32 UITextView::onMouseClick( const Vector2i& Pos, const Uint32 Flags ) {
return UIWidget::onMouseClick( Pos, Flags );
}
Uint32 UITextView::onMouseDown( const Vector2i& Pos, const Uint32 Flags ) {
Uint32 UITextView::onMouseDown( const Vector2i& Pos, const Uint32& Flags ) {
if ( NULL != getEventDispatcher() && isTextSelectionEnabled() && ( Flags & EE_BUTTON_LMASK ) && getEventDispatcher()->getDownControl() == this ) {
Vector2f controlPos( Vector2f( Pos.x, Pos.y ) );
worldToNode( controlPos );

View File

@@ -166,7 +166,7 @@ void UIWidget::createTooltip() {
mTooltip->setTooltipOf( this );
}
Uint32 UIWidget::onMouseMove( const Vector2i & Pos, const Uint32 Flags ) {
Uint32 UIWidget::onMouseMove( const Vector2i & Pos, const Uint32& Flags ) {
if ( mVisible && NULL != mTooltip && !mTooltip->getText().empty() ) {
EventDispatcher * eventDispatcher = getEventDispatcher();
@@ -216,7 +216,7 @@ Uint32 UIWidget::onMouseMove( const Vector2i & Pos, const Uint32 Flags ) {
return UINode::onMouseMove( Pos, Flags );
}
Uint32 UIWidget::onMouseExit( const Vector2i & Pos, const Uint32 Flags ) {
Uint32 UIWidget::onMouseLeave( const Vector2i & Pos, const Uint32& Flags ) {
if ( mVisible && NULL != mTooltip && !mTooltip->getText().empty() ) {
mTooltip->setTooltipTime( Milliseconds( 0.f ) );
@@ -224,7 +224,7 @@ Uint32 UIWidget::onMouseExit( const Vector2i & Pos, const Uint32 Flags ) {
mTooltip->hide();
}
return UINode::onMouseExit( Pos, Flags );
return UINode::onMouseLeave( Pos, Flags );
}
UIWidget * UIWidget::setTooltipText( const String& Text ) {

View File

@@ -688,7 +688,7 @@ Uint32 UIWindow::onMessage( const NodeMessage * Msg ) {
break;
}
case NodeMessage::MouseExit:
case NodeMessage::MouseLeave:
{
if ( getUISceneNode() != NULL )
getUISceneNode()->setCursor( Cursor::Arrow );

View File

@@ -222,7 +222,7 @@ void UIWinMenu::refreshButtons() {
Uint32 UIWinMenu::onMessage( const NodeMessage * Msg ) {
switch ( Msg->getMsg() ) {
case NodeMessage::MouseUp:
case NodeMessage::MouseEnter:
case NodeMessage::MouseOver:
{
if ( Msg->getSender()->isType( UI_TYPE_SELECTBUTTON ) ) {
UISelectButton * tbut = reinterpret_cast<UISelectButton*> ( Msg->getSender() );
@@ -231,7 +231,7 @@ Uint32 UIWinMenu::onMessage( const NodeMessage * Msg ) {
Vector2f pos( tbut->getPosition().x, tbut->getPosition().y + tbut->getSize().getHeight() );
tpop->setPosition( pos );
if ( Msg->getMsg() == NodeMessage::MouseEnter ) {
if ( Msg->getMsg() == NodeMessage::MouseOver ) {
if ( NULL != mCurrentMenu ) {
mCurrentMenu = tpop;

View File

@@ -449,17 +449,15 @@ void InputTextBuffer::update( InputEvent* Event ) {
if ( c == KEY_HOME ) {
if ( 0 != mPromptPos ) {
for ( Int32 i = (Int32)mPromptPos - 1; i >= 0; i-- ) {
if ( i >= 0 ) {
if ( mText[i] == '\n' ) {
mPromptPos = i + 1;
autoPrompt( false );
break;
}
if ( mText[i] == '\n' ) {
mPromptPos = i + 1;
autoPrompt( false );
break;
}
if ( i == 0 ) {
mPromptPos = 0;
autoPrompt( false );
}
if ( i == 0 ) {
mPromptPos = 0;
autoPrompt( false );
}
}
}