uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp
branchRCL_3
changeset 7 433cbbb6a04b
parent 3 d8a3531bc6b8
child 8 10534483575f
equal deleted inserted replaced
3:d8a3531bc6b8 7:433cbbb6a04b
    59         {
    59         {
    60         iWindow->SetNodeTracking( aValue );
    60         iWindow->SetNodeTracking( aValue );
    61         }
    61         }
    62     }
    62     }
    63 // ---------------------------------------------------------------------------
    63 // ---------------------------------------------------------------------------
    64 // OrphonMe
    64 // OrphanMe
    65 // ---------------------------------------------------------------------------
    65 // ---------------------------------------------------------------------------
    66 //
    66 //
    67 CAlfNode* CAlfNode::OrphonMe()
    67 CAlfNode* CAlfNode::OrphanMe()
    68     {
    68 
    69     __ALFLOGSTRING1("CAlfNode::OrphonMe %d", iId);
    69     {
    70 	// this window will not be used anymore by wserv and cannot be drawn into. Thus destroying the
    70     __ALFLOGSTRING1("CAlfNode::OrphanMe %d", iId);
    71 	// visual representing this node is safe.
    71     // Parent node has been deleted. Orphan the node: remove the parent/sibling relationship.
    72     if ( iWindow && iModel )
       
    73         {
       
    74         iModel->Server().WindowMgr()->DestroyWindow( *iWindow );
       
    75         iWindow = NULL;
       
    76         }
       
    77 
       
    78     CAlfNode* sibling = iSibling;
    72     CAlfNode* sibling = iSibling;
    79     iSibling = NULL;
    73     iSibling = NULL;
    80     iParent = NULL;
    74     iParent = NULL;
    81     return sibling;
    75     return sibling;
    82     }
    76     }
  1172 // ---------------------------------------------------------------------------
  1166 // ---------------------------------------------------------------------------
  1173 // 
  1167 // 
  1174 CAlfNode::~CAlfNode()
  1168 CAlfNode::~CAlfNode()
  1175     {
  1169     {
  1176     __ALFLOGSTRING1("CAlfNode::~CAlfNode %d", iId);
  1170     __ALFLOGSTRING1("CAlfNode::~CAlfNode %d", iId);
       
  1171 	if ( iWindow && iModel ) // just in case: the window should be deleted already
       
  1172         {
       
  1173         iModel->Server().WindowMgr()->DestroyWindow( *iWindow );
       
  1174         iWindow = NULL;
       
  1175         }
  1177     }
  1176     }
  1178 
  1177 
  1179 // ---------------------------------------------------------------------------
  1178 // ---------------------------------------------------------------------------
  1180 // HasChildren
  1179 // HasChildren
  1181 // ---------------------------------------------------------------------------
  1180 // ---------------------------------------------------------------------------
  1231     else
  1230     else
  1232         {
  1231         {
  1233         __ALFLOGSTRING1("My parent says, that I'm not his child :..( or no parent %d ", iParent );
  1232         __ALFLOGSTRING1("My parent says, that I'm not his child :..( or no parent %d ", iParent );
  1234         }
  1233         }
  1235     
  1234     
  1236     // Orphon all the children
  1235     // Orphan all the children
  1237     CAlfNode* child = iChild; 
  1236     CAlfNode* child = iChild; 
  1238     while( child )
  1237     while( child )
  1239         {
  1238         {
  1240         child = child->OrphonMe();
  1239         child = child->OrphanMe();
  1241         }
  1240         }
  1242     iChild = NULL;
  1241     iChild = NULL;
  1243     if ( iModel )
  1242     if ( iModel )
  1244         {    
  1243         {    
  1245         iModel->RemoveNode( iId );
  1244         iModel->RemoveNode( iId );
  1678 CAlfNodeVisual::~CAlfNodeVisual()
  1677 CAlfNodeVisual::~CAlfNodeVisual()
  1679     {
  1678     {
  1680     if ( iWindow && iModel )
  1679     if ( iWindow && iModel )
  1681         {
  1680         {
  1682         iModel->Server().WindowMgr()->DestroyWindow( *iWindow );
  1681         iModel->Server().WindowMgr()->DestroyWindow( *iWindow );
       
  1682 		iWindow = NULL; // make sure there is no double deletion
  1683         }
  1683         }
  1684     }
  1684     }
  1685 
  1685 
  1686 // ---------------------------------------------------------------------------
  1686 // ---------------------------------------------------------------------------
  1687 // Constructor
  1687 // Constructor
  1942         windowAttributes->iScreenNumber = iScreenNumber; 
  1942         windowAttributes->iScreenNumber = iScreenNumber; 
  1943 
  1943 
  1944         iModel->Server().Bridge()->AddData( EAlfDSDestroyWindow, 
  1944         iModel->Server().Bridge()->AddData( EAlfDSDestroyWindow, 
  1945                 iGroupId, 
  1945                 iGroupId, 
  1946                 iId, 
  1946                 iId, 
  1947                 (TAny*)offset );                
  1947                 (TAny*)offset );
       
  1948         iWindow = 0; // just in case
  1948         }
  1949         }
  1949     RemoveDependencies( iParent->iChild );
  1950     RemoveDependencies( iParent->iChild );
  1950     };
  1951     };
  1951 
  1952 
  1952 // ---------------------------------------------------------------------------
  1953 // ---------------------------------------------------------------------------