/usr/include/simgear/structure/SGBinding.hxx is in libsimgear-dev 3.0.0-6+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | /**
* \file commands.hxx
* Interface definition for encapsulated commands.
* Started Spring 2001 by David Megginson, david@megginson.com
* This code is released into the Public Domain.
*
* $Id$
*/
#ifndef __SGBINDING_HXX
#define __SGBINDING_HXX
#include <simgear/compiler.h>
#include <string>
#include <map>
#include <vector>
#include <simgear/props/props.hxx>
#include <simgear/props/condition.hxx>
#include "commands.hxx"
/**
* An input binding of some sort.
*
* <p>This class represents a binding that can be assigned to a
* keyboard key, a joystick button or axis, or even a panel
* instrument.</p>
*/
class SGBinding : public SGConditional
{
public:
/**
* Default constructor.
*/
SGBinding ();
/**
* Convenience constructor.
*
* @param node The binding will be built from this node.
*/
SGBinding(const std::string& commandName);
/**
* Convenience constructor.
*
* @param node The binding will be built from this node.
*/
SGBinding (const SGPropertyNode * node, SGPropertyNode* root);
/**
* Destructor.
*/
virtual ~SGBinding ();
/**
* clear internal state of the binding back to empty. This is useful
* if you don't want the 'remove on delete' behaviour of the
* destructor.
*/
void clear();
/**
* Get the command name.
*
* @return The string name of the command for this binding.
*/
const std::string &getCommandName () const { return _command_name; }
/**
* Get the command itself.
*
* @return The command associated with this binding, or 0 if none
* is present.
*/
SGCommandMgr::Command* getCommand () const { return _command; }
/**
* Get the argument that will be passed to the command.
*
* @return A property node that will be passed to the command as its
* argument, or 0 if none was supplied.
*/
const SGPropertyNode * getArg () { return _arg; }
/**
* Read a binding from a property node.
*
* @param node The property node containing the binding.
*/
void read (const SGPropertyNode * node, SGPropertyNode* root);
/**
* Fire a binding.
*/
void fire () const;
/**
* Fire a binding with a scaled movement (rather than absolute position).
*/
void fire (double offset, double max) const;
/**
* Fire a binding with a setting (i.e. joystick axis).
*
* A double 'setting' property will be added to the arguments.
*
* @param setting The input setting, usually between -1.0 and 1.0.
*/
void fire (double setting) const;
/**
* Fire a binding with a number of additional parameters
*
* The children of params will be merged with the fixed arguments.
*/
void fire (SGPropertyNode* params) const;
private:
void innerFire() const;
// just to be safe.
SGBinding (const SGBinding &binding);
std::string _command_name;
mutable SGCommandMgr::Command* _command;
mutable SGPropertyNode_ptr _arg;
mutable SGPropertyNode_ptr _setting;
};
typedef SGSharedPtr<SGBinding> SGBinding_ptr;
typedef std::vector<SGBinding_ptr > SGBindingList;
typedef std::map<unsigned,SGBindingList> SGBindingMap;
/**
* fire every binding in a list, in sequence
*/
void fireBindingList(const SGBindingList& aBindings, SGPropertyNode* params = NULL);
/**
* fire every binding in a list with a setting value
*/
void fireBindingListWithOffset(const SGBindingList& aBindings, double offset, double max);
/**
* read multiple bindings from property-list format
*/
SGBindingList readBindingList(const simgear::PropertyList& aNodes, SGPropertyNode* aRoot);
/**
* call clear() on every binding in a list
*/
void clearBindingList(const SGBindingList& aBindings);
#endif
|