add item frames to BMenu archive

add class names to BMenuItem archives


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18069 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2006-07-08 00:38:31 +00:00
parent 8cc767ee45
commit 9b224ec82e
3 changed files with 22 additions and 5 deletions
+10 -4
View File
@@ -291,7 +291,7 @@ BMenu::Archive(BMessage *data, bool deep) const
if (err != B_OK)
break;
if (fLayout == B_ITEMS_IN_MATRIX) {
// TODO Store location of items
err = data->AddRect("_i_frames", item->fBounds);
}
}
}
@@ -1172,10 +1172,16 @@ BMenu::InitData(BMessage *data)
data->FindFloat("_maxwidth", &fMaxContentWidth);
BMessage msg;
for (int32 i = 0; data->FindMessage("_items", i, &msg) == B_OK; i++) {
for (int32 i = 0; data->FindMessage("_items", i, &msg) == B_OK; i++) {
BArchivable *object = instantiate_object(&msg);
if (BMenuItem *item = dynamic_cast<BMenuItem *>(object))
AddItem(item);
if (BMenuItem *item = dynamic_cast<BMenuItem *>(object)) {
BRect bounds;
if ((fLayout == B_ITEMS_IN_MATRIX)
&& (data->FindRect("_i_frames", i, &bounds) == B_OK))
AddItem(item, bounds);
else
AddItem(item);
}
}
}
}