Improve (mostly Canvas event related) documentation.

This commit is contained in:
Thomas Geymayer
2014-07-29 23:04:45 +02:00
parent c5d649aa0b
commit f41b18f064
30 changed files with 192 additions and 57 deletions

View File

@@ -1923,7 +1923,7 @@ ENABLE_PREPROCESSING = YES
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
MACRO_EXPANSION = NO
MACRO_EXPANSION = YES
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
# the macro expansion is limited to the macros specified with the PREDEFINED and

View File

@@ -1,4 +1,5 @@
///@file The canvas for rendering with the 2d API
///@file
/// The canvas for rendering with the 2d API
//
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
//
@@ -43,6 +44,9 @@ namespace canvas
class CanvasMgr;
class MouseEvent;
/**
* Canvas to draw onto (to an off-screen render target).
*/
class Canvas:
public PropertyBasedElement,
public nasal::Object

View File

@@ -125,7 +125,7 @@ namespace canvas
if( type_map.empty() )
{
# define ENUM_MAPPING(type, str)\
# define ENUM_MAPPING(type, str, class_name)\
type_map.insert(TypeMap::value_type(str, type));
# include "CanvasEventTypes.hxx"
# undef ENUM_MAPPING

View File

@@ -1,4 +1,5 @@
// Canvas Event for event model similar to DOM Level 3 Event Model
/// @file
/// Canvas Event for event model similar to DOM Level 3 Event Model
//
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
//
@@ -27,19 +28,28 @@ namespace simgear
namespace canvas
{
/**
* Base class for all Canvas events.
*
* The event system is closely following the specification of the DOM Level 3
* Event Model.
*/
class Event:
public SGReferenced
{
public:
/// Event type identifier
enum Type
{
UNKNOWN,
# define ENUM_MAPPING(name, str) name,
# define ENUM_MAPPING(name, str, class_name)\
name, /*!< class_name (type=str) */
# include "CanvasEventTypes.hxx"
# undef ENUM_MAPPING
CUSTOM_EVENT ///< all user defined event types share the same id. They
/// are just differentiated by using the type string.
CUSTOM_EVENT ///< First event type id available for user defined event
/// type.
/// @see CustomEvent
};
int type;

View File

@@ -20,16 +20,16 @@
# error "Don't include this file directly!"
#endif
ENUM_MAPPING(MOUSE_DOWN, "mousedown")
ENUM_MAPPING(MOUSE_UP, "mouseup")
ENUM_MAPPING(CLICK, "click")
ENUM_MAPPING(DBL_CLICK, "dblclick")
ENUM_MAPPING(DRAG, "drag")
ENUM_MAPPING(WHEEL, "wheel")
ENUM_MAPPING(MOUSE_MOVE, "mousemove")
ENUM_MAPPING(MOUSE_OVER, "mouseover")
ENUM_MAPPING(MOUSE_OUT, "mouseout")
ENUM_MAPPING(MOUSE_ENTER, "mouseenter")
ENUM_MAPPING(MOUSE_LEAVE, "mouseleave")
ENUM_MAPPING(KEY_DOWN, "keydown")
ENUM_MAPPING(KEY_UP, "keyup")
ENUM_MAPPING(MOUSE_DOWN, "mousedown", MouseEvent)
ENUM_MAPPING(MOUSE_UP, "mouseup", MouseEvent)
ENUM_MAPPING(CLICK, "click", MouseEvent)
ENUM_MAPPING(DBL_CLICK, "dblclick", MouseEvent)
ENUM_MAPPING(DRAG, "drag", MouseEvent)
ENUM_MAPPING(WHEEL, "wheel", MouseEvent)
ENUM_MAPPING(MOUSE_MOVE, "mousemove", MouseEvent)
ENUM_MAPPING(MOUSE_OVER, "mouseover", MouseEvent)
ENUM_MAPPING(MOUSE_OUT, "mouseout", MouseEvent)
ENUM_MAPPING(MOUSE_ENTER, "mouseenter", MouseEvent)
ENUM_MAPPING(MOUSE_LEAVE, "mouseleave", MouseEvent)
ENUM_MAPPING(KEY_DOWN, "keydown", KeyboardEvent)
ENUM_MAPPING(KEY_UP, "keyup", KeyboardEvent)

View File

@@ -1,7 +1,8 @@
///@file Placement for putting a canvas texture onto OpenSceneGraph objects.
//
// It also provides a SGPickCallback for passing mouse events to the canvas and
// manages emissive lighting of the placed canvas.
///@file
/// Placement for putting a canvas texture onto OpenSceneGraph objects.
///
/// It also provides a SGPickCallback for passing mouse events to the canvas and
/// manages emissive lighting of the placed canvas.
//
// Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
//

View File

@@ -1,4 +1,5 @@
///@file Interface for 2D Canvas elements
///@file
/// Interface for 2D Canvas elements
//
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
//
@@ -42,7 +43,7 @@ namespace canvas
{
/**
* Baseclass for Elements displayed inside a Canvas.
* Base class for Elements displayed inside a Canvas.
*/
class Element:
public PropertyBasedElement

View File

@@ -1,4 +1,5 @@
///@file Canvas user defined event
///@file
/// Canvas user defined event
//
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
//
@@ -27,6 +28,10 @@ namespace simgear
namespace canvas
{
/**
* User defined event (optionally carrying additional context information or
* data).
*/
class CustomEvent:
public Event
{

View File

@@ -1,4 +1,5 @@
///@file Input device event (keyboard/mouse)
///@file
/// Input device event (keyboard/mouse)
//
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
//
@@ -35,14 +36,25 @@ namespace canvas
public Event
{
public:
/// Default initialization (no active keyboard modifier).
DeviceEvent();
/// Initialize from an OpenSceneGraph event.
DeviceEvent(const osgGA::GUIEventAdapter& ea);
/// Get mask of active keyboard modifiers at the time of the event.
int getModifiers() const { return modifiers; }
/// Get if a Ctrl modifier was active.
bool ctrlKey() const;
/// Get if a Shift modifier was active.
bool shiftKey() const;
/// Get if an Alt modifier was active.
bool altKey() const;
/// Get if a Meta modifier was active.
bool metaKey() const;
protected:

View File

@@ -1,4 +1,5 @@
///@file Keyboard event
///@file
/// Keyboard event
//
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
//
@@ -26,6 +27,9 @@ namespace simgear
namespace canvas
{
/**
* Keyboard (button up/down) event
*/
class KeyboardEvent:
public DeviceEvent
{

View File

@@ -1,4 +1,5 @@
///@file Mouse event
///@file
/// Mouse event
//
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
//
@@ -26,6 +27,9 @@ namespace simgear
namespace canvas
{
/**
* Mouse (button/move/wheel) event
*/
class MouseEvent:
public DeviceEvent
{

View File

@@ -1,4 +1,4 @@
// Align items horizontally or vertically in a box
/// @file
//
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
//
@@ -26,6 +26,11 @@ namespace simgear
namespace canvas
{
/**
* Align LayoutItems horizontally or vertically in a box.
*
* @see http://qt-project.org/doc/qt-4.8/qboxlayout.html#details
*/
class BoxLayout:
public Layout
{

View File

@@ -1,4 +1,4 @@
// Basic class for canvas layouts
/// @file
//
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
//
@@ -27,6 +27,9 @@ namespace simgear
namespace canvas
{
/**
* Base class for all Canvas layouts.
*/
class Layout:
public LayoutItem
{

View File

@@ -1,4 +1,5 @@
///@file Basic element for layouting canvas elements
///@file
/// Basic element for layouting canvas elements.
//
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
//

View File

@@ -1,4 +1,5 @@
///@file Glue for GUI widgets implemented in Nasal space
///@file
/// Glue for GUI widgets implemented in Nasal space.
//
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
//
@@ -31,7 +32,7 @@ namespace canvas
{
/**
* Baseclass/ghost to create widgets with Nasal.
* Base class/ghost to implement gui widgets in Nasal space.
*/
class NasalWidget:
public LayoutItem,

View File

@@ -1,4 +1,4 @@
///@file Element providing blank space in a layout.
///@file
//
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
//

View File

@@ -1,4 +1,4 @@
///@file HTTP request writing response to a file.
///@file
//
// Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
//
@@ -27,6 +27,9 @@ namespace simgear
namespace HTTP
{
/**
* HTTP request writing response to a file.
*/
class FileRequest:
public Request
{

View File

@@ -1,4 +1,4 @@
///@file HTTP request keeping response in memory.
///@file
//
// Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
//
@@ -27,6 +27,9 @@ namespace simgear
namespace HTTP
{
/**
* HTTP request keeping response in memory.
*/
class MemoryRequest:
public Request
{

View File

@@ -1,3 +1,20 @@
// Copyright (C) 2011 James Turner <zakalawe@mac.com>
// Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#include "HTTPRequest.hxx"
#include <simgear/compiler.h>

View File

@@ -1,3 +1,22 @@
///@file
//
// Copyright (C) 2011 James Turner <zakalawe@mac.com>
// Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#ifndef SG_HTTP_REQUEST_HXX
#define SG_HTTP_REQUEST_HXX
@@ -18,6 +37,9 @@ namespace simgear
namespace HTTP
{
/**
* Base class for HTTP request (and answer).
*/
class Request:
public SGReferenced
{

View File

@@ -1,4 +1,5 @@
///@file Parse and represent SVG preserveAspectRatio attribute
///@file
/// Parse and represent SVG preserveAspectRatio attribute.
//
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
//
@@ -53,6 +54,7 @@ namespace simgear
bool operator==(const SVGpreserveAspectRatio& rhs) const;
/// Parse preserveAspectRatio from string.
static SVGpreserveAspectRatio parse(const std::string& str);
private:

View File

@@ -1,4 +1,5 @@
///@file Really simple markdown parser
///@file
/// Really simple markdown parser.
//
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
//

View File

@@ -1,4 +1,4 @@
///@file Manage lifetime and encapsulate a Nasal context
///@file
//
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
//
@@ -24,6 +24,9 @@
namespace nasal
{
/**
* Manage lifetime and encapsulate a Nasal context.
*/
class Context
{
public:

View File

@@ -1,4 +1,4 @@
///@file Wrapper class for Nasal hashes
///@file
//
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
//
@@ -29,7 +29,7 @@ namespace nasal
{
/**
* A Nasal Hash
* Wrapper class for Nasal hashes.
*/
class Hash
{

View File

@@ -1,4 +1,4 @@
///@file Object exposed to Nasal including a Nasal hash for data storage.
///@file
//
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
//
@@ -28,6 +28,9 @@
namespace nasal
{
/**
* Object exposed to Nasal including a Nasal hash for data storage.
*/
class Object:
public virtual SGVirtualWeakReferenced
{

View File

@@ -1,4 +1,5 @@
///@file Wrapper class for keeping Nasal objects save from the garbage collector
///@file
/// Wrapper class for keeping Nasal objects save from the garbage collector.
//
// Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
//

View File

@@ -1,4 +1,4 @@
///@file Wrapper class for Nasal strings
///@file
//
// Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
//
@@ -26,7 +26,7 @@ namespace nasal
{
/**
* A Nasal String
* Wrapper class for Nasal strings.
*/
class String
{

View File

@@ -60,11 +60,22 @@ namespace simgear
return 0.5 + 0.5 * (*easeOut)(t - 1);
}
/**
* Helper for exponential ease out with integer exponent.
*
* @tparam N Exponent.
* @tparam is_odd If the exponent is odd.
*/
template<size_t N, bool is_odd>
struct easeOutImpl;
/// http://easings.net/#easeOutCubic (N = 3)
/// http://easings.net/#easeOutQuint (N = 5)
/**
* Ease out with odd integer exponent.
*
* @tparam N Exponent.
* @see http://easings.net/#easeOutCubic (N = 3)
* @see http://easings.net/#easeOutQuint (N = 5)
*/
template<size_t N>
struct easeOutImpl<N, true>
{
@@ -74,8 +85,13 @@ namespace simgear
}
};
/// http://easings.net/#easeOutQuad (N = 2)
/// http://easings.net/#easeOutQuart (N = 4)
/**
* Ease out with even integer exponent.
*
* @tparam N Exponent.
* @see http://easings.net/#easeOutQuad (N = 2)
* @see http://easings.net/#easeOutQuart (N = 4)
*/
template<size_t N>
struct easeOutImpl<N, false>
{
@@ -85,10 +101,15 @@ namespace simgear
}
};
/// http://easings.net/#easeOutQuad (N = 2)
/// http://easings.net/#easeOutCubic (N = 3)
/// http://easings.net/#easeOutQuart (N = 4)
/// http://easings.net/#easeOutQuint (N = 5)
/**
* Exponential ease out with integer exponent.
*
* @see http://easings.net/#easeOutQuad (N = 2)
* @see http://easings.net/#easeOutCubic (N = 3)
* @see http://easings.net/#easeOutQuart (N = 4)
* @see http://easings.net/#easeOutQuint (N = 5)
* @see easeOutImpl
*/
template<size_t N>
double easeOutPow(double t)
{

View File

@@ -1,4 +1,4 @@
///@file Handle a list of callbacks like a single boost::function
///@file
//
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
//
@@ -39,6 +39,11 @@ namespace simgear
# define BOOST_PP_FILENAME_1 <simgear/structure/detail/function_list_template.hxx>
# include BOOST_PP_ITERATE()
/**
* Handle a list of callbacks like a single boost::function.
*
* @tparam Sig Function signature.
*/
template<typename Sig>
class function_list<boost::function<Sig> >:
public function_list<Sig>

View File

@@ -1,4 +1,4 @@
///@file Extended std::map with methods for easier usage.
///@file
//
// Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
//
@@ -25,6 +25,9 @@
namespace simgear
{
/**
* Extended std::map with methods for easier usage.
*/
template<class Key, class Value>
class Map:
public std::map<Key, Value>