Changeset 4089 in orxonox.OLD for orxonox/trunk/src/lib/gui
- Timestamp:
- May 6, 2005, 5:42:12 PM (20 years ago)
- Location:
- orxonox/trunk/src/lib/gui/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/gui/gui/gui_gtk.cc
r4083 r4089 1051 1051 \param buttonName sets the Name of the Button 1052 1052 */ 1053 Button::Button(c har* buttonName)1053 Button::Button(const char* buttonName) 1054 1054 { 1055 1055 this->optionType = GUI_NOTHING; -
orxonox/trunk/src/lib/gui/gui/gui_gtk.h
r4083 r4089 263 263 { 264 264 public: 265 Button(c har* buttonName = NULL);265 Button(const char* buttonName = NULL); 266 266 virtual ~Button(void); 267 267 -
orxonox/trunk/src/lib/gui/gui/gui_keys.cc
r4088 r4089 37 37 keysFrame = new Frame("Keyboard-Options:"); 38 38 { 39 Box* keysBox ; //!< The Frame that holds the keyOptions.39 Box* keysBox0; //!< The Frame that holds the keyOptions. 40 40 41 41 // keysFrame->setGroupName("Keyboard"); 42 keysBox = new Box('h');42 keysBox0 = new Box('v'); 43 43 { 44 Player* player1; //!< The first Player's keys. 45 Player* player2; //!< The seconds Player's keys. 46 Button* misc; //!< Other keyboeard options come here. \todo include some like pause, quit and so on. 47 48 player1 = new Player("player1"); 49 player2 = new Player("player2"); 50 51 keysBox->fill(player1->getOpenButton()); 52 keysBox->fill(player2->getOpenButton()); 44 Box* keysBox1; 45 MiscKeys* misc; //!< The Misc Keys 46 47 keysBox1 = new Box('h'); 48 { 49 PlayerKeys* player1; //!< The first Player's keys. 50 PlayerKeys* player2; //!< The seconds Player's keys. 51 52 player1 = new PlayerKeys("player1"); 53 player2 = new PlayerKeys("player2"); 54 55 keysBox1->fill(player1->getOpenButton()); 56 keysBox1->fill(player2->getOpenButton()); 57 } 58 keysBox0->fill(keysBox1); 59 60 misc = new MiscKeys(); 61 keysBox0->fill(misc->getOpenButton()); 53 62 } 54 keysFrame->fill(keysBox );63 keysFrame->fill(keysBox0); 55 64 } 56 65 … … 80 89 long GuiKeys::keySignal = 0; 81 90 82 91 //////////// 83 92 /* PLAYER */ 84 93 //////////// 85 94 /** 86 95 \brief Creates new inputs for a player 87 96 \param player the name of the Player 88 97 */ 89 Player ::Player(char* player)98 PlayerKeys::PlayerKeys(char* player) 90 99 { 91 100 Window* pKeyWindow; //!< The Window for a new Key-setting. … … 95 104 strcat(windowName, player); 96 105 pKeyWindow = new Window(windowName); 97 delete windowName;98 106 { 99 107 Frame* pKeyFrame; //!< The Frame for a new Key-setting. … … 107 115 108 116 pKeysBox->setGroupName(player); 109 pKeysBox->fill(addKey( UP, "up"));110 pKeysBox->fill(addKey( DOWN, "down"));111 pKeysBox->fill(addKey( LEFT, "left"));112 pKeysBox->fill(addKey( RIGHT, "right"));113 pKeysBox->fill(addKey( SHOOT, "fire"));117 pKeysBox->fill(addKey("up", "UP")); 118 pKeysBox->fill(addKey("down", "DOWN")); 119 pKeysBox->fill(addKey("left", "LEFT")); 120 pKeysBox->fill(addKey("right", "RIGHT")); 121 pKeysBox->fill(addKey("fire", "SPACE")); 114 122 closeButton = new Button("close"); 115 123 #ifdef HAVE_GTK2 … … 123 131 pKeyWindow->fill(pKeyFrame); 124 132 } 133 delete windowName; 125 134 Window::addWindow(pKeyWindow); 126 135 #ifdef HAVE_GTK2 … … 138 147 \returns the OpenButton of a Player 139 148 */ 140 Button* Player ::getOpenButton(void)149 Button* PlayerKeys::getOpenButton(void) 141 150 { 142 151 return this->openButton; 143 152 } 144 153 145 /** 146 \brief sets a new Key(only output) 147 \param key the new Key. 148 */ 149 void Player::setkey(KEYS key) 150 { 151 PRINT(4)("setting up Key: %d\n", key); 152 } 154 ////////////////// 155 /* MISC_OPTIONS */ 156 ////////////////// 157 /** 158 \brief Creates new inputs for a misc 159 \param player the name of the Misc 160 */ 161 MiscKeys::MiscKeys() 162 { 163 Window* keyWindow; //!< The Window for a new Key-setting. 164 165 keyWindow = new Window("misc Keys"); 166 { 167 Frame* keyFrame; //!< The Frame for a new Key-setting. 168 169 keyFrame = new Frame("misc Keys:"); 170 { 171 Box* keysBox; //!< The Box that holds the Key-settings. 172 keysBox = new Box('v'); 173 { 174 Button* closeButton; //!< The CloseButton for this key-settings. 175 176 keysBox->setGroupName("miscKeys"); 177 keysBox->fill(addKey( "quit", "ESCAPE")); 178 keysBox->fill(addKey("pause", "PAUSE")); 179 keysBox->fill(addKey("up_world", "x")); 180 keysBox->fill(addKey("down_world", "z")); 181 keysBox->fill(addKey("view0", "1")); 182 keysBox->fill(addKey("view1", "2")); 183 keysBox->fill(addKey("view2", "3")); 184 keysBox->fill(addKey("view3", "4")); 185 keysBox->fill(addKey("view4", "5")); 186 keysBox->fill(addKey("view5", "6")); 187 188 closeButton = new Button("close"); 189 #ifdef HAVE_GTK2 190 closeButton->connectSignal("button_press_event", keyWindow, Window::windowClose); 191 #endif /* HAVE_GTK2 */ 192 193 keysBox->fill(closeButton); 194 } 195 keyFrame->fill(keysBox); 196 } 197 keyWindow->fill(keyFrame); 198 } 199 Window::addWindow(keyWindow); 200 #ifdef HAVE_GTK2 201 keyWindow->connectSignal("destroy", keyWindow, Window::windowClose); 202 keyWindow->connectSignal("delete_event", keyWindow, Window::windowClose); 203 #endif /* HAVE_GTK2 */ 204 205 this->openButton = new Button("misc"); 206 #ifdef HAVE_GTK2 207 this->openButton->connectSignal("button_press_event", keyWindow, Window::windowOpen); 208 #endif /* HAVE_GTK2 */ 209 } 210 211 /** 212 \returns the OpenButton of a Misc 213 */ 214 Button* MiscKeys::getOpenButton(void) 215 { 216 return this->openButton; 217 } 218 153 219 154 220 /** … … 158 224 \returns A widget that has the Key-Box 159 225 */ 160 Widget* addKey( KEYS key, char* name)226 Widget* addKey(const char* name, const char* defaultVal) 161 227 { 162 228 InputKey* inputKey = new InputKey; 163 inputKey->pKeyBox = new Box(); 164 inputKey->pKeyButton = new Button(name); 165 inputKey->pKeyOLabel = new OptionLabel(name, name); 166 inputKey->pKeyOLabel->saveability(); 167 168 #ifdef HAVE_GTK2 169 //inputKey->pKeyButton->connectSignal("key_press_event", inputKey->pKeyButton, key_cb); 170 inputKey->pKeyButton->connectSignal("button_press_event", inputKey, inputWindowEvent); 171 #endif /* HAVE_GTK2 */ 172 inputKey->pKeyBox->fill(inputKey->pKeyButton); 173 inputKey->pKeyBox->fill(inputKey->pKeyOLabel); 174 return inputKey->pKeyBox; 229 inputKey->keyBox = new Box(); 230 inputKey->keyButton = new Button(name); 231 if (defaultVal) 232 inputKey->keyOLabel = new OptionLabel(name, defaultVal); 233 else 234 inputKey->keyOLabel = new OptionLabel(name, name); 235 inputKey->keyOLabel->saveability(); 236 237 #ifdef HAVE_GTK2 238 //inputKey->keyButton->connectSignal("key_press_event", inputKey->keyButton, key_cb); 239 inputKey->keyButton->connectSignal("button_press_event", inputKey, inputWindowEvent); 240 #endif /* HAVE_GTK2 */ 241 inputKey->keyBox->fill(inputKey->keyButton); 242 inputKey->keyBox->fill(inputKey->keyOLabel); 243 return inputKey->keyBox; 175 244 } 176 245 … … 194 263 { 195 264 InputKey* inputkey =(InputKey*) inputKey; 196 char title [ 20];197 198 switch(event->keyval) 265 char title [50]; 266 267 switch(event->keyval) 199 268 { 200 269 case GDK_Up: … … 362 431 } 363 432 364 inputkey-> pKeyOLabel->setValue(title);433 inputkey->keyOLabel->setValue(title); 365 434 GuiKeys::inputButton->disconnectSignal(GuiKeys::keySignal); 366 435 GuiKeys::inputWindow->close(); -
orxonox/trunk/src/lib/gui/gui/gui_keys.h
r4088 r4089 15 15 #endif /* HAVE_GTK2 */ 16 16 17 /**18 \brief defines the Possible Player Keys19 */20 enum KEYS {UP, DOWN, LEFT, RIGHT, SHOOT};21 22 17 //! One KeyOption has one InputKey 23 18 struct InputKey 24 19 { 25 Box* pKeyBox; //!< One Box that holds the Keys26 Button* pKeyButton; //!< The Button for changing the Key.27 OptionLabel* pKeyOLabel;//!< The Label for displaying the Key-setting.20 Box* keyBox; //!< One Box that holds the Keys 21 Button* keyButton; //!< The Button for changing the Key. 22 OptionLabel* keyOLabel;//!< The Label for displaying the Key-setting. 28 23 }; 29 24 … … 41 36 42 37 //! Class to hold infos about a Player 43 class Player 38 class PlayerKeys 44 39 { 45 40 private: … … 47 42 48 43 public: 49 Player(char* player); 50 44 PlayerKeys(char* player); 51 45 52 46 Button* getOpenButton(void); 53 54 void setkey(KEYS key);55 56 47 }; 57 48 58 Widget* addKey(KEYS key, char* name); 49 class MiscKeys 50 { 51 private: 52 Button* openButton; //!< The OpenButton for this key-settings. 53 54 public: 55 MiscKeys(); 56 57 Button* getOpenButton(void); 58 }; 59 60 Widget* addKey(const char* name, const char* defaultValue = NULL); 59 61 #ifdef HAVE_GTK2 60 62 gint inputWindowEvent(GtkWidget* w, GdkEventKey* event, void* widget);
Note: See TracChangeset
for help on using the changeset viewer.