All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Luminous::MultiHead::Window Class Reference

One OpenGL window. More...

#include <Luminous/MultiHead.hpp>

Inheritance diagram for Luminous::MultiHead::Window:
Valuable::Node Valuable::Attribute Patterns::NotCopyable Valuable::Serializable

Valuable Attributes

bool direct-rendering = true
 Direct rendering mode enabled. More...
 
bool frameless = true
 Should the window be frameless. More...
 
int fsaa-samples = 4
 Number of samples per pixel for full-screen anti-aliasing. More...
 
bool fullscreen = false
 Should the window be full-screen. More...
 
int64_t gpu-upload-limit = ((int64_t)4) << 36
 Maximum upload limit for GPU texture and buffer uploads. More...
 
int64_t gpu-upload-margin = ((int64_t)128 << 12)
 Minimum upload limit for GPU texture and buffer uploads. More...
 
Vector2i location = Nimble::Vector2i(0, 0)
 Location of the window in desktop coordinates. More...
 
bool resizeable = false
 Should the window be resizeable. More...
 
int screennumber = -1
 Screen number for the window. Use -1 for default screen. More...
 
- Valuable Attributes inherited from Valuable::Node
Node::Uuid id = generateId()
 Returns the unique id. More...
 

Public Member Functions

LUMINOUS_API void addArea (std::unique_ptr< Area > a)
 Adds an area to the window.
 
int antiAliasingSamples () const
 Number of samples per pixel for full-screen anti-aliasing. More...
 
Areaarea (size_t i)
 Get one of the areas.
 
const Areaarea (size_t i) const
 Get one of the areas.
 
size_t areaCount () const
 Number of areas that this window holds.
 
LUMINOUS_API void deleteAreas ()
 Remove all areas for all windows.
 
bool directRendering () const
 Direct rendering mode enabled. More...
 
bool frameless () const
 Should the window be frameless.
 
bool fullscreen () const
 Should the window be full-screen.
 
LUMINOUS_API Nimble::Recti getRect () const
 Get the window rectangle. More...
 
LUMINOUS_API Nimble::Rect graphicsBounds () const
 Returns the union of the areas' graphics bounds.
 
int height () const
 Returns the height of this window in pixels. More...
 
LUMINOUS_API bool isAreaSoftwareColorCorrected (int areaIndex) const
 Checks if software color correction is in use for the specified area. More...
 
const Vector2i & location () const
 Location of the window in desktop coordinates.
 
LUMINOUS_API void removeArea (size_t i)
 Remove area from given index. More...
 
bool resizeable () const
 Should the window be resizeable.
 
LUMINOUS_API void resizeEvent (Nimble::Size size)
 Resize the window, and automatically one child area. More...
 
const MultiHeadscreen () const
 Return the screen configuration that this Window belongs to.
 
int screennumber () const
 Screen number for the window. Use -1 for default screen.
 
void setAntiAliasingSamples (int samplesPerPixel)
 Setter for attribute fsaa-samples. More...
 
void setDirectRendering (bool enable)
 Set direct rendering mode. More...
 
void setFrameless (bool frameless)
 Setter for attribute frameless. More...
 
void setFullscreen (bool f)
 Sets the fullscreen flag. More...
 
void setGeometry (int x, int y, int w, int h)
 Set the location and size of this window.
 
void setGeometry (Nimble::Vector2i loc, Nimble::Size s)
 Set the location and size of this window.
 
void setLocation (Nimble::Vector2i loc)
 Setter for attribute location. More...
 
void setResizeable (bool resizeable)
 Setter for attribute resizeable. More...
 
void setScreennumber (int s)
 Setter for attribute screennumber. More...
 
LUMINOUS_API void setSeam (float seam)
 Sets the seam for each area.
 
void setSize (Nimble::Size size)
 
void setUploadLimit (int64_t limit)
 Setter for attribute gpu-upload-limit. More...
 
void setUploadMargin (int64_t margin)
 Setter for attribute gpu-upload-margin. More...
 
Nimble::Size size () const
 Size of the window on the computer display.
 
QByteArray type () const
 Element type used during serialization. More...
 
int64_t uploadLimit () const
 Maximum upload limit for GPU texture and buffer uploads. More...
 
int64_t uploadMargin () const
 Minimum upload limit for GPU texture and buffer uploads. More...
 
int width () const
 Returns the width of this window in pixels. More...
 
LUMINOUS_API Window (MultiHead *screen=0)
 Constructs a new window for the given screen.
 
LUMINOUS_API Nimble::Vector2f windowToGraphics (Nimble::Vector2f loc, bool &convOk) const
 Convert a coordinate from screen to graphics coordinates. More...
 
LUMINOUS_API QPointF windowToGraphics (QPointF loc, bool &convOk) const
 Convert a coordinate from screen to graphics coordinates. More...
 
- Public Member Functions inherited from Valuable::Node
bool acceptsEvent (const QByteArray &messageId) const
 Returns true if this object accepts event 'id' in eventProcess.
 
bool addAttribute (Attribute *const attribute)
 Adds a new Attribute to the list of attribute objects. More...
 
bool addAttribute (const QByteArray &name, Attribute *const attribute)
 Adds a new Attribute to the list of attribute objects.
 
template<typename Widget >
bool addAttribute (const QByteArray &name, const Radiant::IntrusivePtr< Widget > &attribute)
 Adds a new Attribute to the list of attribute objects. More...
 
long addListener (const QByteArray &attribute, v8::Persistent< v8::Function > func, int role=Attribute::CHANGE_ROLE)
 Add a JavaScript attribute listener to attribute belonging this Node. More...
 
virtual Attributeattribute (const QByteArray &name) const
 Gets an Attribute with the given name. More...
 
template<typename T >
AttributeT< T > * attribute (const QByteArray &name) const
 Gets an Attribute with the given name. More...
 
const containerattributes () const
 
void clearValues (Layer layer)
 Clears all Attribute values of the given layer. More...
 
void debugDump ()
 Prints the contents of this Attribute to the terminal.
 
virtual bool deserialize (const ArchiveElement &element)
 De-serializes this object (and its children) from a DOM node.
 
void eventAddDeprecated (const QByteArray &deprecatedId, const QByteArray &newId)
 Register a deprecated event that is automatically converted to new event id and a warning is issued when it is used. More...
 
void eventAddIn (const QByteArray &messageId)
 Registers a new event that this class handles in eventProcess.
 
template<typename Widget >
long eventAddListener (const QByteArray &eventId, const QByteArray &messageId, Radiant::IntrusivePtr< Widget > &listener, ListenerType listenerType=DIRECT, const Radiant::BinaryData *defaultData=0)
 Add an event listener to this object. More...
 
long eventAddListener (const QByteArray &eventId, const QByteArray &messageId, Valuable::Node *listener, ListenerType listenerType=DIRECT, const Radiant::BinaryData *defaultData=0)
 Add an event listener to this object. More...
 
long eventAddListener (const QByteArray &eventId, ListenerFuncVoid func, ListenerType listenerType=DIRECT)
 Add an event listener to this object. More...
 
long eventAddListener (const QByteArray &eventId, Node *dstNode, ListenerFuncVoid func, ListenerType listenerType=DIRECT)
 
long eventAddListenerBd (const QByteArray &eventId, Node *dstNode, ListenerFuncBd func, ListenerType listenerType=DIRECT)
 
long eventAddListenerBd (const QByteArray &eventId, ListenerFuncBd func, ListenerType listenerType=DIRECT)
 Add an event listener to this object. More...
 
void eventAddOut (const QByteArray &eventId)
 Registers a new event this class can send with eventSend.
 
const QSet< QByteArray > & eventInNames () const
 Returns set of all registered IN events.
 
unsigned eventListenerCount () const
 Returns the number of event listeners.
 
const QSet< QByteArray > & eventOutNames () const
 Returns set of all registered OUT events.
 
void eventPassingEnable (bool enable)
 Control whether events are passed.
 
template<typename Widget >
int eventRemoveListener (Radiant::IntrusivePtr< Widget > &listener)
 Removes all events from this object to given listener. More...
 
template<typename Widget >
int eventRemoveListener (const QByteArray &eventId=QByteArray(), const QByteArray &messageId=QByteArray(), Radiant::IntrusivePtr< Widget > &listener=Radiant::IntrusivePtr< Widget >())
 Removes events from this object that match the parameters. More...
 
int eventRemoveListener (const QByteArray &eventId=QByteArray(), const QByteArray &messageId=QByteArray(), Valuable::Node *listener=0)
 Removes event listeners from this object. More...
 
int eventRemoveListener (Valuable::Node *listener)
 Removes all events from this object to given listener. More...
 
bool eventRemoveListener (long listenerId)
 Removes event listener with given id. More...
 
void eventSend (const QByteArray &eventId, Radiant::BinaryData &bd)
 Sends an event and bd to all listeners on this eventId.
 
void eventSend (const QByteArray &eventId)
 Sends an event to all listeners on this eventId.
 
template<typename P1 >
void eventSend (const QByteArray &eventId, const P1 &p1)
 Sends an event to all listeners on this eventId. More...
 
template<typename P1 , typename P2 >
void eventSend (const QByteArray &eventId, const P1 &p1, const P2 &p2)
 Sends an event to all listeners on this eventId. More...
 
template<typename P1 , typename P2 , typename P3 >
void eventSend (const QByteArray &eventId, const P1 &p1, const P2 &p2, const P3 &p3)
 Sends an event to all listeners on this eventId. More...
 
template<typename P1 , typename P2 , typename P3 , typename P4 >
void eventSend (const QByteArray &eventId, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4)
 Sends an event to all listeners on this eventId. More...
 
template<typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
void eventSend (const QByteArray &eventId, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5)
 Sends an event to all listeners on this eventId. More...
 
unsigned eventSourceCount () const
 Returns the number of event sources.
 
Uuid id () const
 Returns the unique id.
 
bool isBeingDestroyed () const
 Returns true if we are about to delete this object. More...
 
bool loadFromFileXML (const QString &filename)
 Reads this object (and its children) from an XML file.
 
bool loadFromMemoryXML (const QByteArray &buffer)
 Reads this object (and its children) from a memory buffer.
 
 Node (Node *host, const QByteArray &name="", bool transit=false)
 Constructs a new Node and adds it under the given host. More...
 
 Node (Node &&node)
 Moves a node, including all its attributes, events etc. More...
 
Nodeoperator= (Node &&node)
 Moves a node, replacing this. More...
 
void removeAttribute (Attribute *const attribute)
 Removes an Attribute from the list of attribute objects.
 
bool saveToFileXML (const QString &filename, unsigned int opts=SerializationOptions::DEFAULTS) const
 Saves this object (and its children) to an XML file.
 
bool saveToMemoryXML (QByteArray &buffer, unsigned int opts=SerializationOptions::DEFAULTS) const
 Saves this object (and its children) to binary data buffer.
 
virtual ArchiveElement serialize (Archive &doc) const
 Serializes this object (and its children) to a DOM node.
 
virtual void setAsDefaults ()
 Sets the current USER attribute value as the default value and clears the USER value. More...
 
void setId (Uuid newId)
 Sets the unique id. More...
 
template<class T >
bool setValue (const QByteArray &name, const T &v)
 Uses a query string to find a Attribute, and sets a new value to that if found. More...
 
bool setValue (const QByteArray &name, v8::Handle< v8::Value > v)
 Set attribute value from JavaScript. More...
 
- Public Member Functions inherited from Valuable::Attribute
long addListener (ListenerFunc func, int role=CHANGE_ROLE)
 Adds a listener that is invoked whenever the value is changed. More...
 
long addListener (Node *listener, ListenerFunc func, int role=CHANGE_ROLE)
 Adds a listener that is invoked whenever the value is changed. More...
 
long addListener (v8::Persistent< v8::Function > func, int role=CHANGE_ROLE)
 Adds a JavaScript listener that is invoked whenever the value is changed. More...
 
virtual float asFloat (bool *const ok=0, Layer layer=LAYER_CURRENT) const
 Converts the value object in a floating point number. More...
 
virtual int asInt (bool *const ok=0, Layer layer=LAYER_CURRENT) const
 Converts the value object in an integer. More...
 
virtual QString asString (bool *const ok=0, Layer layer=LAYER_CURRENT) const
 Converts the value object to a string. More...
 
 Attribute (const Attribute &o)
 Create a copy of the given Attribute WITHOUT the link to host, listeners, or the attribute name. More...
 
 Attribute (Node *host, const QByteArray &name, bool transit=false)
 Constructs a new value object and attaches it to its host. More...
 
virtual void clearValue (Layer layer)
 Unsets the value from a specific layer. More...
 
virtual void emitChange ()
 Invokes the change valueChanged function of all listeners.
 
virtual void eventProcess (const QByteArray &id, Radiant::BinaryData &data)
 Process a message. More...
 
void eventProcessFloat (const char *id, float v)
 Utility function for sending a float message to the object.
 
void eventProcessInt (const char *id, int v)
 Utility function for sending an int message to the object.
 
void eventProcessString (const char *id, const QString &str)
 Utility function for sending string message to the object.
 
void eventProcessString (const char *id, const char *str)
 Utility function for sending string message to the object.
 
void eventProcessVector2 (const char *id, Nimble::Vector2)
 Utility function for sending a Nimble::Vector2f message to the object.
 
void eventProcessVector3 (const char *id, Nimble::Vector3)
 Utility function for sending a Vector3 message to the object.
 
void eventProcessVector4 (const char *id, Nimble::Vector4)
 Utility function for sending a Vector4 message to the object.
 
virtual bool handleShorthand (const Valuable::StyleValue &value, Radiant::ArrayMap< Valuable::Attribute *, Valuable::StyleValue > &expanded)
 If attribute supports shorthand properties, this should be used to parse those. More...
 
Nodehost () const
 The host object of the value object (is any). More...
 
virtual bool isChanged () const
 
virtual bool isValueDefinedOnLayer (Layer layer) const
 Check if the given layer defines a value. More...
 
bool layerForSerialization (SerializationOptions flags, Layer &layer) const
 
const QByteArray & name () const
 Returns the name of the object.
 
const Attributeoperator= (const Attribute &)
 Create a copy of the given Attribute WITHOUT the link to host, listeners, or the attribute name. More...
 
AttributeownerShorthand () const
 
QByteArray path () const
 Returns the path (separated by '/'s) from the root.
 
void removeHost ()
 Sets the host pointer to zero and removes this object from the host. More...
 
bool removeListener (Node *listener, int role=ALL_ROLES)
 Removes a listener from the listener list. More...
 
bool removeListener (long id)
 Removes a listener from the listener list. More...
 
void removeListeners (int role=ALL_ROLES)
 Removes listeners from the listener list.
 
virtual bool set (float v, Layer layer=USER, ValueUnit unit=VU_UNKNOWN)
 Sets the value of the object.
 
virtual bool set (int v, Layer layer=USER, ValueUnit unit=VU_UNKNOWN)
 Sets the value of the object.
 
virtual bool set (const QString &v, Layer layer=USER, ValueUnit unit=VU_UNKNOWN)
 Sets the value of the object.
 
virtual bool set (const Nimble::Vector2f &v, Layer layer=USER, QList< ValueUnit > units=QList< ValueUnit >())
 Sets the value of the object.
 
virtual bool set (const Nimble::Vector3f &v, Layer layer=USER, QList< ValueUnit > units=QList< ValueUnit >())
 Sets the value of the object.
 
virtual bool set (const Nimble::Vector4f &v, Layer layer=USER, QList< ValueUnit > units=QList< ValueUnit >())
 Sets the value of the object.
 
virtual bool set (const StyleValue &value, Layer layer=USER)
 Sets the value of the object.
 
void setName (const QByteArray &s)
 Sets the name of the object.
 
void setOwnerShorthand (Attribute *owner)
 
- Public Member Functions inherited from Valuable::Serializable
virtual bool deserializeXML (const DOMElement &element)
 Deserializes (reads) this object from an XML element. More...
 
bool isSerializable () const
 
void setSerializable (bool v)
 

Friends

class Area
 

Additional Inherited Members

- Public Types inherited from Valuable::Node
typedef container::const_iterator const_iterator
 
typedef Radiant::ArrayMap
< QByteArray, Attribute * > 
container
 Container for attributes, key is the attribute name.
 
typedef container::iterator iterator
 Iterator for the container.
 
typedef std::function< void(Radiant::BinaryData &)> ListenerFuncBd
 Listener function type that takes a BinaryData reference as a parameter, similar to eventProcess.
 
typedef std::function< void()> ListenerFuncVoid
 Default listener function type.
 
enum  ListenerType { DIRECT =1, AFTER_UPDATE =2, AFTER_UPDATE_ONCE =4 }
 Types of event listeners. More...
 
typedef int64_t Uuid
 Unique identifier type.
 
- Static Public Member Functions inherited from Valuable::Node
static bool copyValues (const Node &from, Node &to)
 Copies attribute values from one node to another. More...
 
static void disableQueue ()
 Disables all AFTER_UPDATE event processing, no new events will be accepted and the current queue will be cleared. More...
 
static Uuid generateId ()
 Generates a unique identifier. More...
 
static void invokeAfterUpdate (ListenerFuncVoid function)
 Queue function to be called in the main thread after the next update() More...
 
static int processQueue ()
 Triggers any pending AFTER_UPDATE-events. More...
 
static void reEnableQueue ()
 Enables queue after calling disableQueue. More...
 
static void setFatalOnEventMismatch (bool haltApplication)
 Controls what to do when an event mismatch is detected The default behavior is to output a warning to the terminal (haltApplication = false). More...
 
- Protected Member Functions inherited from Valuable::Node
virtual void attributeAdded (Attribute *attribute)
 This is called when new attribute is added to Node. More...
 
virtual void attributeRemoved (Attribute *attribute)
 This is called when attribute is removed from Node. More...
 
Nodesender ()
 Get the sender of the event, only valid in DIRECT events. More...
 
void setBeingDestroyed ()
 Sets 'isBeginDestroyed' flag to true and removes all event listeners to this object. More...
 

Detailed Description

One OpenGL window.

A window is responsible for one OpenGL context.

Member Function Documentation

int Luminous::MultiHead::Window::antiAliasingSamples ( ) const
inline

Number of samples per pixel for full-screen anti-aliasing.

Returns
Current value of the fsaa-samples attribute
bool Luminous::MultiHead::Window::directRendering ( ) const
inline

Direct rendering mode enabled.

Returns
true if direct rendering is enabled, false is rendering is done through an off-screen render target
Current value of the direct-rendering attribute
LUMINOUS_API Nimble::Recti Luminous::MultiHead::Window::getRect ( ) const

Get the window rectangle.

Returns
window rectangle
int Luminous::MultiHead::Window::height ( ) const
inline

Returns the height of this window in pixels.

Returns
height of the window
LUMINOUS_API bool Luminous::MultiHead::Window::isAreaSoftwareColorCorrected ( int  areaIndex) const

Checks if software color correction is in use for the specified area.

This function returns true if 3D RGB cube color-correction is used, false if the 2D color-correction is used or the 3D color-correction is disabled.

Parameters
areaIndexarea index
Returns
true if 3D color-correction is used; otherwise false
LUMINOUS_API void Luminous::MultiHead::Window::removeArea ( size_t  i)

Remove area from given index.

Note that after this ordering of the areas in greater indices will be changed

LUMINOUS_API void Luminous::MultiHead::Window::resizeEvent ( Nimble::Size  size)

Resize the window, and automatically one child area.

This method is used when the window contains only one child
area, and automatially changes the size of the area to match
the area of the window.
Parameters
sizenew window size
void Luminous::MultiHead::Window::setAntiAliasingSamples ( int  samplesPerPixel)
inline

Setter for attribute fsaa-samples.

Parameters
samplesPerPixelnew attribute value
void Luminous::MultiHead::Window::setDirectRendering ( bool  enable)
inline

Set direct rendering mode.

Setter for attribute direct-rendering.

Parameters
enablenew attribute value
void Luminous::MultiHead::Window::setFrameless ( bool  frameless)
inline

Setter for attribute frameless.

Parameters
framelessnew attribute value
void Luminous::MultiHead::Window::setFullscreen ( bool  f)
inline

Sets the fullscreen flag.

Setter for attribute fullscreen.

Parameters
fnew attribute value
void Luminous::MultiHead::Window::setLocation ( Nimble::Vector2i  loc)
inline

Setter for attribute location.

Parameters
locnew attribute value
void Luminous::MultiHead::Window::setResizeable ( bool  resizeable)
inline

Setter for attribute resizeable.

Parameters
resizeablenew attribute value
void Luminous::MultiHead::Window::setScreennumber ( int  s)
inline

Setter for attribute screennumber.

Parameters
snew attribute value
void Luminous::MultiHead::Window::setUploadLimit ( int64_t  limit)
inline

Setter for attribute gpu-upload-limit.

Parameters
limitnew attribute value
void Luminous::MultiHead::Window::setUploadMargin ( int64_t  margin)
inline

Setter for attribute gpu-upload-margin.

Parameters
marginnew attribute value
QByteArray Luminous::MultiHead::Window::type ( ) const
inlinevirtual

Element type used during serialization.

Returns
"window"

Reimplemented from Valuable::Attribute.

int64_t Luminous::MultiHead::Window::uploadLimit ( ) const
inline

Maximum upload limit for GPU texture and buffer uploads.

Returns
Current value of the gpu-upload-limit attribute
int64_t Luminous::MultiHead::Window::uploadMargin ( ) const
inline

Minimum upload limit for GPU texture and buffer uploads.

Returns
Current value of the gpu-upload-margin attribute
int Luminous::MultiHead::Window::width ( ) const
inline

Returns the width of this window in pixels.

Returns
width of the window
LUMINOUS_API Nimble::Vector2f Luminous::MultiHead::Window::windowToGraphics ( Nimble::Vector2f  loc,
bool &  convOk 
) const

Convert a coordinate from screen to graphics coordinates.

This class traverses through all the areas to find an area that would include given location. It is entirely possible none of the areas contains the given coordinate, as there can be gaps between areas (due to keystoning, for example).

Parameters
locThe location in screen coordinates.
convOkset to true or false depending on whether the conversion could be carried out.
Returns
the point in graphics coordinates
LUMINOUS_API QPointF Luminous::MultiHead::Window::windowToGraphics ( QPointF  loc,
bool &  convOk 
) const

Convert a coordinate from screen to graphics coordinates.

This class traverses through all the areas to find an area that would include given location. It is entirely possible none of the areas contains the given coordinate, as there can be gaps between areas (due to keystoning, for example).

Parameters
locThe location in screen coordinates.
convOkset to true or false depending on whether the conversion could be carried out.
Returns
the point in graphics coordinates