KCWin is a standard plugin distributed with KildClient that allows you to create windows with a terminal for output and an entry box for input. These windows do nothing by themselves, but they can be used by other plugins when they need a window for input and output. The output area supports ANSI colors and thus is like a mini MUD window.
This plugin requires the gtk2-perl bindings. It will fail to run if these bindings are not found.
This plugin is more often used as a helper for other plugins. A plugin that uses KCWin should use $::world->requireplugin('KCWin') in a BEGIN block, as described in Section D.5.1.
Use KCWin->new
to create a new window.
KCWin
derives from
Gtk2::Window
so you can use all of its
methods.
The widgets are accessible for customization. If
$kcw
is a KCWin
, the
following widgets are available:
$kcw->{VBOX}
,
Gtk2::VBox
, the vertical box that contains
the output and input areas.
$kcw->{SCROLLWIN}
,
Gtk2::ScrolledWindow
Gtk2::ScrolledWindow, this
holds the TextView that is used for output.
$kcw->{TEXTVIEW}
,
Gtk2::TextView
, is the widget used for
output.
$kcw->{TEXTBUFFER}
,
Gtk2::TextBuffer
, for convenience, the
TextBuffer displayed in the window.
$kcw->{CMDAREA}
,
Gtk2::HBox
, a box that holds a button to
clear the input area, and the input area itself.
$kcw->{BTNCLEAR}
,
Gtk2::Button
, a button that clears the input
entry widget when clicked.
$kcw->{ENTRY}
,
Gtk2::Entry
, the input entry widget. Connect
to the activate signal of this widget to do something when the user
presses ENTER in this widget.
The widgets can be used, and the window can be customized (by adding
other widgets, for example). Some common actions have functions in
KCWin
as a shortcut. These functions will be
described in the following sections.
KCWin version 1.x used a
Gnome2::Vte::Terminal
for output (the same
widget that was used in the main KildClient window). KCWin version 2.x
(which comes with KildClient 2.x) has changed that in favour of a
Gtk2::TextView
(to match a change in the main
KildClient program).
If you never used the KCWin->{VTE}
variable
directly, you will not need to change anything in your plugins that
use KCWin. If you did, you will probably have to change some things.
The new Gtk2::TextView
widget is accessible via
KCWin->{TEXTVIEW}
, as described above.
Another feature that has been added is a Clear button just like in the MUD windows, which clears the entry widget. However, most plugins should not need to do anything to adapt themselves to that.
Finally, because of the changes, some more widgets are present
in the window, and accessible via elements of the hash that holds a
KCWin
. These widgets are responsible for the
layout of the window.