view src/gtk/joypadconfig.h @ 5:8fe0c57e53d2

concentrating on lua first
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:39:40 -0600
parents f9f4f1b99eed
children
line wrap: on
line source
1 // -*- C++ -*-
2 // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
3 // Copyright (C) 1999-2003 Forgotten
4 // Copyright (C) 2004 Forgotten and the VBA development team
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2, or(at your option)
9 // any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef __VBA_JOYPADCONFIG_H__
21 #define __VBA_JOYPADCONFIG_H__
23 #include <vector>
25 #include <libglademm.h>
26 #include <gtkmm.h>
28 #ifndef GTKMM20
29 # include "sigccompat.h"
30 #endif // ! GTKMM20
32 #include "input.h"
34 namespace VBA
35 {
37 class JoypadConfig
38 {
39 public:
40 guint m_uiUp;
41 guint m_uiDown;
42 guint m_uiLeft;
43 guint m_uiRight;
44 guint m_uiA;
45 guint m_uiB;
46 guint m_uiL;
47 guint m_uiR;
48 guint m_uiSelect;
49 guint m_uiStart;
50 guint m_uiSpeed;
51 guint m_uiCapture;
53 guint * puiAt(int _iIndex);
54 int iFind(guint _uiKeycode);
55 void vSetDefault();
56 Keymap * poCreateKeymap() const;
57 };
59 class JoypadConfigDialog : public Gtk::Dialog
60 {
61 public:
62 JoypadConfigDialog(GtkDialog * _pstDialog,
63 const Glib::RefPtr<Gnome::Glade::Xml> & _poXml);
64 virtual ~JoypadConfigDialog();
66 void vSetConfig(const JoypadConfig & _roConfig);
67 inline JoypadConfig stGetConfig() const { return m_oConfig; }
69 protected:
70 bool bOnEntryFocusIn(GdkEventFocus * _pstEvent, guint _uiEntry);
71 bool bOnEntryFocusOut(GdkEventFocus * _pstEvent);
73 bool on_key_press_event(GdkEventKey * _pstEvent);
75 private:
76 JoypadConfig m_oConfig;
77 Gtk::Button * m_poOkButton;
78 std::vector<Gtk::Entry *> m_oEntries;
79 guint * m_puiCurrentKeyCode;
80 guint m_uiCurrentEntry;
82 void vUpdateEntries();
83 };
85 } // namespace VBA
88 #endif // __VBA_JOYPADCONFIG_H__