s/text/label/

This commit is contained in:
rdb 2014-03-09 18:54:30 +00:00
parent 88f1cc5347
commit d6be70b339
3 changed files with 18 additions and 18 deletions

View File

@ -47,15 +47,15 @@ get_mapped_button(int i) const {
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: ButtonMap::get_mapped_button_text // Function: ButtonMap::get_mapped_button_label
// Access: Published // Access: Published
// Description: Returns the text associated with the nth mapped // Description: Returns the label associated with the nth mapped
// button, meaning the button that the nth raw // button, meaning the button that the nth raw
// button is mapped to. // button is mapped to.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE const string &ButtonMap:: INLINE const string &ButtonMap::
get_mapped_button_text(int i) const { get_mapped_button_label(int i) const {
return _buttons[i]->_text; return _buttons[i]->_label;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -94,7 +94,7 @@ get_mapped_button(const string &raw_name) const {
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: ButtoMap::get_mapped_button_text // Function: ButtoMap::get_mapped_button_label
// Access: Published // Access: Published
// Description: If the button map specifies a special name for the // Description: If the button map specifies a special name for the
// button (eg. if the operating system or keyboard // button (eg. if the operating system or keyboard
@ -106,19 +106,19 @@ get_mapped_button(const string &raw_name) const {
// name of the Panda event associated with the button. // name of the Panda event associated with the button.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE const string &ButtonMap:: INLINE const string &ButtonMap::
get_mapped_button_text(ButtonHandle raw) const { get_mapped_button_label(ButtonHandle raw) const {
pmap<int, ButtonNode>::const_iterator it; pmap<int, ButtonNode>::const_iterator it;
it = _button_map.find(raw.get_index()); it = _button_map.find(raw.get_index());
if (it == _button_map.end()) { if (it == _button_map.end()) {
static const string empty = ""; static const string empty = "";
return empty; return empty;
} else { } else {
return it->second._text; return it->second._label;
} }
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: ButtoMap::get_mapped_button_text // Function: ButtoMap::get_mapped_button_label
// Access: Published // Access: Published
// Description: If the button map specifies a special name for the // Description: If the button map specifies a special name for the
// button (eg. if the operating system or keyboard // button (eg. if the operating system or keyboard
@ -130,12 +130,12 @@ get_mapped_button_text(ButtonHandle raw) const {
// name of the Panda event associated with the button. // name of the Panda event associated with the button.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE const string &ButtonMap:: INLINE const string &ButtonMap::
get_mapped_button_text(const string &raw_name) const { get_mapped_button_label(const string &raw_name) const {
ButtonHandle raw_button = ButtonRegistry::ptr()->find_button(raw_name); ButtonHandle raw_button = ButtonRegistry::ptr()->find_button(raw_name);
if (raw_button == ButtonHandle::none()) { if (raw_button == ButtonHandle::none()) {
static const string empty = ""; static const string empty = "";
return empty; return empty;
} else { } else {
return get_mapped_button_text(raw_button); return get_mapped_button_label(raw_button);
} }
} }

View File

@ -22,12 +22,12 @@ TypeHandle ButtonMap::_type_handle;
// Description: Registers a new button mapping. // Description: Registers a new button mapping.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void ButtonMap:: void ButtonMap::
map_button(ButtonHandle raw_button, ButtonHandle button, const string &text) { map_button(ButtonHandle raw_button, ButtonHandle button, const string &label) {
int index = raw_button.get_index(); int index = raw_button.get_index();
ButtonNode bnode; ButtonNode bnode;
bnode._raw = raw_button; bnode._raw = raw_button;
bnode._mapped = button; bnode._mapped = button;
bnode._text = text; bnode._label = label;
_button_map[index] = bnode; _button_map[index] = bnode;
_buttons.push_back(&_button_map[index]); _buttons.push_back(&_button_map[index]);
} }

View File

@ -35,21 +35,21 @@ PUBLISHED:
INLINE int get_num_buttons() const; INLINE int get_num_buttons() const;
INLINE ButtonHandle get_raw_button(int i) const; INLINE ButtonHandle get_raw_button(int i) const;
INLINE ButtonHandle get_mapped_button(int i) const; INLINE ButtonHandle get_mapped_button(int i) const;
INLINE const string &get_mapped_button_text(int i) const; INLINE const string &get_mapped_button_label(int i) const;
INLINE ButtonHandle get_mapped_button(ButtonHandle raw) const; INLINE ButtonHandle get_mapped_button(ButtonHandle raw) const;
INLINE ButtonHandle get_mapped_button(const string &raw_name) const; INLINE ButtonHandle get_mapped_button(const string &raw_name) const;
INLINE const string &get_mapped_button_text(ButtonHandle raw) const; INLINE const string &get_mapped_button_label(ButtonHandle raw) const;
INLINE const string &get_mapped_button_text(const string &raw_name) const; INLINE const string &get_mapped_button_label(const string &raw_name) const;
public: public:
void map_button(ButtonHandle raw_button, ButtonHandle button, const string &text = ""); void map_button(ButtonHandle raw_button, ButtonHandle button, const string &label = "");
private: private:
struct ButtonNode { struct ButtonNode {
ButtonHandle _raw; ButtonHandle _raw;
ButtonHandle _mapped; ButtonHandle _mapped;
string _text; string _label;
}; };
pmap<int, ButtonNode> _button_map; pmap<int, ButtonNode> _button_map;