2006-03-05 17:24:44 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
|
* \file GuiKeySymbol.h
|
2006-03-05 17:24:44 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Asger and J<EFBFBD>rgen
|
|
|
|
|
* \author John Levon
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
|
#ifndef GUIKEYSYM_H
|
|
|
|
|
#define GUIKEYSYM_H
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-04-27 08:43:38 +00:00
|
|
|
|
#include "frontends/KeySymbol.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-05-07 10:20:43 +00:00
|
|
|
|
#include <QString>
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
class QKeyEvent;
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
/**
|
|
|
|
|
* Qt-specific key press.
|
|
|
|
|
*
|
|
|
|
|
* This is some really sick stuff.
|
|
|
|
|
*/
|
2007-09-05 20:33:29 +00:00
|
|
|
|
class GuiKeySymbol : public KeySymbol
|
|
|
|
|
{
|
2006-03-05 17:24:44 +00:00
|
|
|
|
public:
|
2007-08-31 05:53:55 +00:00
|
|
|
|
GuiKeySymbol();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
virtual ~GuiKeySymbol() {}
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-01-08 11:01:26 +00:00
|
|
|
|
/// .
|
|
|
|
|
/// inlined out because of profiling results under linux when
|
|
|
|
|
/// opening a document.
|
2007-04-27 08:43:38 +00:00
|
|
|
|
inline bool operator==(KeySymbol const& ks) const;
|
2007-01-08 11:01:26 +00:00
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
/// delayed constructor
|
|
|
|
|
void set(QKeyEvent * ev);
|
|
|
|
|
|
|
|
|
|
/// set from a LyX symbolic name
|
|
|
|
|
virtual void init(std::string const & symbolname);
|
|
|
|
|
|
|
|
|
|
/// Is this a valid key?
|
|
|
|
|
virtual bool isOK() const;
|
|
|
|
|
|
|
|
|
|
/// Is this a modifier key only?
|
|
|
|
|
virtual bool isModifier() const;
|
|
|
|
|
|
|
|
|
|
/// return the LyX symbolic name
|
|
|
|
|
virtual std::string getSymbolName() const;
|
|
|
|
|
|
|
|
|
|
/// Is this normal insertable text ? (last ditch attempt only)
|
|
|
|
|
virtual bool isText() const;
|
|
|
|
|
|
|
|
|
|
/**
|
2006-08-13 22:54:59 +00:00
|
|
|
|
* Return the value of the keysym into the UCS-4 encoding.
|
2007-04-27 08:43:38 +00:00
|
|
|
|
* This converts the KeySymbol to a 32-bit encoded character.
|
2006-03-05 17:24:44 +00:00
|
|
|
|
*/
|
2007-01-24 14:01:34 +00:00
|
|
|
|
virtual char_type getUCSEncoded() const;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-01-04 17:10:24 +00:00
|
|
|
|
/**
|
|
|
|
|
* Return a human-readable version of a key+modifier pair.
|
|
|
|
|
* This will be the GUI version (translated and with special
|
|
|
|
|
* characters for Mac OS X) when \c forgui is true.
|
|
|
|
|
*/
|
|
|
|
|
virtual docstring const print(key_modifier::state mod, bool forgui) const;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
///
|
2007-08-31 05:53:55 +00:00
|
|
|
|
int key() const { return key_; }
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
private:
|
|
|
|
|
/// the Qt sym value
|
|
|
|
|
int key_;
|
|
|
|
|
/// the event string value
|
|
|
|
|
QString text_;
|
|
|
|
|
};
|
|
|
|
|
|
2007-08-14 15:00:09 +00:00
|
|
|
|
/// return the LyX key state from Qt's
|
|
|
|
|
key_modifier::state q_key_state(Qt::KeyboardModifiers state);
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
|
#endif // GUIKEYSYM_H
|