예제 #1
0
bool BContainer::GetConnectorStr(int* i,CString* connector)
{
	BItem* element;
	DWORD parentOffset;
	BButton* conName;
	CString temp;

	
	element = GetElement(*i);
	if(element == NULL)
		return false;
	if(element->elementType != TYPE_ELEMENT_HEADER)
	{
		return false;
	}
	conName = (BButton*)element;
	conName->GetString(&temp);
	parentOffset = element->offset;

	connector->Format("%s{",temp);
	*i+=1;
	element = GetElement(*i);

	while(*i<vElements.GetSize() && element != NULL && element->offset >parentOffset)
	{
		if(!GetElementStr(element,&temp))
		{
			*i+=1;
			element = GetElement(*i);
			continue;
		}
		connector->Append(temp);		
		*i+=1;
		element = GetElement(*i);
	}
	connector->AppendChar('}');
	return true;
}
예제 #2
0
bool BContainer::GetElementStr(BItem* element,CString* str)
{
	BCheckBox* boolItem;
	BEdit*	editItem;
	BCombo* comboItem;
	BFile* fileItem;
	BButton* buttonItem;
	CString temp;
	GML::Utils::GString gStrTemp;
	

	UINT someUIntValue;
	int	someIntValue;
	double someDoubleValue;


	switch(element->elementType)
	{
	case GML::Utils::AttributeList::BOOLEAN:
		boolItem = (BCheckBox*)element;
		if(boolItem->IsChecked())
			str->Format("%s=True;",boolItem->label);
		else
			str->Format("%s=False;",boolItem->label);
		return true;

	case GML::Utils::AttributeList::UINT32:
		editItem = (BEdit*)element;
		editItem->GetText(temp);
		gStrTemp.Set(temp.GetBuffer());
		if(!gStrTemp.ConvertToUInt32(&someUIntValue))
			return false;
		str->Format("%s=%u;",editItem->label,someUIntValue);
		return true;
	case GML::Utils::AttributeList::INT32:
		editItem = (BEdit*)element;
		editItem->GetText(temp);
		gStrTemp.Set(temp.GetBuffer());
		if(!gStrTemp.ConvertToInt32(&someIntValue))
			return false;
		str->Format("%s=%d;",editItem->label,someIntValue);
		return true;
	
	case GML::Utils::AttributeList::DOUBLE:
		editItem = (BEdit*)element;
		editItem->GetText(temp);
		gStrTemp.Set(temp.GetBuffer());
		if(!gStrTemp.ConvertToDouble(&someDoubleValue))
			return false;
		str->Format("%s=%lf;",editItem->label,someDoubleValue);
		return true;	
	case GML::Utils::AttributeList::STRING:
		editItem = (BEdit*)element;
		editItem->GetText(temp);
		if(temp.Compare("")==0)
		{
			return false;			
		}
		str->Format("%s=%s;",editItem->label,temp);
		return true;

	case TYPE_COMBO:
		comboItem = (BCombo*)element;
		comboItem->GetSelectedItem(temp);
		str->Format("%s=%s;",comboItem->label,temp);
		return true;
	case TYPE_FILE:
		fileItem = (BFile*)element;
		fileItem->GetText(temp);
		str->Format("%s=%s;",fileItem->label,temp);
		return true;
	case TYPE_ELEMENT_HEADER:
		buttonItem = (BButton*)element;
		buttonItem->GetString(&temp);
		str->Format("%s",temp);
		return true;
	}

	return false;
}