API-Version: 1.9

GtkWidget

It is possible to create new widgets but only widgets that are currently used by dwb can be created. The widgets used by dwb can be found under {@see http://portix.bitbucket.org/dwb/resources/layout.html}

new GtkWidget(name)

Constructs a new GtkWidget

Parameters:
Name Type Description
name String

Name of the Widget, e.g. "GtkLabel"

Source:
Returns:

A GtkWidget

Example
var myLabel = new GtkWidget("GtkLabel");

Extends

Methods

add(widget)

Adds a child to a GtkWidget, note that the function can only be called on widgets derived from GtkContainer

Parameters:
Name Type Description
widget GtkWidget

The widget to add to the container

Source:

blockSignal(id)

Blocks emission of a signal

Parameters:
Name Type Description
id Number

The signal id retrieved from GObject#connect

Inherited From:
Source:

connect(name, callback, after) → {Number}

Connect to a GObject-signal. Note that all signals are connected using the signal::- or with notify::-prefix. If connecting to a signal the signal::-prefix must be omitted. The callback function will have the same parameters as the GObject signal callback without the first parameter, however some parameters may be undefined if they cannot be converted to javascript objects. All signal handlers are executed after dwb’s default handler.

Parameters:
Name Type Argument Description
name String

The signal name.

callback GObject~connectCallback

Callback that will be called when the signal is emitted.

after Boolean <optional>

Whether to connect after the default signal handler.

Inherited From:
Source:
Returns:

The signal id of this signal

Type
Number

connectBlocked(name, callback, after) → {Number}

Connect to a gobject-signal but block the emission of the own callback during execution of the callback. Useful if the object is connected to a notify event and the the property is changed in the callback function.

Parameters:
Name Type Argument Description
name String

The signal name.

callback Function

Callback that will be called when the signal is emitted.

after Boolean <optional>

Whether to connect after the default signal handler.

Inherited From:
Source:
Returns:

The signal id of this signal

Type
Number

destroy()

Destroys a widget

Source:

disconnect(id) → {Boolean}

Disconnects from a signal

Parameters:
Name Type Description
id Number

The signal id retrieved from GObject.connect

Inherited From:
Source:
Returns:

Whether a signal was found and disconnected

Type
Boolean

getChildren() → {Array[GtkWidget]}

Gets all children of a widget. Note that this function can only be called on widgets derived from GtkContainer.

Since:
  • 1.9
Source:
Returns:

An array of children or an empty array if the widget has no children

Type
Array[GtkWidget]

notify(name, callback, after) → {Number}

Connects to a property change notification

Parameters:
Name Type Argument Description
name String

The property name, can also be in camelcase.

callback GObject~notifyCallback

Callback that will be called when the property changes

after Boolean <optional>

Whether to connect after the default handler.

Inherited From:
Source:
Returns:

The signal id of this signal

Type
Number

notifyBlocked(name, callback, after) → {Number}

Connects to a property change notification but with signal blocking. Must be used if the property is modified in the callback function.

Parameters:
Name Type Argument Description
name String

The property name, can also be in camelcase.

callback GObject~notifyCallback

Callback that will be called when the property changes

after Boolean <optional>

Whether to connect after the default handler.

Inherited From:
Deprecated:
  • Yes
Source:
Returns:

The signal id of this signal

Type
Number
Example
 
gui.statusLabel.notifyBlocked("label", function() {
     this.label += "foo"; 
});

packEnd(child, expand, fill, padding)

Adds a widget to a GtkBox

Parameters:
Name Type Description
child GtkWidget

The child widget

expand Boolean

Whether to expand the widget

fill Boolean

Whether to fill the remaining space

padding Number

Padding in the box

Source:

packStart(child, expand, fill, padding)

Adds a widget to a GtkBox

Parameters:
Name Type Description
child GtkWidget

The child widget

expand Boolean

Whether to expand the widget

fill Boolean

Whether to fill the remaining space

padding Number

Padding in the box

Source:

remove(widget)

Removes a child from a GtkWidget, note that the function can only be called on widgets derived from GtkContainer

Parameters:
Name Type Description
widget GtkWidget

The widget to remove from the container

Since:
  • 1.9
Source:

reorderChild(child, position)

Moves a widget in a GtkBox or a GtkMenu to a new Position

Parameters:
Name Type Description
child GtkWidget

The child widget

position Number

Whether to expand the widget

Source:

unblockSignal(id)

Unblocks a signal that was blocked with GObject#blockSignal

Parameters:
Name Type Description
id Number

The signal id retrieved from GObject#connect

Inherited From:
Source: