Permalink
Browse files

Switched to a virtual IsInteractive() function, because its better

  • Loading branch information...
jgranick committed Apr 3, 2013
1 parent 6fe6fd1 commit 0f179f2cdadfe3ed18fa1d1d28d31a9f4c45f760
@@ -17,8 +17,6 @@ class InteractiveObject extends DisplayObject
nmeMouseEnabled = true;
super(inHandle, inType);
-
- nme_display_object_set_interactive(nmeHandle, true);
}
/** @private */ override private function nmeAsInteractiveObject():InteractiveObject {
@@ -62,7 +60,6 @@ class InteractiveObject extends DisplayObject
}
// Native Methods
- private static var nme_display_object_set_interactive = Loader.load("nme_display_object_set_interactive", 2);
private static var nme_display_object_set_mouse_enabled = Loader.load("nme_display_object_set_mouse_enabled", 2);
private static var nme_display_object_set_needs_soft_keyboard = Loader.load("nme_display_object_set_needs_soft_keyboard", 2);
private static var nme_display_object_get_needs_soft_keyboard = Loader.load("nme_display_object_get_needs_soft_keyboard", 1);
@@ -36,7 +36,6 @@ DisplayObject::DisplayObject(bool inInitRef) : Object(inInitRef)
pixelSnapping = psNone;
opaqueBackground = 0;
mouseEnabled = true;
- interactive = false;
needsSoftKeyboard = false;
mMask = 0;
mIsMaskCount = 0;
@@ -207,7 +206,7 @@ void DisplayObject::Render( const RenderTarget &inTarget, const RenderState &inS
hit = mGfx->Render(inTarget,state);
- if(interactive)
+ if(IsInteractive())
inState.mHitResult = state.mHitResult;
else
inState.mHitResult = state.mHitResult != NULL ? mParent : NULL;
@@ -219,7 +218,7 @@ void DisplayObject::Render( const RenderTarget &inTarget, const RenderState &inS
if (hit)
{
- if(interactive)
+ if(IsInteractive())
inState.mHitResult = this;
else
inState.mHitResult = mParent;
@@ -1245,7 +1244,7 @@ void DisplayObjectContainer::Render( const RenderTarget &inTarget, const RenderS
}
else
{
- if (inState.mHitResult==this && !obj->interactive)
+ if (inState.mHitResult==this && !obj->IsInteractive())
continue;
if (obj->opaqueBackground)
@@ -1267,7 +1266,7 @@ void DisplayObjectContainer::Render( const RenderTarget &inTarget, const RenderS
{
if (inState.mPhase == rpHitTest && obj->mouseEnabled)
{
- if (obj->interactive)
+ if (obj->IsInteractive())
{
inState.mHitResult = obj;
return;
@@ -1752,7 +1752,6 @@ DO_DISPLAY_PROP(height,Height,alloc_float,val_number)
DO_DISPLAY_PROP(alpha,Alpha,alloc_float,val_number)
DO_DISPLAY_PROP(bg,OpaqueBackground,alloc_int,val_int)
DO_DISPLAY_PROP(mouse_enabled,MouseEnabled,alloc_bool,val_bool)
-DO_DISPLAY_PROP(interactive,Interactive,alloc_bool,val_bool)
DO_DISPLAY_PROP(cache_as_bitmap,CacheAsBitmap,alloc_bool,val_bool)
DO_DISPLAY_PROP(pedantic_bitmap_caching,PedanticBitmapCaching,alloc_bool,val_bool)
DO_DISPLAY_PROP(pixel_snapping,PixelSnapping,alloc_int,val_int)
View
@@ -176,8 +176,6 @@ class DisplayObject : public Object
DisplayObject *getMask() { return mMask; }
virtual void setOpaqueBackground(uint32 inBG);
uint32 getOpaqueBackground() { return opaqueBackground; }
- bool getInteractive() { return interactive; }
- void setInteractive(bool inVal) { interactive = inVal; }
bool getMouseEnabled() { return mouseEnabled; }
void setMouseEnabled(bool inVal) { mouseEnabled = inVal; }
bool getNeedsSoftKeyboard() { return needsSoftKeyboard; }
@@ -227,7 +225,6 @@ class DisplayObject : public Object
DRect scrollRect;
int id;
bool visible;
- bool interactive;
bool mouseEnabled;
bool needsSoftKeyboard;
bool movesForSoftKeyboard;
@@ -255,7 +252,6 @@ class DisplayObject : public Object
virtual void OnKey(Event &inEvent) { }
virtual bool FinishEditOnEnter() { return false; }
-
void SetParent(DisplayObjectContainer *inParent);
UserPoint GlobalToLocal(const UserPoint &inPoint);
@@ -281,6 +277,7 @@ class DisplayObject : public Object
void ChangeIsMaskCount(int inDelta);
bool IsMask() const { return mIsMaskCount; }
+ virtual bool IsInteractive() const { return false; }
void CombineColourTransform(const RenderState *inState,
const ColorTransform *inObjTrans,
@@ -336,14 +333,15 @@ class DisplayObjectContainer : public DisplayObject
bool NonNormalBlendChild();
void GetExtent(const Transform &inTrans, Extent2DF &outExt,bool inForBitmap,bool inIncludeStroke);
void DirtyCache(bool inParentOnly = false);
+
+ bool IsInteractive() const { return true; }
void hackAddChild(DisplayObject *inObj) { mChildren.push_back(inObj); }
void hackRemoveChildren() { mChildren.resize(0); }
bool getMouseChildren() { return mouseChildren; }
void setMouseChildren(bool inVal) { mouseChildren = inVal; }
-
-
+
bool mouseChildren;
CachedExtent mExtentCache[3];
protected:
@@ -381,7 +379,7 @@ class SimpleButton : public DisplayObject
bool NonNormalBlendChild();
void DirtyCache(bool inParentOnly = false);
-
+ bool IsInteractive() const { return true; }
bool getEnabled() const { return enabled; }
void setEnabled(bool inEnabled) { enabled = inEnabled; }

0 comments on commit 0f179f2

Please sign in to comment.