1/* 2 * Copyright 2004-2014 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Jérôme Duval 7 * John Scipione, jscipione@gmail.com 8 * Sandor Vroemisse 9 */ 10 11 12#include "KeymapApplication.h" 13 14 15// #pragma mark - KeymapApplication 16 17 18KeymapApplication::KeymapApplication() 19 : 20 BApplication("application/x-vnd.Haiku-Keymap"), 21 fModifierKeysWindow(NULL) 22{ 23 // create the window 24 fWindow = new KeymapWindow(); 25 fWindow->Show(); 26} 27 28 29void 30KeymapApplication::MessageReceived(BMessage* message) 31{ 32 switch (message->what) { 33 case kMsgShowModifierKeysWindow: 34 _ShowModifierKeysWindow(); 35 break; 36 case kMsgCloseModifierKeysWindow: 37 fModifierKeysWindow = NULL; 38 break; 39 case kMsgUpdateModifierKeys: 40 fWindow->PostMessage(message); 41 break; 42 } 43 44 BApplication::MessageReceived(message); 45} 46 47 48void 49KeymapApplication::_ShowModifierKeysWindow() 50{ 51 if (fModifierKeysWindow != NULL) 52 fModifierKeysWindow->Activate(); 53 else { 54 fModifierKeysWindow = new ModifierKeysWindow(); 55 fModifierKeysWindow->CenterIn(fWindow->Frame()); 56 fModifierKeysWindow->Show(); 57 } 58} 59 60 61// #pragma mark - main method 62 63 64int 65main(int, char**) 66{ 67 new KeymapApplication; 68 be_app->Run(); 69 delete be_app; 70 return B_OK; 71} 72