fixed some property_info and value_info for BShelf, BMenu, BWindow and BView

real support is to be implemented for a lot of them


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17728 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2006-06-05 15:57:58 +00:00
parent eb1b419599
commit a03ac89526
4 changed files with 172 additions and 52 deletions

View File

@ -49,62 +49,91 @@ bool BMenu::sAltAsCommandKey;
static property_info
sPropList[] = {
{ "Enabled", { B_GET_PROPERTY, 0 },
{ B_DIRECT_SPECIFIER, 0 }, "Returns true if menu or menu item is enabled; false "
"otherwise." },
{ B_DIRECT_SPECIFIER, 0 }, "Returns true if menu or menu item is enabled; false "
"otherwise.",
0, { B_BOOL_TYPE }
},
{ "Enabled", { B_SET_PROPERTY, 0 },
{ B_DIRECT_SPECIFIER, 0 }, "Enables or disables menu or menu item." },
{ B_DIRECT_SPECIFIER, 0 }, "Enables or disables menu or menu item.",
0, { B_BOOL_TYPE }
},
{ "Label", { B_GET_PROPERTY, 0 },
{ B_DIRECT_SPECIFIER, 0 }, "Returns the string label of the menu or menu item." },
{ B_DIRECT_SPECIFIER, 0 }, "Returns the string label of the menu or menu item.",
0, { B_STRING_TYPE }
},
{ "Label", { B_SET_PROPERTY, 0 },
{ B_DIRECT_SPECIFIER, 0 }, "Sets the string label of the menu or menu item." },
{ B_DIRECT_SPECIFIER, 0 }, "Sets the string label of the menu or menu item.",
0, { B_STRING_TYPE }
},
{ "Mark", { B_GET_PROPERTY, 0 },
{ B_DIRECT_SPECIFIER, 0 }, "Returns true if the menu item or the menu's superitem "
"is marked; false otherwise." },
{ B_DIRECT_SPECIFIER, 0 }, "Returns true if the menu item or the menu's superitem "
"is marked; false otherwise.",
0, { B_BOOL_TYPE }
},
{ "Mark", { B_SET_PROPERTY, 0 },
{ B_DIRECT_SPECIFIER, 0 }, "Marks or unmarks the menu item or the menu's superitem." },
{ B_DIRECT_SPECIFIER, 0 }, "Marks or unmarks the menu item or the menu's superitem.",
0, { B_BOOL_TYPE }
},
{ "Menu", { B_CREATE_PROPERTY, 0 },
{ B_NAME_SPECIFIER, B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER, 0 },
{ B_NAME_SPECIFIER, B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER, 0 },
"Adds a new menu item at the specified index with the text label found in \"data\" "
"and the int32 command found in \"what\" (used as the what field in the CMessage "
"sent by the item)." },
"sent by the item)." , 0, {},
{ {{{"data", B_STRING_TYPE}}}
}
},
{ "Menu", { B_DELETE_PROPERTY, 0 },
{ B_NAME_SPECIFIER, B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER, 0 },
"Removes the selected menu or menus." },
{ B_NAME_SPECIFIER, B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER, 0 },
"Removes the selected menu or menus.", 0, {}
},
{ "Menu", { B_GET_PROPERTY, B_SET_PROPERTY, 0 },
{ B_NAME_SPECIFIER, B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER, 0 },
{ "Menu", { },
{ B_NAME_SPECIFIER, B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER, 0 },
"Directs scripting message to the specified menu, first popping the current "
"specifier off the stack." },
"specifier off the stack.", 0, {}
},
{ "MenuItem", { B_COUNT_PROPERTIES, 0 },
{ B_DIRECT_SPECIFIER, 0 }, "Counts the number of menu items in the specified menu." },
{ B_DIRECT_SPECIFIER, 0 }, "Counts the number of menu items in the specified menu.",
0, { B_INT32_TYPE }
},
{ "MenuItem", { B_CREATE_PROPERTY, 0 },
{ B_NAME_SPECIFIER, B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER, 0 },
{ B_NAME_SPECIFIER, B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER, 0 },
"Adds a new menu item at the specified index with the text label found in \"data\" "
"and the int32 command found in \"what\" (used as the what field in the CMessage "
"sent by the item)." },
"sent by the item).", 0, {},
{ { {{"data", B_STRING_TYPE },
{"be:invoke_message", B_MESSAGE_TYPE},
{"what", B_INT32_TYPE},
{"be:target", B_MESSENGER_TYPE}} }
}
},
{ "MenuItem", { B_DELETE_PROPERTY, 0 },
{ B_NAME_SPECIFIER, B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER, 0 },
"Removes the specified menu item from its parent menu." },
{ B_NAME_SPECIFIER, B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER, 0 },
"Removes the specified menu item from its parent menu."
},
{ "MenuItem", { B_EXECUTE_PROPERTY, 0 },
{ B_NAME_SPECIFIER, B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER, 0 },
"Invokes the specified menu item." },
{ B_NAME_SPECIFIER, B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER, 0 },
"Invokes the specified menu item."
},
{ "MenuItem", { B_GET_PROPERTY, B_SET_PROPERTY, 0 },
{ B_NAME_SPECIFIER, B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER, 0 },
{ "MenuItem", { },
{ B_NAME_SPECIFIER, B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER, 0 },
"Directs scripting message to the specified menu, first popping the current "
"specifier off the stack." },
{0}
"specifier off the stack."
},
{}
};

View File

@ -19,6 +19,7 @@
#include <MessageFilter.h>
#include <Messenger.h>
#include <Point.h>
#include <PropertyInfo.h>
#include <Rect.h>
#include <Shelf.h>
#include <View.h>
@ -29,6 +30,32 @@
#include <string.h>
static property_info sPropertyList[] = {
{
"Replicant",
{ B_COUNT_PROPERTIES, B_CREATE_PROPERTY },
{ B_DIRECT_SPECIFIER },
NULL, 0,
},
{
"Replicant",
{ B_DELETE_PROPERTY, B_GET_PROPERTY },
{ B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER, B_NAME_SPECIFIER, B_ID_SPECIFIER },
NULL, 0,
},
{
"Replicant",
{},
{ B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER, B_NAME_SPECIFIER, B_ID_SPECIFIER },
"... of Replicant {index | name | id} of ...", 0,
},
{}
};
extern "C" void _ReservedShelf1__6BShelfFv(BShelf *const, int32,
const BMessage*, const BView*);
@ -346,6 +373,8 @@ class _TReplicantViewFilter_ : public BMessageFilter {
};
// #pragma mark -
@ -404,7 +433,32 @@ BShelf::Instantiate(BMessage *data)
void
BShelf::MessageReceived(BMessage *msg)
{
//TODO: Implement
BMessage replyMsg(B_REPLY);
bool handled = false;
switch (msg->what) {
case B_GET_PROPERTY:
case B_SET_PROPERTY: {
BMessage specifier;
int32 what;
const char *prop;
int32 index;
if (msg->GetCurrentSpecifier(&index, &specifier, &what, &prop) != B_OK)
break;
break;
}
};
if (handled) {
if (msg->what == B_SET_PROPERTY)
replyMsg.AddInt32("error", B_OK);
} else {
replyMsg.what = B_MESSAGE_NOT_UNDERSTOOD;
replyMsg.AddInt32("error", B_BAD_SCRIPT_SYNTAX);
replyMsg.AddString("message", "Didn't understand the specifier(s)");
}
msg->SendReply(&replyMsg);
}
@ -457,10 +511,17 @@ BShelf::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier,
status_t
BShelf::GetSupportedSuites(BMessage *data)
BShelf::GetSupportedSuites(BMessage *message)
{
//TODO
return B_ERROR;
status_t err;
err = message->AddString("suites", "suite/vnd.Be-shelf");
if (err == B_OK) {
BPropertyInfo propInfo(sPropertyList);
err = message->AddFlat("messages", &propInfo);
}
if (err == B_OK)
return BHandler::GetSupportedSuites(message);
return err;
}

View File

@ -61,31 +61,27 @@ using std::nothrow;
static property_info sViewPropInfo[] = {
{ "Frame", { B_GET_PROPERTY, 0 },
{ B_DIRECT_SPECIFIER, 0 }, "Returns the view's frame rectangle.",0 },
{ B_DIRECT_SPECIFIER, 0 }, "Returns the view's frame rectangle.", 0, { B_RECT_TYPE }
},
{ "Frame", { B_SET_PROPERTY, 0 },
{ B_DIRECT_SPECIFIER, 0 }, "Sets the view's frame rectangle.",0 },
{ B_DIRECT_SPECIFIER, 0 }, "Sets the view's frame rectangle.", 0, { B_RECT_TYPE }
},
{ "Hidden", { B_GET_PROPERTY, 0 },
{ B_DIRECT_SPECIFIER, 0 }, "Returns true if the view is hidden; false otherwise.",0 },
{ B_DIRECT_SPECIFIER, 0 }, "Returns true if the view is hidden; false otherwise.", 0, { B_BOOL_TYPE }
},
{ "Hidden", { B_SET_PROPERTY, 0 },
{ B_DIRECT_SPECIFIER, 0 }, "Hides or shows the view.",0 },
{ B_DIRECT_SPECIFIER, 0 }, "Hides or shows the view.", 0, { B_BOOL_TYPE }
},
{ "Shelf", { 0 },
{ B_DIRECT_SPECIFIER, 0 }, "Directs the scripting message to the shelf.",0 },
{ B_DIRECT_SPECIFIER, 0 }, "Directs the scripting message to the shelf.", 0
},
{ "View", { B_COUNT_PROPERTIES, 0 },
{ B_DIRECT_SPECIFIER, 0 }, "Returns the number of of child views.",0 },
{ B_DIRECT_SPECIFIER, 0 }, "Returns the number of of child views.", 0, { B_INT32_TYPE }
},
{ "View", { 0 },
{ B_INDEX_SPECIFIER, 0 }, "Directs the scripting message to the specified view.",0 },
{ "View", { 0 },
{ B_REVERSE_INDEX_SPECIFIER, 0 }, "Directs the scripting message to the specified view.",0 },
{ "View", { 0 },
{ B_NAME_SPECIFIER, 0 }, "Directs the scripting message to the specified view.",0 },
{ B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER, B_NAME_SPECIFIER, 0 },
"Directs the scripting message to the specified view.", 0
},
{ 0, { 0 }, { 0 }, 0, 0 }
};

View File

@ -87,6 +87,11 @@ class BWindow::Shortcut {
using BPrivate::gDefaultTokens;
static property_info sWindowPropInfo[] = {
{
"Active", { B_GET_PROPERTY, B_SET_PROPERTY },
{ B_DIRECT_SPECIFIER }, NULL, 0, { B_BOOL_TYPE }
},
{
"Feel", { B_GET_PROPERTY, B_SET_PROPERTY },
{ B_DIRECT_SPECIFIER }, NULL, 0, { B_INT32_TYPE }
@ -119,7 +124,7 @@ static property_info sWindowPropInfo[] = {
{
"Workspaces", { B_GET_PROPERTY, B_SET_PROPERTY },
{ B_DIRECT_SPECIFIER }, NULL, 0, { B_INT32_TYPE}
{ B_DIRECT_SPECIFIER }, NULL, 0, { B_INT32_TYPE }
},
{
@ -127,6 +132,11 @@ static property_info sWindowPropInfo[] = {
{ B_DIRECT_SPECIFIER }, NULL, 0, {}
},
{
"View", { B_COUNT_PROPERTIES },
{ B_DIRECT_SPECIFIER }, NULL, 0, { B_INT32_TYPE }
},
{
"View", {}, {}, NULL, 0, {}
},
@ -136,6 +146,30 @@ static property_info sWindowPropInfo[] = {
{ B_DIRECT_SPECIFIER }, NULL, 0, { B_BOOL_TYPE }
},
{}
};
static value_info sWindowValueInfo[] = {
{
"MoveTo", 'WDMT', B_COMMAND_KIND,
"Moves to the position in the BPoint data"
},
{
"MoveBy", 'WDMB', B_COMMAND_KIND,
"Moves by the offsets in the BPoint data"
},
{
"ResizeTo", 'WDRT', B_COMMAND_KIND,
"Resize to the size in the BPoint data"
},
{
"ResizeBy", 'WDRB', B_COMMAND_KIND,
"Resize by the offsets in the BPoint data"
},
{}
};
@ -2185,7 +2219,7 @@ BWindow::GetSupportedSuites(BMessage *data)
status_t status = data->AddString("Suites", "suite/vnd.Be-window");
if (status == B_OK) {
BPropertyInfo propertyInfo(sWindowPropInfo);
BPropertyInfo propertyInfo(sWindowPropInfo, sWindowValueInfo);
status = data->AddFlat("message", &propertyInfo);
if (status == B_OK)