2 * Copyright 2001-2014 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Erik Jaesler, erik@cgsoftware.com
12 #include <Archivable.h>
21 #define B_OBSERVE_WHAT_CHANGE "be:observe_change_what"
22 #define B_OBSERVE_ORIGINAL_WHAT "be:observe_orig_what"
23 const uint32 B_OBSERVER_OBSERVE_ALL
= 0xffffffff;
29 class BHandler
: public BArchivable
{
31 BHandler(const char* name
= NULL
);
35 BHandler(BMessage
* data
);
36 static BArchivable
* Instantiate(BMessage
* data
);
37 virtual status_t
Archive(BMessage
* data
, bool deep
= true) const;
40 virtual void MessageReceived(BMessage
* message
);
41 BLooper
* Looper() const;
42 void SetName(const char* name
);
43 const char* Name() const;
44 virtual void SetNextHandler(BHandler
* handler
);
45 BHandler
* NextHandler() const;
48 virtual void AddFilter(BMessageFilter
* filter
);
49 virtual bool RemoveFilter(BMessageFilter
* filter
);
50 virtual void SetFilterList(BList
* filters
);
54 status_t
LockLooperWithTimeout(bigtime_t timeout
);
58 virtual BHandler
* ResolveSpecifier(BMessage
* message
, int32 index
,
59 BMessage
* specifier
, int32 what
,
60 const char* property
);
61 virtual status_t
GetSupportedSuites(BMessage
* data
);
63 // Observer calls, inter-looper and inter-team
64 status_t
StartWatching(BMessenger target
, uint32 what
);
65 status_t
StartWatchingAll(BMessenger target
);
66 status_t
StopWatching(BMessenger target
, uint32 what
);
67 status_t
StopWatchingAll(BMessenger target
);
69 // Observer calls for observing targets in the local team
70 status_t
StartWatching(BHandler
* observer
, uint32 what
);
71 status_t
StartWatchingAll(BHandler
* observer
);
72 status_t
StopWatching(BHandler
* observer
, uint32 what
);
73 status_t
StopWatchingAll(BHandler
* observer
);
77 virtual status_t
Perform(perform_code d
, void* arg
);
80 virtual void SendNotices(uint32 what
,
81 const BMessage
* notice
= NULL
);
82 bool IsWatched() const;
85 typedef BArchivable _inherited
;
86 friend inline int32
_get_object_token_(const BHandler
* );
88 friend class BMessageFilter
;
90 virtual void _ReservedHandler2();
91 virtual void _ReservedHandler3();
92 virtual void _ReservedHandler4();
94 void _InitData(const char* name
);
95 BPrivate::ObserverList
* _ObserverList();
97 BHandler(const BHandler
&);
98 BHandler
& operator=(const BHandler
&);
99 void SetLooper(BLooper
* looper
);
104 BHandler
* fNextHandler
;
106 BPrivate::ObserverList
* fObserverList
;