lyx_mirror/src/frontends/LyXKeySym.h
Jean-Marc Lasgouttes 4c1fb15143 Make the shortcuts work correctly with the mac.
* src/frontends/LyXKeySym.h:
	* src/frontends/qt4/QLyXKeySym.h:
	* src/frontends/qt4/QLyXKeySym.C (print): add a forgui boolean that 
	tells whether the string should used localized names and special 
	characters.

	* src/MenuBackend.C (binding): 
	* src/kbmap.C (print): 
	* src/kbsequence.C (print, printOptions): add forgui parameter.

	* src/frontends/qt4/QLPopupMenu.C (addBinding): use a non-localaized 
	binding for Qt/Mac (because it needs to be parsed back) and a 
	localized one for the others (so that it looks good).

	* src/kbmap.C (defkey,printbindings): 
	* src/lyxfunc.C (processKeySym,dispatch,viewStatusMessage): adapt to 
	above changes.

	* src/kbmap.C (printKey): remove.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16510 a592a061-630c-0410-9148-cb99ea01b6c8
2007-01-04 17:10:24 +00:00

79 lines
1.7 KiB
C++

// -*- C++ -*-
/**
* \file LyXKeySym.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Asger and Jürgen
*
* Full author contact details are available in file CREDITS.
*/
#ifndef LYXKEYSYM_H
#define LYXKEYSYM_H
#include <string>
#include "key_state.h"
#include "support/docstring.h"
#include <boost/shared_ptr.hpp>
namespace lyx {
/**
* This is a base class for representing a keypress.
* Each frontend has to implement this to provide
* the functionality that LyX needs in regards to
* key presses.
*/
class LyXKeySym {
public:
LyXKeySym() {}
virtual ~LyXKeySym() {}
/// Initialize with the name of a key. F. ex. "space" or "a"
virtual void init(std::string const & symbolname) = 0;
/// Is this a valid key?
virtual bool isOK() const = 0;
/// Is this a modifier key only?
virtual bool isModifier() const = 0;
/// Is this normal insertable text ? (last ditch attempt only)
virtual bool isText() const = 0;
/// What is the symbolic name of this key? F.ex. "Return" or "c"
virtual std::string getSymbolName() const = 0;
/**
* Return the value of the keysym into the UCS-4 encoding.
* This converts the LyXKeySym to a 32-bit encoded character.
*/
virtual size_t getUCSEncoded() const = 0;
/**
* Return a string describing the KeySym with modifier mod.
* Use the native UI format when \c forgui is true.
*/
virtual docstring const print(key_modifier::state mod, bool forgui) const = 0;
};
/**
* We need to be able to equality compare these for the
* sake of the keymap business.
*/
bool operator==(LyXKeySym const & k1, LyXKeySym const & k2);
typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
} // namespace lyx
#endif