Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/gui/gui/orxonox_gui_keys.h @ 4024

Last change on this file since 4024 was 4024, checked in by bensch, 19 years ago

orxonox/trunk: gui: more addaptive structure

File size: 2.4 KB
Line 
1/*!
2  \file orxonox_gui_keys.h
3  \brief File that holds the class that creates the Keyboard-Options.
4*/
5
6#ifndef _ORXONOX_GUI_KEYS_H
7#define _ORXONOX_GUI_KEYS_H
8
9#include "orxonox_gui.h"
10#include "orxonox_gui_element.h"
11
12#ifdef HAVE_GTK2
13#include <gdk/gdkkeysyms.h>
14#endif /* HAVE_GTK2 */
15
16/**
17   \brief defines the Possible Player Keys
18*/
19enum KEYS {UP, DOWN, LEFT, RIGHT, SHOOT};
20
21class Player;
22//! Class that creates the Keys-Options.
23class OrxonoxGuiKeys : public OrxonoxGuiElement
24{
25 private:
26  Frame* keysFrame;      //!< The Frame that holds the keyOptions.
27  Box* keysBox;          //!< The Frame that holds the keyOptions.
28  Player* player1;       //!< The first Player's keys.
29  Player* player2;       //!< The seconds Player's keys.
30  Button* misc;          //!< Other keyboeard options come here. \todo include some like pause, quit and so on.
31
32 public:
33  OrxonoxGuiKeys(void);
34  ~OrxonoxGuiKeys(void);
35};
36
37//! Class to hold infos about a Player
38/**
39   \todo split into subclass and superclass ButtonConfigurator
40*/
41class Player
42{
43 private:
44  Window* pKeyWindow;     //!< The Window for a new Key-setting.
45  Frame* pKeyFrame;       //!< The Frame for a new Key-setting.
46  Button* openButton;     //!< The OpenButton for this key-settings.
47  Button* closeButton;    //!< The CloseButton for this key-settings.
48  Box* pKeysBox;          //!< The Box that holds the Key-settings.
49 
50  //! One KeyOption has one InputKey
51  struct InputKey
52  {
53    Box* pKeyBox;           //!< One Box that holds the Keys
54    Button* pKeyButton;     //!< The Button for changing the Key.
55    OptionLabel* pKeyOLabel;//!< The Label for displaying the Key-setting.
56  };
57
58  InputKey* inputKey[10];     //!< Buttons-array. \todo make it dynamic.
59
60  static Window* inputWindow; //!< A Window that gets keyboard clicks. Static, because only one needed.
61  static Button* inputButton; //!< A Button that gets keyboard clicks. Static, because only one needed.
62  static long keySignal;      //!< A keySignal that handles keyboard clicks. Static, because only one needed.
63 public:
64  Player(char* player);
65
66  Widget* addKey(KEYS key, char* name);
67
68  Button* getOpenButton(void);
69
70#ifdef HAVE_GTK2
71  static gint inputWindowEvent(GtkWidget* w, GdkEventKey* event, void* widget);
72  static gint key_cb(GtkWidget* w, GdkEventKey* event, void* inputKey);
73#endif /* HAVE_GTK2 */
74  void setkey(KEYS key);
75 
76};
77
78
79
80#endif /* _ORXONOX_GUI_KEYS_H */
Note: See TracBrowser for help on using the repository browser.