Gtk2-GladeXML

 view release on metacpan or  search on metacpan

ChangeLog  view on Meta::CPAN


2006-09-04	kaffeetisch

	* MANIFEST: Add the two new examples.

	* MANIFEST, META.yml, Makefile.PL: Let EU::MM generate META.yml on
	'make dist'.

2006-08-26	kaffeetisch

	* AUTHORS, examples/TODO, examples/clipboard.glade,
	examples/clipboard.gladep, examples/clipboard.pl,
	examples/dnd.glade, examples/dnd.gladep, examples/dnd.pl: Add the
	examples Fabrice added to the SourceForge tracker two ages ago.

2006/05/07	kaffeetisch

	* GladeXML.xs: Hush a signedness warning.

2005/09/28	kaffeetisch

	* GladeXML.pm: Add a link to Grant's TPR article.

MANIFEST  view on Meta::CPAN

GladeXML.pm
GladeXML.xs
LICENSE
MANIFEST			This list of files
MANIFEST.SKIP
Makefile.PL
NEWS
README
examples/README
examples/TODO
examples/clipboard.glade
examples/clipboard.gladep
examples/clipboard.pl
examples/dnd.glade
examples/dnd.gladep
examples/dnd.pl
examples/fileman.glade
examples/fileman.gladep
examples/fileman.pl
examples/hello-world.glade
examples/hello-world.gladep
examples/hello-world.pl
examples/progress.glade

examples/clipboard.gladep  view on Meta::CPAN

<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">

<glade-project>
  <name>clipboard</name>
  <program_name>clipboard</program_name>
  <gnome_support>FALSE</gnome_support>
</glade-project>

examples/clipboard.pl  view on Meta::CPAN

#!/usr/bin/perl -w

#----------------------------------------------------------------------
#  clipboard.pl
#
#  A simple example of Gtk2/GladeXML Clipboard
#
#  Copyright (C) 2004 Fabrice Duballet
#
#  This library is free software; you can redistribute it and/or
#  modify it under the terms of the GNU Lesser General Public
#  License as published by the Free Software Foundation; either
#  version 2 of the License, or (at your option) any later version.
# 

examples/clipboard.pl  view on Meta::CPAN

#
#----------------------------------------------------------------------

use strict;
use warnings;

use Gtk2 '-init'; # auto-initializes Gtk2
use Gtk2::GladeXML;

# Load the UI from the Glade-2 file
my $glade = Gtk2::GladeXML->new("clipboard.glade");

# Connect the signal handlers
$glade->signal_autoconnect_from_package('main');

# Cache controls in perl-variables
my $editor = $glade->get_widget('textview1');
my $buffer = $editor->get_buffer();

my $clipboard = $editor->get_clipboard();

my $clipboard_buffer = $glade->get_widget('textview2')->get_buffer();

my $oldtext = '';

# Start it up
Gtk2->main;

exit 0;


#----------------------------------------------------------------------
# Signal handlers, connected to signals we defined using glade-2 


# Handle cut
sub on_cut1_activate
{
    $buffer->cut_clipboard($clipboard, 1);
}

# Handle copy
sub on_copy1_activate
{
    $buffer->copy_clipboard($clipboard);
}

# Handle paste
sub on_paste1_activate
{  
    $buffer->paste_clipboard($clipboard, undef, 1);
}

# Handle expose-event
# Refresh textview buffer if the clipboard has a new content
sub on_textview2_expose_event
{
    my $newtext = $clipboard->wait_for_text();
    if ($newtext ne $oldtext)
    {
        $clipboard_buffer->set_text($newtext);
        $oldtext = $newtext;
    }
}

# Handles window-manager-quit: shuts down gtk2 lib
sub on_quit1_activate {Gtk2->main_quit;}

sub on_main_delete_event {Gtk2->main_quit;}



( run in 1.407 second using v1.01-cache-2.11-cpan-2398b32b56e )