Ejemplo n.º 1
0
void Alloc_GUITreeview(TGUIWidget *AWidget)
{
  Alloc_GUIWidget(AWidget);
  
  TIterator *BTree = Alloc_Iterator(NULL);
  Widget_AddPointer(AWidget, "tree", BTree);
  Widget_AddInt(AWidget, "posx", 0);
  Widget_AddInt(AWidget, "posy", 0);
  
  TIterator *BItemA = Alloc_Iterator(NULL);
  Iterator_Add(BTree, BItemA);
  TIterator *BItemB = Alloc_Iterator(NULL);
  Iterator_Add(BTree, BItemB);
  TIterator *BItemC = Alloc_Iterator(NULL);
  Iterator_Add(BTree, BItemC);
  TIterator *BItemD = Alloc_Iterator(NULL);
  Iterator_Add(BTree, BItemD);
  TIterator *BItemE = Alloc_Iterator(NULL);
  Iterator_Add(BTree, BItemE);
  
  TIterator *BItemBA = Alloc_Iterator(NULL);
  Iterator_Add(BItemB, BItemBA);
  TIterator *BItemBB = Alloc_Iterator(NULL);
  Iterator_Add(BItemB, BItemBB);
  TIterator *BItemBC = Alloc_Iterator(NULL);
  Iterator_Add(BItemB, BItemBC);
  
  TIterator *BItemCA = Alloc_Iterator(NULL);
  Iterator_Add(BItemC, BItemCA);
  
  
  AWidget->FDraw = &GUITreeview_Draw;  
};
Ejemplo n.º 2
0
void StringIterator_Add(StringIterator * iterator, const char * string)
{
    if (iterator != NULL)
    {
        if (string != NULL)
        {
            // allocate memory, to be managed by iterator:
            char * newString = strdup(string);
            if (newString != NULL)
            {
                Iterator_Add(iterator->Iterator, newString);
            }
            else
            {
                LogErrorWithEnum(AwaError_Internal, "unable to allocate memory for string");
            }
        }
        else
        {
            LogErrorWithEnum(AwaError_Internal, "string is NULL");
        }
    }
    else
    {
        LogErrorWithEnum(AwaError_IteratorInvalid, "iterator is NULL");
    }
}