void CNamingTreeCtrl::ClearChildren(HTREEITEM hItem) { if(hItem == 0) { HTREEITEM hItem = GetRootItem(); if(hItem) { //CORBA::Object_var Object = (CORBA::Object_ptr)GetItemData(hItem); ClearChildren(hItem); delete GetTreeObject(hItem); DeleteItem(hItem); } return; } HTREEITEM hChild; while(hChild = GetNextItem(hItem, TVGN_CHILD)) { // Remove our reference count on the object reference ClearChildren(hChild); delete GetTreeObject(hChild); DeleteItem(hChild); } }
void Particle::Reset() { _age = 0; _wx = 0; _wy = 0; _z = 1.0f; _avatar = NULL; _dead = 0; ClearChildren(); _directionVariation = 0; _direction = 0; _directionLocked = false; _randomSpeed = 0; _randomDirection = 0; _parent = NULL; _rootParent = NULL; _aCycles = 0; _cCycles = 0; _rptAgeA = 0; _rptAgeC = 0; _releaseSingleParticle = false; _gravity = 0; _weight = 0; _emitter = NULL; // let _listIter stay an invalid iterator }
OGR_SRSNode::~OGR_SRSNode() { CPLFree( pszValue ); ClearChildren(); }
void CNamingTreeCtrl::OnContextPopupRefresh() { // TODO: Add your command handler code here HTREEITEM hItem = GetSelectedItem(); ClearChildren(hItem); ListContext(hItem); }
void CNamingTreeCtrl::OnObjectpopupUnbind() { // TODO: Add your command handler code here if(MessageBox(ACE_TEXT ("Are you sure you want to unbind this object?"), ACE_TEXT ("Confirm"), MB_YESNO | MB_ICONEXCLAMATION) != IDYES) { return; } HTREEITEM hItem = GetSelectedItem(); HTREEITEM hParent = GetParentItem(hItem); if(!hParent) { return; } CNamingObject* pObject = GetTreeObject(hItem); CNamingObject* pParent= GetTreeObject(hParent); CosNaming::NamingContext_var Context = pParent->NamingContext(); try { Context->unbind(pObject->Name()); ClearChildren(hItem); delete pObject; DeleteItem(hItem); } catch(CORBA::Exception& ex) { MessageBox(ACE_TEXT_CHAR_TO_TCHAR (ex._rep_id()), ACE_TEXT ("CORBA::Exception")); } }
void ScoreDef::Clear() { ReplaceClef(NULL); ReplaceKeySig(NULL); ReplaceMensur(NULL); ClearChildren(); }
void C4GoalDisplay::SetGoals(const C4IDList &rAllGoals, const C4IDList &rFulfilledGoals, int32_t iGoalSymbolHeight) { // clear previous ClearChildren(); // determine goal display area by goal count int32_t iGoalSymbolMargin = C4GUI_DefDlgSmallIndent; int32_t iGoalSymbolAreaHeight = 2*iGoalSymbolMargin + iGoalSymbolHeight; int32_t iGoalAreaWdt = GetClientRect().Wdt; int32_t iGoalsPerRow = Max<int32_t>(1, iGoalAreaWdt / iGoalSymbolAreaHeight); int32_t iGoalCount = rAllGoals.GetNumberOfIDs(); int32_t iRowCount = (iGoalCount-1) / iGoalsPerRow + 1; C4Rect rcNewBounds = GetBounds(); rcNewBounds.Hgt = GetMarginTop()+GetMarginBottom()+iRowCount*iGoalSymbolAreaHeight; SetBounds(rcNewBounds); C4GUI::ComponentAligner caAll(GetClientRect(), 0,0, true); // place goal symbols in this area int32_t iGoal = 0; for (int32_t iRow=0; iRow<iRowCount; ++iRow) { int32_t iColCount = Min<int32_t>(iGoalCount - iGoal, iGoalsPerRow); C4GUI::ComponentAligner caGoalArea(caAll.GetFromTop(iGoalSymbolAreaHeight, iColCount*iGoalSymbolAreaHeight), iGoalSymbolMargin,iGoalSymbolMargin, false); for (int32_t iCol=0; iCol<iColCount; ++iCol,++iGoal) { C4ID idGoal = rAllGoals.GetID(iGoal); bool fFulfilled = !!rFulfilledGoals.GetIDCount(idGoal, 1); AddElement(new GoalPicture(caGoalArea.GetGridCell(iCol, iColCount, iRow, iRowCount), idGoal, fFulfilled)); } } }
void DistributionBranch::Random(unsigned int depth) { Op=rand()%2; if (depth<=0) Op=OP_DISTRI; ClearChildren(); if (Op==OP_DISTRI && Distributions.size()>0) { Distri=rand()%Distributions.size(); for(unsigned int i=0;i<Distributions[Distri].parameters;i++) { Leaf *l=new Leaf; l->Random(0); Attach(l); } } else { Leaf *l=new Leaf; l->Limits(0.0f,1.0f); l->Random(0); Attach(l); DistributionBranch *b1,*b2; b1=new DistributionBranch(); b2=new DistributionBranch(); b1->Random(depth-1); b2->Random(depth-1); Attach(b1); Attach(b2); } }
void CNamingTreeCtrl::OnContextPopupDestroy() { // TODO: Add your command handler code here if(MessageBox(ACE_TEXT ("Are you sure you want to destroy this context?"), ACE_TEXT ("Confirm"), MB_YESNO | MB_ICONEXCLAMATION) != IDYES) { return; } HTREEITEM hItem = GetSelectedItem(); HTREEITEM hParent = GetParentItem(hItem); if(!hParent) { return; } CNamingObject* pObject = GetTreeObject(hItem); CNamingObject* pParent= GetTreeObject(hParent); CosNaming::NamingContext_var Parent = pParent->NamingContext(); try { // First try to destroy, it will raise exception if its not empty CosNaming::NamingContext_var Context = pObject->NamingContext(); Context->destroy(); // Ok its destroyed, clean up any children we might have laying around ClearChildren(hItem); DeleteItem(hItem); // do the unbind Parent->unbind(pObject->Name()); delete pObject; } catch(CORBA::Exception& ex) { MessageBox(ACE_TEXT_CHAR_TO_TCHAR (ex._rep_id()), ACE_TEXT ("CORBA::Exception")); } }
CElement::~CElement ( void ) { // Get rid of the children elements ClearChildren (); SetParentObject ( NULL ); // Remove ourselves from our element group if ( m_pElementGroup ) m_pElementGroup->Remove ( this ); // Delete our event manager delete m_pCustomData; delete m_pEventManager; // Unreference us from what's referencing us list < CPerPlayerEntity* > ::const_iterator iter = m_ElementReferenced.begin (); for ( ; iter != m_ElementReferenced.end (); iter++ ) { if ( !(*iter)->m_ElementReferences.empty() ) (*iter)->m_ElementReferences.remove ( this ); } RemoveAllCollisions ( true ); // Null all camera elements referencing us list < CPlayerCamera* > ::const_iterator iterFollowingCameras = m_FollowingCameras.begin (); for ( ; iterFollowingCameras != m_FollowingCameras.end (); iterFollowingCameras++ ) { (*iterFollowingCameras)->m_pTarget = NULL; } if ( m_pAttachedTo ) m_pAttachedTo->RemoveAttachedElement ( this ); list < CElement* > ::iterator iterAttached = m_AttachedElements.begin (); for ( ; iterAttached != m_AttachedElements.end () ; iterAttached++ ) { // Make sure our attached element stores it's current position (*iterAttached)->GetPosition (); // Unlink it (*iterAttached)->m_pAttachedTo = NULL; } list < CPed * > ::iterator iterUsers = m_OriginSourceUsers.begin (); for ( ; iterUsers != m_OriginSourceUsers.end () ; iterUsers++ ) { CPed* pPed = *iterUsers; if ( pPed->m_pContactElement == this ) pPed->m_pContactElement = NULL; } // Deallocate our unique ID CElementIDs::PushUniqueID ( this ); // Remove our reference from the element deleter g_pGame->GetElementDeleter ()->Unreference ( this ); // Ensure nothing has inadvertently set a parent assert ( m_pParent == NULL ); }
void CNamingTreeCtrl::OnDestroy() { CTreeCtrl::OnDestroy(); // TODO: Add your message handler code here ClearChildren(); }
void MusPage::Clear( ) { ClearChildren( ); defin = 20; // by default we have no values and use the document ones m_pageHeight = -1; m_pageWidth = -1; m_pageLeftMar = 0; m_pageRightMar = 0; }
int Artic::ResetDrawing(FunctorParams *functorParams) { // Call parent one too LayerElement::ResetDrawing(functorParams); // Remove all ArticPart children ClearChildren(); return FUNCTOR_CONTINUE; };
void DFsScript::OnDestroy() { ClearVariables(true); ClearSections(); ClearChildren(); parent = NULL; if (data != NULL) delete [] data; data = NULL; parent = NULL; trigger = NULL; Super::OnDestroy(); }
void CNamingTreeCtrl::Resolve(CosNaming::NamingContext_ptr pRootContext) { ClearChildren(); if(!CORBA::is_nil(pRootContext)) { HTREEITEM hItem = InsertItem(ACE_TEXT ("Root")); CosNaming::Name Name; Name.length(1); Name[0].id = CORBA::string_dup("Root"); SetItemData(hItem, (DWORD)new CNamingObject(Name, pRootContext, true)); ListContext(hItem); } }
void SFlarePlanetaryBox::Construct(const SFlarePlanetaryBox::FArguments& InArgs) { Radius = 200; PlanetImage = NULL; ClearChildren(); // Add slots const int32 NumSlots = InArgs.Slots.Num(); for (int32 SlotIndex = 0; SlotIndex < NumSlots; ++SlotIndex) { Children.Add(InArgs.Slots[SlotIndex]); } }
void HKWidgetPrefab::LoadPrefab(const char *pPrefab) { ClearChildren(); prefab = pPrefab; if(MFString_EndsWith(pPrefab, ".xml")) { HKWidget *pPrefabRoot = HKWidget_CreateFromXML(pPrefab); AddChild(pPrefabRoot); } else { MFDebug_Assert(false, "Unknown prefab format!"); } }
void HKWidgetListbox::Unbind() { if(pAdapter) { // unsubscribe from adapter pAdapter->onInsertItem -= fastdelegate::MakeDelegate(this, &HKWidgetListbox::OnInsert); pAdapter->onRemoveItem -= fastdelegate::MakeDelegate(this, &HKWidgetListbox::OnRemove); pAdapter->onTouchItem -= fastdelegate::MakeDelegate(this, &HKWidgetListbox::OnChange); pAdapter = NULL; } selection = -1; scrollOffset = 0.f; ClearChildren(); }
Object::Object( const Object& object ) { ClearChildren(); m_parent = NULL; m_classid = object.m_classid; m_uuid = object.m_uuid; // for now copy the uuid - to be decided m_isModified = true; int i; for (i = 0; i < (int)object.m_children.size(); i++) { Object *current = object.m_children[i]; Object* copy = current->Clone(); copy->Modify(); copy->SetParent( this ); m_children.push_back( copy ); } }
Object& Object::operator=( const Object& object ) { if ( this != &object ) // not self assignement { ClearChildren(); m_parent = NULL; m_classid = object.m_classid; m_uuid = object.m_uuid; // for now copy the uuid - to be decided m_isModified = true; int i; for (i = 0; i < (int)object.m_children.size(); i++) { Object *current = object.m_children[i]; Object* copy = current->Clone(); copy->Modify(); copy->SetParent( this ); m_children.push_back( copy ); } } return *this; }
void Doc::Reset( DocType type ) { UpdateFontValues(); m_type = type; ClearChildren(); m_pageWidth = -1; m_pageHeight = -1; m_pageRightMar = 0; m_pageLeftMar = 0; m_pageTopMar = 0; m_spacingStaff = m_env.m_spacingStaff; m_spacingSystem = m_env.m_spacingSystem; m_drawingPage = NULL; m_currentScoreDefDone = false; m_scoreDef.Clear(); }
Object::~Object() { ClearChildren(); }
OGRErr OGR_SRSNode::importFromWkt( char ** ppszInput, int nRecLevel, int* pnNodes ) { const char *pszInput = *ppszInput; int bInQuotedString = FALSE; /* Sanity checks */ if( nRecLevel == 10 ) { return OGRERR_CORRUPT_DATA; } if( *pnNodes == 1000 ) { return OGRERR_CORRUPT_DATA; } /* -------------------------------------------------------------------- */ /* Clear any existing children of this node. */ /* -------------------------------------------------------------------- */ ClearChildren(); /* -------------------------------------------------------------------- */ /* Read the ``value'' for this node. */ /* -------------------------------------------------------------------- */ char szToken[512]; int nTokenLen = 0; while( *pszInput != '\0' && nTokenLen < (int) sizeof(szToken)-1 ) { if( *pszInput == '"' ) { bInQuotedString = !bInQuotedString; } else if( !bInQuotedString && (*pszInput == '[' || *pszInput == ']' || *pszInput == ',' || *pszInput == '(' || *pszInput == ')' ) ) { break; } else if( !bInQuotedString && (*pszInput == ' ' || *pszInput == '\t' || *pszInput == 10 || *pszInput == 13) ) { /* just skip over whitespace */ } else { szToken[nTokenLen++] = *pszInput; } pszInput++; } if( *pszInput == '\0' || nTokenLen == sizeof(szToken) - 1 ) return OGRERR_CORRUPT_DATA; szToken[nTokenLen++] = '\0'; SetValue( szToken ); /* -------------------------------------------------------------------- */ /* Read children, if we have a sublist. */ /* -------------------------------------------------------------------- */ if( *pszInput == '[' || *pszInput == '(' ) { do { OGR_SRSNode *poNewChild; OGRErr eErr; pszInput++; // Skip bracket or comma. poNewChild = new OGR_SRSNode(); (*pnNodes) ++; eErr = poNewChild->importFromWkt( (char **) &pszInput, nRecLevel + 1, pnNodes ); if( eErr != OGRERR_NONE ) { delete poNewChild; return eErr; } AddChild( poNewChild ); // swallow whitespace while( isspace(*pszInput) ) pszInput++; } while( *pszInput == ',' ); if( *pszInput != ')' && *pszInput != ']' ) return OGRERR_CORRUPT_DATA; pszInput++; } *ppszInput = (char *) pszInput; return OGRERR_NONE; }
OGRErr OGR_SRSNode::importFromWkt( char ** ppszInput ) { const char *pszInput = *ppszInput; int bInQuotedString = FALSE; /* -------------------------------------------------------------------- */ /* Clear any existing children of this node. */ /* -------------------------------------------------------------------- */ ClearChildren(); /* -------------------------------------------------------------------- */ /* Read the ``value'' for this node. */ /* -------------------------------------------------------------------- */ char szToken[512]; int nTokenLen = 0; while( *pszInput != '\0' && nTokenLen < (int) sizeof(szToken)-1 ) { if( *pszInput == '"' ) { bInQuotedString = !bInQuotedString; } else if( !bInQuotedString && (*pszInput == '[' || *pszInput == ']' || *pszInput == ',' || *pszInput == '(' || *pszInput == ')' ) ) { break; } else { szToken[nTokenLen++] = *pszInput; } pszInput++; } if( *pszInput == '\0' || nTokenLen == sizeof(szToken) - 1 ) return OGRERR_CORRUPT_DATA; szToken[nTokenLen++] = '\0'; SetValue( szToken ); /* -------------------------------------------------------------------- */ /* Read children, if we have a sublist. */ /* -------------------------------------------------------------------- */ if( *pszInput == '[' || *pszInput == '(' ) { do { OGR_SRSNode *poNewChild; OGRErr eErr; pszInput++; // Skip bracket or comma. poNewChild = new OGR_SRSNode(); eErr = poNewChild->importFromWkt( (char **) &pszInput ); if( eErr != OGRERR_NONE ) return eErr; AddChild( poNewChild ); } while( *pszInput == ',' ); if( *pszInput != ')' && *pszInput != ']' ) return OGRERR_CORRUPT_DATA; pszInput++; } *ppszInput = (char *) pszInput; return OGRERR_NONE; }
CElement::~CElement ( void ) { // Get rid of the children elements ClearChildren (); SetParentObject ( NULL ); // Remove ourselves from our element group if ( m_pElementGroup ) m_pElementGroup->Remove ( this ); // Delete our event manager delete m_pCustomData; delete m_pEventManager; // Unreference us from what's referencing us list < CPerPlayerEntity* > ::const_iterator iter = m_ElementReferenced.begin (); for ( ; iter != m_ElementReferenced.end (); iter++ ) { (*iter)->m_ElementReferences.remove ( this ); } RemoveAllCollisions ( true ); // Null all camera elements referencing us std::list < CPlayerCamera* > cloneFollowingCameras = m_FollowingCameras; for ( std::list < CPlayerCamera* > ::const_iterator iter = cloneFollowingCameras.begin () ; iter != cloneFollowingCameras.end () ; iter++ ) { (*iter)->SetTarget ( NULL ); } if ( m_pAttachedTo ) m_pAttachedTo->RemoveAttachedElement ( this ); list < CElement* > ::iterator iterAttached = m_AttachedElements.begin (); for ( ; iterAttached != m_AttachedElements.end () ; iterAttached++ ) { // Make sure our attached element stores it's current position (*iterAttached)->GetPosition (); // Unlink it (*iterAttached)->m_pAttachedTo = NULL; } list < CPed * > ::iterator iterUsers = m_OriginSourceUsers.begin (); for ( ; iterUsers != m_OriginSourceUsers.end () ; iterUsers++ ) { CPed* pPed = *iterUsers; if ( pPed->m_pContactElement == this ) pPed->m_pContactElement = NULL; } // Remove from spatial database GetSpatialDatabase ()->RemoveEntity ( this ); if ( GetID() != INVALID_ELEMENT_ID && GetID() >= MAX_SERVER_ELEMENTS ) CLogger::ErrorPrintf( "ERROR: Element ID is incorrect (%08x) (Type:%d)\n", GetID().Value(), GetType() ); // Deallocate our unique ID CElementIDs::PushUniqueID ( this ); // Remove our reference from the element deleter g_pGame->GetElementDeleter ()->Unreference ( this ); // Ensure nothing has inadvertently set a parent assert ( m_pParent == NULL ); CElementRefManager::OnElementDelete ( this ); SAFE_RELEASE( m_pChildrenListSnapshot ); }
wxSimpleHtmlTag::~wxSimpleHtmlTag() { ClearAttributes(); ClearChildren(); }
//***************************************************************************** bool CHTMLWidget::Parse( //Parse text buffer and add child widgets for each part. // //Params: const CStretchyBuffer &text) //(in) Text to parse. // //Returns: True if parse was successful, false if there was a parse error. { //Renderer init. ClearChildren(); this->wCurrentColumn = this->wX = 0; this->wY = this->wMargin; this->bSkipSpace = true; this->dwCurrentLinkTag = this->dwLinkTagStart; for (int i = First_Tag; i <= Tag_Count; ++i) // Including unknown aeTagLevel[i] = 0; mIdmap.clear(); static const WCHAR defaultColor[] = {We('F'),We('F'),We('F'),We('F'),We('F'),We('F'),We(0)}; this->wstrBGColor = defaultColor; //Parser init. XML_Parser parser = XML_ParserCreate(NULL); XML_SetUserData(parser, this); XML_SetElementHandler(parser, StartElement_cb, EndElement_cb); XML_SetCharacterDataHandler(parser, InElement_cb); // XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_NEVER); bool bResult = true; char *buf = (char*)(BYTE*)text; //size - 2 seems to fix "invalid token" errors at EOF (even at empty files). const UINT size = text.Size() - 2; //Parse the XML. static const char entities[] = "<?xml version=\"1.0\" encoding=\"" "UTF-8" "\"?>" "<!DOCTYPE html [" "<!ENTITY nbsp \"\xc2\xa0\">" //utf-8 for 0xa0 = unicode nbsp "]>"; if ((XML_Parse(parser, entities, strlen(entities), false) == XML_STATUS_ERROR) || (XML_Parse(parser, buf, size, true) == XML_STATUS_ERROR)) { //Some problem occurred. char errorStr[256]; _snprintf(errorStr, 256, "HTML Parse Error: %s at line %u:%u" NEWLINE, XML_ErrorString(XML_GetErrorCode(parser)), (UINT)XML_GetCurrentLineNumber(parser), (UINT)XML_GetCurrentColumnNumber(parser)); CFiles Files; Files.AppendErrorLog((char *)errorStr); #ifdef RUSSIAN_BUILD //Fix unsupported KOI8 encoded Cyrillic chars. // ConvertCyrillicEncodedXMLToUTF8(text); #endif AsciiToUnicode(errorStr, this->wstrStatus); bResult = false; } //Parser clean-up. XML_ParserFree(parser); NewLine(); //once done, ensure final line of text is included in height NewLine(true); //...and have a blank line at the bottom to look good //Render surface to display on screen. bool bCanResize = CanResize(); if (bCanResize) { this->pParent->ScrollAbsolute(0, 0); //scroll to top of page if (this->wY < this->pParent->GetH()) //stretch surface to fill container this->wY = this->pParent->GetH(); } UpdateHTMLSurface(); //Resize (if possible). if (bCanResize) Resize(this->pHTMLSurface->w, this->pHTMLSurface->h); return bResult; }
UPanelSlot* UContentWidget::SetContent(UWidget* Content) { ClearChildren(); return AddChild(Content); }