Esempio n. 1
0
status_t
BControl::GetSupportedSuites(BMessage* message)
{
	message->AddString("suites", "suite/vnd.Be-control");

	BPropertyInfo propInfo(sPropertyList);
	message->AddFlat("messages", &propInfo);

	return BView::GetSupportedSuites(message);
}
Esempio n. 2
0
BHandler*
BStringView::ResolveSpecifier(BMessage* message, int32 index,
	BMessage* specifier, int32 form, const char* property)
{
	BPropertyInfo propInfo(sPropertyList);
	if (propInfo.FindMatch(message, 0, specifier, form, property) >= B_OK)
		return this;

	return BView::ResolveSpecifier(message, index, specifier, form, property);
}
Esempio n. 3
0
//------------------------------------------------------------------------------
BHandler *BControl::ResolveSpecifier(BMessage *message, int32 index,
									 BMessage *specifier, int32 what,
									 const char *property)
{
	BPropertyInfo propInfo(prop_list);

	if (propInfo.FindMatch(message, 0, specifier, what, property) < B_OK)
		return BView::ResolveSpecifier(message, index, specifier, what,
			property);
	else
		return this;
}
Esempio n. 4
0
BHandler *
PathBox::ResolveSpecifier(BMessage *msg, int32 index,
							BMessage *specifier, int32 form,
							const char *property)
{
	BPropertyInfo propInfo(sProperties);

	if (propInfo.FindMatch(msg, 0, specifier, form, property) >= B_OK)
		return this;

	return BView::ResolveSpecifier(msg, index, specifier, form, property);
}
Esempio n. 5
0
BHandler *
BTextControl::ResolveSpecifier(BMessage *message, int32 index,
										 BMessage *specifier, int32 what,
										 const char *property)
{
	BPropertyInfo propInfo(sPropertyList);

	if (propInfo.FindMatch(message, 0, specifier, what, property) >= B_OK)
		return this;

	return BControl::ResolveSpecifier(message, index, specifier, what,
		property);
}
Esempio n. 6
0
BHandler*
BListView::ResolveSpecifier(BMessage* message, int32 index,
	BMessage* specifier, int32 form, const char* property)
{
	BPropertyInfo propInfo(sProperties);

	if (propInfo.FindMatch(message, 0, specifier, form, property) < 0) {
		return BView::ResolveSpecifier(message, index, specifier, form,
			property);
	}

	// TODO: msg->AddInt32("_match_code_", );

	return this;
}
status_t
BChannelSlider::GetSupportedSuites(BMessage* data)
{
	if (data == NULL)
		return B_BAD_VALUE;

	status_t err = data->AddString("suites", "suite/vnd.Be-channel-slider");

	BPropertyInfo propInfo(sPropertyInfo);
	if (err == B_OK)
		err = data->AddFlat("messages", &propInfo);

	if (err == B_OK)
		return BChannelControl::GetSupportedSuites(data);
	return err;
}
void
BChannelSlider::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case B_SET_PROPERTY: {
		case B_GET_PROPERTY:
			BMessage reply(B_REPLY);
			int32 index = 0;
			BMessage specifier;
			int32 what = 0;
			const char* property = NULL;
			bool handled = false;
			status_t status = message->GetCurrentSpecifier(&index, &specifier,
				&what, &property);
			BPropertyInfo propInfo(sPropertyInfo);
			if (status == B_OK
				&& propInfo.FindMatch(message, index, &specifier, what,
					property) >= 0) {
				handled = true;
				if (message->what == B_SET_PROPERTY) {
					orientation orient;
					if (specifier.FindInt32("data", (int32*)&orient) == B_OK) {
						SetOrientation(orient);
						Invalidate(Bounds());
					}
				} else if (message->what == B_GET_PROPERTY)
					reply.AddInt32("result", (int32)Orientation());
				else
					status = B_BAD_SCRIPT_SYNTAX;
			}

			if (handled) {
				reply.AddInt32("error", status);
				message->SendReply(&reply);
			} else {
				BChannelControl::MessageReceived(message);
			}
		}	break;

		default:
			BChannelControl::MessageReceived(message);
			break;
	}
}
BHandler*
AutoMounter::ResolveSpecifier(BMessage* message, int32 index,
	BMessage* specifier, int32 what, const char* property)
{
	BPropertyInfo propInfo(sPropertyInfo);

	uint32 data;
	if (propInfo.FindMatch(message, 0, specifier, what, property, &data) >= 0) {
		if (data == kApplication)
			return this;

		BMessage reply(B_MESSAGE_NOT_UNDERSTOOD);
		reply.AddInt32("error", B_ERROR);
		reply.AddString("message", "Unkown specifier.");
		message->SendReply(&reply);
		return NULL;
	}

	return BApplication::ResolveSpecifier(message, index, specifier, what,
		property);
}
XPCDispTypeInfo::FuncDescArray::FuncDescArray(XPCCallContext& ccx, JSObject* obj, const XPCDispIDArray& array, XPCDispNameArray & names)
{
    PRUint32 size = array.Length();
    names.SetSize(size);
    PRUint32 memid = 0;
    JSContext* cx = ccx;
    // Initialize each function description in the array
    for(PRUint32 index = 0; index < size; ++index)
    {
        XPCDispJSPropertyInfo propInfo(cx, ++memid, obj, array.Item(cx, index));
        names.SetName(index + 1, propInfo.GetName());
        if(!BuildFuncDesc(ccx, obj, propInfo))
            return;
        // non-readonly Properties get two function descriptions
        if(propInfo.IsProperty() && !propInfo.IsReadOnly())
        {
            propInfo.SetSetter();
            if(!BuildFuncDesc(ccx, obj, propInfo))
                return;
        }
    }
}
Esempio n. 11
0
void
BListView::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case B_COUNT_PROPERTIES:
		case B_EXECUTE_PROPERTY:
		case B_GET_PROPERTY:
		case B_SET_PROPERTY:
		{
			BPropertyInfo propInfo(sProperties);
			BMessage specifier;
			const char *property;

			if (message->GetCurrentSpecifier(NULL, &specifier) != B_OK
				|| specifier.FindString("property", &property) != B_OK)
				return;

			switch (propInfo.FindMatch(message, 0, &specifier, message->what,
					property)) {
				case B_ERROR:
					BView::MessageReceived(message);
					break;

				case 0:
				{
					BMessage reply(B_REPLY);
					reply.AddInt32("result", CountItems());
					reply.AddInt32("error", B_OK);

					message->SendReply(&reply);
					break;
				}

				case 1:
					break;

				case 2:
				{
					int32 count = 0;

					for (int32 i = 0; i < CountItems(); i++) {
						if (ItemAt(i)->IsSelected())
							count++;
					}

					BMessage reply(B_REPLY);
					reply.AddInt32("result", count);
					reply.AddInt32("error", B_OK);

					message->SendReply(&reply);
					break;
				}

				case 3:
					break;

				case 4:
				{
					BMessage reply (B_REPLY);

					for (int32 i = 0; i < CountItems(); i++) {
						if (ItemAt(i)->IsSelected())
							reply.AddInt32("result", i);
					}

					reply.AddInt32("error", B_OK);

					message->SendReply(&reply);
					break;
				}

				case 5:
					break;

				case 6:
				{
					BMessage reply(B_REPLY);

					bool select;
					if (message->FindBool("data", &select) == B_OK && select)
						Select(0, CountItems() - 1, false);
					else
						DeselectAll();

					reply.AddInt32("error", B_OK);

					message->SendReply(&reply);
					break;
				}
			}
			break;
		}

		case B_SELECT_ALL:
			if (fListType == B_MULTIPLE_SELECTION_LIST)
				Select(0, CountItems() - 1, false);
			break;

		default:
			BView::MessageReceived(message);
	}
}
Esempio n. 12
0
//------------------------------------------------------------------------------
void BControl::MessageReceived(BMessage *message)
{
	bool handled = false;
	BMessage reply(B_REPLY);

	if (message->what == B_GET_PROPERTY || message->what == B_SET_PROPERTY)
	{
		BPropertyInfo propInfo(prop_list);
		BMessage specifier;
		int32 index;
		int32 form;
		const char *property;

		if (message->GetCurrentSpecifier(&index, &specifier, &form, &property) == B_OK)
		{
			if (strcmp(property, "Label") == 0)
			{
				if (message->what == B_GET_PROPERTY)
				{
					reply.AddString("result", fLabel);
					handled = true;
				}
				else
				{
					const char *label;
					
					if (message->FindString("data", &label) == B_OK)
					{
						SetLabel(label);
						reply.AddInt32("error", B_OK);
						handled = true;
					}
				}
			}
			else if (strcmp(property, "Value") == 0)
			{
				if (message->what == B_GET_PROPERTY)
				{
					reply.AddInt32("result", fValue);
					handled = true;
				}
				else
				{
					int32 value;
					
					if (message->FindInt32("data", &value) == B_OK)
					{
						SetValue(value);
						reply.AddInt32("error", B_OK);
						handled = true;
					}
				}
			}
			else if (strcmp(property, "Enabled") == 0)
			{
				if (message->what == B_GET_PROPERTY)
				{
					reply.AddBool("result", fEnabled);
					handled = true;
				}
				else
				{
					bool enabled;
					
					if (message->FindBool("data", &enabled) == B_OK)
					{
						SetEnabled(enabled);
						reply.AddInt32("error", B_OK);
						handled = true;
					}
				}
			}
		}
	}

	if (handled)
		message->SendReply(&reply);
	else
		BView::MessageReceived(message);
}