Skip to content
reduz edited this page Feb 23, 2014 · 12 revisions

Object

Category: Core\

Brief Description

Base class for all non built-in types.

Member Functions

Signals

  • script_changed**(****)**

Numeric Constants

  • NOTIFICATION_POSTINITIALIZE = 0 - Called right when the object is initialized. Not available in script.
  • NOTIFICATION_PREDELETE = 1 - Called before the object is about to be deleted.
  • CONNECT_DEFERRED = 1 - Connect a signal in deferred mode. This way, signal emissions are stored in a queue, then set on idle time.
  • CONNECT_PERSIST = 2 - Persisting connections are saved when the object is serialized to file.
  • CONNECT_ONESHOT = 4 - One short connections disconnect themselves after emission.

Description

Base class for all non built-in types. Everything not a built-in type starts the inheritance chain from this class. Objects do not manage memory, if inheriting from one the object will most likely have to be deleted manually (call the #free function from the script or delete from C++). Some derivates add memory management, such as reference (which keps a reference count and deletes itself automatically when no longer referenced) and node, which deletes the children tree when deleted. Objects export properties, which are mainly useful for storage and editing, but not really so much in programming. Properties are exported in #_get_property_list and handled in #_get and [_set]. However, scripting languages and C++ have simper means to export them. Objects also receive notifications (#_notification). Notifications are a simple way to notify the object about simple events, so they can all be handled together.

Member Function Description

== _get ==

  • void #_get( String property ) virtual \ Return a property, return null if the property does not exist. == _get_property_list ==
  • Array [[#get_property_list|get_property_list]](****) virtual \ Return the property list, array of dictionaries, dictionaries must countain: name:String, type:int (see TYPE* enum in globals) and optionally: hint:int (see PROPERTY_HINT* in globals), hint_string:String, usage:int (see PROPERTY_USAGE_* in globals). == _notification ==
  • void #_notification( int what ) virtual \ Notification request, the notification id is received. == _set ==
  • void #_set( String property, var value ) virtual \ Set a property. Return true if the property was found. == get_type ==
  • String #get_type(****) const \ Return the type of the object as a string. == is_type ==
  • bool #is_type( String type ) const \ Check the type of the obeject against a string (including inheritance). == set ==
  • void #set( String property, var value ) \ Set property into the object. == get ==
  • void #get( String property ) const \ Get a property from the object. == get_property_list ==
  • Array #get_property_list(****) const \ Return the list of properties as an array of dictionaries, dictionaries countain: name:String, type:int (see TYPE_* enum in globals) and optionally: hint:int (see PROPERTY_HINT_* in globals), hint_string:String, usage:int (see PROPERTY_USAGE_* in globals). == notification ==
  • void #notification( int what, bool arg1=false ) \ Notify the object of something. == get_instance_ID ==
  • int #get_instance_ID(****) const \ Return the instance ID. All objects have a unique instance ID. == set_script ==
  • void #set_script( Script script ) \ Set a script into the object, scripts extend the object functionality. == get_script ==
  • Script #get_script(****) const \ Return the object script (or null if it doesn't have one). == set_meta ==
  • void #set_meta( String name, var value ) \ Set a metadata into the object. Medatada is serialized. Metadata can be //anything//. == get_meta ==
  • void #get_meta( String name ) const \ Return a metadata from the object. == has_meta ==
  • bool #has_meta( String name ) const \ Return true if a metadata is found with the requested name. == get_meta_list ==
  • StringArray #get_meta_list(****) const \ Return the list of metadatas in the object. == add_user_signal ==
  • void #add_user_signal( String signal, Array arguments=Array() ) \ Add a user signal (can be added anytime). Arguments are optional, but can be added as an array of dictionaries, each containing "name" and "type" (from [@GlobalScope] TYPE_*). == emit_signal ==
  • void #emit_signal( String signal, var arg0=NULL, var arg1=NULL, var arg2=NULL, var arg3=NULL, var arg4=NULL ) \ Emit a signal. Arguments are passed in an array. == call ==
  • void #call( String method, var arg0=NULL, var arg1=NULL, var arg2=NULL, var arg3=NULL, var arg4=NULL, var arg5=NULL, var arg6=NULL, var arg7=NULL, var arg8=NULL, var arg9=NULL ) \ Call a function in the object, result is returned. == call_deferred ==
  • void #call_deferred( String method, var arg0=NULL, var arg1=NULL, var arg2=NULL, var arg3=NULL, var arg4=NULL ) \ Create and store a function in the object. The call will take place on idle time. == get_signal_list ==
  • Array #get_signal_list(****) const \ Return the list of signals as an array of dictionaries. == connect ==
  • void #connect( String signal, Object target, String method, Array binds=Array(), int flags=0 ) \ Connect a signal to a method at a target (member function). Binds are optional and are passed as extra arguments to the call. Flags specify optional deferred or one shot connections, see enum CONNECT_*. A signal can only be connected once to a method, and it will throw an error if already connected. If you want to avoid this, use #is_connected to check. == disconnect ==
  • void #disconnect( String signal, Object target, String method ) \ Disconnect a signal from a method. == is_connected ==
  • bool #is_connected( String signal, Object target, String method ) const \ Return true if a connection exists for a given signal and target/method. == set_block_signals ==
  • void #set_block_signals( bool enable ) \ If set to true, signal emission is blocked. == is_blocking_signals ==
  • bool #is_blocking_signals(****) const \ Return true if signal emission blocking is enabled. == set_message_translation ==
  • void #set_message_translation( bool enable ) \ Set true if this object can translate strings (in calls to tr() ). Default is true. == can_translate_messages ==
  • void #can_translate_messages( bool arg0 ) \ Return true if this object can translate strings. == XL_MESSAGE ==
  • String #XL_MESSAGE( String message ) const \ deprecated, will go away. == tr ==
  • String #tr( String message ) const \ Translate a message. Only works in message translation is enabled (which is by default). See #set_message_translation.
Clone this wiki locally