ENUM_MAPPING(MOUSE_LEAVE, "mouseleave", MouseEvent)
ENUM_MAPPING(KEY_DOWN, "keydown", KeyboardEvent)
ENUM_MAPPING(KEY_UP, "keyup", KeyboardEvent)
+ENUM_MAPPING(KEY_PRESS, "keypress", KeyboardEvent)
|| _key == KEY_AltGraph;
}
+ //----------------------------------------------------------------------------
+ bool KeyboardEvent::isPrint() const
+ {
+ const std::string& key_name = key();
+ if( key_name.empty() )
+ return false;
+
+ // Check if _name contains exactly one (UTF-8 encoded) printable character.
+ std::string::const_iterator it = key_name.begin();
+ utf8::next(it, key_name.end());
+ return it == key_name.end();
+ }
+
} // namespace canvas
} // namespace simgear
/// Whether the key which has triggered this event is a modifier
bool isModifier() const;
+ /// Whether this events represents an input of a printable character
+ bool isPrint() const;
+
protected:
uint32_t _key, //!< Key identifier for this event
_unmodified_key; //!< Virtual key identifier without any
<< ", loc=" << evt.location()
<< ", char=" << evt.charCode()
<< ", key=" << evt.keyCode()
+ << (evt.isPrint() ? ", printable" : "")
<< std::endl;
return true;
}
viewer.addEventHandler(handler);
viewer.setUpViewInWindow(100, 100, 200, 100, 0);
+ viewer.setRunMaxFrameRate(5);
return viewer.run();
}
};
/**
- * Flags for LayoutItem alignment inside Layouts.
+ * Flags for LayoutItem alignment inside {@link Layout Layouts}.
*
* @note You can only use one horizontal and one vertical flag at the same.
*/
int minimumHeightForWidth(int w) const;
/**
- * Set alignment of item within @link{Layout Layouts}.
+ * Set alignment of item within {@link Layout Layouts}.
*
* @param alignment Bitwise combination of vertical and horizontal
* alignment flags.