4ceb1e519c
task_looper() again. * removed BMessenger::fPreferred - whenever you had to specify "usePreferred" separately, you don't have to do that anymore - use B_PREFERRED_TOKEN instead. * fixed BTokenSpace::GetToken() semantics: it will no longer touch the "object" argument in case of failure. * Introduced a BWindow::_DistributeMessage() that will be part of the event dispatcher counterpart to the app_server (the other will be _DetermineTarget()). * Made it easier to use Michael's Message4 implementation: just add the following line to your UserBuildConfig: AppendToConfigVar DEFINES : HAIKU_TOP src : USING_MESSAGE4 : global ; * Introduced ServerWindow::HandlerMessenger() and FocusMessenger() - the first will target the client handler, while the other will target the preferred handler of the client looper (usually the view having focus). * Fixed dano message unflattening in the Message4 code. * Changed BMessage::PrintToStream() to no longer use macros in the Message4 implementation. * I hope that's all - it's a huge change, but it's all connected. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15046 a95241bf-73f2-0310-859d-f6bbb57e9c96
80 lines
2.0 KiB
C++
80 lines
2.0 KiB
C++
/*
|
|
* Copyright 2001-2005, Haiku, Inc. All Rights Reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*
|
|
* Authors:
|
|
* Ingo Weinhold (bonefish@users.sf.net)
|
|
*/
|
|
#ifndef _MESSENGER_H
|
|
#define _MESSENGER_H
|
|
|
|
|
|
#include <BeBuild.h>
|
|
#include <OS.h>
|
|
#include <ByteOrder.h>
|
|
#include <Message.h>
|
|
|
|
class BHandler;
|
|
class BLooper;
|
|
|
|
|
|
class BMessenger {
|
|
public:
|
|
BMessenger();
|
|
BMessenger(const char *signature, team_id team = -1,
|
|
status_t *result = NULL);
|
|
BMessenger(const BHandler *handler, const BLooper *looper = NULL,
|
|
status_t *result = NULL);
|
|
BMessenger(const BMessenger &from);
|
|
~BMessenger();
|
|
|
|
// Target
|
|
|
|
bool IsTargetLocal() const;
|
|
BHandler *Target(BLooper **looper) const;
|
|
bool LockTarget() const;
|
|
status_t LockTargetWithTimeout(bigtime_t timeout) const;
|
|
|
|
// Message sending
|
|
|
|
status_t SendMessage(uint32 command, BHandler *replyTo = NULL) const;
|
|
status_t SendMessage(BMessage *message, BHandler *replyTo = NULL,
|
|
bigtime_t timeout = B_INFINITE_TIMEOUT) const;
|
|
status_t SendMessage(BMessage *message, BMessenger replyTo,
|
|
bigtime_t timeout = B_INFINITE_TIMEOUT) const;
|
|
status_t SendMessage(uint32 command, BMessage *reply) const;
|
|
status_t SendMessage(BMessage *message, BMessage *reply,
|
|
bigtime_t deliveryTimeout = B_INFINITE_TIMEOUT,
|
|
bigtime_t replyTimeout = B_INFINITE_TIMEOUT) const;
|
|
|
|
// Operators and misc
|
|
|
|
BMessenger &operator=(const BMessenger &from);
|
|
bool operator==(const BMessenger &other) const;
|
|
|
|
bool IsValid() const;
|
|
team_id Team() const;
|
|
|
|
//----- Private or reserved -----------------------------------------
|
|
|
|
class Private;
|
|
|
|
private:
|
|
friend class Private;
|
|
|
|
void _SetTo(team_id team, port_id port, int32 token);
|
|
void _InitData(const char *signature, team_id team, status_t *result);
|
|
|
|
private:
|
|
port_id fPort;
|
|
int32 fHandlerToken;
|
|
team_id fTeam;
|
|
|
|
int32 _reserved[3];
|
|
};
|
|
|
|
_IMPEXP_BE bool operator<(const BMessenger &a, const BMessenger &b);
|
|
_IMPEXP_BE bool operator!=(const BMessenger &a, const BMessenger &b);
|
|
|
|
#endif // _MESSENGER_H
|