Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/gui/gui/gui_keys.h @ 4086

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

orxonox/trunk: keySelector is now extern from Player

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