1 /* 2 * Copyright 2001-2015, Haiku, Inc. 3 * Distributed under the terms of the MIT license. 4 * 5 * Authors: 6 * DarkWyrm <bpmagic@columbus.rr.com> 7 * Axel Dörfler, axeld@pinc-software.de 8 * Julian Harnath, <julian.harnath@rwth-aachen.de> 9 */ 10 #ifndef TEST_SERVER_LOOP_ADAPTER_H 11 #define TEST_SERVER_LOOP_ADAPTER_H 12 13 #include "MessageLooper.h" 14 15 16 class BMessage; 17 class Desktop; 18 19 20 class TestServerLoopAdapter : public MessageLooper { 21 public: 22 TestServerLoopAdapter(const char* signature, 23 const char* looperName, port_id port, 24 bool initGui, status_t* outError); 25 virtual ~TestServerLoopAdapter(); 26 27 // MessageLooper interface 28 virtual port_id MessagePort() const { return fMessagePort; } 29 virtual status_t Run(); 30 31 // BApplication interface 32 virtual void MessageReceived(BMessage* message) = 0; 33 virtual bool QuitRequested() { return true; } 34 35 private: 36 // MessageLooper interface 37 virtual void _DispatchMessage(int32 code, 38 BPrivate::LinkReceiver &link); 39 40 virtual Desktop* _FindDesktop(uid_t userID, 41 const char* targetScreen) = 0; 42 port_id _CreatePort(); 43 44 45 46 private: 47 port_id fMessagePort; 48 }; 49 50 51 #endif // TEST_SERVER_LOOP_ADAPTER_H 52