* merged Frame and Hidden properties (set and get) (bug #3493).
* changed Hidden set property to not check the current hidden state, as it's not exactly related. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30920 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+27
-38
@@ -71,22 +71,14 @@ using std::nothrow;
|
|||||||
|
|
||||||
|
|
||||||
static property_info sViewPropInfo[] = {
|
static property_info sViewPropInfo[] = {
|
||||||
{ "Frame", { B_GET_PROPERTY, 0 },
|
{ "Frame", { B_GET_PROPERTY, B_SET_PROPERTY },
|
||||||
{ B_DIRECT_SPECIFIER, 0 }, "Returns the view's frame rectangle.", 0,
|
{ B_DIRECT_SPECIFIER, 0 }, "The view's frame rectangle.", 0,
|
||||||
{ B_RECT_TYPE }
|
{ B_RECT_TYPE }
|
||||||
},
|
},
|
||||||
{ "Frame", { B_SET_PROPERTY, 0 },
|
{ "Hidden", { B_GET_PROPERTY, B_SET_PROPERTY },
|
||||||
{ B_DIRECT_SPECIFIER, 0 }, "Sets the view's frame rectangle.", 0,
|
{ B_DIRECT_SPECIFIER, 0 }, "Whether or not the view is hidden.",
|
||||||
{ B_RECT_TYPE }
|
|
||||||
},
|
|
||||||
{ "Hidden", { B_GET_PROPERTY, 0 },
|
|
||||||
{ B_DIRECT_SPECIFIER, 0 }, "Returns wether or not the view is hidden.",
|
|
||||||
0, { B_BOOL_TYPE }
|
0, { B_BOOL_TYPE }
|
||||||
},
|
},
|
||||||
{ "Hidden", { B_SET_PROPERTY, 0 },
|
|
||||||
{ B_DIRECT_SPECIFIER, 0 }, "Hides or shows the view.", 0,
|
|
||||||
{ B_BOOL_TYPE }
|
|
||||||
},
|
|
||||||
{ "Shelf", { 0 },
|
{ "Shelf", { 0 },
|
||||||
{ B_DIRECT_SPECIFIER, 0 }, "Directs the scripting message to the "
|
{ B_DIRECT_SPECIFIER, 0 }, "Directs the scripting message to the "
|
||||||
"shelf.", 0
|
"shelf.", 0
|
||||||
@@ -4060,12 +4052,10 @@ BView::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier,
|
|||||||
switch (propertyInfo.FindMatch(msg, index, specifier, what, property)) {
|
switch (propertyInfo.FindMatch(msg, index, specifier, what, property)) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
|
||||||
case 3:
|
case 3:
|
||||||
case 5:
|
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
case 4:
|
case 2:
|
||||||
if (fShelf) {
|
if (fShelf) {
|
||||||
msg->PopSpecifier();
|
msg->PopSpecifier();
|
||||||
return fShelf;
|
return fShelf;
|
||||||
@@ -4075,7 +4065,7 @@ BView::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier,
|
|||||||
replyMsg.AddString("message", "This window doesn't have a shelf");
|
replyMsg.AddString("message", "This window doesn't have a shelf");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 4:
|
||||||
{
|
{
|
||||||
if (!fFirstChild) {
|
if (!fFirstChild) {
|
||||||
err = B_NAME_NOT_FOUND;
|
err = B_NAME_NOT_FOUND;
|
||||||
@@ -4225,33 +4215,32 @@ BView::MessageReceived(BMessage* msg)
|
|||||||
BPropertyInfo propertyInfo(sViewPropInfo);
|
BPropertyInfo propertyInfo(sViewPropInfo);
|
||||||
switch (propertyInfo.FindMatch(msg, index, &specifier, what, prop)) {
|
switch (propertyInfo.FindMatch(msg, index, &specifier, what, prop)) {
|
||||||
case 0:
|
case 0:
|
||||||
err = replyMsg.AddRect("result", Frame());
|
if (msg->what == B_GET_PROPERTY) {
|
||||||
|
err = replyMsg.AddRect("result", Frame());
|
||||||
|
} else if (msg->what == B_SET_PROPERTY) {
|
||||||
|
BRect newFrame;
|
||||||
|
err = msg->FindRect("data", &newFrame);
|
||||||
|
if (err == B_OK) {
|
||||||
|
MoveTo(newFrame.LeftTop());
|
||||||
|
ResizeTo(newFrame.right, newFrame.bottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
{
|
if (msg->what == B_GET_PROPERTY) {
|
||||||
BRect newFrame;
|
err = replyMsg.AddBool("result", IsHidden());
|
||||||
err = msg->FindRect("data", &newFrame);
|
} else if (msg->what == B_SET_PROPERTY) {
|
||||||
if (err == B_OK) {
|
bool newHiddenState;
|
||||||
MoveTo(newFrame.LeftTop());
|
err = msg->FindBool("data", &newHiddenState);
|
||||||
ResizeTo(newFrame.right, newFrame.bottom);
|
if (err == B_OK) {
|
||||||
|
if (newHiddenState == true)
|
||||||
|
Hide();
|
||||||
|
else
|
||||||
|
Show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case 2:
|
case 2:
|
||||||
err = replyMsg.AddBool( "result", IsHidden());
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
{
|
|
||||||
bool newHiddenState;
|
|
||||||
err = msg->FindBool("data", &newHiddenState);
|
|
||||||
if (err == B_OK) {
|
|
||||||
if (!IsHidden() && newHiddenState == true)
|
|
||||||
Hide();
|
|
||||||
else if (IsHidden() && newHiddenState == false)
|
|
||||||
Show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case 5:
|
|
||||||
err = replyMsg.AddInt32("result", CountChildren());
|
err = replyMsg.AddInt32("result", CountChildren());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user