Provides BMessageFilter class. More...
Classes | |
class | BMessageFilter |
Describes a message filter for BLooper and BHandler. More... | |
Typedefs | |
typedef filter_result(* | filter_hook) (BMessage *message, BHandler **target, BMessageFilter *filter) |
Prototype for a custom filter_hook for use in the BMessageFilter class. More... | |
Enumerations | |
enum | filter_result { B_SKIP_MESSAGE, B_DISPATCH_MESSAGE } |
Return Codes and Protocol of the filter_hook. More... | |
enum | message_delivery { B_ANY_DELIVERY, B_DROPPED_DELIVERY, B_PROGRAMMED_DELIVERY } |
BMessageFilter filter criteria on how a message was delivered. More... | |
enum | message_source { B_ANY_SOURCE, B_REMOTE_SOURCE, B_LOCAL_SOURCE } |
BMessageFilter filter criteria on the source of a message. More... | |
Provides BMessageFilter class.
filter_result(* filter_hook)(BMessage *message, BHandler **target, BMessageFilter *filter) |
Prototype for a custom filter_hook
for use in the BMessageFilter class.
This hook can be used when you are constructing a new BMessageFilter object. It is a custom filter function you can use.
This hook should handle the following parameters:
[in] | message | The message that needs to be verified. |
[out] | target | If your filter hook is conscious about the available handlers, you can set a specific BHandler based on your filters requirements. You do not have to change this field, because there will always be a working default. |
[in] | filter | A pointer to the filter from which this hook is called. |
enum filter_result |
Return Codes and Protocol of the filter_hook.
These return codes should be used in your own filter_hook function, or by your overridden BMessageFilter::Filter() method.
Enumerator | |
---|---|
B_SKIP_MESSAGE | The message does not pass the filter criteria and should not be handled.
|
B_DISPATCH_MESSAGE | The message passes the filter criteria and should be dispatched to a BHandler.
|
enum message_delivery |
BMessageFilter filter criteria on how a message was delivered.
Two constructors of the BMessageFilter class allow you to specify that it should filter based on how the message was delivered. There are two ways in which messages can be delivered within the Haiku API: by direct delivery using the BLooper::PostMessage() function, and by drag and drop in the GUI. With this filter you can, for example, specify that your handler only handles deliveries that were programmed by you, and not any random drag and drop actions initiated by the user.
Enumerator | |
---|---|
B_ANY_DELIVERY | Accept both delivery methods.
|
B_DROPPED_DELIVERY | Only accept messages that were dropped by the user in the GUI.
|
B_PROGRAMMED_DELIVERY | Only accept messages that were delivered using the BLooper::PostMessage() method.
|
enum message_source |
BMessageFilter filter criteria on the source of a message.
One of the key features of the messaging system of Haiku, is the ability to send messages between applications. However, your handler or looper might have been written in such a way that it would make no sense to try to process messages from an external source. Use these filter criteria to filter the unwanted messages out.
You use these constants in the constructors of the BMessageFilter class.
app_server
, are considered remote messages. Keep this in mind when you want to set up criteria for your window and application loopers.