App-Guiio
view release on metacpan or search on metacpan
lib/App/Guiio.pm view on Meta::CPAN
$self->{CURRENT_ACTIONS} = $self->{ACTIONS} ;
$self->set_font($self->{FONT_FAMILY}, $self->{FONT_SIZE});
}
#-----------------------------------------------------------------------------
sub destroy
{
my ($self) = @_;
$self->{widget}->get_toplevel()->destroy() ;
}
#-----------------------------------------------------------------------------
sub set_title
{
my ($self, $title) = @_;
if(defined $title)
{
$self->{widget}->get_toplevel()->set_title($title . ' - guiio') ;
$self->{TITLE} = $title ;
}
}
sub get_title
{
my ($self) = @_;
$self->{TITLE} ;
}
#-----------------------------------------------------------------------------
sub set_font
{
my ($self, $font_family, $font_size) = @_;
$self->{FONT_FAMILY} = $font_family || 'Monospace';
$self->{FONT_SIZE} = $font_size || 10 ;
$self->{widget}->modify_font
(
Gtk2::Pango::FontDescription->from_string
(
$self->{FONT_FAMILY} . ' ' . $self->{FONT_SIZE}
)
);
}
sub get_font
{
my ($self) = @_;
return($self->{FONT_FAMILY}, $self->{FONT_SIZE}) ;
}
#-----------------------------------------------------------------------------
sub update_display
{
my ($self) = @_;
my $widget = $self->{widget} ;
$self->call_hook('CANONIZE_CONNECTIONS', $self->{CONNECTIONS}, $self->get_character_size()) ;
$widget->queue_draw_area(0, 0, $widget->allocation->width,$widget->allocation->height);
}
#-----------------------------------------------------------------------------
sub call_hook
{
my ($self, $hook_name, @arguments) = @_;
$self->{HOOKS}{$hook_name}->(@arguments) if (exists $self->{HOOKS}{$hook_name}) ;
}
#-----------------------------------------------------------------------------
sub configure_event
{
my ($widget, $event, $self) = @_;
$self->{PIXMAP} = Gtk2::Gdk::Pixmap->new
(
$widget->window,
$widget->allocation->width, $widget->allocation->height,
-1
);
$self->{PIXMAP}->draw_rectangle
(
$widget->get_style->base_gc ($widget->state),
TRUE, 0, 0, $widget->allocation->width,
$widget->allocation->height
);
return TRUE;
}
#-----------------------------------------------------------------------------
sub expose_event
{
my ($widget, $event, $self) = @_;
my $gc = Gtk2::Gdk::GC->new($self->{PIXMAP});
# draw background
$gc->set_foreground($self->get_color('background'));
$self->{PIXMAP}->draw_rectangle
(
$gc, TRUE,
0, 0,
$widget->allocation->width, $widget->allocation->height
);
my ($character_width, $character_height) = $self->get_character_size() ;
( run in 1.510 second using v1.01-cache-2.11-cpan-600a1bdf6e4 )