NAME

App::Chart::Gtk2::Ex::ToplevelSingleton -- single instance of toplevel window

SYNOPSIS

package MyToplevel;
use Gtk2;
use Glib::Object::Subclass 'Gtk2::Window';
use base 'App::Chart::Gtk2::Ex::ToplevelSingleton';

use App::Chart::Gtk2::Ex::ToplevelSingleton hide_on_delete => 1;

$toplevel = MyToplevel->instance;

if (MyToplevel->has_instance) { do_something() }

DESCRIPTION

This package is designed as a multi-inheritance mix-in for subclasses of Gtk2::Window which normally want only a single window instance, to be used throughout a program.

After adding ToplevelSingleton to your @ISA, MyToplevel->instance returns a single shared instance of a MyToplevel window.

SEE ALSO

Class::Singleton