guit  0.1
 All Classes Functions Variables Typedefs Enumerations Friends
Public Types | Public Member Functions | Static Public Member Functions | List of all members
guit::GChannel Class Reference

Input channel. More...

Inheritance diagram for guit::GChannel:
guit::GCursor guit::GProp guit::GObject

Public Types

using Specif = int32_t
 Specificity of Properties.
 

Public Member Functions

GCursorclone (bool) const override
 Clones the prop (when applicable). More...
 
unsigned int channel () const
 returns the channel of this cursor.
 
GCursoroperator<< (GFunction const &fun)
 Adds a callback that is fired when the mouse value is changed.
 
void show (bool state)
 Shows/hides this cursor.
 
void freeze (bool state)
 Freezes this cursor. More...
 
void setColor (GColor &)
 Changes the color of the cursor.
 
GColorcolor () const
 Returns the color of the cursor.
 
void setShape (Shape)
 Changes the shape of the cursor. More...
 
Shape shape () const
 Returns the shape of the cursor.
 
void displayAsNative (bool)
 Displays this cursor as a native cursor. More...
 
void startDrag (Gadget &from, std::function< void(GCursor &)> const &onDrop, Shape=Hand)
 Starts a Drag & Drop action controlled by this cursor. More...
 
bool isDragging () const
 Returns true if a Drag & Drop is being performed.
 
Gadgetsource ()
 Returns the gadget where the Drag & Drop started from (if any).
 
GWindowsourceWindow ()
 Returns the window where the Drag & Drop started from (if any).
 
Gadgettarget ()
 Returns the gadget where the Drag & Drop ended (if any).
 
GWindowtargetWindow ()
 Returns the window where the Drag & Drop ended (if any).
 
GPoint const & targetPos ()
 Returns the position in the window where the Drag & Drop ended.
 
virtual bool isMutable () const
 Returns true if the prop is mutable. More...
 
virtual void setImmutable ()
 Makes the prop immutable. More...
 
virtual GString stringValue () const
 Returns the value of the prop as a string. More...
 
virtual float floatValue () const
 Returns the value of the prop as a float. More...
 
virtual bool boolValue () const
 Returns the value as a bool. More...
 
virtual bool isEquivalent (GProp const &other) const
 Returns true if these props are equivalent. More...
 
virtual bool onAdd (Gadget *)
 Called when the property is added to an object. More...
 
virtual void onRemove (Gadget *)
 Called when the property is removed from an object. More...
 
virtual void error (GString const &funname, GString const &message) const
 Prints an error message. More...
 
void operator delete (void *)
 delete does nothing, see GObject class.
 
void forgetSmartPointers ()
 Forgets all smart pointers pointing this object. More...
 
unsigned int useCount () const
 Returns the numbers of smart pointers referencing the object.
 
virtual void removeNotifiers (void *obj)
 [Implementation] Notifies this object that it must no longer refer obj.
 
void move (GPoint const &pos)
 Moves the cursor on the screen (screen coordinates).
 
GPoint const & pos () const
 Returns the position of the cursor on the screen.
 
GPoint wpos () const
 Returns the position of the cursor relative to the current window. More...
 
GString typeName () const override
 Returns the name and role of the prop's type.
 
GProptoProp () override
 Class conversions.
 
bool write (GString const &filename) const
 Writes the value of the prop on a file or a stream.
 
virtual class GVarProptoVarProp ()
 Type conversions.
 
template<class Subclass >
Subclass * to ()
 Class conversions.
 
void ignoreSmartPointers ()
 Checks/sets whether this object can be auto-deleted by smart pointers. More...
 

Static Public Member Functions

static GDim screenSize ()
 Returns the size of the main screen.
 
static GCursorcursor (unsigned int channel=0)
 Returns the cursor corresponding to this input channel if it exists, null otherwise. More...
 
static GCursorobtainCursor (unsigned int channel=0)
 Returns the cursor corresponding to this channel, creates it if needed. More...
 
static int cursorCount ()
 Returns the number of cursors that currently exist. More...
 
using GType = GPropType
 Returns prop's meta-class. More...
 

Detailed Description

Input channel.

Member Typedef Documentation

using guit::GProp::GType = GPropType
inherited

Returns prop's meta-class.

Both functions return the prop's type, but Type() is a static method and type() a virtual method.

Member Function Documentation

GCursor* guit::GCursor::clone ( bool  copy_value) const
inlineoverridevirtualinherited

Clones the prop (when applicable).

Mutable props (i.e. deriving from GVarProp) can be cloned, otherwise this method returns null. The value is copied if copy_value is used, the default value is used otherwise.

Reimplemented from guit::GProp.

GCursor * guit::GCursor::cursor ( unsigned int  channel = 0)
staticinherited

Returns the cursor corresponding to this input channel if it exists, null otherwise.

See Also
obtainCursor().
GCursor & guit::GCursor::obtainCursor ( unsigned int  channel = 0)
staticinherited

Returns the cursor corresponding to this channel, creates it if needed.

  • 0 specifies the system cursor, it is linked to the native event flow.
  • strictly positive values specify pseudo-cursors. Each pseudo-cursor is linked to the event flow of a separate input channel. Pseudo-cursors can only be displayed on Guit windows (not on the entire screen)
    See Also
    cursor()
int guit::GCursor::cursorCount ( )
staticinherited

Returns the number of cursors that currently exist.

Always >= 1 because this count includes the system cursor.

GPoint guit::GCursor::wpos ( ) const
inherited

Returns the position of the cursor relative to the current window.

Return {0,0} if no current window

void guit::GCursor::freeze ( bool  state)
inherited

Freezes this cursor.

The cursors won't move if state is true. However if will still receive events.

void guit::GCursor::setShape ( Shape  shape)
inherited

Changes the shape of the cursor.

Works only if this cursor display a native cursor (typically, cursor(0)).

void guit::GCursor::displayAsNative ( bool  val)
inherited

Displays this cursor as a native cursor.

This cursor will be displayed as a native cursor, even if it's not the system cursor. This feature allows moving the native cursor in a customized way that don't depend on the native event flow, e.g. to change the mouse gain dynamically or to process input from multiple touchpads differently. The system cursor (cursor(0)) should then typically be frozen, meaning it will still receive events but won't move the cursor on the screen. This method has no effect of the system cursor (cursor(0)).

void guit::GCursor::startDrag ( Gadget from,
std::function< void(GCursor &)> const &  onDrop,
Shape  shape = Hand 
)
inherited

Starts a Drag & Drop action controlled by this cursor.

onDrop is called when the drag-and-drop operation ends.

virtual bool guit::GProp::isMutable ( ) const
inlinevirtualinherited

Returns true if the prop is mutable.

Returns true only if the prop derives from GVarProp and setImmutable() was not called. Props with another type than GVarProp are always immutable.

Reimplemented in guit::GVarProp.

virtual void guit::GProp::setImmutable ( )
inlinevirtualinherited

Makes the prop immutable.

Affects only GVarProp props (other props are always immutable). A prop cannot be made mutable again after this method has been called.

Reimplemented in guit::GVarProp.

virtual GString guit::GProp::stringValue ( ) const
inlinevirtualinherited
virtual float guit::GProp::floatValue ( ) const
inlinevirtualinherited

Returns the value of the prop as a float.

Returns 0.f if the prop has no value of its value cannot be converted to a float.

Reimplemented in guit::GNumExpr, guit::GTextExpr, guit::GBoolExpr, guit::GExpr, guit::GState, guit::GText, and guit::GBool.

virtual bool guit::GProp::boolValue ( ) const
inlinevirtualinherited

Returns the value as a bool.

Returns false if the prop has no value of its value cannot be converted to a bool.

Reimplemented in guit::GNumExpr, guit::GTextExpr, guit::GBoolExpr, guit::GExpr, and guit::GBool.

bool guit::GProp::isEquivalent ( GProp const &  other) const
virtualinherited

Returns true if these props are equivalent.

Adding a prop to a gadget replaces the equivalent prop it contains (if it contains any). In all other cases, the prop is added to the gadget proplist. NOTE: props with a negative role are never equivalent!

Reimplemented in guit::GExpr, guit::GCond, guit::GState, and guit::GAnim.

bool guit::GProp::onAdd ( Gadget g)
virtualinherited

Called when the property is added to an object.

note: must call addModes().

Reimplemented in guit::GTextData, guit::GTip, guit::GCond, guit::GDragPos, guit::GDragSize, guit::GPos, guit::GText, guit::GSize, guit::GFlex, guit::GFlow, guit::GItems, and guit::GValue.

void guit::GProp::onRemove ( Gadget g)
virtualinherited

Called when the property is removed from an object.

note: must call removeModes().

Reimplemented in guit::GTextData, guit::GTip, guit::GCond, guit::GDragPos, guit::GDragSize, guit::GPos, guit::GText, guit::GSize, guit::GFlex, and guit::GHotkey.

void guit::GObject::error ( GString const &  funname,
GString const &  message 
) const
virtualinherited

Prints an error message.

See Also
GApp::onError() to change error management.
void guit::GObject::ignoreSmartPointers ( )
inlineinherited

Checks/sets whether this object can be auto-deleted by smart pointers.

ignoreSmartPointers() has a permanent effect, contrary to forgetSmartPointers(). Objects not created by calling new are never auto-deleted by smart pointers.

void guit::GObject::forgetSmartPointers ( )
inlineinherited

Forgets all smart pointers pointing this object.

The smart pointers that are currently pointing to the object won't auto-delete it. forgetSmartPointers() has a temporary effect, contrary to ignoreSmartPointers().


The documentation for this class was generated from the following files: