Got rid of that unused and superfluous TokenSpace callback stuff.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17200 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-04-22 16:29:44 +00:00
parent 9b2a903688
commit 704c03b9e6
3 changed files with 9 additions and 26 deletions
+4 -10
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2005, Haiku.
* Copyright 2001-2006, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -30,23 +30,17 @@
namespace BPrivate {
typedef void (*new_token_callback)(int16, void*);
typedef void (*remove_token_callback)(int16, void*);
typedef bool (*get_token_callback)(int16, void*);
class BTokenSpace : public BLocker {
public:
BTokenSpace();
~BTokenSpace();
int32 NewToken(int16 type, void* object,
new_token_callback callback = NULL);
int32 NewToken(int16 type, void* object);
void SetToken(int32 token, int16 type, void* object);
bool RemoveToken(int32 token, remove_token_callback callback = NULL);
bool RemoveToken(int32 token);
bool CheckToken(int32 token, int16 type) const;
status_t GetToken(int32 token, int16 type, void** object,
get_token_callback callback = NULL) const;
status_t GetToken(int32 token, int16 type, void** object) const;
private:
struct token_info {
+4 -15
View File
@@ -35,8 +35,7 @@ BTokenSpace::~BTokenSpace()
int32
BTokenSpace::NewToken(int16 type, void* object,
new_token_callback callback)
BTokenSpace::NewToken(int16 type, void* object)
{
BAutolock locker(this);
@@ -45,9 +44,6 @@ BTokenSpace::NewToken(int16 type, void* object,
fTokenMap[token] = tokenInfo;
if (callback)
callback(type, object);
return token;
}
@@ -62,8 +58,8 @@ void
BTokenSpace::SetToken(int32 token, int16 type, void* object)
{
BAutolock locker(this);
token_info tokenInfo = { type, object };
token_info tokenInfo = { type, object };
fTokenMap[token] = tokenInfo;
// this makes sure SetToken() plays more or less nice with NewToken()
@@ -73,7 +69,7 @@ BTokenSpace::SetToken(int32 token, int16 type, void* object)
bool
BTokenSpace::RemoveToken(int32 token, remove_token_callback callback)
BTokenSpace::RemoveToken(int32 token)
{
BAutolock locker(this);
@@ -81,9 +77,6 @@ BTokenSpace::RemoveToken(int32 token, remove_token_callback callback)
if (iterator == fTokenMap.end())
return false;
if (callback)
callback(iterator->second.type, iterator->second.object);
fTokenMap.erase(iterator);
return true;
}
@@ -106,8 +99,7 @@ BTokenSpace::CheckToken(int32 token, int16 type) const
status_t
BTokenSpace::GetToken(int32 token, int16 type, void** _object,
get_token_callback callback) const
BTokenSpace::GetToken(int32 token, int16 type, void** _object) const
{
BAutolock locker(const_cast<BTokenSpace&>(*this));
@@ -119,9 +111,6 @@ BTokenSpace::GetToken(int32 token, int16 type, void** _object,
if (iterator == fTokenMap.end() || iterator->second.type != type)
return B_ENTRY_NOT_FOUND;
if (callback && !callback(iterator->second.type, iterator->second.object))
return B_ENTRY_NOT_FOUND;
*_object = iterator->second.object;
return B_OK;
}
+1 -1
View File
@@ -490,7 +490,7 @@ BMenuBar::RestoreFocus()
if (window != NULL && window->Lock()) {
BHandler *handler = NULL;
if (BPrivate::gDefaultTokens.GetToken(fPrevFocusToken, B_HANDLER_TOKEN,
(void **)&handler, NULL) == B_OK) {
(void **)&handler) == B_OK) {
BView *view = dynamic_cast<BView *>(handler);
if (view != NULL && view->Window() == window)
view->MakeFocus();