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