FlightGear next
NasalCanvas.cxx File Reference
#include "config.h"
#include "NasalCanvas.hxx"
#include <Canvas/canvas_mgr.hxx>
#include <Canvas/gui_mgr.hxx>
#include <Main/globals.hxx>
#include <Scripting/NasalCondition.hxx>
#include <Scripting/NasalSys.hxx>
#include <osgGA/GUIEventAdapter>
#include <simgear/sg_inlines.h>
#include <simgear/canvas/Canvas.hxx>
#include <simgear/canvas/CanvasWindow.hxx>
#include <simgear/canvas/elements/CanvasElement.hxx>
#include <simgear/canvas/elements/CanvasText.hxx>
#include <simgear/canvas/events/CanvasKeyBinding.hxx>
#include <simgear/canvas/events/CustomEvent.hxx>
#include <simgear/canvas/events/KeyboardEvent.hxx>
#include <simgear/canvas/events/MouseEvent.hxx>
#include <simgear/canvas/layout/BoxLayout.hxx>
#include <simgear/canvas/layout/GridLayout.hxx>
#include <simgear/canvas/layout/NasalWidget.hxx>
#include <simgear/canvas/layout/SpacerItem.hxx>
#include <simgear/nasal/cppbind/from_nasal.hxx>
#include <simgear/nasal/cppbind/to_nasal.hxx>
#include <simgear/nasal/cppbind/NasalHash.hxx>
#include <simgear/nasal/cppbind/Ghost.hxx>
#include <simgear/canvas/layout/AlignFlag_values.hxx>

Go to the source code of this file.

Classes

struct  CustomEventDetailWrapper
 

Macros

#define ALIGN_ENUM_MAPPING(key, val, comment)
 

Typedefs

typedef nasal::Ghost< sc::EventPtr > NasalEvent
 
typedef nasal::Ghost< sc::CustomEventPtr > NasalCustomEvent
 
typedef nasal::Ghost< sc::DeviceEventPtr > NasalDeviceEvent
 
typedef nasal::Ghost< sc::KeyboardEventPtr > NasalKeyboardEvent
 
typedef nasal::Ghost< sc::MouseEventPtr > NasalMouseEvent
 
typedef nasal::Ghost< sc::KeyBindingRef > NasalKeyBinding
 
typedef SGSharedPtr< CustomEventDetailWrapperCustomEventDetailPtr
 
typedef nasal::Ghost< CustomEventDetailPtrNasalCustomEventDetail
 
typedef nasal::Ghost< simgear::PropertyBasedElementPtr > NasalPropertyBasedElement
 
typedef nasal::Ghost< sc::CanvasPtr > NasalCanvas
 
typedef nasal::Ghost< sc::ElementPtr > NasalElement
 
typedef nasal::Ghost< sc::GroupPtr > NasalGroup
 
typedef nasal::Ghost< sc::TextPtr > NasalText
 
typedef nasal::Ghost< sc::ImagePtr > NasalImage
 
typedef nasal::Ghost< sc::LayoutItemRef > NasalLayoutItem
 
typedef nasal::Ghost< sc::LayoutRef > NasalLayout
 
typedef nasal::Ghost< sc::BoxLayoutRef > NasalBoxLayout
 
typedef nasal::Ghost< sc::GridLayoutRef > NasalGridLayout
 
using NasalSpacerItem = nasal::Ghost<sc::SpacerItemRef>
 
typedef nasal::Ghost< sc::WindowPtr > NasalWindow
 

Functions

naRef propNodeGhostCreate (naContext c, SGPropertyNode *n)
 
template<class Element>
naRef elementGetNode (Element &element, naContext c)
 
naRef to_nasal_helper (naContext c, const osg::BoundingBox &bb)
 
SGPropertyNode * from_nasal_helper (naContext c, naRef ref, SGPropertyNode **)
 
CanvasMgrrequireCanvasMgr (const nasal::ContextWrapper &ctx)
 
GUIMgrrequireGUIMgr (const nasal::ContextWrapper &ctx)
 
static naRef f_createCanvas (const nasal::CallContext &ctx)
 Create new Canvas and get ghost for it.
 
static naRef f_createWindow (const nasal::CallContext &ctx)
 Create new Window and get ghost for it.
 
static naRef f_getCanvas (const nasal::CallContext &ctx)
 Get ghost for existing Canvas.
 
naRef f_canvasCreateGroup (sc::Canvas &canvas, const nasal::CallContext &ctx)
 
naRef f_getDesktop (const nasal::CallContext &ctx)
 Get group containing all gui windows.
 
naRef f_setInputFocus (const nasal::CallContext &ctx)
 
naRef f_grabPointer (const nasal::CallContext &ctx)
 
naRef f_ungrabPointer (const nasal::CallContext &ctx)
 
static naRef f_groupCreateChild (sc::Group &group, const nasal::CallContext &ctx)
 
static sc::ElementPtr f_groupGetChild (sc::Group &group, SGPropertyNode *node)
 
static naRef f_groupAddKeyBinding (sc::Group &group, const nasal::CallContext &ctx)
 
static naRef f_windowAddKeyBinding (sc::Window &window, const nasal::CallContext &ctx)
 
static void propElementSetData (simgear::PropertyBasedElement &el, const std::string &name, const nasal::ContextWrapper &ctx, naRef ref)
 
static naRef f_propElementData (simgear::PropertyBasedElement &el, const nasal::CallContext &ctx)
 Accessor for HTML5 data properties.
 
static naRef f_createCustomEvent (const nasal::CallContext &ctx)
 
static naRef f_customEventGetDetail (sc::CustomEvent &event, naContext c)
 
static naRef f_layoutItemSetVisible (sc::LayoutItem &item, const nasal::CallContext &ctx)
 
static naRef f_boxLayoutAddItem (sc::BoxLayout &box, const nasal::CallContext &ctx)
 
static naRef f_boxLayoutInsertItem (sc::BoxLayout &box, const nasal::CallContext &ctx)
 
static naRef f_boxLayoutAddStretch (sc::BoxLayout &box, const nasal::CallContext &ctx)
 
static naRef f_boxLayoutInsertStretch (sc::BoxLayout &box, const nasal::CallContext &ctx)
 
template<class Type, class Base>
static naRef f_newAsBase (const nasal::CallContext &ctx)
 
static naRef f_imageFillRect (sc::Image &img, const nasal::CallContext &ctx)
 
static naRef f_imageSetPixel (sc::Image &img, const nasal::CallContext &ctx)
 
static naRef f_canvasImageSize (sc::Image &img, const nasal::CallContext &ctx)
 
static naRef f_gridLayoutAddItem (sc::GridLayout &grid, const nasal::CallContext &ctx)
 
static naRef f_newGridLayout (const nasal::CallContext &ctx)
 
static naRef f_newSpacerItem (const nasal::CallContext &ctx)
 
static naRef f_keyBindingAddBinding (sc::KeyBinding &keyBinding, const nasal::CallContext &ctx)
 
static naRef f_newKeyBinding (const nasal::CallContext &ctx)
 
naRef initNasalCanvas (naRef globals, naContext c)
 

Macro Definition Documentation

◆ ALIGN_ENUM_MAPPING

#define ALIGN_ENUM_MAPPING ( key,
val,
comment )
Value:
canvas_module.set(#key, sc::key);

Typedef Documentation

◆ CustomEventDetailPtr

Definition at line 70 of file NasalCanvas.cxx.

◆ NasalBoxLayout

typedef nasal::Ghost<sc::BoxLayoutRef> NasalBoxLayout

Definition at line 82 of file NasalCanvas.cxx.

◆ NasalCanvas

typedef nasal::Ghost<sc::CanvasPtr> NasalCanvas

Definition at line 74 of file NasalCanvas.cxx.

◆ NasalCustomEvent

typedef nasal::Ghost<sc::CustomEventPtr> NasalCustomEvent

Definition at line 63 of file NasalCanvas.cxx.

◆ NasalCustomEventDetail

Definition at line 71 of file NasalCanvas.cxx.

◆ NasalDeviceEvent

typedef nasal::Ghost<sc::DeviceEventPtr> NasalDeviceEvent

Definition at line 64 of file NasalCanvas.cxx.

◆ NasalElement

typedef nasal::Ghost<sc::ElementPtr> NasalElement

Definition at line 75 of file NasalCanvas.cxx.

◆ NasalEvent

typedef nasal::Ghost<sc::EventPtr> NasalEvent

Definition at line 62 of file NasalCanvas.cxx.

◆ NasalGridLayout

typedef nasal::Ghost<sc::GridLayoutRef> NasalGridLayout

Definition at line 83 of file NasalCanvas.cxx.

◆ NasalGroup

typedef nasal::Ghost<sc::GroupPtr> NasalGroup

Definition at line 76 of file NasalCanvas.cxx.

◆ NasalImage

typedef nasal::Ghost<sc::ImagePtr> NasalImage

Definition at line 78 of file NasalCanvas.cxx.

◆ NasalKeyBinding

typedef nasal::Ghost<sc::KeyBindingRef> NasalKeyBinding

Definition at line 67 of file NasalCanvas.cxx.

◆ NasalKeyboardEvent

typedef nasal::Ghost<sc::KeyboardEventPtr> NasalKeyboardEvent

Definition at line 65 of file NasalCanvas.cxx.

◆ NasalLayout

typedef nasal::Ghost<sc::LayoutRef> NasalLayout

Definition at line 81 of file NasalCanvas.cxx.

◆ NasalLayoutItem

typedef nasal::Ghost<sc::LayoutItemRef> NasalLayoutItem

Definition at line 80 of file NasalCanvas.cxx.

◆ NasalMouseEvent

typedef nasal::Ghost<sc::MouseEventPtr> NasalMouseEvent

Definition at line 66 of file NasalCanvas.cxx.

◆ NasalPropertyBasedElement

typedef nasal::Ghost<simgear::PropertyBasedElementPtr> NasalPropertyBasedElement

Definition at line 73 of file NasalCanvas.cxx.

◆ NasalSpacerItem

using NasalSpacerItem = nasal::Ghost<sc::SpacerItemRef>

Definition at line 84 of file NasalCanvas.cxx.

◆ NasalText

typedef nasal::Ghost<sc::TextPtr> NasalText

Definition at line 77 of file NasalCanvas.cxx.

◆ NasalWindow

typedef nasal::Ghost<sc::WindowPtr> NasalWindow

Definition at line 86 of file NasalCanvas.cxx.

Function Documentation

◆ elementGetNode()

template<class Element>
naRef elementGetNode ( Element & element,
naContext c )

Definition at line 57 of file NasalCanvas.cxx.

◆ f_boxLayoutAddItem()

static naRef f_boxLayoutAddItem ( sc::BoxLayout & box,
const nasal::CallContext & ctx )
static

Definition at line 388 of file NasalCanvas.cxx.

◆ f_boxLayoutAddStretch()

static naRef f_boxLayoutAddStretch ( sc::BoxLayout & box,
const nasal::CallContext & ctx )
static

Definition at line 416 of file NasalCanvas.cxx.

◆ f_boxLayoutInsertItem()

static naRef f_boxLayoutInsertItem ( sc::BoxLayout & box,
const nasal::CallContext & ctx )
static

Definition at line 401 of file NasalCanvas.cxx.

◆ f_boxLayoutInsertStretch()

static naRef f_boxLayoutInsertStretch ( sc::BoxLayout & box,
const nasal::CallContext & ctx )
static

Definition at line 422 of file NasalCanvas.cxx.

◆ f_canvasCreateGroup()

naRef f_canvasCreateGroup ( sc::Canvas & canvas,
const nasal::CallContext & ctx )

Definition at line 173 of file NasalCanvas.cxx.

◆ f_canvasImageSize()

static naRef f_canvasImageSize ( sc::Image & img,
const nasal::CallContext & ctx )
static

Definition at line 459 of file NasalCanvas.cxx.

◆ f_createCanvas()

static naRef f_createCanvas ( const nasal::CallContext & ctx)
static

Create new Canvas and get ghost for it.

Definition at line 129 of file NasalCanvas.cxx.

◆ f_createCustomEvent()

static naRef f_createCustomEvent ( const nasal::CallContext & ctx)
static

Definition at line 314 of file NasalCanvas.cxx.

◆ f_createWindow()

static naRef f_createWindow ( const nasal::CallContext & ctx)
static

Create new Window and get ghost for it.

Definition at line 137 of file NasalCanvas.cxx.

◆ f_customEventGetDetail()

static naRef f_customEventGetDetail ( sc::CustomEvent & event,
naContext c )
static

Definition at line 372 of file NasalCanvas.cxx.

◆ f_getCanvas()

static naRef f_getCanvas ( const nasal::CallContext & ctx)
static

Get ghost for existing Canvas.

Definition at line 148 of file NasalCanvas.cxx.

◆ f_getDesktop()

naRef f_getDesktop ( const nasal::CallContext & ctx)

Get group containing all gui windows.

Definition at line 181 of file NasalCanvas.cxx.

◆ f_grabPointer()

naRef f_grabPointer ( const nasal::CallContext & ctx)

Definition at line 192 of file NasalCanvas.cxx.

◆ f_gridLayoutAddItem()

static naRef f_gridLayoutAddItem ( sc::GridLayout & grid,
const nasal::CallContext & ctx )
static

Definition at line 471 of file NasalCanvas.cxx.

◆ f_groupAddKeyBinding()

static naRef f_groupAddKeyBinding ( sc::Group & group,
const nasal::CallContext & ctx )
static

Definition at line 216 of file NasalCanvas.cxx.

◆ f_groupCreateChild()

static naRef f_groupCreateChild ( sc::Group & group,
const nasal::CallContext & ctx )
static

Definition at line 205 of file NasalCanvas.cxx.

◆ f_groupGetChild()

static sc::ElementPtr f_groupGetChild ( sc::Group & group,
SGPropertyNode * node )
static

Definition at line 211 of file NasalCanvas.cxx.

◆ f_imageFillRect()

static naRef f_imageFillRect ( sc::Image & img,
const nasal::CallContext & ctx )
static

Definition at line 436 of file NasalCanvas.cxx.

◆ f_imageSetPixel()

static naRef f_imageSetPixel ( sc::Image & img,
const nasal::CallContext & ctx )
static

Definition at line 447 of file NasalCanvas.cxx.

◆ f_keyBindingAddBinding()

static naRef f_keyBindingAddBinding ( sc::KeyBinding & keyBinding,
const nasal::CallContext & ctx )
static

Definition at line 498 of file NasalCanvas.cxx.

◆ f_layoutItemSetVisible()

static naRef f_layoutItemSetVisible ( sc::LayoutItem & item,
const nasal::CallContext & ctx )
static

Definition at line 381 of file NasalCanvas.cxx.

◆ f_newAsBase()

template<class Type, class Base>
static naRef f_newAsBase ( const nasal::CallContext & ctx)
static

Definition at line 431 of file NasalCanvas.cxx.

◆ f_newGridLayout()

static naRef f_newGridLayout ( const nasal::CallContext & ctx)
static

Definition at line 488 of file NasalCanvas.cxx.

◆ f_newKeyBinding()

static naRef f_newKeyBinding ( const nasal::CallContext & ctx)
static

Definition at line 505 of file NasalCanvas.cxx.

◆ f_newSpacerItem()

static naRef f_newSpacerItem ( const nasal::CallContext & ctx)
static

Definition at line 493 of file NasalCanvas.cxx.

◆ f_propElementData()

static naRef f_propElementData ( simgear::PropertyBasedElement & el,
const nasal::CallContext & ctx )
static

Accessor for HTML5 data properties.

set single property:

el.data("myKey", 5);

set multiple properties

el.data({myProp1: 12, myProp2: "test"});

get value of properties

el.data("myKey"); # 5 el.data("myProp2"); # "test"

remove a single property

el.data("myKey", nil);

remove multiple properties

el.data({myProp1: nil, myProp2: nil});

set and remove multiple properties

el.data({newProp: "some text...", removeProp: nil});

See also
http://api.jquery.com/data/

Definition at line 278 of file NasalCanvas.cxx.

◆ f_setInputFocus()

naRef f_setInputFocus ( const nasal::CallContext & ctx)

Definition at line 186 of file NasalCanvas.cxx.

◆ f_ungrabPointer()

naRef f_ungrabPointer ( const nasal::CallContext & ctx)

Definition at line 199 of file NasalCanvas.cxx.

◆ f_windowAddKeyBinding()

static naRef f_windowAddKeyBinding ( sc::Window & window,
const nasal::CallContext & ctx )
static

Definition at line 223 of file NasalCanvas.cxx.

◆ from_nasal_helper()

SGPropertyNode * from_nasal_helper ( naContext c,
naRef ref,
SGPropertyNode **  )

Definition at line 99 of file NasalCanvas.cxx.

◆ initNasalCanvas()

naRef initNasalCanvas ( naRef globals,
naContext c )

Definition at line 510 of file NasalCanvas.cxx.

◆ propElementSetData()

static void propElementSetData ( simgear::PropertyBasedElement & el,
const std::string & name,
const nasal::ContextWrapper & ctx,
naRef ref )
static

Definition at line 230 of file NasalCanvas.cxx.

◆ propNodeGhostCreate()

naRef propNodeGhostCreate ( naContext c,
SGPropertyNode * n )
extern

Definition at line 36 of file nasal-props.cxx.

◆ requireCanvasMgr()

CanvasMgr & requireCanvasMgr ( const nasal::ContextWrapper & ctx)

Definition at line 108 of file NasalCanvas.cxx.

◆ requireGUIMgr()

GUIMgr & requireGUIMgr ( const nasal::ContextWrapper & ctx)

Definition at line 117 of file NasalCanvas.cxx.

◆ to_nasal_helper()

naRef to_nasal_helper ( naContext c,
const osg::BoundingBox & bb )

Definition at line 88 of file NasalCanvas.cxx.