home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 July / CMCD0704.ISO / Software / Freeware / Utilitare / VisualBoyAdvance-1.7.2 / src / gtk / joypadconfig.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-05-10  |  2.2 KB  |  89 lines

  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
  5.  
  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.
  19.  
  20. #ifndef __VBA_JOYPADCONFIG_H__
  21. #define __VBA_JOYPADCONFIG_H__
  22.  
  23. #include <vector>
  24.  
  25. #include <libglademm.h>
  26. #include <gtkmm.h>
  27.  
  28. #ifndef GTKMM20
  29. # include "sigccompat.h"
  30. #endif // ! GTKMM20
  31.  
  32. #include "input.h"
  33.  
  34. namespace VBA
  35. {
  36.  
  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;
  52.  
  53.   guint *  puiAt(int _iIndex);
  54.   int      iFind(guint _uiKeycode);
  55.   void     vSetDefault();
  56.   Keymap * poCreateKeymap() const;
  57. };
  58.  
  59. class JoypadConfigDialog : public Gtk::Dialog
  60. {
  61. public:
  62.   JoypadConfigDialog(GtkDialog * _pstDialog,
  63.                      const Glib::RefPtr<Gnome::Glade::Xml> & _poXml);
  64.   virtual ~JoypadConfigDialog();
  65.  
  66.   void vSetConfig(const JoypadConfig & _roConfig);
  67.   inline JoypadConfig stGetConfig() const { return m_oConfig; }
  68.  
  69. protected:
  70.   bool bOnEntryFocusIn(GdkEventFocus * _pstEvent, guint _uiEntry);
  71.   bool bOnEntryFocusOut(GdkEventFocus * _pstEvent);
  72.  
  73.   bool on_key_press_event(GdkEventKey * _pstEvent);
  74.  
  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;
  81.  
  82.   void vUpdateEntries();
  83. };
  84.  
  85. } // namespace VBA
  86.  
  87.  
  88. #endif // __VBA_JOYPADCONFIG_H__
  89.