Changeset 4086 in orxonox.OLD for orxonox/trunk/src/lib/gui/gui/gui_keys.cc
- Timestamp:
- May 6, 2005, 4:51:48 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/gui/gui/gui_keys.cc
r4085 r4086 43 43 44 44 this->keysFrame->fill(this->keysBox); 45 46 47 this->inputWindow = new Window("inputWindow"); 48 this->inputButton = new Button("test"); 49 #ifdef HAVE_GTK2 50 this->inputWindow->connectSignal("destroy", Widget::doNothingSignal); 51 this->inputWindow->connectSignal("delete_event", Widget::doNothingSignal); 52 #endif /* HAVE_GTK2 */ 53 this->inputWindow->fill(inputButton); 54 45 55 this->setMainWidget(keysFrame); 46 56 } … … 53 63 // nothing to do here. 54 64 } 65 66 67 Window* GuiKeys::inputWindow = NULL; 68 Button* GuiKeys::inputButton = NULL; 69 long GuiKeys::keySignal = 0; 70 55 71 56 72 /* PLAYER */ … … 93 109 this->openButton->connectSignal("button_press_event", this->pKeyWindow, Window::windowOpen); 94 110 #endif /* HAVE_GTK2 */ 95 96 this->inputWindow = new Window("inputWindow"); 97 98 this->inputButton = new Button("test"); 99 this->inputWindow->fill(inputButton); 100 #ifdef HAVE_GTK2 101 this->inputWindow->connectSignal("destroy", Widget::doNothingSignal); 102 this->inputWindow->connectSignal("delete_event", Widget::doNothingSignal); 103 #endif /* HAVE_GTK2 */ 104 111 } 112 113 /** 114 \returns the OpenButton of a Player 115 */ 116 Button* Player::getOpenButton(void) 117 { 118 return this->openButton; 119 } 120 121 /** 122 \brief sets a new Key(only output) 123 \param key the new Key. 124 */ 125 void Player::setkey(KEYS key) 126 { 127 PRINT(4)("setting up Key: %d\n", key); 105 128 } 106 129 … … 111 134 \returns A widget that has the Key-Box 112 135 */ 113 Widget* Player::addKey(KEYS key, char* name) 114 { 115 this->inputKey[key] = new InputKey; 116 this->inputKey[key]->pKeyBox = new Box(); 117 this->inputKey[key]->pKeyButton = new Button(name); 118 this->inputKey[key]->pKeyOLabel = new OptionLabel(name, name); 119 this->inputKey[key]->pKeyOLabel->saveability(); 120 121 #ifdef HAVE_GTK2 122 //inputKey[key]->pKeyButton->connectSignal("key_press_event", inputKey[key]->pKeyButton, key_cb); 123 this->inputKey[key]->pKeyButton->connectSignal("button_press_event", this->inputKey[key], inputWindowEvent); 124 #endif /* HAVE_GTK2 */ 125 this->inputKey[key]->pKeyBox->fill(this->inputKey[key]->pKeyButton); 126 this->inputKey[key]->pKeyBox->fill(this->inputKey[key]->pKeyOLabel); 127 return this->inputKey[key]->pKeyBox; 128 } 129 130 /** 131 \returns the OpenButton of a Player 132 */ 133 Button* Player::getOpenButton(void) 134 { 135 return this->openButton; 136 } 137 138 /** 139 \brief sets a new Key(only output) 140 \param key the new Key. 141 */ 142 void Player::setkey(KEYS key) 143 { 144 PRINT(4)("setting up Key: %d\n", key); 145 } 146 147 Window* Player::inputWindow = NULL; 148 Button* Player::inputButton = NULL; 149 long Player::keySignal = 0; 150 151 #ifdef HAVE_GTK2 152 gint Player::inputWindowEvent(GtkWidget* w, GdkEventKey* event, void* inputKey) 153 { 154 inputButton->setTitle("press a Key"); 155 keySignal = inputButton->connectSignal("key_press_event", inputKey, key_cb); 156 inputWindow->open(); 136 Widget* addKey(KEYS key, char* name) 137 { 138 InputKey* inputKey = new InputKey; 139 inputKey->pKeyBox = new Box(); 140 inputKey->pKeyButton = new Button(name); 141 inputKey->pKeyOLabel = new OptionLabel(name, name); 142 inputKey->pKeyOLabel->saveability(); 143 144 #ifdef HAVE_GTK2 145 //inputKey->pKeyButton->connectSignal("key_press_event", inputKey->pKeyButton, key_cb); 146 inputKey->pKeyButton->connectSignal("button_press_event", inputKey, inputWindowEvent); 147 #endif /* HAVE_GTK2 */ 148 inputKey->pKeyBox->fill(inputKey->pKeyButton); 149 inputKey->pKeyBox->fill(inputKey->pKeyOLabel); 150 return inputKey->pKeyBox; 151 } 152 153 154 #ifdef HAVE_GTK2 155 gint inputWindowEvent(GtkWidget* w, GdkEventKey* event, void* inputKey) 156 { 157 GuiKeys::inputButton->setTitle("press a Key"); 158 GuiKeys::keySignal = GuiKeys::inputButton->connectSignal("key_press_event", inputKey, key_cb); 159 GuiKeys::inputWindow->open(); 157 160 } 158 161 … … 164 167 \returns Nothing 165 168 */ 166 gint Player::key_cb(GtkWidget* w, GdkEventKey* event, void* inputKey)169 gint key_cb(GtkWidget* w, GdkEventKey* event, void* inputKey) 167 170 { 168 171 InputKey* inputkey =(InputKey*) inputKey; … … 336 339 337 340 inputkey->pKeyOLabel->setValue(title); 338 inputButton->disconnectSignal(keySignal);339 inputWindow->close();340 } 341 #endif /* HAVE_GTK2 */ 341 GuiKeys::inputButton->disconnectSignal(GuiKeys::keySignal); 342 GuiKeys::inputWindow->close(); 343 } 344 #endif /* HAVE_GTK2 */
Note: See TracChangeset
for help on using the changeset viewer.