annotate src/gtk/joypadconfig.h @ 1:f9f4f1b99eed

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