Modules
ADT Database GTK2 GUI IP PiJAX Public Sql Stdio Subversion System Tools Xosd lua v4l2 wx
Recent Changes
Public.Parser.XML2 1.50
Public.ZeroMQ 1.1
Public.Template.Mustache 1.0
Public.Protocols.XMPP 1.4
Sql.Provider.jdbc 1.0
Popular Downloads
Public.Parser.JSON2 1.0
Public.Parser.JSON 0.2
GTK2 2.23
Public.Web.FCGI 1.8
Public.Parser.XML2 1.48
|
Pike Module Reference: module version 0.1, prepared
MODULE GUI |
Modules GTK2
|
Description
All Graphical User Interfaces available for Pike are in this module
|
MODULE GUI.GTK2 |
Classes Alignment Button Container Fixed HBox HSeparator Label Object Separator VBox VSeparator Widget Window
Methods events_pending() flush() init() main() main_quit()
|
Description
A GTK+-2.x module for Pike
This is basically a wrapper around gtk functions. Only very little code (like the module handling) is done apart from gtk code.
-
Method init
void GUI.GTK2.init(array argv)
- Description
Initializes everything needed to operate GTK
- Parameter argv
Command line arguments that might affect GTK
- Note
In contrary to the C gtk_init() function this one doesn't adjust argv to exclude GTK arguments
-
Method events_pending
int GUI.GTK2.events_pending()
- Description
Checks if any events are pending. This can be used to update the GUI and invoke timeouts etc. while doing some time intensive computation.
- Returns
1 if events are pending, 0 otherwise
-
Method flush
void GUI.GTK2.flush()
- Description
Calls gdk_flush()
-
Method main
void GUI.GTK2.main()
- Description
Runs the main loop until main_quit() is called. You can nest calls to main(). In that case main_quit() will make the innermost invocation of the main loop return.
-
Method main_quit
void GUI.GTK2.main_quit()
- Description
Makes the innermost invocation of the main loop return when it regains control.
|
CLASS GUI.GTK2.Widget |
Methods destroy() hide() hide_all() map() realize() set_sensitive() show() show_all() unmap() unrealize()
|
- Description
Base class for all widgets
Signal Prototypes
"accel-closures-changed" void user_function (Widget object, mixed user_data)
"grab-focus" void user_function (Widget object, mixed user_data)
-
Method show_all
void GUI.GTK2.Widget()->show_all()
- Description
Recursively shows a widget, and any child widgets (if the widget is a container).
-
Method show
void GUI.GTK2.Widget()->show()
- Description
Flags a widget to be displayed. Any widget that isn't shown will
not appear on the screen. If you want to show all the widgets in
a container, it's easier to call show_all() on the container,
instead of individually showing the widgets.
Remember that you have to show the containers containing a widget,
in addition to the widget itself, before it will appear onscreen.
When a toplevel container is shown, it is immediately realized and
mapped; other shown widgets are realized and mapped when their
toplevel container is realized and mapped.
-
Method hide
void GUI.GTK2.Widget()->hide()
- Description
Reverses the effects of show(), causing the widget to
be hidden (invisible to the user).
-
Method hide_all
void GUI.GTK2.Widget()->hide_all()
- Description
Recursively hides a widget and any child widgets.
-
Method map
void GUI.GTK2.Widget()->map()
- Description
This function is only for use in widget implementations.
Causes a widget to be mapped if it isn't already.
-
Method unmap
void GUI.GTK2.Widget()->unmap()
- Description
This function is only for use in widget implementations.
Causes a widget to be unmapped if it's currently mapped.
-
Method realize
void GUI.GTK2.Widget()->realize()
- Description
Creates the GDK (windowing system) resources associated
with a widget. Normally realization happens implicitly;
if you show a widget and all its parent containers, then
the widget will be realized and mapped automatically.
Realizing a widget requires all the widget's parent widgets
to be realized; calling realize() realizes the widget's parents
in addition to widget itself. If a widget is not yet inside a
toplevel window when you realize it, bad things will happen.
This function is primarily used in widget implementations,
and isn't very useful otherwise.
-
Method unrealize
void GUI.GTK2.Widget()->unrealize()
- Description
This function is only useful in widget implementations.
Causes a widget to be unrealized (frees all GDK resources
associated with the widget).
-
Method set_sensitive
void GUI.GTK2.Widget()->set_sensitive(int(0..1) sensitive)
- Description
Sets the sensitivity of a widget. A widget is sensitive if the user can interact with it. Insensitive widgets are "grayed out" and the user can't interact with them. Insensitive widgets are known as "inactive", "disabled", or "ghosted" in some other toolkits.
- Parameter sensitive
1 to make a widget sensitive
-
Method destroy
void GUI.GTK2.Widget()->destroy()
- Description
Destroys a widget. When a widget is destroyed, it will
break any references it holds to other objects. If the
widget is inside a container, the widget will be removed
from the container. If the widget is a toplevel (derived
from Window), it will be removed from the list of toplevels,
and the reference GTK+ holds to it will be removed. Removing
a widget from its container or the list of toplevels results
in the widget being finalized, unless you've added additional
references to the widget with g_object_ref().
FIXME: implement g_object_ref()
FIXME: convince me not to implement g_object_ref()
In most cases, only toplevel widgets (windows) require explicit
destruction, because when you destroy a toplevel its children
will be destroyed as well.
|
CLASS GUI.GTK2.Separator |
|
- Description
Base class for HSeparator and VSeparator
|
CLASS GUI.GTK2.Button |
Methods create() get_label() set_label()
|
- Description
A widget that creates a signal when clicked on.
Object Hierarchy
Object -> Widget -> Container -> Bin
-> Button
Signal Prototypes
"activate" void user_function (Button dialog, mixed user_data)
The "activate" signal on GtkButton is an action signal and emitting
it causes the button to animate press then release. Applications should
never connect to this signal, but use the "clicked" signal.
"clicked" void user_function (Button dialog, mixed user_data)
Emitted when a button clicked on by the mouse and the cursor stays on
the button. If the cursor is not on the button when the mouse button
is released, the signal is not emitted.
"enter" void user_function (Button dialog, mixed user_data)
Emitted when the mouse cursor enters the region of the button.
"leave" void user_function (Button dialog, mixed user_data)
Emitted when the mouse cursor leaves the region of the button.
"pressed" void user_function (Button dialog, mixed user_data)
Emitted when the button is initially pressed.
"released" void user_function (Button dialog, mixed user_data)
Emitted when a button which is pressed is released, no matter where
the mouse cursor is.
-
Method create
void GUI.GTK2.Button()->create() void GUI.GTK2.Button()->create(string label) void GUI.GTK2.Button()->create(string label, int(0..1) mnemonic)
- Description
create() creates a plain button to which you can add other Widgets using add(Widget w)
create(string label) creates a button with the given text
- Parameter label
the text on the button
- Parameter mnemonic
whether the character after an underscore ('_') should be interpreted as a mnemonic
-
Method set_label
void GUI.GTK2.Button()->set_label(string label)
- Description
Sets the label of the button
- Parameter label
the new label
-
Method get_label
string GUI.GTK2.Button()->get_label()
- Description
Returns the current label of the button, or 0 if not set
|
CLASS GUI.GTK2.Label |
Methods create() get_text() set_text()
|
- Description
A widget that displays a small to medium amount of text.
-
Method create
void GUI.GTK2.Label()->create(string label)
- Description
Creates a new label with the given text inside it
- Parameter label
text of the label
-
Method set_text
void GUI.GTK2.Label()->set_text(string label)
- Description
Sets the text within the GtkLabel widget. It overwrites any text that was there before.
This will also clear any previously set mnemonic accelerators
- Parameter label
the text you want to set
-
Method get_text
string GUI.GTK2.Label()->get_text()
- Description
Fetches the text from a label widget, as displayed on the screen. This does not include any embedded underlines indicating mnemonics
|
CLASS GUI.GTK2.Container |
Methods add() remove()
|
- Description
Base class for widgets which contain other widgets
Object Hierarchy
Object -> Widget -> Container
Signal Prototypes
"add" void user_function (Container container, Widget widget, mixed user_data)
"check-resize" void user_function (Container container, mixed user_data)
"remove" void user_function (Container container, Widget widget, mixed user_data)
"set-focus-child" void user_function (Container container, Widget widget, mixed user_data)
-
Method add
void GUI.GTK2.Container()->add(object(Widget) widget)
- Description
Adds widget to this Container. Typically used for simple
containers such as Window, Frame, or Button; for more
complicated layout containers such as Box or Table,
this function will pick default packing parameters that may
not be correct. So consider functions such as Box->pack_start()
and Table->attach() as an alternative to add() in those cases.
A widget may be added to only one container at a time; you can't
place the same widget inside two different containers.
FIXME: implement Frame, Button, Box, Table
-
Method remove
void GUI.GTK2.Container()->remove(object(Widget) widget)
- Description
Removes widget from this Container. widget must be inside this
Container. Note that this Container will own a reference to
widget, and that this may be the last reference held; so removing
a widget from its container can destroy that widget. If you want
to use widget again, you need to add a reference to it while it's
not inside a container, using g_object_ref(). If you don't want to
use widget again it's usually more efficient to simply destroy it
directly using destroy() since this will remove it from the
container and help break any circular reference count cycles.
FIXME: implement g_object_ref();
|
CLASS GUI.GTK2.VSeparator |
Methods create()
|
- Description
A vertical separator
-
Method create
void GUI.GTK2.VSeparator()->create()
- Description
Creates a new VSeparator
|
CLASS GUI.GTK2.HSeparator |
Methods create()
|
- Description
A horizontal separator
-
Method create
void GUI.GTK2.HSeparator()->create()
- Description
Creates a new HSeparator
|
CLASS GUI.GTK2.Fixed |
Methods create() move() put()
|
- Description
A container which allows you to position widgets at fixed coordinates
-
Method create
void GUI.GTK2.Fixed()->create()
- Description
Creates a new Fixed
-
Method put
void GUI.GTK2.Fixed()->put(object(Widget) w, int x, int y)
- Description
Adds a widget to a Fixed container at the given position.
- Parameter w
Widget to add
- Parameter x
the horizontal position to place the widget at
- Parameter y
the vertical position to place the widget at
-
Method move
void GUI.GTK2.Fixed()->move(object(Widget) w, int x, int y)
- Description
Moves a child of a Fixed container to the given position.
- Parameter w
Widget to move
- Parameter x
the horizontal position to move the widget to
- Parameter y
the vertical position to move the widget to
|
CLASS GUI.GTK2.Window |
Methods activate_focus() create() get_resizable() get_title() set_destroy_with_parent() set_modal() set_resizable() set_title() set_transient_for()
|
- Description
Toplevel which can contain other widgets
-
Method create
void GUI.GTK2.Window()->create() void GUI.GTK2.Window()->create(int type) void GUI.GTK2.Window()->create(string title) void GUI.GTK2.Window()->create(string title, int type)
- Description
Create a new Window
- Parameter title
The title of the Window
- Parameter type
the Window type
-
Method set_title
void GUI.GTK2.Window()->set_title(string title)
- Description
Sets the title of the Window. The title of a window
will be displayed in its title bar; on the X Window
System, the title bar is rendered by the window manager,
so exactly how the title appears to users may vary
according to a user's exact configuration. The title
should help a user distinguish this window from other
windows they may have open. A good title might include
the application name and current document filename, for example.
-
Method set_resizable
void GUI.GTK2.Window()->set_resizable(int resizable)
- Description
Sets whether the user can resize a window.
Windows are user resizable by default.
-
Method get_resizable
int GUI.GTK2.Window()->get_resizable()
- Description
Gets the value set by set_resizable().
- Returns
1 if the window is resizable, 0 otherwise
-
Method activate_focus
int GUI.GTK2.Window()->activate_focus()
- Description
Activates the current focused widget within the window.
- Returns
1 if a widget got activated, 0 otherwise
-
Method set_modal
void GUI.GTK2.Window()->set_modal(int modal)
- Description
Sets a window modal or non-modal. Modal windows prevent
interaction with other windows in the same application.
To keep modal dialogs on top of main application windows,
use set_transient_for() to make the dialog transient for
the parent; most window managers will then disallow
lowering the dialog below the parent.
-
Method set_transient_for
void GUI.GTK2.Window()->set_transient_for(object(Window) parent)
- Description
Dialog windows should be set transient for the main application window they were spawned from. This allows window managers to e.g. keep the dialog on top of the main window, or center the dialog over the main window.
On Windows, this function will and put the child window on top of the parent, much as the window manager would have done on X.
-
Method set_destroy_with_parent
void GUI.GTK2.Window()->set_destroy_with_parent(int setting)
- Description
If setting is 1, then destroying the transient parent of
window will also destroy window itself. This is useful for
dialogs that shouldn't persist beyond the lifetime of the
main window they're associated with, for example.
-
Method get_title
string GUI.GTK2.Window()->get_title()
- Description
Retrieves the title of the window.
|
CLASS GUI.GTK2.Alignment |
Methods create() get_bottom_padding() get_left_padding() get_right_padding() get_top_padding() set() set_padding()
|
- Description
A widget which controls the alignment and size of its child
Object Hierarchy
Object -> Widget -> Container -> Bin
-> Alignment
-
Method create
void GUI.GTK2.Alignment()->create(float xalign, float yalign, float xscale, float yscale)
- Description
Creates a new Alignment
- Parameter xalign
the horizontal alignment of the child widget, from 0 (left) to 1 (right).
- Parameter yalign
the vertical alignment of the child widget, from 0 (top) to 1 (bottom).
- Parameter xscale
the amount that the child widget expands horizontally to fill up unused space, from 0 to 1. A value of 0 indicates that the child widget should never expand. A value of 1 indicates that the child widget will expand to fill all of the space allocated for the Alignment.
- Parameter yscale
the amount that the child widget expands vertically to fill up unused space, from 0 to 1. The values are similar to xscale.
-
Method set
void GUI.GTK2.Alignment()->set(float xalign, float yalign, float xscale, float yscale)
- Description
Sets the Alignment values
- Parameter xalign
the horizontal alignment of the child widget, from 0 (left) to 1 (right).
- Parameter yalign
the vertical alignment of the child widget, from 0 (top) to 1 (bottom).
- Parameter xscale
the amount that the child widget expands horizontally to fill up unused space, from 0 to 1. A value of 0 indicates that the child widget should never expand. A value of 1 indicates that the child widget will expand to fill all of the space allocated for the Alignment.
- Parameter yscale
the amount that the child widget expands vertically to fill up unused space, from 0 to 1. The values are similar to xscale.
-
Method get_top_padding
int GUI.GTK2.Alignment()->get_top_padding()
- Description
Gets the padding for the top of the widget
- Returns
the padding for the top of the widget
-
Method get_bottom_padding
int GUI.GTK2.Alignment()->get_bottom_padding()
- Description
Gets the padding for the bottom of the widget
- Returns
the padding for the bottom of the widget
-
Method get_left_padding
int GUI.GTK2.Alignment()->get_left_padding()
- Description
Gets the padding for the left of the widget
- Returns
the padding for the left of the widget
-
Method get_right_padding
int GUI.GTK2.Alignment()->get_right_padding()
- Description
Gets the padding for the right of the widget
- Returns
the padding for the right of the widget
-
Method set_padding
void GUI.GTK2.Alignment()->set_padding(int top, int bottom, int left, int right)
- Description
Sets the padding on the different sides of the widget. The padding adds blank space to the sides of the widget. For instance, this can be used to indent the child widget towards the right by adding padding on the left.
- Parameter top
the padding at the top of the widget
- Parameter bottom
the padding at the bottom of the widget
- Parameter left
the padding at the left of the widget
- Parameter right
the padding at the right of the widget
|
CLASS GUI.GTK2.HBox |
Methods create()
|
- Description
HBox is a container that organizes child widgets into a single row.
-
Method create
void GUI.GTK2.HBox()->create() void GUI.GTK2.HBox()->create(int(0..1) homogeneous) void GUI.GTK2.HBox()->create(int(0..1) homogeneous, int spacing)
- Description
Creates a new HBox.
- Parameter homogeneous
whether all children are to be given equal space allotments (default: 0)
- Parameter spacing
the number of pixels to place by default between children (default: 0)
|
CLASS GUI.GTK2.Object |
Methods signal_connect()
|
- Description
The base class of the GTK+ type hierarchy.
Signal Prototypes
"destroy" void user_function (Object object,mixed user_data)
-
Method signal_connect
int GUI.GTK2.Object()->signal_connect(string signal, function callback, mixed|void callback_arg)
- Description
FIXME: add doc
|
CLASS GUI.GTK2.VBox |
Methods create()
|
- Description
VBox is a container that organizes child widgets into a single column.
-
Method create
void GUI.GTK2.VBox()->create() void GUI.GTK2.VBox()->create(int(0..1) homogeneous) void GUI.GTK2.VBox()->create(int(0..1) homogeneous, int spacing)
- Description
Creates a new VBox.
- Parameter homogeneous
whether all children are to be given equal space allotments (default: 0)
- Parameter spacing
the number of pixels to place by default between children (default: 0)
|
|