Base class for all objects that participate in the GLib
object system.
addEventHandler
public int addEventHandler(String name,
Object cbrecv)
Connect an event to a callback method that has the same
name as the event. For example, the event "clicked" will
be mapped to a method "clicked()" in the object cbrecv.
name
- The name of the event to map.cbrecv
- The name of the object that is to recieve
the event.
- The handle id of the event that can be used in a
call to removeEventHandler.
addEventHandler
public int addEventHandler(String name,
Object cbrecv,
Object data)
Connect a event to a callback method that has the same
name as the event. For example, the event "clicked" will
be mapped to a method "clicked()" in the object cbrecv.
name
- The name of the event to map.cbrecv
- The name of the object that is to recieve
the event.data
- User defined data that will be passed to the callback.
- The handle id of the event that can be used in a
call to removeEventHandler.
addEventHandler
public int addEventHandler(String name,
String func,
Class cbrecv)
Connect a event to a static callback method "func" in
Class "cbrecv".
name
- The name of the event to map.func
- The name of the static callback method.cbrecv
- The name of the class that is to recieve
the event.
- The handle id of the event that can be used in a
call to removeEventHandler.
addEventHandler
public int addEventHandler(String name,
String func,
Class cbrecv,
Object data)
Connect a event to a static callback method "func" in
Class "cbrecv".
name
- The name of the event to map.func
- The name of the static callback method.cbrecv
- The name of the class that is to recieve
the event.data
- User defined data that will be passed to the callback.
- The handle id of the event that can be used in a
call to removeEventHandler.
addEventHandler
public int addEventHandler(String name,
String func,
Object cbrecv)
Connect a event to a callback method "func" in object "cbrecv".
name
- The name of the event to map.func
- The name of the callback method.cbrecv
- The name of the object that is to recieve
the event.
- The handle id of the event that can be used in a
call to removeEventHandler.
addEventHandler
public int addEventHandler(String name,
String func,
Object cbrecv,
Object data)
Connect a event to a callback method "func" in object "cbrecv".
name
- The name of the event to map.func
- The name of the callback method.cbrecv
- The name of the object that is to recieve
the event.data
- User defined data that will be passed to the callback.
- The handle id of the event that can be used in a
call to removeEventHandler.
addListener
public void addListener(PropertyNotificationListener listen)
Add a listener that will be activated when a property is updated
updated ("notify" signal). The notify signal is emitted on an
object when one of its properties has been changed. Note that
getting this signal doesn't guarantee that the value of the
property has actually changed, it may also be emitted when the
setter for the property is called to reinstate the previous
value.
equals
public boolean equals(Object other)
Check if two objects refer to the same (native) object.
other
- the reference object with which to compare.
- true if both objects refer to the same object.
freezeNotify
public void freezeNotify()
Stops emission of "notify" signals on object. The signals are
queued until
thawNotify()
is called.
This is necessary for accessors that modify multiple
properties to prevent premature notification while the object
is still being modified.
getBooleanProperty
public boolean getBooleanProperty(String name)
Convenience method for retrieving boolean properties.
name
- The name of the property to retrieve.
- The value of the given property.
getData
public Object getData(String key)
Gets the Java Object associated with the given key from this
object's object association table.
key
- The association key.
- The Java Object associated with this key or
null if the named association key does not exist.
setData(String,Object)
getData
protected static final Object getData(Handle handle,
String key)
getDoubleProperty
public double getDoubleProperty(String name)
Convenience method for retrieving double properties.
name
- The name of the property to retrieve.
- The value of the given property.
getEventListenerClass
public Class getEventListenerClass(String signal)
getEventType
public EventType getEventType(String signal)
getFloatProperty
public float getFloatProperty(String name)
Convenience method for retrieving float properties.
name
- The name of the property to retrieve.
- The value of the given property.
getGObjectFromHandle
public static GObject getGObjectFromHandle(Handle hndl)
Gets a
GObject instance for the given
Handle. If
no Java object currently exists for the given
Handle, this
method will return
null. You should then instantiate the
required Java class using the class' handle-constructor. For example:
// Get a Handle from somewhere (typically as a parameter to a method
// used as a callback and invoked from the C JNI side).
SomeGtkClass finalobj = null;
GObject obj = GObject.getGObjectFromHandle( handle );
if ( obj == null ) {
finalobj = new SomeGtkClass( handle );
} else {
finalobj = (SomeGtkClass)obj;
}
NOTE: This is for internal use only and should never need to be used
in application code.
getHandle
public final Handle getHandle()
Get the raw handle value. This value
should never be modified by the application. It's
sole use is to pass to native methods.
- the handle value.
getIntFromHandle
protected static final int getIntFromHandle(Handle handle)
Return the int to which the native
Handle
holds a pointer. The native Handle is assumed to hold a C
pointer to an int ( gint* ). This method dereferences that
pointer and returns the value to which it points as an integer.
handle
- The native Handle holding a pointer to an int.
- The int that is pointed to by the native Handle.
getIntProperty
public int getIntProperty(String name)
Convenience method for retrieving int properties.
name
- The name of the property to retrieve.
- The value of the given property.
getJavaObjectProperty
public Object getJavaObjectProperty(String name)
Convenience method for retrieving Object properties.
name
- The name of the property to retrieve.
- The value of the given property.
getLongProperty
public long getLongProperty(String name)
Convenience method for retrieving long properties.
name
- The name of the property to retrieve.
- The value of the given property.
getNullHandle
public static final Handle getNullHandle()
Get a native handle that refers to a null pointer.
getPixbufProperty
public Pixbuf getPixbufProperty(String name)
Convenience method for retrieving Pixbuf properties.
name
- The name of the property to retrieve.
- The value of the given property.
getProperty
public Value getProperty(String name)
Get the
Value
of the given property
(
name). If there is a GTK property with this name, the
GTK property will be retrived. Otherwise, a Java-side property will
be returned.
NOTE: Prefer using one of the convenience methods over using
this method directly.
name
- The name of the property to retrieve.
- The value of the given property.
getStringFromHandle
protected static final String getStringFromHandle(Handle handle)
Return the String to which the native
Handle
holds a pointer. The native Handle is assumed to hold a C
pointer to a String (char* ). This method dereferences that
pointer and returns the value to which it points as a String.
handle
- The native Handle holding a pointer to a String.
- The String that is pointed to by the native Handle.
getStringProperty
public String getStringProperty(String name)
Convenience method for retrieving String properties.
name
- The name of the property to retrieve.
- The value of the given property.
hasProperty
public boolean hasProperty(String name)
Determines if this object supports the given named property. First the
GTK properties are checked, then, if no property with this name is
found, the Java-side properties are checked.
name
- The property to verify.
- True if the given name is a property of this object, false
otherwise.
hashCode
public int hashCode()
Returns a hash code value for the object. This allows for
using GObjects as keys in hashmaps.
- a hash code value for the object.
instantiateJGObjectFromGType
protected static final Object instantiateJGObjectFromGType(int type,
Handle handle)
notify
public void notify(String property_name)
Emits a "notify" signal for the given property. The property can
be a GTK native property or a Java-side property. If no property
exist by the given name, this method does nothing.
property_name
- The name of a property installed on the
class of this object.
removeEventHandler
public void removeEventHandler(int handler)
Disconnect a event from its' callback method.
handler
- The handler id of the event. This is the value
returned from a call to addEventHandler().
removeListener
public void removeListener(PropertyNotificationListener listen)
Remove the given listener from those activated when a property is
updated.
setBooleanProperty
public void setBooleanProperty(String name,
boolean value)
Convenience method for setting boolean properties.
name
- The name of the property to set.value
- The value to set in the property.
setProperty(String,Value)
setData
public void setData(String key,
Object data)
Sets an association from a String to a Java Object to
be stored in the GTK object's table of associations. If the
object already had an association with the given key, the old
association will be destroyed.
key
- The association key.data
- The Java Object to associate with the given key.
getData(String)
setData
protected static final void setData(Handle handle,
String key,
Object data)
setDoubleProperty
public void setDoubleProperty(String name,
double value)
Convenience method for setting double properties.
name
- The name of the property to set.value
- The value to set in the property.
setProperty(String,Value)
setFloatProperty
public void setFloatProperty(String name,
float value)
Convenience method for setting float properties.
name
- The name of the property to set.value
- The value to set in the property.
setProperty(String,Value)
setHandle
protected void setHandle(Handle hndl)
Sets this object's native handle.
setIntProperty
public void setIntProperty(String name,
int value)
Convenience method for setting int properties.
name
- The name of the property to set.value
- The value to set in the property.
setProperty(String,Value)
setJavaObjectProperty
public void setJavaObjectProperty(String name,
Object value)
Convenience method for setting Object properties.
name
- The name of the property to set.value
- The value to set in the property.
setLongProperty
public void setLongProperty(String name,
long value)
Convenience method for setting long properties.
name
- The name of the property to set.value
- The value to set in the property.
setProperty(String,Value)
setPixbufProperty
public void setPixbufProperty(String name,
Pixbuf value)
Convenience method for setting Pixbuf properties.
name
- The name of the property to set.value
- The value to set in the property.
setProperty(String,Value)
setProperty
public void setProperty(String name,
Value val)
Set the given property (
name) with the given
Value
on this object. If there is a GTK property with
this name, the GTK property will be set. Otherwise, a Java-side
property will be set.
NOTE: Prefer using one of the convenience methods over using
this method directly.
name
- The name of the property to set.val
- The value to set in the property.
setStringProperty
public void setStringProperty(String name,
String value)
Convenience method for setting String properties.
name
- The name of the property to set.value
- The value to set in the property.
setProperty(String,Value)
thawNotify
public void thawNotify()
Reverts the effect of a previous call to
freezeNotify()
. This causes all queued "notify"
signals on object to be emitted.