Re: Example for "right-click" window
- From: Jens Luedicke <jens luedicke gmail com>
- To: Gabor Szabo <szabgab gmail com>
- Cc: Gtk-Perl-List <gtk-perl-list gnome org>
- Subject: Re: Example for "right-click" window
- Date: Wed, 13 Apr 2005 10:59:41 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Gabor Szabo wrote:
In the application I am writing I would like to add support to
right-click on various things. Now the right click already works but
the window I open looks horrible.
Does somene have an example (in Perl) of a window that looks like the "regular"
windows that come up when right clicking ?
You want to use a menu and not a window:
my $item_factory = new Gtk2::ItemFactory("Gtk2::Menu", '<main>', undef);
my $popup_menu = $item_factory->get_widget('<main>');
my @menu_items = (
{ path => '/Open',
item_type => '<Item>'},
{ path => '/Copy', callback => \&main::copy_cb,
item_type =>
'<Item>'},
{ path => '/Move', callback => \&main::move_cb,
item_type =>
'<Item>'},
{ path => '/Rename', callback => \&main::rename_cb,
item_type => '<Item>'},
{ path => '/MkDir', callback => \&main::mkdir_cb,
item_type
=> '<Item>'},
{ path => '/Delete', callback => \&main::delete_cb,
item_type => '<Item>'},
{ path => '/sep1',
item_type => '<Separator>'},
{ path => '/Bookmarks',
item_type => '<Item>'},
{ path => '/sep2',
item_type => '<Separator>'},
{ path => '/Archive/Create tar.gz', callback => sub {
$self->create_tar_gz_archive }, item_type => '<Item>'},
{ path => '/Archive/Create tar.bz2', callback => sub {
$self->create_tar_bz2_archive }, item_type => '<Item>'},
{ path => '/Archive/Extract', callback => sub {
$self->extract_archive }, item_type => '<Item>'},
{ path => '/sep3',
item_type => '<Separator>'},
{ path => '/Properties', callback => sub {
$self->set_properties }, item_type => '<Item>'},
);
$item_factory->create_items(undef, @menu_items);
$popup_menu->show_all;
$popup_menu->popup(undef, undef, undef, undef, $e->button, $e->time);
Hope that helps...
Jens
- --
Jens Luedicke
web: http://perldude.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCXN99iCvkc4H0gTERAvDkAKDRuqcO1p12wI+Ze+Za63S+hnWbZACcC6/C
FoxEhfXW83C3V4HwQDGogXU=
=XaL1
-----END PGP SIGNATURE-----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]