Added Create/DeletePicture to ServerApp

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15802 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2006-01-03 08:08:20 +00:00
parent 39e8aac151
commit 20c2f67293
2 changed files with 33 additions and 2 deletions

View File

@ -2536,7 +2536,20 @@ ServerApp::CountPictures() const
ServerPicture *
ServerApp::FindPicture(int32 token) const
ServerApp::CreatePicture(int32 *token)
{
ServerPicture *picture = new (nothrow) ServerPicture();
if (picture != NULL) {
fPictureList.AddItem(picture);
if (token != NULL)
*token = picture->Token();
}
return picture;
}
ServerPicture *
ServerApp::FindPicture(const int32 &token) const
{
// TODO: we need to make sure the picture is ours?!
ServerPicture* picture;
@ -2546,7 +2559,23 @@ ServerApp::FindPicture(int32 token) const
return NULL;
}
bool
ServerApp::DeletePicture(const int32 &token)
{
ServerPicture *picture = FindPicture(token);
if (picture == NULL)
return false;
if (!fPictureList.RemoveItem(picture))
return false;
delete picture;
return true;
}
team_id
ServerApp::ClientTeam() const
{

View File

@ -71,7 +71,9 @@ class ServerApp : public MessageLooper {
ServerBitmap *FindBitmap(int32 token) const;
int32 CountPictures() const;
ServerPicture *FindPicture(int32 token) const;
ServerPicture *CreatePicture(int32 *token = NULL);
ServerPicture *FindPicture(const int32 &token) const;
bool DeletePicture(const int32 &token);
AreaPool *AppAreaPool() { return &fSharedMem; }