Changeset 3315 in orxonox.OLD for orxonox/branches/updater/src/gui/orxonox_gui_keys.cc
- Timestamp:
- Jan 3, 2005, 12:13:38 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/updater/src/gui/orxonox_gui_keys.cc
r3288 r3315 29 29 \brief Creates an Keyboard-Frame 30 30 */ 31 OrxonoxGuiKeys::OrxonoxGuiKeys ()32 { 33 keysFrame = new Frame("Keyboard-Options:");31 OrxonoxGuiKeys::OrxonoxGuiKeys(void) 32 { 33 this->keysFrame = new Frame("Keyboard-Options:"); 34 34 // keysFrame->setGroupName("Keyboard"); 35 keysBox = new Box('h');36 player1 = new Player("player1");37 player2 = new Player("player2");38 39 keysBox->fill(player1->getOpenButton());40 keysBox->fill(player2->getOpenButton());41 42 keysFrame->fill (keysBox);35 this->keysBox = new Box('h'); 36 this->player1 = new Player("player1"); 37 this->player2 = new Player("player2"); 38 39 this->keysBox->fill(this->player1->getOpenButton()); 40 this->keysBox->fill(this->player2->getOpenButton()); 41 42 this->keysFrame->fill(this->keysBox); 43 43 } 44 44 … … 47 47 \return Returns the Audio-frame 48 48 */ 49 Widget* OrxonoxGuiKeys::getWidget ()50 { 51 return keysFrame;49 Widget* OrxonoxGuiKeys::getWidget(void) 50 { 51 return this->keysFrame; 52 52 } 53 53 … … 60 60 Player::Player(char* player) 61 61 { 62 char windowName[100] = "Keyboard settings of "; 63 strcat (windowName, player); 64 pKeyWindow = new Window(windowName); 65 pKeyFrame = new Frame (windowName); 66 pKeysBox = new Box('v'); 67 pKeysBox->setGroupName (player); 68 pKeysBox->fill(addKey(UP, "up")); 69 pKeysBox->fill(addKey(DOWN, "down")); 70 pKeysBox->fill(addKey(LEFT, "left")); 71 pKeysBox->fill(addKey(RIGHT, "right")); 72 pKeysBox->fill(addKey(SHOOT, "shoot")); 73 62 char* windowName = new char[strlen(player)+25]; 63 strcpy(windowName, "Keyboard settings of "); 64 strcat(windowName, player); 65 this->pKeyWindow = new Window(windowName); 66 this->pKeyFrame = new Frame(windowName); 67 this->pKeysBox = new Box('v'); 68 this->pKeysBox->setGroupName(player); 69 this->pKeysBox->fill(addKey(UP, "up")); 70 this->pKeysBox->fill(addKey(DOWN, "down")); 71 this->pKeysBox->fill(addKey(LEFT, "left")); 72 this->pKeysBox->fill(addKey(RIGHT, "right")); 73 this->pKeysBox->fill(addKey(SHOOT, "shoot")); 74 delete windowName; 74 75 closeButton = new Button("close"); 75 76 #ifdef HAVE_GTK2 76 closeButton->connectSignal("button_press_event",pKeyWindow, Window::windowClose);77 #endif /* HAVE_GTK2 */ 78 79 pKeysBox->fill(closeButton);80 pKeyFrame->fill(pKeysBox);81 pKeyWindow->fill(pKeyFrame);82 Window::addWindow( pKeyWindow);83 #ifdef HAVE_GTK2 84 pKeyWindow->connectSignal("destroy",pKeyWindow, Window::windowClose);85 pKeyWindow->connectSignal("delete_event",pKeyWindow, Window::windowClose);86 #endif /* HAVE_GTK2 */ 87 88 openButton = new Button(player);89 #ifdef HAVE_GTK2 90 openButton->connectSignal("button_press_event",pKeyWindow, Window::windowOpen);91 #endif /* HAVE_GTK2 */ 92 93 inputWindow = new Window("inputWindow");94 95 inputButton = new Button("test");96 inputWindow->fill(inputButton);97 #ifdef HAVE_GTK2 98 inputWindow->connectSignal("destroy", Widget::doNothingSignal);99 inputWindow->connectSignal("delete_event", Widget::doNothingSignal);77 this->closeButton->connectSignal("button_press_event", this->pKeyWindow, Window::windowClose); 78 #endif /* HAVE_GTK2 */ 79 80 this->pKeysBox->fill(this->closeButton); 81 this->pKeyFrame->fill(this->pKeysBox); 82 this->pKeyWindow->fill(this->pKeyFrame); 83 Window::addWindow(this->pKeyWindow); 84 #ifdef HAVE_GTK2 85 this->pKeyWindow->connectSignal("destroy", this->pKeyWindow, Window::windowClose); 86 this->pKeyWindow->connectSignal("delete_event", this->pKeyWindow, Window::windowClose); 87 #endif /* HAVE_GTK2 */ 88 89 this->openButton = new Button(player); 90 #ifdef HAVE_GTK2 91 this->openButton->connectSignal("button_press_event", this->pKeyWindow, Window::windowOpen); 92 #endif /* HAVE_GTK2 */ 93 94 this->inputWindow = new Window("inputWindow"); 95 96 this->inputButton = new Button("test"); 97 this->inputWindow->fill(inputButton); 98 #ifdef HAVE_GTK2 99 this->inputWindow->connectSignal("destroy", Widget::doNothingSignal); 100 this->inputWindow->connectSignal("delete_event", Widget::doNothingSignal); 100 101 #endif /* HAVE_GTK2 */ 101 102 … … 108 109 \returns A widget that has the Key-Box 109 110 */ 110 Widget* Player::addKey 111 { 112 inputKey[key] = new InputKey;113 inputKey[key]->pKeyBox = new Box();114 inputKey[key]->pKeyButton = new Button(name);115 inputKey[key]->pKeyOLabel = new OptionLabel(name, name);116 inputKey[key]->pKeyOLabel->saveability();111 Widget* Player::addKey(KEYS key, char* name) 112 { 113 this->inputKey[key] = new InputKey; 114 this->inputKey[key]->pKeyBox = new Box(); 115 this->inputKey[key]->pKeyButton = new Button(name); 116 this->inputKey[key]->pKeyOLabel = new OptionLabel(name, name); 117 this->inputKey[key]->pKeyOLabel->saveability(); 117 118 118 119 #ifdef HAVE_GTK2 119 120 //inputKey[key]->pKeyButton->connectSignal("key_press_event", inputKey[key]->pKeyButton, key_cb); 120 inputKey[key]->pKeyButton->connectSignal("button_press_event",inputKey[key], inputWindowEvent);121 #endif /* HAVE_GTK2 */ 122 inputKey[key]->pKeyBox->fill(inputKey[key]->pKeyButton);123 inputKey[key]->pKeyBox->fill(inputKey[key]->pKeyOLabel);124 return inputKey[key]->pKeyBox;121 this->inputKey[key]->pKeyButton->connectSignal("button_press_event", this->inputKey[key], inputWindowEvent); 122 #endif /* HAVE_GTK2 */ 123 this->inputKey[key]->pKeyBox->fill(this->inputKey[key]->pKeyButton); 124 this->inputKey[key]->pKeyBox->fill(this->inputKey[key]->pKeyOLabel); 125 return this->inputKey[key]->pKeyBox; 125 126 } 126 127 … … 128 129 \returns the OpenButton of a Player 129 130 */ 130 Button* Player::getOpenButton( )131 { 132 return openButton;133 } 134 135 /** 136 \brief sets a new Key 131 Button* Player::getOpenButton(void) 132 { 133 return this->openButton; 134 } 135 136 /** 137 \brief sets a new Key(only output) 137 138 \param key the new Key. 138 139 */ … … 163 164 gint Player::key_cb(GtkWidget* w, GdkEventKey* event, void* inputKey) 164 165 { 165 InputKey* inputkey = 166 InputKey* inputkey =(InputKey*) inputKey; 166 167 char title [20]; 167 168 … … 256 257 char* tmp; 257 258 sprintf(tmp, "%c", event->keyval); 258 printf 259 printf("other key %s \n", tmp); 259 260 strcpy(title, tmp); 260 261 break; 261 262 } 262 263 263 inputkey->pKeyOLabel->setValue 264 inputkey->pKeyOLabel->setValue(title); 264 265 inputButton->disconnectSignal(keySignal); 265 266 inputWindow->close();
Note: See TracChangeset
for help on using the changeset viewer.