Gtk-Perl
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
Bonobo/Bonobo.pm view on Meta::CPAN
package Bonobo;
require Gnome;
require Exporter;
require DynaLoader;
require AutoLoader;
use CORBA::ORBit
defines => "-D__ORBIT_IDL__ -D__BONOBO_COMPILATION",
idl_path => "/usr/share/idl:/usr/local/share/idl:/opt/idl",
idl => ['Bonobo.idl'];
require Carp;
$VERSION = "0.7010";
my $orb = CORBA::ORB_init("orbit-local-orb");
my $poa = $orb->resolve_initial_references("RootPOA");
@ISA = qw(Exporter DynaLoader);
# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
@EXPORT = qw(
);
# Other items we are prepared to export if requested
@EXPORT_OK = qw(
);
require Bonobo::Types;
sub dl_load_flags {Gtk::dl_load_flags()}
bootstrap Bonobo $VERSION;
# Autoload methods go after __END__, and are processed by the autosplit program.
sub getopt_options {
my $dummy;
return (
"oaf-od-ior=s" => \$dummy,
"oaf-ior-fd=i" => \$dummy,
"oaf-activate-iid=s" => \$dummy,
"oaf-private" => \$dummy,
);
}
# perl-side interface implementations
my $ListenerId = 0;
package Bonobo::UnknownImpl;
@ISA = "POA_".CORBA::ORBit::find_interface("IDL:Bonobo/Unknown:1.0");
sub new {
my ($class, @attrs) = @_;
my $self = bless {__repoid => $class->_porbit_repoid, @attrs}, $class;
return $self;
}
# do we actually need to ref/unref here? What about objects we haven't created?
sub ref { }
sub unref { }
sub queryInterface {
my ($self, $repo) = @_;
if (!defined($repo) || $repo eq $self->{__repoid}) {
return $self->{__object} if exists $self->{__object};
my $id = $poa->activate_object ($self);
return $self->{__object} = $poa->id_to_reference ($id);
}
foreach my $child (@{$self->{__objects}}) {
my $ref = $child->queryInterface($repo);
return $ref if defined $ref;
}
return undef;
}
package Bonobo::ListenerImpl;
@ISA = ("POA_".CORBA::ORBit::find_interface("IDL:Bonobo/Listener:1.0"), 'Bonobo::UnknownImpl');
sub event {
my ($self, $event_name, $any) = @_;
Carp::carp "$self received event '$event_name': you need to provide your own event handler";
}
package Bonobo::EventSourceImpl;
@ISA = ("POA_".CORBA::ORBit::find_interface("IDL:Bonobo/EventSource:1.0"), 'Bonobo::UnknownImpl');
sub addListener {
$_[0]->addListenerWithMask($_[1]);
}
sub addListenerWithMask {
my ($self, $listener, $event_mask) = @_;
$ListenerId++;
$self->{__listeners}->{$ListenerId} = $listener;
if (defined $event_mask) {
$self->{__emasks}->{$ListenerId} = [split(/,/,$event_mask)]
}
return $ListenerId;
}
sub removeListener {
my ($self, $id) = @_;
my $ref = delete $self->{__listeners}->{$id};
# raise exception unless defined($ref);
}
# for use in perl, not a function in the interface
sub notify {
my ($self, $event, $val) = @_;
foreach my $id (keys %{$self->{__listeners}}) {
my $listener = $self->{__listeners}->{$id};
if (!exists $self->{__emasks}->{$id}) {
$listener->event($event, $val);
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.889 second using v1.00-cache-2.02-grep-82fe00e-cpan-1925d2aa809 )