Ejemplo n.º 1
0
void wxPropertyList::AddProperty(const char* name, const char* value, const char* helpString,
                                int type, const char* comboItems, bool reverseOrder, bool advanced)
{ 
    wxPropertyItem* pItem = 0; 
   
    // add or update the property item
    for(size_t i = 0; i < m_PropertyItems.Count(); i++)
    {
        if(m_PropertyItems[i]->GetPropName().IsSameAs(name))
        {
            pItem = m_PropertyItems[i];
            if(!pItem->GetCurValue().IsSameAs(value))
            {
                pItem->SetCurValue(value);
                pItem->SetHelpString(helpString);
                pItem->SetAdvanced(advanced);
            
                // update the property item
                int row = FindProperty(pItem);
                if(row != -1)
                    UpdatePropertyItem(pItem, row);         
            }
            return;
        }
    }

    // if it is not found, then create a new one
    if(!pItem)
    {
        pItem = new wxPropertyItem(name, value, helpString, type, comboItems);
        pItem->SetAdvanced(advanced);
  
        AddPropItem(pItem, 1);
    }
}
Ejemplo n.º 2
0
status_t
PLabel::GetProperty(const char *name, PValue *value, const int32 &index) const
{
	if (!name || !value)
		return B_ERROR;
	
	BString str(name);
	PProperty *prop = FindProperty(name,index);
	if (!prop)
		return B_NAME_NOT_FOUND;
	
	BStringView *backend = (BStringView*)fView;

	if (backend->Window())
		backend->Window()->Lock();

	if (str.ICompare("Alignment") == 0)
		((EnumProperty*)prop)->SetValue(backend->Alignment());
	else if (str.ICompare("Text") == 0)
		((StringProperty*)prop)->SetValue(backend->Text());
	else
	{
		if (backend->Window())
			backend->Window()->Unlock();

		return PView::GetProperty(name, value, index);
	}

	if (backend->Window())
		backend->Window()->Unlock();

	return prop->GetValue(value);
}
Ejemplo n.º 3
0
status_t
PListView::SetProperty(const char *name, PValue *value, const int32 &index)
{
	if (!name || !value)
		return B_ERROR;
	
	BString str(name);
	PProperty *prop = FindProperty(name,index);
	if (!prop)
		return B_NAME_NOT_FOUND;
	
	if (FlagsForProperty(prop) & PROPERTY_READ_ONLY)
		return B_READ_ONLY;
	
	BListView *backend = (BListView*)fView;
	
	BoolValue boolval;
	CharValue charval;
	ColorValue colorval;
	FloatValue floatval;
	IntValue intval;
	PointValue pointval;
	RectValue rectval;
	StringValue stringval;
	
	status_t status = prop->SetValue(value);
	if (status != B_OK)
		return status;

	if (backend->Window())
		backend->Window()->Lock();

	else if (str.ICompare("SelectionMessage") == 0)
	{
		BMessage selMsg(*intval.value);
		backend->SetSelectionMessage(&selMsg);
	}
	else if (str.ICompare("InvocationMessage") == 0)
	{
		BMessage invMsg(*intval.value);
		backend->SetInvocationMessage(&invMsg);
	}
	else if (str.ICompare("SelectionType") == 0)
	{
		prop->GetValue(&intval);
		backend->SetListType((list_view_type)*intval.value);
	}
	else
	{
		if (backend->Window())
			backend->Window()->Unlock();

		return PView::SetProperty(name, value, index);
	}

	if (backend->Window())
		backend->Window()->Unlock();

	return prop->GetValue(value);
}
Ejemplo n.º 4
0
status_t
PControl::GetProperty(const char *name, PValue *value, const int32 &index) const
{
	if (!name || !value)
		return B_ERROR;
	
	BString str(name);
	PProperty *prop = FindProperty(name,index);
	if (!prop)
		return B_NAME_NOT_FOUND;
	
	if (!fView)
		return B_NO_INIT;
	
	BControl *viewAsControl = (BControl*)fView;
	
	if (str.ICompare("Enabled") == 0)
		((BoolProperty*)prop)->SetValue(viewAsControl->IsEnabled());
	else if (str.ICompare("Label") == 0)
		((StringProperty*)prop)->SetValue(viewAsControl->Label());
	else if (str.ICompare("Value") == 0)
		((IntProperty*)prop)->SetValue(viewAsControl->Value());
	else
		return PView::GetProperty(name,value,index);
	
	return prop->GetValue(value);
}
Ejemplo n.º 5
0
wxVariant ctProperties::FindPropertyValue(const wxString& name) const
{
    ctProperty* prop = FindProperty(name);
    if (prop)
        return prop->m_variant;
    else
        return wxEmptyString;
}
Ejemplo n.º 6
0
GUI_TextField::GUI_TextField(const char *aname, int x, int y, int w, int h, GUI_Font * afont, int maxlength):GUI_Widget(aname, x, y, w, h), font(afont)
{
    type = TYPE_TEXTFIELD;
    SetFlags(WIDGET_SELECTABLE);
    SetTransparent(1);

    fontnormalcolor = DEFAULT_FONTCOLOR;
    fontfocusedcolor = DEFAULT_FONTCOLOR;

    fontsize = DEFAULT_FONTSIZE;
    if (font) {
        font->IncRef();
    }

    cursorpos = 0;
    startoffset = 0;
    inpdigit = 0;
    inpdigitptr = 0;
    buffer_size = maxlength;
    buffer_index = 0;
    buffer = (char*)calloc(1, buffer_size);
    cbuffer = (char*)calloc(1, buffer_size);
    validchars = 0;

    MemberFunctionProperty < GUI_TextField > *mp;
    mp = new MemberFunctionProperty < GUI_TextField > ("text", this, &GUI_TextField::pget_Text, &GUI_TextField::pset_Text, false);
    AddProperty(mp);
    mp = new MemberFunctionProperty < GUI_TextField > ("font", this, &GUI_TextField::pget_Font, &GUI_TextField::pset_Font, true);
    AddProperty(mp);
    mp = new MemberFunctionProperty < GUI_TextField > ("fontsize", this, &GUI_TextField::pget_FontSize, &GUI_TextField::pset_FontSize, false);
    AddProperty(mp);
    mp = new MemberFunctionProperty < GUI_TextField > ("fontcolor", this, &GUI_TextField::pget_FontColor, &GUI_TextField::pset_FontColor, false);
    AddProperty(mp);
    mp = new MemberFunctionProperty < GUI_TextField > ("fontfocusedcolor", this, &GUI_TextField::pget_FontFocusedColor, &GUI_TextField::pset_FontFocusedColor, false);
    AddProperty(mp);
    mp = new MemberFunctionProperty < GUI_TextField > ("maxlength", this, &GUI_TextField::pget_MaxLength, &GUI_TextField::pset_MaxLength, false);
    AddProperty(mp);
    mp = new MemberFunctionProperty < GUI_TextField > ("cursorpos", this, &GUI_TextField::pget_CursorPos, &GUI_TextField::pset_CursorPos, false);
    AddProperty(mp);
    mp = new MemberFunctionProperty < GUI_TextField > ("validchars", this, &GUI_TextField::pget_ValidChars, &GUI_TextField::pset_ValidChars, false);
    AddProperty(mp);

    FindProperty("width")->SetRequired(true);
    FindProperty("height")->SetRequired(true);
}
Ejemplo n.º 7
0
int DynamicObject::SetPropertyValue(const char *property, Variant value)
{
    ObjectProperty *prop = FindProperty(property);
    if (prop) {
        return prop->SetValue(value);
    }
    systemObject->Log(0, "Object %s does not have a property %s", GetName(), property);
    return -1;
}
Ejemplo n.º 8
0
Variant DynamicObject::GetPropertyValue(const char *property)
{
    ObjectProperty *prop = FindProperty(property);
    if (prop) {
        return prop->GetValue();
    }
    systemObject->Log(0, "Object %s does not have a property %s", name, property);
    return VARNULL;
}
Ejemplo n.º 9
0
// Get an existing property (given its name)
GProperty* GAnimElement::Property(const GString& Name) const {

	GUInt32 i;

	if (Name.length() <= 0)
		return NULL;
	// do a binary search
	return FindProperty(Name, i);
}
Ejemplo n.º 10
0
void ctProperties::DeleteProperty(const wxString& name)
{
    ctProperty* prop = FindProperty(name);
    if (prop)
    {
        m_list.DeleteObject(prop);
        delete prop;
    }
}
Ejemplo n.º 11
0
	void SetProperty(const WorldProperty& _prop) {
		int i = FindProperty(_prop.name);
		if (i < 0) {
			AddProperty(_prop);	
			return;
		}

		data[i].data = _prop.data;
	}
Ejemplo n.º 12
0
status_t
PControl::SetProperty(const char *name, PValue *value, const int32 &index)
{
	// Modal, Front, and Floating properties are missing because they are read-only
	if (!name || !value)
		return B_ERROR;
	
	BString str(name);
	PProperty *prop = FindProperty(name,index);
	if (!prop)
		return B_NAME_NOT_FOUND;
	
	status_t status = prop->SetValue(value);
	if (status != B_OK)
		return status;
	
	if (!fView)
		return B_NO_INIT;
	
	BControl *viewAsControl = (BControl*)fView;
	
	BoolValue bv;
	IntValue iv;
	StringValue sv;
	
	if (viewAsControl->Window())
		viewAsControl->Window()->Lock();
	
	if (str.ICompare("Enabled") == 0)
	{
		prop->GetValue(&bv);
		viewAsControl->SetEnabled(bv.value);
	}
	else if (str.ICompare("Label") == 0)
	{
		prop->GetValue(&sv);
		viewAsControl->SetLabel(sv.value->String());
		viewAsControl->Invalidate();
	}
	else if (str.ICompare("Value") == 0)
	{
		prop->GetValue(&iv);
		viewAsControl->SetValue(*iv.value);
	}
	else
	{
		if (viewAsControl->Window())
			viewAsControl->Window()->Unlock();
		return PView::SetProperty(name,value,index);
	}

	if (viewAsControl->Window())
		viewAsControl->Window()->Unlock();
	
	return prop->GetValue(value);
}
Ejemplo n.º 13
0
ctProperty* ctProperties::FindOrCreateProperty(const wxString& name)
{
    ctProperty* prop = FindProperty(name);
    if (!prop)
    {
        prop = new ctProperty(name);
        AddProperty(prop);
    }
    return prop;
}
Ejemplo n.º 14
0
status_t
PLabel::SetProperty(const char *name, PValue *value, const int32 &index)
{
	if (!name || !value)
		return B_ERROR;
	
	BString str(name);
	PProperty *prop = FindProperty(name,index);
	if (!prop)
		return B_NAME_NOT_FOUND;
	
	if (FlagsForProperty(prop) & PROPERTY_READ_ONLY)
		return B_READ_ONLY;
	
	BStringView *backend = (BStringView*)fView;
	
	BoolValue boolval;
	CharValue charval;
	ColorValue colorval;
	FloatValue floatval;
	IntValue intval;
	PointValue pointval;
	RectValue rectval;
	StringValue stringval;
	
	status_t status = prop->SetValue(value);
	if (status != B_OK)
		return status;

	if (backend->Window())
		backend->Window()->Lock();

	if (str.ICompare("Alignment") == 0)
	{
		prop->GetValue(&intval);
		backend->SetAlignment((alignment)*intval.value);
	}
	else if (str.ICompare("Text") == 0)
	{
		prop->GetValue(&stringval);
		backend->SetText(*stringval.value);
	}
	else
	{
		if (backend->Window())
			backend->Window()->Unlock();

		return PView::SetProperty(name, value, index);
	}

	if (backend->Window())
		backend->Window()->Unlock();

	return prop->GetValue(value);
}
Ejemplo n.º 15
0
static void ParseActorProperty(FScanner &sc, Baggage &bag)
{
	static const char *statenames[] = {
		"Spawn", "See", "Melee", "Missile", "Pain", "Death", "XDeath", "Burn", 
		"Ice", "Raise", "Crash", "Crush", "Wound", "Disintegrate", "Heal", NULL };

	strlwr (sc.String);

	FString propname = sc.String;

	if (sc.CheckString ("."))
	{
		sc.MustGetString ();
		propname += '.';
		strlwr (sc.String);
		propname += sc.String;
	}
	else
	{
		sc.UnGet ();
	}

	FPropertyInfo *prop = FindProperty(propname);

	if (prop != NULL)
	{
		if (bag.Info->Class->IsDescendantOf(prop->cls))
		{
			ParsePropertyParams(sc, prop, (AActor *)bag.Info->Class->Defaults, bag);
		}
		else
		{
			sc.ScriptMessage("\"%s\" requires an actor of type \"%s\"\n", propname.GetChars(), prop->cls->TypeName.GetChars());
			FScriptPosition::ErrorCounter++;
		}
	}
	else if (!propname.CompareNoCase("States"))
	{
		if (bag.StateSet) 
		{
			sc.ScriptMessage("'%s' contains multiple state declarations", bag.Info->Class->TypeName.GetChars());
			FScriptPosition::ErrorCounter++;
		}
		ParseStates(sc, bag.Info, (AActor *)bag.Info->Class->Defaults, bag);
		bag.StateSet=true;
	}
	else if (MatchString(propname, statenames) != -1)
	{
		bag.statedef.SetStateLabel(propname, CheckState (sc, bag.Info->Class));
	}
	else
	{
		sc.ScriptError("\"%s\" is an unknown actor property\n", propname.GetChars());
	}
}
Ejemplo n.º 16
0
// remove the specified property form internal list
GBool GAnimElement::RemoveProperty(const GString& Name) {

	if (Name.length() <= 0)
		return G_FALSE;

	GUInt32 propIndex;
	GProperty *tmpProp;

	tmpProp = FindProperty(Name, propIndex);
	return RemoveProperty(propIndex);
}
Ejemplo n.º 17
0
int Properties::GetPropertyValue(const char* name)const
{
	int value = 0;

	Property* prop = FindProperty(name);

	if (prop)
	{
		value = prop->value;
	}
	return value;
}
Ejemplo n.º 18
0
void MP4Container::FindFloatProperty(const char* name, 
	MP4Property** ppProperty, u_int32_t* pIndex)
{
	if (!FindProperty(name, ppProperty, pIndex)) {
		throw new MP4Error("no such property",
			 "MP4Container::FindFloatProperty");
	}
	if ((*ppProperty)->GetType() != Float32Property) {
		throw new MP4Error("type mismatch", 
			"MP4Container::FindFloatProperty");
	}
}
Ejemplo n.º 19
0
bool Properties::SetPropertyValue(const char* name, const int value)
{
	bool ret = false;

	Property* prop = FindProperty(name);
	if (prop)
	{
		prop->value = value;
		ret = true;
	}

	return ret;
}
Ejemplo n.º 20
0
TInt CPropertyReg::PropertyIndex(TPropertyGroup aGroup, TUid aPropertyId, Bookmark::TPropertyType aType)
	{
	TPropertyList& list = List(aGroup);
	TInt index = FindProperty(list, aPropertyId);
	if (index != KErrNotFound)
		{
		if (list[index]->Type() != aType)
			{
			index = KErrNotFound;
			}
		}
	return index;
	}
Ejemplo n.º 21
0
UString GetNameOfProperty(PROPID propID, const wchar_t *name)
{
  int index = FindProperty(propID);
  if (index < 0)
  {
    if (name)
      return name;
    wchar_t s[16];
    ConvertUInt32ToString(propID, s);
    return s;
  }
  const CPropertyIDNamePair &pair = kPropertyIDNamePairs[index];
  return LangString(pair.ResourceID, pair.LangID);
}
EXPORT_C TBool CMsgStoreMessagePart::IsEmbeddedMessageL()
	{
	
	TUint index;
	TBool isEmbeddedMsg = EFalse;
	
	if ( FindProperty( KMsgStorePropertyIsEmbeddedMsg, index ) )
		{
		isEmbeddedMsg = PropertyValueBoolL( index );
		}
	
	return isEmbeddedMsg;
	
	}
Ejemplo n.º 23
0
TInt CPropertyReg::DeregisterPropertyL(TPropertyGroup aGroup, TUid aCustomId)
	{
	TPropertyList& list = List(aGroup);
	TInt index = FindProperty(list, aCustomId);
	if (index == KErrNotFound)
		{
		return KErrNotFound;
		}
	
	list[index]->DeleteL();
	iDeletedList.AppendL(list[index]);
	list.Remove(index);
	
	return KErrNone;
	}
Ejemplo n.º 24
0
void InitCheckbutton(GladeXML *xml, cngplpData* data, const gpointer *widget)
{
	WidgetInfo *widget_checkbutton = (WidgetInfo *)widget;
	PropInfo *prop_list = widget_checkbutton->prop_list;
	PropInfo *property = NULL;
	const char *text = NULL;
	if(prop_list != NULL){
		property = FindProperty(prop_list, "text");
	}
	if(property != NULL){
		text = NameToTextByName(property->res);
		if(text != NULL){
			SetButtonLabel(widget_checkbutton->name, text);
		}
	}
}
Ejemplo n.º 25
0
status_t
PProgressBar::GetProperty(const char *name, PValue *value, const int32 &index) const
{
	if (!name || !value)
		return B_ERROR;
	
	BString str(name);
	PProperty *prop = FindProperty(name,index);
	if (!prop)
		return B_NAME_NOT_FOUND;
	
	BStatusBar *backend = (BStatusBar*)fView;

	if (backend->Window())
		backend->Window()->Lock();

	if (str.ICompare("BarColor") == 0)
		((ColorProperty*)prop)->SetValue(backend->BarColor());
	else if (str.ICompare("BarHeight") == 0)
		((FloatProperty*)prop)->SetValue(backend->BarHeight());
	else if (str.ICompare("Label") == 0)
		((StringProperty*)prop)->SetValue(backend->Label());
	else if (str.ICompare("CurrentValue") == 0)
	{
		((FloatProperty*)prop)->SetValue(backend->CurrentValue());
	}
	else if (str.ICompare("MaxValue") == 0)
		((FloatProperty*)prop)->SetValue(backend->MaxValue());
	else if (str.ICompare("Text") == 0)
		((StringProperty*)prop)->SetValue(backend->Text());
	else if (str.ICompare("TrailingLabel") == 0)
		((StringProperty*)prop)->SetValue(backend->TrailingLabel());
	else if (str.ICompare("TrailingText") == 0)
		((StringProperty*)prop)->SetValue(backend->TrailingText());
	else
	{
		if (backend->Window())
			backend->Window()->Unlock();

		return PView::GetProperty(name, value, index);
	}

	if (backend->Window())
		backend->Window()->Unlock();

	return prop->GetValue(value);
}
UProperty* FTrackInstancePropertyBindings::GetProperty(const UObject* Object) const
{
	UProperty* Prop = nullptr;

	FPropertyAndFunction PropAndFunction = RuntimeObjectToFunctionMap.FindRef(Object);
	if( PropAndFunction.PropertyAddress.Property ) 
	{
		Prop = PropAndFunction.PropertyAddress.Property;
	}
	else
	{
		FPropertyAddress PropertyAddress = FindProperty( Object, PropertyPath );
		Prop = PropertyAddress.Property;
	}

	return Prop;
}
Ejemplo n.º 27
0
void CPropertyReg::RegisterPropertyL(TPropertyGroup aGroup, TUid aCustomId, Bookmark::TPropertyType aDataType)
	{
	TPropertyList& list = List(aGroup);
	if (FindProperty(list, aCustomId) != KErrNotFound)
		{
		User::Leave(Bookmark::KErrUidAlreadyUsed);
		}

	CCustomProperty* property = CCustomProperty::NewL(*iDatabaseRepository);
	CleanupStack::PushL(property);
	TUint32 newEntryId = AssignIdL(aGroup);		
	property->SetIdFromIndexBase(newEntryId);
	property->SetUid(aCustomId);
	property->SetType(aDataType);
	list.AppendL(property);
	CleanupStack::Pop(property);
	}
Ejemplo n.º 28
0
/* Find integer attribute matching Name in XML tag Parent and return it if exists.  
Removes attribute from Parent */
extern int GetIntProperty(INP ezxml_t Parent,
				 INP const char *Name,
				 INP boolean Required,
				 INP int default_value)
{
	const char * Prop;
	int property_value;

	property_value = default_value;
	Prop = FindProperty(Parent, Name, Required);
    if(Prop)
	{
	    property_value = my_atoi(Prop);
	    ezxml_set_attr(Parent, Name, NULL);
	}
	return property_value;
}
Ejemplo n.º 29
0
float UGAAttributesBase::GetFloatValue(const FGAAttribute& AttributeIn)
{
	if ((AttributeIn.AttributeName == LastAttributeName))
	{
		if (CachedFloatPropety)
		{
			const void* ValuePtr = CachedFloatPropety->ContainerPtrToValuePtr<void>(this);
			return CachedFloatPropety->GetFloatingPointPropertyValue(ValuePtr);
		}
	}
	//LastAttributeName = AttributeIn.AttributeName;
	UNumericProperty* NumericProperty = CastChecked<UNumericProperty>(FindProperty(AttributeIn));
	CachedFloatPropety = NumericProperty;
	const void* ValuePtr = NumericProperty->ContainerPtrToValuePtr<void>(this);
	return NumericProperty->GetFloatingPointPropertyValue(ValuePtr);

	return 0;
}
Ejemplo n.º 30
0
/* Find floating-point attribute matching Name in XML tag Parent and return it if exists.  
Removes attribute from Parent */
extern float GetFloatProperty(INP ezxml_t Parent,
				 INP const char *Name,
				 INP boolean Required,
				 INP float default_value)
{
	
	const char * Prop;
	float property_value;

	property_value = default_value;
	Prop = FindProperty(Parent, Name, Required);
    if(Prop)
	{
	    property_value = atof(Prop);
	    ezxml_set_attr(Parent, Name, NULL);
	}
	return property_value;
}