diff 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
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/gtk/joypadconfig.h	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,88 @@
     1.4 +// -*- C++ -*-
     1.5 +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
     1.6 +// Copyright (C) 1999-2003 Forgotten
     1.7 +// Copyright (C) 2004 Forgotten and the VBA development team
     1.8 +
     1.9 +// This program is free software; you can redistribute it and/or modify
    1.10 +// it under the terms of the GNU General Public License as published by
    1.11 +// the Free Software Foundation; either version 2, or(at your option)
    1.12 +// any later version.
    1.13 +//
    1.14 +// This program is distributed in the hope that it will be useful,
    1.15 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.16 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.17 +// GNU General Public License for more details.
    1.18 +//
    1.19 +// You should have received a copy of the GNU General Public License
    1.20 +// along with this program; if not, write to the Free Software Foundation,
    1.21 +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    1.22 +
    1.23 +#ifndef __VBA_JOYPADCONFIG_H__
    1.24 +#define __VBA_JOYPADCONFIG_H__
    1.25 +
    1.26 +#include <vector>
    1.27 +
    1.28 +#include <libglademm.h>
    1.29 +#include <gtkmm.h>
    1.30 +
    1.31 +#ifndef GTKMM20
    1.32 +# include "sigccompat.h"
    1.33 +#endif // ! GTKMM20
    1.34 +
    1.35 +#include "input.h"
    1.36 +
    1.37 +namespace VBA
    1.38 +{
    1.39 +
    1.40 +class JoypadConfig
    1.41 +{
    1.42 +public:
    1.43 +  guint m_uiUp;
    1.44 +  guint m_uiDown;
    1.45 +  guint m_uiLeft;
    1.46 +  guint m_uiRight;
    1.47 +  guint m_uiA;
    1.48 +  guint m_uiB;
    1.49 +  guint m_uiL;
    1.50 +  guint m_uiR;
    1.51 +  guint m_uiSelect;
    1.52 +  guint m_uiStart;
    1.53 +  guint m_uiSpeed;
    1.54 +  guint m_uiCapture;
    1.55 +
    1.56 +  guint *  puiAt(int _iIndex);
    1.57 +  int      iFind(guint _uiKeycode);
    1.58 +  void     vSetDefault();
    1.59 +  Keymap * poCreateKeymap() const;
    1.60 +};
    1.61 +
    1.62 +class JoypadConfigDialog : public Gtk::Dialog
    1.63 +{
    1.64 +public:
    1.65 +  JoypadConfigDialog(GtkDialog * _pstDialog,
    1.66 +                     const Glib::RefPtr<Gnome::Glade::Xml> & _poXml);
    1.67 +  virtual ~JoypadConfigDialog();
    1.68 +
    1.69 +  void vSetConfig(const JoypadConfig & _roConfig);
    1.70 +  inline JoypadConfig stGetConfig() const { return m_oConfig; }
    1.71 +
    1.72 +protected:
    1.73 +  bool bOnEntryFocusIn(GdkEventFocus * _pstEvent, guint _uiEntry);
    1.74 +  bool bOnEntryFocusOut(GdkEventFocus * _pstEvent);
    1.75 +
    1.76 +  bool on_key_press_event(GdkEventKey * _pstEvent);
    1.77 +
    1.78 +private:
    1.79 +  JoypadConfig              m_oConfig;
    1.80 +  Gtk::Button *             m_poOkButton;
    1.81 +  std::vector<Gtk::Entry *> m_oEntries;
    1.82 +  guint *                   m_puiCurrentKeyCode;
    1.83 +  guint                     m_uiCurrentEntry;
    1.84 +
    1.85 +  void vUpdateEntries();
    1.86 +};
    1.87 +
    1.88 +} // namespace VBA
    1.89 +
    1.90 +
    1.91 +#endif // __VBA_JOYPADCONFIG_H__