Appendix C. Using KCWin for Input/Output Windows

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:

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.

C.1. Changes from Previous Versions

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.