1c099b74eSFreeman Lou /* 2c099b74eSFreeman Lou * Copyright 2014 Freeman Lou <freemanlou2430@yahoo.com> 3c099b74eSFreeman Lou * All rights reserved. Distributed under the terms of the MIT license. 4c099b74eSFreeman Lou */ 5c099b74eSFreeman Lou #include "VirtualKeyboardInputDevice.h" 6c099b74eSFreeman Lou 7a9fd76aeSFreeman Lou #include <InterfaceDefs.h> 8a9fd76aeSFreeman Lou 9c099b74eSFreeman Lou extern "C" BInputServerDevice* 10c099b74eSFreeman Lou instantiate_input_device() 11c099b74eSFreeman Lou { 12c099b74eSFreeman Lou return new(std::nothrow) VirtualKeyboardInputDevice(); 13c099b74eSFreeman Lou } 14c099b74eSFreeman Lou 15c099b74eSFreeman Lou 16c099b74eSFreeman Lou VirtualKeyboardInputDevice::VirtualKeyboardInputDevice() 17c099b74eSFreeman Lou { 18a9fd76aeSFreeman Lou fKeyboardWindow = new VirtualKeyboardWindow(this); 19c099b74eSFreeman Lou } 20c099b74eSFreeman Lou 21c099b74eSFreeman Lou 22a9fd76aeSFreeman Lou VirtualKeyboardInputDevice::~VirtualKeyboardInputDevice() 23c099b74eSFreeman Lou { 24c099b74eSFreeman Lou } 25c099b74eSFreeman Lou 26c099b74eSFreeman Lou 27c099b74eSFreeman Lou status_t 28c099b74eSFreeman Lou VirtualKeyboardInputDevice::InitCheck() 29c099b74eSFreeman Lou { 30a9fd76aeSFreeman Lou static input_device_ref keyboard = {"VirtualKeyboard", 31a9fd76aeSFreeman Lou B_KEYBOARD_DEVICE, (void*) this}; 32a9fd76aeSFreeman Lou static input_device_ref* devices[2] = {&keyboard, NULL}; 33a9fd76aeSFreeman Lou 34a9fd76aeSFreeman Lou RegisterDevices(devices); 35a9fd76aeSFreeman Lou return B_OK; 36c099b74eSFreeman Lou } 37c099b74eSFreeman Lou 38c099b74eSFreeman Lou 39c099b74eSFreeman Lou status_t 40c099b74eSFreeman Lou VirtualKeyboardInputDevice::Start(const char* name, void* cookie) 41c099b74eSFreeman Lou { 42c099b74eSFreeman Lou fKeyboardWindow->Show(); 43a9fd76aeSFreeman Lou return B_OK; 44a9fd76aeSFreeman Lou } 45c099b74eSFreeman Lou 46a9fd76aeSFreeman Lou 47a9fd76aeSFreeman Lou status_t 48a9fd76aeSFreeman Lou VirtualKeyboardInputDevice::Stop(const char* name, void* cookie) 49a9fd76aeSFreeman Lou { 50a9fd76aeSFreeman Lou if (fKeyboardWindow) { 51a9fd76aeSFreeman Lou fKeyboardWindow->Quit(); 52a9fd76aeSFreeman Lou fKeyboardWindow = NULL; 53a9fd76aeSFreeman Lou } 54a9fd76aeSFreeman Lou return B_OK; 55c099b74eSFreeman Lou } 56*2071724cSFreeman Lou 57*2071724cSFreeman Lou 58*2071724cSFreeman Lou status_t 59*2071724cSFreeman Lou VirtualKeyboardInputDevice::Control(const char* name, void* cookie, 60*2071724cSFreeman Lou uint32 command, BMessage* message) 61*2071724cSFreeman Lou { 62*2071724cSFreeman Lou return B_OK; 63*2071724cSFreeman Lou } 64