1 //-------------------------------------------------------------------- 2 // 3 // PostDispatchInvoker.cpp 4 // 5 // Written by: Owen Smith 6 // 7 //-------------------------------------------------------------------- 8 9 /* 10 Copyright 1999, Be Incorporated. All Rights Reserved. 11 This file may be used under the terms of the Be Sample Code License. 12 */ 13 14 #include "PostDispatchInvoker.h" 15 #include <Looper.h> 16 17 //==================================================================== 18 // PostDispatchInvoker Implementation 19 20 21 //-------------------------------------------------------------------- 22 // PostDispatchInvoker constructors, destructors, operators 23 24 PostDispatchInvoker::PostDispatchInvoker(uint32 cmdFilter, 25 BMessage* invokeMsg, BHandler* invokeHandler, 26 BLooper* invokeLooper) 27 : BMessageFilter(cmdFilter, NULL), 28 BInvoker(invokeMsg, invokeHandler, invokeLooper) 29 { } 30 31 32 33 //-------------------------------------------------------------------- 34 // PostDispatchInvoker virtual function overrides 35 36 filter_result PostDispatchInvoker::Filter(BMessage* message, 37 BHandler** target) 38 { 39 Looper()->DispatchMessage(message, *target); 40 BMessage* pInvMsg = Message(); 41 pInvMsg->AddMessage("Dispatched Message", message); 42 pInvMsg->AddPointer("Dispatch Target", *target); 43 Invoke(); 44 return B_SKIP_MESSAGE; 45 } 46