Permalink
Browse files

Implement TabGroup.removeTab()

[TIMOB-12985]
  • Loading branch information...
1 parent 09647f1 commit 71f10dd92105172ee6239ea6c3a2c8c21e860019 Joshua Roesslein committed Mar 22, 2013
@@ -88,6 +88,18 @@ int NativeTabGroupObject::addChildNativeObject(NativeObject* obj)
return NATIVE_ERROR_NOTSUPPORTED;
}
+int NativeTabGroupObject::removeChildNativeObject(NativeObject* obj)
+{
+ if (obj && obj->getObjectType() != N_TYPE_TAB) {
+ return NATIVE_ERROR_INVALID_ARG;
+ }
+
+ Tab* tab = static_cast<Tab*>(obj->getNativeHandle());
+ tabGroup_->remove(tab);
+
+ return NATIVE_ERROR_OK;
+}
+
int NativeTabGroupObject::setActiveTab(TiObject* obj)
{
HandleScope scope;
@@ -37,6 +37,7 @@ class NativeTabGroupObject : public NativeControlObject
virtual NATIVE_TYPE getObjectType() const;
virtual NAHANDLE getNativeHandle() const;
virtual int addChildNativeObject(NativeObject* obj);
+ virtual int removeChildNativeObject(NativeObject* obj);
virtual int setActiveTab(TiObject* obj);
virtual int setActiveTab(NativeObject* tab);
virtual int setActiveTab(int index);
View
@@ -45,6 +45,7 @@ class TiUIBase : public TiProxy
virtual void onCreateStaticMembers();
// FIXME move back to private once TiUITabGroup has been modified to not abuse it for addTab
static Handle<Value> _add(void* userContext, TiObject* caller, const Arguments& args);
+ static Handle<Value> _remove(void* userContext, TiObject* caller, const Arguments& args);
Persistent<Object> createConfig_;
vector<ObjectEntry> childControls_;
@@ -54,7 +55,6 @@ class TiUIBase : public TiProxy
static Handle<Value> _getValue(int propertyNumber, void* context);
static Handle<Value> _getChildren(void* userContext);
static Handle<Value> _hide(void* userContext, TiObject* caller, const Arguments& args);
- static Handle<Value> _remove(void* userContext, TiObject* caller, const Arguments& args);
static Handle<Value> _show(void* userContext, TiObject* caller, const Arguments& args);
static Handle<Value> _startLayout(void* userContext, TiObject* caller, const Arguments& args);
static Handle<Value> _finishLayout(void* userContext, TiObject* caller, const Arguments& args);
@@ -32,6 +32,7 @@ void TiUITabGroup::onCreateStaticMembers()
TiUIBase::onCreateStaticMembers();
TiGenericFunctionObject::addGenericFunctionToParent(this, "open", this, _open);
TiGenericFunctionObject::addGenericFunctionToParent(this, "addTab", this, _addTab);
+ TiGenericFunctionObject::addGenericFunctionToParent(this, "removeTab", this, _removeTab);
}
void TiUITabGroup::initializeTiObject(TiObject* parentContext)
@@ -61,3 +62,9 @@ Handle<Value> TiUITabGroup::_addTab(void* userContext, TiObject* caller, const A
return Undefined();
}
+Handle<Value> TiUITabGroup::_removeTab(void* userContext, TiObject* caller, const Arguments& args)
+{
+ TiUIBase::_remove(userContext, caller, args);
+ return Undefined();
+}
+
View
@@ -32,6 +32,7 @@ class TiUITabGroup : public TiUIBase
private:
static Handle<Value> _open(void* userContext, TiObject* caller, const Arguments& args);
static Handle<Value> _addTab(void* userContext, TiObject* caller, const Arguments& args);
+ static Handle<Value> _removeTab(void* userContext, TiObject* caller, const Arguments& args);
TiUITabGroup();
//This class is neither copy-constructible nor assignable

0 comments on commit 71f10dd

Please sign in to comment.