Adding implementation and tests for global function get_deskbar_frame().

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1187 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
jrand 2002-09-26 03:27:26 +00:00
parent 47a39f50ed
commit 63c051f283
2 changed files with 44 additions and 1 deletions

View File

@ -34,6 +34,7 @@
#include <Message.h>
#include <View.h>
#include <Rect.h>
#include <InterfaceDefs.h>
// Project Includes ------------------------------------------------------------
@ -54,6 +55,29 @@ static const uint32 gIsExpandedWhat = 'gexp';
static const uint32 gSetLocationWhat = 'sloc';
static const uint32 gExpandWhat = 'sexp';
status_t get_deskbar_frame(BRect *frame)
{
BMessenger deskbarMessenger(gDeskbarSignature);
BMessage requestMessage(B_GET_PROPERTY);
BMessage replyMessage;
status_t result;
result = requestMessage.AddSpecifier("Frame");
if (result == B_OK) {
result = requestMessage.AddSpecifier("Window", "Deskbar");
if (result == B_OK) {
result = deskbarMessenger.SendMessage(&requestMessage, &replyMessage);
if ((result == B_OK) &&
(replyMessage.what == B_REPLY)) {
result = replyMessage.FindRect("result", frame);
}
}
}
return(result);
}
//------------------------------------------------------------------------------
BDeskbar::BDeskbar()
: fMessenger(new BMessenger(gDeskbarSignature))

View File

@ -1,5 +1,5 @@
/*
$Id: DeskbarLocationTest.cpp,v 1.1 2002/09/13 03:51:09 jrand Exp $
$Id: DeskbarLocationTest.cpp,v 1.2 2002/09/26 03:27:26 jrand Exp $
This file implements tests for the following use cases of BDeskbar:
- Frame
@ -13,6 +13,7 @@
#include "DeskbarLocationTest.h"
#include <Deskbar.h>
#include <InterfaceDefs.h>
/*
@ -69,6 +70,24 @@
}
BRect myRect(myDeskbar->Frame());
switch (currLocation) {
case B_DESKBAR_TOP:
case B_DESKBAR_LEFT_TOP:
assert(myRect.top == 0.0);
assert(myRect.left == 0.0);
break;
case B_DESKBAR_BOTTOM:
case B_DESKBAR_LEFT_BOTTOM:
assert(myRect.left == 0.0);
break;
case B_DESKBAR_RIGHT_TOP:
case B_DESKBAR_RIGHT_BOTTOM:
break;
default:
assert(false);
break;
}
assert(get_deskbar_frame(&myRect) == B_OK);
switch (currLocation) {
case B_DESKBAR_TOP:
case B_DESKBAR_LEFT_TOP: