view release on metacpan or search on metacpan
ChangeLog.pre-git view on Meta::CPAN
* t/GtkStatusIcon.t
* xs/GtkStatusIcon.xs: Wrap gtk_status_icon_get_x11_window_id.
2008-08-15 Torsten Schoenfeld <kaffeetisch@gmx.de>
* t/GtkSocket-GtkPlug.t
* xs/GtkSocket.xs: Wrap gtk_socket_get_plug_window.
* t/GtkScaleButton.t
* xs/GtkScaleButton.xs: Wrap gtk_scale_button_get_popup,
gtk_scale_button_get_plus_button, and
gtk_scale_button_get_minus_button.
* t/GtkPrintSettings.t
* xs/GtkPrintSettings.xs: Wrap gtk_print_settings_load_file and
gtk_print_settings_load_key_file.
* t/GtkPageSetup.t
* xs/GtkPageSetup.xs: Wrap gtk_page_setup_load_file and
gtk_page_setup_load_key_file.
ChangeLog.pre-git view on Meta::CPAN
* xs/GtkAboutDialog.xs: Hide the AboutDialog on any reponse.
See http://svn.gnome.org/viewcvs/gtk%2B?revision=14919&view=revision
which changed the behavior of the dialog in gtk+ between 2.8 and 2.10.
2007-06-25 kaffeetisch
* t/GtkIconView.t
* xs/GtkIconView.xs: Supply default values for scroll_to_path.
Suggested by Jeffrey Ratcliffe.
* exampels/cellrenderer_popup.pl: Slightly modified patch from
Grant McLean makes sure the popup works properly when using simple
clicks instead of click-and-hold.
2007-06-24 kaffeetisch
* Gtk2.pm, MANIFEST, Makefile.PL, NEWS, README: Unstable release
1.152.
2007-06-23 kaffeetisch
* t/GtkMenuItem.t
ChangeLog.pre-git view on Meta::CPAN
Gtk2/xs/GtkStock.xs, Gtk2/xs/GtkTextIter.xs,
Gtk2/xs/GtkToolButton.xs, Gtk2/xs/GtkTreeModel.xs,
Gtk2/xs/GtkTreeView.xs, Gtk2/xs/GtkTreeViewColumn.xs,
Gtk2/xs/GtkWindow.xs: Make all version checks refer to stable
releases.
2005/09/06 muppetman
* examples/cellrenderer_date.pl, AUTHORS: Modified patch from Daniel
Kasak (dkasak at nusconsulting dot com dot au) ensures that the
calendar popup never appears offscreen.
* examples/cellrenderer_date.pl: Further modify the example to use
size_request() instead of showing the window offscreen to get the
allocation and then moving it onscreen.
2005/09/05 kaffeetisch
* MANIFEST, META.yml: Remove META.yml.
* doctypes: Add GdkPixbuf_noinc.
ChangeLog.pre-git view on Meta::CPAN
* t/GdkX11.t, xs/GdkX11.xs: Bind gdk_x11_display_set_cursor_theme,
gdk_x11_display_get_user_time.
* t/GtkDialog.t, xs/GtkDialog.xs: Bind
gtk_dialog_get_response_for_widget.
* t/GtkDnd.t, xs/GtkDnd.xs: Bind gtk_drag_source_set_icon_name.
* t/GtkEntryCompletion.t, xs/GtkEntryCompletion.xs: Bind
gtk_entry_completion_set_popup_set_width,
gtk_entry_completion_get_popup_set_width,
gtk_entry_completion_set_popup_single_match,
gtk_entry_completion_get_popup_single_match.
* t/GtkIconView.t, xs/GtkIconView.xs: Bind
gtk_icon_view_get_cursor, gtk_icon_view_get_item_at_pos,
gtk_icon_view_get_visible_range,
gtk_icon_view_enable_model_drag_source,
gtk_icon_view_enable_model_drag_dest,
gtk_icon_view_unset_model_drag_source,
gtk_icon_view_unset_model_drag_dest,
gtk_icon_view_set_reorderable, gtk_icon_view_get_reorderable,
gtk_icon_view_set_drag_dest_item,
ChangeLog.pre-git view on Meta::CPAN
* xs/GtkClipboard.xs: Don't use the _noinc typemaps with
gtk_clipboard_get and gtk_clipboard_get_for_display since we don't
actually own the returned clipboards.
* t/GtkEntryCompletion.t, xs/GtkEntryCompletion.xs: Bind and test
gtk_entry_completion_get_text_column,
gtk_entry_completion_insert_prefix,
gtk_entry_completion_set_inline_completion,
gtk_entry_completion_get_inline_completion,
gtk_entry_completion_set_popup_completion,
gtk_entry_completion_get_popup_completion.
* t/GtkIconTheme.t, xs/GtkIconTheme.xs: Bind and test
gtk_icon_theme_get_icon_sizes. Move the search path modifying
tests to the end to make this test finally work.
* t/GtkLabel.t, xs/GtkLabel.xs: Bind and test
gtk_label_set_ellipsize, gtk_label_get_ellipsize,
gtk_label_set_width_chars, gtk_label_get_width_chars.
* t/GtkComboBox.t, xs/GtkComboBox.xs, xs/GtkTreeView.xs: Bind and
test gtk_combo_box_popup, gtk_combo_box_popdown,
gtk_combo_box_get_wrap_width, gtk_combo_box_get_row_span_column,
gtk_combo_box_get_column_span_column,
gtk_combo_box_set_row_separator_func.
* gtk2perl.h, maps_pango-1.0, maps_pango_1.4, t/PangoTypes.t,
t/PangoScrip.t, xs/PangoTypes.xs, xs/PangoScript.xs: Protect
pango_find_base_dir and all of PangoScript with 1.4.0 version
guards.
2004/10/24 11:55 (-0400) rwmcfa1
ChangeLog.pre-git view on Meta::CPAN
* t/PangoContext.t
* xs/PangoContext.xs: Bind get_font_map. Make [sg]et_matrix
accept undef.
* xs/PangoFont.xs: Don't warn about unregistered subclasses of
PangoFontMap.
2004/07/09 22:52 (-0400) muppetman
* examples/cellrenderer_popup.pl: add a toggle to show off both
the boxes and no-boxes styles; use named constants instead of
magic numbers.
* examples/cellrenderer_spinbutton.pl: some tweaks to the renderer;
center vertically in the cell; handle focus-out gracefully (thanks
to jens wilke for both); draw the editor widget only as large as
necessary; use named constants for TRUE and FALSE instead of
magic numbers.
* xs/GtkTreeModel.xs: fix some buggy code in the synopsis
2004/07/07 22:23 (-0400) muppetman
* examples/cellrenderer-popup.pl: fix a bug in the menu-positioning
code, which wasn't taking the treeview's visible region offsets into
account, resulting in oddly-placed popups when used with a scrolled
textview. so, use a scroller in this example to make sure it works.
thanks to jens wilke for the bug report.
2004/07/07 21:08 (+0200) kaffeetisch
A t/PangoTypes.t
A xs/PangoTypes.xs
* MANIFEST
* gtk2perl.h
* xs_files-2.0: Bind and test stuff from pango-types.h, including
ChangeLog.pre-git view on Meta::CPAN
2004/03/25 21:45 (-0500) muppetman
* NEWS: merged from stable, so we'll have it in future versions.
* README, xs/GdkRgb.xs, xs/GdkTypes.xs, xs/Gtk2.xs,
xs/GtkSelection.xs, xs/GtkTreeSelection.xs: various fixes merged
from stable
2004/03/25 21:24 (-0500) muppetman
* examples/cellrenderer_popup.pl: update version check now that
1.040 is out.
* examples/combo_box.pl, examples/file_chooser.pl: use the correct
version check API.
2004/03/24 01:35 (+0100) kaffeetisch
* t/GtkFileChooser.t: Set select_multiple to FALSE again to make
the preview stuff work.
ChangeLog.pre-git view on Meta::CPAN
2004/02/04 02:13 (-0500) muppetman
* xs/GtkCellRenderer.xs: re-vamp vfunc support for be more natural
and perlish. use inheritable ALL_CAPS_METHODS instead of the
freakish and highly non-standard system used in the past. the update
is rather ugly, because we still support the old way for
backwards-compatibility. requires new code just added to Glib which
calls _INSTALL_OVERRIDES as part of Glib::Type::register_object.
* examples/cellrenderer_popup.pl, examples/cellrenderer_spinbutton.pl,
t/GtkCellRenderer.t: updated for new cellrenderer techniques
* examples/cellrenderer_date.pl: updated for new cellrenderer
techniques; also copied in some of torsten's experimental date
renderer code from odot.
2004/02/04 02:16 (+0100) kaffeetisch
* t/PangoLayout.t: Skip the call to set_font_description with
undef until another bug in pango has been fixed.
ChangeLog.pre-git view on Meta::CPAN
* xs/GdkColor.xs: Add a class argument to Gtk2::Gdk::Colormap::new
and implement ::get_visual and ::get_screen.
* xs/GdkWindow.xs: Hush a compiler warning.
* xs/GtkIconFactory.xs: Bind remove_default. Provide a default
value for the detail argument of set_render_icon.
* Gtk2.pm
* xs/GtkItemFactory.xs: Implement create_item and create_items in
XS. Implement delete_entry, delete_entries, popup_data,
popup_data_from_widget, and set_translate_func.
* xs/GtkRc.xs: Implement get_default_files. Fix
set_default_files. Add a class argument to get_style and
reparse_all_for_settings. Remove add_widget_name_style,
add_widget_class_style, and add_class_style since they're
deprecated. Comment out find_module_in_path. Rearrange member
handling of Gtk2::RcStyle's. Turn [gs]et_font_desc into
font_desc.
* xs/GtkTooltips.xs: In data_get, check for NULL before converting
ChangeLog.pre-git view on Meta::CPAN
* api.pod: removed stuff from the specifics section that is now
documented directly in the apidoc pods.
2003/11/10 01:51 pcg
* api.pod: Document new operation on GFlags.
2003/11/08 01:20 (-0500) muppetman
* examples/cellrenderer_date.pl, examples/cellrenderer_popup.pl,
examples/cellrenderer_spinbutton.pl, examples/histogramplot.pl:
update to use new fangled flags operators
* xs/GtkDialog.xs: fix the same sorts of bugs in the dialog::response
marshaller as we found earlier this week in Glib/GClosure.xs.
A examples/insert-text-test.pl
* xs/GtkEditable.xs: fix the Gtk2::Editable::insert-text signal.
allows you to modify the arguments or return values on the stack,
by the TIMTOWTDI principle. new example code modifies @_.
ChangeLog.pre-git view on Meta::CPAN
fixing a few things while tracking down bugs reported by
Bjarne Steinsb??:
* xs/GtkCellRenderer.xs, xs/GtkStyle.xs: all of the gtk_paint_foo()
functions ask for GdkWindows, but actually work on GdkDrawables.
according to http://bugzilla.gnome.org/show_bug.cgi?id=102678 ,
the same is true for gtk_cell_renderer_render(), and has been fixed
in gtk+ 2.3.0. so, we use GdkDrawable instead of GdkWindow in all
of those places.
* examples/cellrenderer_popup.pl: if the treeview is reorderable,
the popup and editing interaction is broken, resulting in the treeview
thinking we're still dragging the row. fix that by using a dummy
GtkCellEditable.
* xs/GtkEntry.xs: GtkEntry also implements GtkCellEditable.
use gperl_prepend_isa() instead of custom AV-handling code.
2003/10/29 09:36 rwmcfa1
* xs/GtkWidget.xs: improved error messages in get/set_flags. croak when
trying to set a read only flag.
ChangeLog.pre-git view on Meta::CPAN
* xs/GtkCellRenderer.xs: document CellRendererState and
CellRendererMode with CellRenderer.
2003/10/27 14:34 muppetman
* xs/GtkCellRenderer.xs: merged the cellrenderer subclassing stuff,
with lots of new-style experimental documentation.
* t/30.GtkCellRenderer.t: new test
* examples/cellrenderer_date.pl, examples/cellrenderer_popup.pl,
examples/cellrenderer_spinbutton.pl: new examples
2003/10/22 13:31 muppetman
stuff found while writing a documentation generator...
* xs/GtkListStore.xs: stray semicolon
* xs/GdkScreen.xs: arg list had an output parameter in it
2003/10/19 18:55 rwmcfa1
ChangeLog.pre-git view on Meta::CPAN
Gtk-Perl code.
* xs/GdkPixbuf.xs, api.pod: implemented the animation iter and
pixbuf formats stuff, finally.
* xs/GtkStyle.xs: painstakingly traced through the source of
gtkstyle.c to see where NULL is and isn't allowed, and updated all
the paint_foo functions accordingly.
* xs/GtkTextIter.xs: implemented get_marks, get_toggled_tags,
get_attributes, and get_language
* xs/GtkWidget.xs: implement get_child_requisition. apparently this
isn't equivalent to get_size_request after all; some widget
implementations need this (e.g., placing popups by hand).
* xs/PangoContext.xs: don't know why these weren't implemented.
2003/10/12 13:42 rwmcfa1
* xs/(most).xs: UNUSED is no more, PERL_UNUSED_VAR used where
needed, relies on new ParseXS to prevent the other warnings that were
its fault, we now only quite the ones that are ours
* Gtk2/xs/GtkObject.xs: fixed problem where g_object_unref was being
called on the wrong thing. there was both a SV * class and GtkObject
ChangeLog.pre-git view on Meta::CPAN
* Gtk2/gtk2perl.h, Gtk2/xs/GdkTypes.xs: special handling for
GdkModifierType flags... GDK_MODIFIER_MASK matches all of the flag
values, and causes nasty problems when you try to convert the SV flags
wrapper *back* to C. so, handle it separately, and don't allow
GDK_MODIFIER_MASK to make it into perl from C. (can still go the other
way, though)
* Gtk2/xs/GtkItemFactory.xs: bracket callback with ENTER/SAVETMPS &
FREETMPS/LEAVE
* Gtk2/xs/GtkMenu.xs: implemented gtk_menu_popup
* Gtk2/xs/GtkTreeModel.xs: it's possible for gtk_tree_model_iter_next
to return NULL
* Gtk2/xs/GtkTreeView.xs: implemented
gtk_tree_view_insert_column_with_data_func
* Gtk2/xs/GtkTreeViewColumn.xs: implemented
gtk_tree_view_column_set_cell_data_func
doctypes
examples/accel_groups.pl
examples/adding_stock_icons.pl
examples/assistant.pl
examples/attributes.pl
examples/buttonbox.pl
examples/cairo-clock.pl
examples/cairo-rendering.pl
examples/calendar.pl
examples/cellrenderer_date.pl
examples/cellrenderer_popup.pl
examples/cellrenderer_progress.pl
examples/cellrenderer_spinbutton.pl
examples/color_list.pl
examples/color_snooper.pl
examples/combo_box.pl
examples/customlist.pl
examples/customrenderer.pl
examples/customtree.pl
examples/dialog.pl
examples/draw_text.pl
- Gtk2::Gdk::Window->invalidate_rect, set_icon_name,
input_shape_combine_mask, shape_combine_mask,
input_shape_combine_region, shape_combine_region
- Gtk2::AccelLabel->set_accel_widget
- Gtk2::Menu->set_screen
- Gtk2::Widget->set_accel_path, shape_combine_mask
- Gtk2::Window->set_default_icon_name
* In syntax check mode, do not call gtk_init. gtk_init may abort the
program (e.g. if DISPLAY is not set), so only call gtk_init_check even
if asked to call gtk_init.
* Gtk2::Menu: trap exceptions in popup callbacks. Uncaught exceptions
in a popup callback can result in persistent mouse and keyboard grabs,
locking the screen until the program is killed.
* Make Gtk2::ListStore->remove()'s return value consistent on gtk+ 2.0.
* Fix memory handling in Gtk2::RecentInfo->get_application_info.
* Improve the documentation in many places. [Special thanks to Kevin
Ryde]
* Fix some build and test failures.
Overview of changes in Gtk2 1.224
=================================
examples/cellrenderer_date.pl view on Meta::CPAN
Glib::ParamSpec -> string("date", "Date", "What's the date again?", "", [qw(readable writable)]),
]
;
use constant x_padding => 2;
use constant y_padding => 3;
use constant arrow_width => 15;
use constant arrow_height => 15;
sub hide_popup {
my ($cell) = @_;
Gtk2 -> grab_remove($cell -> { _popup });
$cell -> { _popup } -> hide();
}
sub get_today {
my ($cell) = @_;
my ($day, $month, $year) = (localtime())[3, 4, 5];
$year += 1900;
$month += 1;
return ($year, $month, $day);
examples/cellrenderer_date.pl view on Meta::CPAN
}
sub add_padding {
my ($cell, $year, $month, $day) = @_;
return ($year, sprintf("%02d", $month), sprintf("%02d", $day));
}
sub INIT_INSTANCE {
my ($cell) = @_;
my $popup = Gtk2::Window -> new ('popup');
my $vbox = Gtk2::VBox -> new(0, 0);
my $calendar = Gtk2::Calendar -> new();
my $hbox = Gtk2::HBox -> new(0, 0);
my $today = Gtk2::Button -> new('Today');
my $none = Gtk2::Button -> new('None');
$cell -> {_arrow} = Gtk2::Arrow -> new("down", "none");
examples/cellrenderer_date.pl view on Meta::CPAN
$hbox -> pack_start($today, 1, 1, 0);
$hbox -> pack_start($none, 1, 1, 0);
$vbox -> pack_start($calendar, 1, 1, 0);
$vbox -> pack_start($hbox, 0, 0, 0);
# Find out if the click happended outside of our window. If so, hide it.
# Largely copied from Planner (the former MrProject).
# Implement via Gtk2::get_event_widget?
$popup -> signal_connect(button_press_event => sub {
my ($popup, $event) = @_;
if ($event -> button() == 1) {
my ($x, $y) = ($event -> x_root(), $event -> y_root());
my ($xoffset, $yoffset) = $popup -> window() -> get_root_origin();
my $allocation = $popup -> allocation();
my $x1 = $xoffset + 2 * $allocation -> x();
my $y1 = $yoffset + 2 * $allocation -> y();
my $x2 = $x1 + $allocation -> width();
my $y2 = $y1 + $allocation -> height();
unless ($x > $x1 && $x < $x2 && $y > $y1 && $y < $y2) {
$cell -> hide_popup();
return 1;
}
}
return 0;
});
$popup -> add($vbox);
$cell -> { _popup } = $popup;
$cell -> { _calendar } = $calendar;
}
sub START_EDITING {
my ($cell, $event, $view, $path, $background_area, $cell_area, $flags) = @_;
my $popup = $cell -> { _popup };
my $calendar = $cell -> { _calendar };
# Specify the callbacks. Will be called by the signal handlers set up in
# INIT_INSTANCE.
$cell -> { _today_clicked_callback } = sub {
my ($button) = @_;
my ($year, $month, $day) = $cell -> get_today();
$cell -> signal_emit(edited => $path, join("-", $cell -> add_padding($year, $month, $day)));
$cell -> hide_popup();
};
$cell -> { _none_clicked_callback } = sub {
my ($button) = @_;
$cell -> signal_emit(edited => $path, "");
$cell -> hide_popup();
};
$cell -> { _day_selected_double_click_callback } = sub {
my ($calendar) = @_;
my ($year, $month, $day) = $calendar -> get_date();
$cell -> signal_emit(edited => $path, join("-", $cell -> add_padding($year, ++$month, $day)));
$cell -> hide_popup();
};
$cell -> { _month_changed } = sub {
my ($calendar) = @_;
my ($selected_year, $selected_month) = $calendar -> get_date();
my ($current_year, $current_month, $current_day) = $cell -> get_today();
if ($selected_year == $current_year &&
++$selected_month == $current_month) {
examples/cellrenderer_date.pl view on Meta::CPAN
else {
$calendar -> unmark_day($current_day);
}
};
my ($year, $month, $day) = $cell -> get_date();
$calendar -> select_month($month - 1, $year);
$calendar -> select_day($day);
# Figure out where to put the popup - i.e., don't put it offscreen,
# as it's not movable (by the user).
$popup -> get_child -> show_all(); # all but $popup itself
$popup -> realize;
my ($requisition) = $popup->size_request;
my ($popup_width, $popup_height) = ($requisition->width, $requisition->height);
my $screen_height = $popup->get_screen->get_height;
my ($x_origin, $y_origin) = $view -> get_bin_window() -> get_origin();
my $popup_x = $x_origin + $cell_area->x + $cell_area->width - $popup_width;
if ($popup_x < 0) {
$popup_x = 0;
}
my $popup_y = $y_origin + $cell_area->y + $cell_area->height;
if ($popup_y + $popup_height > $screen_height) {
$popup_y = $y_origin + $cell_area->y - $popup_height;
}
$popup -> move($popup_x, $popup_y);
$popup -> show();
# Grab the focus and the pointer.
Gtk2 -> grab_add($popup);
$popup -> grab_focus();
Gtk2::Gdk -> pointer_grab($popup -> window(),
1,
[qw(button-press-mask
button-release-mask
pointer-motion-mask)],
undef,
undef,
0);
return;
}
examples/cellrenderer_popup.pl view on Meta::CPAN
my $item = Gtk2::MenuItem->new ($data[$i]);
$item->show;
$menu->append ($item);
$item->{path} = $path;
$item->{index} = $i;
$item->{text} = $data[$i];
#$item->signal_connect (activate => \&editing_done, $cell);
$item->signal_connect (activate => \&editing_done, [$cell, $editable]);
}
$menu->set_active ($cell->{index});
$menu->popup (undef, undef,
\&menu_pos_func, [$widget, $cell_area],
$event ? $event->button : 0,
$event ? $event->time : 0);
$item = $menu->get_active;
$menu->select_item ($item) if $item;
# see the evil trick mentioned above.
$editable;
}
examples/cellrenderer_popup.pl view on Meta::CPAN
#
# regular editable text column for column 0, the string
#
$renderer = Gtk2::CellRendererText->new;
$renderer->set (editable => TRUE);;
$column = Gtk2::TreeViewColumn->new_with_attributes ('something', $renderer,
text => 0);
# this commits changes from the user's editing to the model. compare and
# contrast with the one for the popup, below.
$renderer->signal_connect (edited => sub {
my ($cell, $text_path, $new_text, $model) = @_;
my $path = Gtk2::TreePath->new_from_string ($text_path);
my $iter = $model->get_iter ($path);
$model->set ($iter, 0, $new_text);
}, $model);
$treeview->append_column ($column);
#
# text for col[1]
examples/cellrenderer_popup.pl view on Meta::CPAN
#
# text for col[2]
#
$renderer = Gtk2::CellRendererText->new;
$column = Gtk2::TreeViewColumn->new_with_attributes ('index', $renderer,
text => 2);
$treeview->append_column ($column);
#
# custom cell renderer for cols 1 and 2, an editable popup menu
#
$renderer = Mup::CellRendererPopup->new;
$renderer->set (mode => 'editable');
$column = Gtk2::TreeViewColumn->new_with_attributes ('selector', $renderer,
list => 1,
'index' => 2,
);
# this handler commits the user's selection to the model. compare with
# the one for the typical text renderer -- the only difference is a var name.
$renderer->signal_connect (edited => sub {
examples/cellrenderer_popup.pl view on Meta::CPAN
$treeview->append_column ($column);
my $scroll = Gtk2::ScrolledWindow->new;
$scroll->set_policy ('never', 'automatic');
$scroll->add ($treeview);
$vbox->pack_start ($scroll, TRUE, TRUE, 0);
# since we have a scroller, we need to set some reasonable initial size.
# i'll set one that should have the window scroll a bit, to make sure we
# can easily test the popup behavior when the treeview is scrolled.
$window->set_default_size (-1, 150);
my $check = Gtk2::CheckButton->new ('_show boxes');
$check->set_active ($renderer->get ('show-box'));
$check->signal_connect (toggled => sub {
$renderer->set (show_box => $check->get_active);
$treeview->queue_draw;
});
$vbox->pack_start ($check, FALSE, FALSE, 0);
examples/testdnd.pl view on Meta::CPAN
if ($info == TARGET_ROOTWIN) {
print ("I was dropped on the rootwin\n");
} else {
print "\$data is $data\n";
$data->set ($data->target, 8, "I'm Data!");
}
}
#/* The following is a rather elaborate example demonstrating/testing
# * changing of the window heirarchy during a drag - in this case,
# * via a "spring-loaded" popup window.
# */
$popup_window = undef;
$popped_up = 0;
$in_popup = 0;
$popdown_timer = 0;
$popup_timer = 0;
sub popdown_cb
{
$popdown_timer = 0;
$popup_window->hide();
$popped_up = 0;
return 0;
}
sub popup_motion
{
my ($widget, $context, $x, $y, $time) = @_;
if (!$in_popup)
{
$in_popup = 1;
if ($popdown_timer)
{
print ("removed popdown\n");
Glib::Source->remove ($popdown_timer);
$popdown_timer = 0;
}
}
return 1;
}
sub popup_leave {
my ($widget, $context, $time) = @_;
if ($in_popup)
{
$in_popup = 0;
if ($popdown_timer)
{
print ("added popdown\n");
$popdown_timer = Gtk2::Timeout->add (500, \&popdown_cb);
}
}
}
sub popup_cb {
if (!$popped_up)
{
if (!$popup_window)
{
my ($button, $table, $i, $j);
$popup_window = Gtk2::Window->new ('popup');
$popup_window->set_position('mouse');
$table = Gtk2::Table->new (3, 3, 0);
for ($i=0; $i<3; $i++) {
for ($j=0; $j<3; $j++)
{
$button = new Gtk2::Button ("$i,$j");
$table->attach ($button, $i, $i+1, $j, $j+1,
['expand','fill'],['expand','fill'], 0, 0);
$button->drag_dest_set ('all', ['copy', 'move'],
@target_table[0..1]); # no rootwin
$button->signal_connect ("drag_motion", \&popup_motion);
$button->signal_connect ("drag_leave", \&popup_leave);
}
}
$table->show_all ();
$popup_window->add($table);
}
$popup_window->show;
$popped_up = 1;
}
$popdown_timer = Glib::Timeout->add (500, \&popdown_cb);
print ("added popdown\n");
$popup_timer = 0;
return 0;
}
sub popsite_motion {
my ($widget, $context, $x, $y, $time) = @_;
if (!$popup_timer) {
$popup_timer = Glib::Timeout->add (500, \&popup_cb);
}
return 1;
}
sub popsite_leave {
my ($widget, $context, $time) = @_;
if ($popup_timer)
{
Glib::Source->remove ($popup_timer);
$popup_timer = 0;
}
}
sub source_drag_data_delete {
my ($widget, $context, $data) = @_;
print ("Delete the data!\n");
}
init Gtk2;
gtk-demo/changedisplay.pl view on Meta::CPAN
# Asks the user to click on a window, then waits for them click
# the mouse. When the mouse is released, returns the toplevel
# window under the pointer, or NULL, if there is none.
#
sub query_for_toplevel {
my ($screen, $prompt) = @_;
my $display = $screen->get_display;
my $toplevel = undef;
my $popup = Gtk2::Window->new ('popup');
$popup->set_screen ($screen);
$popup->set_modal (TRUE);
$popup->set_position ('center');
my $frame = Gtk2::Frame->new;
$frame->set_shadow_type ('out');
$popup->add ($frame);
my $label = Gtk2::Label->new ($prompt);
$label->set_padding (10, 10);
$frame->add ($label);
$popup->show_all;
my $cursor = Gtk2::Gdk::Cursor->new_for_display ($display, 'crosshair');
if (Gtk2::Gdk->pointer_grab ($popup->window, FALSE,
'button-release-mask',
undef,
$cursor,
0) eq 'success') #'GDK_GRAB_SUCCESS')
{
my $clicked = FALSE;
$popup->signal_connect (button_release_event => \&button_release_event_cb, \$clicked);
#
# Process events until clicked is set by button_release_event_cb.
# We pass in may_block=TRUE since we want to wait if there
# are no events currently.
#
while (!$clicked) {
Glib::MainContext->default->iteration (TRUE);
}
$toplevel = find_toplevel_at_pointer ($screen->get_display);
# don't move yourself
$toplevel = undef if defined $toplevel and $toplevel == $popup;
}
$popup->destroy;
Gtk2::Gdk->flush; # Really release the grab
return $toplevel;
}
# Prompts the user for a toplevel window to move, and then moves
# that window to the currently selected display
#
sub query_change_display {
my $info = shift;
gtk-demo/images.pl view on Meta::CPAN
use strict;
my $i;
#include "demo-common.h"
my $window = undef;
my $pixbuf_loader = undef;
my $load_timeout = 0;
my $image_stream = undef;
sub error_popup {
my $parent = shift;
my $message = shift;
my $dialog = Gtk2::MessageDialog->new ($parent, 'destroy-with-parent',
'error', 'close', $message);
$dialog->signal_connect (response => sub {$_[0]->destroy; 1});
$dialog->show;
}
sub progressive_prepared_callback {
my ($loader, $image) = @_;
gtk-demo/images.pl view on Meta::CPAN
# You could factor out the error handling code into a nice separate
# function to make things nicer.
#
if (defined $image_stream) {
my $buf;
my $bytes_read = read ($image_stream, $buf, 512);
# sysread returns undef on error
if (not defined $bytes_read) {
error_popup ($window, "Failure reading image file 'alphatest.png': $!");
close $image_stream;
$image_stream = undef;
$load_timeout = 0;
return FALSE; # uninstall the timeout
}
if ($bytes_read == 0) {
warn "end of file";
close $image_stream;
$image_stream = undef;
return TRUE; # do NOT uninstall the timeout, we'll just start loading again
}
eval { $pixbuf_loader->write ($buf) };
if ($@) {
error_popup ($window, "Failed to load image: $@");
close $image_stream;
$image_stream = undef;
$load_timeout = 0;
return FALSE; # uninstall the timeout
}
if (eof $image_stream) {
close $image_stream;
$image_stream = undef;
#
# Errors can happen on close, e.g. if the image file was
# truncated we'll know on close that it was incomplete.
#
eval { $pixbuf_loader->close; };
if ($@) {
error_popup ($window, "Failed to load image: $@");
$pixbuf_loader = undef;
$load_timeout = 0;
return FALSE; # uninstall the timeout
}
$pixbuf_loader = undef;
}
gtk-demo/images.pl view on Meta::CPAN
my $filename;
eval { $filename = main::demo_find_file ("alphatest.png"); };
if ($@) {
$error_message = $@;
} else {
open $image_stream, "<:raw", $filename
or $error_message = "Unable to open image file 'alphatest.png': $!";
}
if (not defined $image_stream) {
error_popup ($window, $error_message);
$load_timeout = 0;
return FALSE; # uninstall the timeout
}
if ($pixbuf_loader) {
$pixbuf_loader->close;
$pixbuf_loader = undef;
}
gtk-demo/images.pl view on Meta::CPAN
(main::demo_find_file ('gtk-logo-rgb.gif'));
};
if ($@) {
# This code shows off error handling. You can just use
# gtk_image_new_from_file() instead if you don't want to report
# errors to the user. If the file doesn't load when using
# gtk_image_new_from_file(), a "missing image" icon will
# be displayed instead.
#
error_popup ($window,
"Unable to open image file 'gtk-logo-rgb.gif': $@");
}
my $image = Gtk2::Image->new_from_pixbuf ($pixbuf);
$frame->add ($image);
# Animation
t/01.GtkWindow.t view on Meta::CPAN
#########################
# GtkWindow Tests
# - rm
#########################
#########################
use Gtk2::TestHelper tests => 120;
ok( my $win = Gtk2::Window->new );
ok( $win = Gtk2::Window->new('popup') );
ok( $win = Gtk2::Window->new('toplevel') );
$win->set_title;
ok(1);
$win->set_title(undef);
ok(1);
$win->set_title('');
ok(1);
$win->set_title('Test Window');
ok(1);
t/GtkComboBox.t view on Meta::CPAN
my ($model, $iter, $data) = @_;
my $been_here = 0 if 0;
return if $been_here++;
isa_ok ($model, 'Gtk2::ListStore');
isa_ok ($iter, 'Gtk2::TreeIter');
is_deeply ($data, { something => 'else' });
}, { something => 'else'});
# make sure the widget is parented, realized and sized, or popup
# and popdown will assert when they try to use combo_box's GdkWindow.
# er, also make sure there's stuff in it.
my $cell = Gtk2::CellRendererText->new;
$combo_box->pack_start ($cell, TRUE);
$combo_box->set_attributes ($cell, text => 0);
my $window = Gtk2::Window->new;
$window->add ($combo_box);
$combo_box->show;
$window->show;
$combo_box->popup;
$combo_box->popdown;
$combo_box->set_wrap_width (1);
$combo_box->set_row_span_column (1);
$combo_box->set_column_span_column (1);
is ($combo_box->get_wrap_width, 1);
is ($combo_box->get_row_span_column, 1);
is ($combo_box->get_column_span_column, 1);
t/GtkEntryCompletion.t view on Meta::CPAN
SKIP: {
skip 'new 2.6 stuff', 3
unless Gtk2->CHECK_VERSION (2, 6, 0);
is ($completion->get_text_column, 0);
$completion->set_inline_completion (1);
is ($completion->get_inline_completion, 1);
$completion->set_popup_completion (1);
is ($completion->get_popup_completion, 1);
$completion->insert_prefix;
}
SKIP: {
skip 'new 2.8 stuff', 2
unless Gtk2->CHECK_VERSION (2, 8, 0);
$completion->set_popup_set_width (TRUE);
is ($completion->get_popup_set_width, TRUE);
$completion->set_popup_single_match (TRUE);
is ($completion->get_popup_single_match, TRUE);
}
SKIP: {
skip 'new 2.12 stuff', 2
unless Gtk2->CHECK_VERSION (2, 12, 0);
$completion->set_inline_selection (TRUE);
is ($completion->get_inline_selection, TRUE);
is ($completion->get_completion_prefix, undef);
t/GtkItemFactory.t view on Meta::CPAN
],
[
'/_Menu/Sub Menu/Test _2',
undef,
sub {
my ($data, $action, $widget) = @_;
isa_ok( $data, 'HASH' );
isa_ok( $widget, "Gtk2::MenuItem" );
my $tmp_fac = Gtk2::ItemFactory->popup_data_from_widget($widget);
isa_ok( $tmp_fac, "Gtk2::ItemFactory" );
is( $tmp_fac->popup_data, $tmp_fac );
$actions_used[4]++;
},
undef,
undef,
],
[
'/_Menu/_Quit',
undef,
\&callback,
t/GtkItemFactory.t view on Meta::CPAN
$fac->set_translate_func(sub {
my ($path, $data) = @_;
like( $path, qr(^/_Menu/) );
is( $data, "bla" );
"_Meenyoo"
}, "bla");
$fac->popup(10, 10, 1, 0, $fac);
isa_ok( $fac->get_widget('<main>'), "Gtk2::Menu" );
# is( Gtk2::ItemFactory->path_from_widget($fac->get_widget_by_action(2)),
# '<main>/Menu/Test 2' );
# sometimes, these can apparently return undef
SKIP: {
my $widget = $fac->get_widget_by_action(2);
skip 'get_widget_by_action returned undef', 1
unless defined $widget;
t/GtkMenu.t view on Meta::CPAN
skip("attach and set_monitor are new in 2.4", 0)
unless Gtk2->CHECK_VERSION (2, 4, 0);
$menu->attach(Gtk2::MenuItem->new("Bla"), 0, 1, 0, 1);
$menu->set_monitor(0);
}
return (50, 50);
};
$menu->popup(undef, undef, $position_callback, "bla", 1, 0);
$menu->popdown;
ok(TRUE);
# crib note: $position_callback sub must be a proper closure referring to a
# variable outside itself to weaken away like this
require Scalar::Util;
Scalar::Util::weaken($position_callback);
ok ($position_callback, 'popup() holds onto position_callback');
my $next_position_callback_variable = 0;
my $next_position_callback = sub { $next_position_callback_variable++;
return (50,50) };
$menu->popup(undef, undef, $next_position_callback, undef, 1, 0);
$menu->popdown;
is ($position_callback, undef,
'next popup() drops previously held position_callback');
# crib note: again $next_position_callback must refer to a variable outside
# itself to weaken away like this
require Scalar::Util;
Scalar::Util::weaken($next_position_callback);
ok ($next_position_callback, 'popup() holds onto next_position_callback');
$menu->popup(undef, undef, undef, undef, 1, 0);
$menu->popdown;
is ($next_position_callback, undef,
'popup() with no position func drops held position_callback');
# If we never entered the pos. callback, fake four tests
unless ($i_know_you) {
foreach (0 .. 3) {
ok (TRUE, 'faking pos. callback');
}
}
{
my $item = Gtk2::MenuItem->new;
t/GtkMenu.t view on Meta::CPAN
$menu->detach;
is_deeply ($detach_args, [ $item, $menu ], 'detach callback args');
# crib note: $detach_func must be a closure referring to a variable
# outside itself to weaken away like this
Scalar::Util::weaken ($detach_func);
is ($detach_func, undef, 'detach callback func freed after called');
}
{
my $popup_runs = 0;
my $saw_warning = '';
{ local $SIG{__WARN__} = sub { $saw_warning = $_[0] };
$menu->popup(undef, undef, sub {
$popup_runs = 1;
die;
}, undef, 1, 0);
}
note "popup position runs=$popup_runs warn='$saw_warning'";
$menu->popdown;
ok ($popup_runs,
'popup positioning die() - popup runs');
ok ($saw_warning,
'popup positioning die() - die not fatal, turned into warning');
}
SKIP: {
skip 'new 2.14 stuff', 2
unless Gtk2->CHECK_VERSION(2, 14, 0);
my $menu = Gtk2::Menu->new;
$menu->set_accel_path ('<gtk2perl>/main/menu');
is ($menu->get_accel_path, '<gtk2perl>/main/menu');
t/GtkNotebook.t view on Meta::CPAN
ok(1);
ok( $nb->get_show_border );
$nb->set_scrollable(1);
ok(1);
ok( $nb->get_scrollable );
$nb->set_scrollable(0);
ok(1);
$nb->popup_disable;
ok(1);
$nb->popup_enable;
ok(1);
ok( ! $nb->get_scrollable );
# in reality this one is only in gtk2.2+, but it's been implemented in
# the xs wrapper since it's trivial anyway
ok( $nb->get_n_pages == 6 );
$nb->set_menu_label($child2, Gtk2::Label->new('re-set'));
ok(1);
ok( $nb->get_menu_label($child2)->get_text eq 're-set');
t/GtkScaleButton.t view on Meta::CPAN
is ($button->get_value, 50);
my $adj = Gtk2::Adjustment->new (50, 0, 100, 2, 10, 20);
$button->set_adjustment ($adj);
is ($button->get_adjustment, $adj);
SKIP: {
skip 'new 2.14 stuff', 4
unless Gtk2->CHECK_VERSION(2, 14, 0);
isa_ok ($button->get_popup (), 'Gtk2::Widget');
isa_ok ($button->get_plus_button (), 'Gtk2::Widget');
isa_ok ($button->get_minus_button (), 'Gtk2::Widget');
$button->set_orientation ('horizontal');
is ($button->get_orientation (), 'horizontal');
}
__END__
Copyright (C) 2007 by the gtk2-perl team (see the file AUTHORS for the
t/GtkStatusIcon.t view on Meta::CPAN
$icon = Gtk2::StatusIcon -> new_from_file($icon_file);
isa_ok($icon, "Gtk2::StatusIcon");
is($icon -> get_storage_type(), "pixbuf");
$icon -> set_from_file($icon_file);
}
# --------------------------------------------------------------------------- #
my $menu = Gtk2::Menu -> new();
$menu -> popup(undef, undef, \&Gtk2::StatusIcon::position_menu, $icon, 0, 0);
$menu -> popdown();
my $callback = sub {
my ($menu, $x, $y, $icon) = @_;
return Gtk2::StatusIcon::position_menu($menu, $x, $y, $icon);
};
$menu -> popup(undef, undef, $callback, $icon, 0, 0);
$menu -> popdown();
# Make sure the convenient way of calling works, too.
{ my @ret = Gtk2::StatusIcon::position_menu($menu, $icon);
is (scalar @ret, 3);
my ($x, $y, $pushed_in) = @ret;
like($x, qr/^-?\d+$/);
like($y, qr/^-?\d+$/);
like($pushed_in, qr/^[01]$/); # boolean
}
xs/GtkComboBox.xs view on Meta::CPAN
$active_iter = $combo_box->get_active_iter;
=cut
=for position DESCRIPTION
=head1 DESCRIPTION
Gtk2::ComboBox is a widget that allows the user to choose from a list of valid
choices. The ComboBox displays the selected choice. When activated, the
ComboBox displays a popup which allows the user to make a new choice.
Unlike its predecessors Gtk2::Combo and Gtk2::OptionMenu, the Gtk2::ComboBox
uses the model-view pattern; the list of valid choices is specified in the form
of a tree model, and the display of the choices can be adapted to the data in
the model by using cell renderers, as you would in a tree view. This is
possible since ComboBox implements the Gtk2::CellLayout interface. The tree
model holding the valid choices is not restricted to a flat list; it can be a
real tree, and the popup will reflect the tree structure.
In addition to the model-view API, ComboBox offers a simple API which is
suitable for text-only combo boxes, and hides the complexity of managing the
data in a model. It consists of the methods C<new_text>, C<append_text>,
C<insert_text>, C<prepend_text>, C<remove_text> and C<get_active_text>.
=cut
GtkWidget *gtk_combo_box_new (class, GtkTreeModel *model=NULL)
ALIAS:
xs/GtkComboBox.xs view on Meta::CPAN
void gtk_combo_box_append_text (GtkComboBox *combo_box, const gchar *text);
void gtk_combo_box_insert_text (GtkComboBox *combo_box, gint position, const gchar *text);
void gtk_combo_box_prepend_text (GtkComboBox *combo_box, const gchar *text);
void gtk_combo_box_remove_text (GtkComboBox *combo_box, gint position);
##/* programmatic control */
void gtk_combo_box_popup (GtkComboBox *combo_box);
void gtk_combo_box_popdown (GtkComboBox *combo_box);
#if GTK_CHECK_VERSION (2, 6, 0)
gint gtk_combo_box_get_wrap_width (GtkComboBox *combo_box);
gint gtk_combo_box_get_row_span_column (GtkComboBox *combo_box);
gint gtk_combo_box_get_column_span_column (GtkComboBox *combo_box);
xs/GtkComboBox.xs view on Meta::CPAN
(GtkTreeViewRowSeparatorFunc)
gtk2perl_tree_view_row_separator_func,
callback,
(GtkDestroyNotify)
gperl_callback_destroy);
void gtk_combo_box_set_focus_on_click (GtkComboBox *combo_box, gboolean focus_on_click);
gboolean gtk_combo_box_get_focus_on_click (GtkComboBox *combo_box);
#AtkObject * gtk_combo_box_get_popup_accessible (GtkComboBox *combo_box);
#endif
#if GTK_CHECK_VERSION (2, 10, 0)
void gtk_combo_box_set_title (GtkComboBox *combo_box, const gchar * title);
const gchar * gtk_combo_box_get_title (GtkComboBox *combo_box);
#endif
xs/GtkEntryCompletion.xs view on Meta::CPAN
#if GTK_CHECK_VERSION (2, 6, 0)
gint gtk_entry_completion_get_text_column (GtkEntryCompletion *completion);
void gtk_entry_completion_insert_prefix (GtkEntryCompletion *completion);
void gtk_entry_completion_set_inline_completion (GtkEntryCompletion *completion, gboolean inline_completion);
gboolean gtk_entry_completion_get_inline_completion (GtkEntryCompletion *completion);
void gtk_entry_completion_set_popup_completion (GtkEntryCompletion *completion, gboolean popup_completion);
gboolean gtk_entry_completion_get_popup_completion (GtkEntryCompletion *completion);
#endif
#if GTK_CHECK_VERSION(2, 8, 0)
void gtk_entry_completion_set_popup_set_width (GtkEntryCompletion *completion, gboolean popup_set_width);
gboolean gtk_entry_completion_get_popup_set_width (GtkEntryCompletion *completion);
void gtk_entry_completion_set_popup_single_match (GtkEntryCompletion *completion, gboolean popup_single_match);
gboolean gtk_entry_completion_get_popup_single_match (GtkEntryCompletion *completion);
#endif
#if GTK_CHECK_VERSION(2, 12, 0)
void gtk_entry_completion_set_inline_selection (GtkEntryCompletion *completion, gboolean inline_selection);
gboolean gtk_entry_completion_get_inline_selection (GtkEntryCompletion *completion);
const gchar_ornull *gtk_entry_completion_get_completion_prefix (GtkEntryCompletion *completion);
xs/GtkItemFactory.xs view on Meta::CPAN
GtkItemFactory *ifactory
PREINIT:
int i;
GtkItemFactoryEntry *entry;
CODE:
for (i = 1; i < items; i++) {
entry = SvGtkItemFactoryEntry (ST (i), NULL);
gtk_item_factory_delete_entry (ifactory, entry);
}
## void gtk_item_factory_popup (GtkItemFactory *ifactory, guint x, guint y, guint mouse_button, guint32 time_)
## void gtk_item_factory_popup_with_data(GtkItemFactory *ifactory, gpointer popup_data, GtkDestroyNotify destroy, guint x, guint y, guint mouse_button, guint32 time_)
### combination of gtk_item_factory_popup and gtk_item_factory_popup_with_data
void
gtk_item_factory_popup (ifactory, x, y, mouse_button, time_, popup_data=NULL)
GtkItemFactory *ifactory
guint x
guint y
guint mouse_button
guint32 time_
SV * popup_data
PREINIT:
SV * real_popup_data = NULL;
CODE:
if (gperl_sv_is_defined (popup_data))
real_popup_data = gperl_sv_copy (popup_data);
gtk_item_factory_popup_with_data (ifactory,
real_popup_data,
real_popup_data
? (GDestroyNotify)gperl_sv_free
: NULL,
x, y, mouse_button, time_);
SV *
gtk_item_factory_popup_data (ifactory)
GtkItemFactory *ifactory
CODE:
RETVAL = (SV *) gtk_item_factory_popup_data (ifactory);
if (RETVAL) {
RETVAL = gperl_sv_copy (RETVAL);
} else {
RETVAL = &PL_sv_undef;
}
OUTPUT:
RETVAL
SV *
gtk_item_factory_popup_data_from_widget (class, widget)
GtkWidget *widget
CODE:
RETVAL = (SV *) gtk_item_factory_popup_data_from_widget (widget);
if (RETVAL) {
RETVAL = gperl_sv_copy (RETVAL);
} else {
RETVAL = &PL_sv_undef;
}
OUTPUT:
RETVAL
void
xs/GtkMenu.xs view on Meta::CPAN
PUSHMARK (SP);
EXTEND (SP, 3);
PUSHs (sv_2mortal (newSVGtkMenu (menu)));
PUSHs (sv_2mortal (newSViv (*x)));
PUSHs (sv_2mortal (newSViv (*y)));
if (callback->data)
XPUSHs (sv_2mortal (newSVsv (callback->data)));
/* A die() from callback->func is suspected to be bad or very bad.
Circa Gtk 2.18 a jump out of $menu->popup seems to leave an X
grab with no way to get rid of it (no keyboard Esc, and no mouse
click handlers). The position func can also be called later for
things like resizing or move to a different GdkScreen, and such a
call might come straight from the main loop, where a die() would
jump out of Gtk2->main. */
PUTBACK;
n = call_sv (callback->func, G_ARRAY | G_EVAL);
SPAGAIN;
xs/GtkMenu.xs view on Meta::CPAN
C<$x>,C<$y> inputs are a proposed position based on the mouse pointer
(not actually documented in the Gtk manuals). The return should be a
desired C<$x>,C<$y>, and an optional C<$push_in> flag. If C<$push_in>
is true then Gtk will adjust C<$x>,C<$y> if necessary so the menu is
fully visible in the screen width and height.
C<$menu_pos_func> and C<$data> are stored in C<$menu> and may be
called again later for a C<< $menu->reposition >> or some obscure
things like a changed C<set_screen> while torn-off. A further
C<< $menu->popup >> call replaces C<$menu_pos_func> and C<$data>.
=cut
void
gtk_menu_popup (menu, parent_menu_shell, parent_menu_item, menu_pos_func, data, button, activate_time)
GtkMenu * menu
GtkWidget_ornull * parent_menu_shell
GtkWidget_ornull * parent_menu_item
SV * menu_pos_func
SV * data
guint button
guint activate_time
###guint32 activate_time
CODE:
if (!gperl_sv_is_defined (menu_pos_func)) {
gtk_menu_popup (menu, parent_menu_shell, parent_menu_item,
NULL, NULL, button, activate_time);
g_object_set_data (G_OBJECT(menu), "_gtk2perl_menu_pos_callback", NULL);
} else {
GPerlCallback * callback;
/* we don't need to worry about the callback arg types since
* we already have to marshall this callback ourselves. */
callback = gperl_callback_new (menu_pos_func, data, 0, NULL, 0);
gtk_menu_popup (menu, parent_menu_shell, parent_menu_item,
(GtkMenuPositionFunc) gtk2perl_menu_position_func,
callback, button, activate_time);
/* The menu will store the callback we give it, and can
* conceivably invoke the callback multiple times
* (repositioning, changing screens, etc). Each call to
* gtk_menu_popup() replaces the function pointer. So,
* if we use a weak reference, we can leak multiple callbacks;
* if we use object data, we can clean up the ones we install
* and reinstall. Not likely, of course, but there are
* pathological programmers out there. */
g_object_set_data_full (G_OBJECT (menu), "_gtk2perl_menu_pos_callback",
callback,
(GDestroyNotify)
gperl_callback_destroy);
}
xs/GtkMenuShell.xs view on Meta::CPAN
gboolean gtk_menu_shell_get_take_focus (GtkMenuShell *menu_shell);
void gtk_menu_shell_set_take_focus (GtkMenuShell *menu_shell, gboolean take_focus);
#endif
# __PRIVATE__
## void _gtk_menu_shell_select_first (GtkMenuShell *menu_shell, gboolean search_sensitive)
## void _gtk_menu_shell_select_last (GtkMenuShell *menu_shell, gboolean search_sensitive)
## void _gtk_menu_shell_activate (GtkMenuShell *menu_shell)
## gint _gtk_menu_shell_get_popup_delay (GtkMenuShell *menu_shell)
xs/GtkNotebook.xs view on Meta::CPAN
void
gtk_notebook_set_scrollable (notebook, scrollable)
GtkNotebook * notebook
gboolean scrollable
## gboolean gtk_notebook_get_scrollable (GtkNotebook *notebook)
gboolean
gtk_notebook_get_scrollable (notebook)
GtkNotebook * notebook
## void gtk_notebook_popup_disable (GtkNotebook *notebook)
void
gtk_notebook_popup_disable (notebook)
GtkNotebook * notebook
## void gtk_notebook_set_tab_label (GtkNotebook *notebook, GtkWidget *child, GtkWidget *tab_label)
void
gtk_notebook_set_tab_label (notebook, child, tab_label=NULL)
GtkNotebook * notebook
GtkWidget * child
GtkWidget_ornull * tab_label
## void gtk_notebook_set_tab_label_text (GtkNotebook *notebook, GtkWidget *child, const gchar *tab_text)
xs/GtkNotebook.xs view on Meta::CPAN
gint
gtk_notebook_get_current_page (notebook)
GtkNotebook * notebook
##void gtk_notebook_set_show_border (GtkNotebook *notebook, gboolean show_border)
void
gtk_notebook_set_show_border (notebook, show_border)
GtkNotebook * notebook
gboolean show_border
##void gtk_notebook_popup_enable (GtkNotebook *notebook)
void
gtk_notebook_popup_enable (notebook)
GtkNotebook * notebook
##GtkWidget * gtk_notebook_get_tab_label (GtkNotebook *notebook, GtkWidget *child)
GtkWidget *
gtk_notebook_get_tab_label (notebook, child)
GtkNotebook * notebook
GtkWidget * child
##gint gtk_notebook_get_n_pages (GtkNotebook *notebook)
gint
xs/GtkScaleButton.xs view on Meta::CPAN
gdouble gtk_scale_button_get_value (GtkScaleButton *button);
void gtk_scale_button_set_value (GtkScaleButton *button, gdouble value);
GtkAdjustment * gtk_scale_button_get_adjustment (GtkScaleButton *button);
void gtk_scale_button_set_adjustment (GtkScaleButton *button, GtkAdjustment *adjustment);
#if GTK_CHECK_VERSION (2, 14, 0)
GtkWidget * gtk_scale_button_get_popup (GtkScaleButton *button);
GtkWidget * gtk_scale_button_get_plus_button (GtkScaleButton *button);
GtkWidget * gtk_scale_button_get_minus_button (GtkScaleButton *button);
void gtk_scale_button_set_orientation (GtkScaleButton *button, GtkOrientation orientation);
GtkOrientation gtk_scale_button_get_orientation (GtkScaleButton *button);
#endif /* 2.14 */
xs/GtkStatusIcon.xs view on Meta::CPAN
=for signature (x, y, push_in) = Gtk2::StatusIcon::position_menu (menu, icon)
=for signature (x, y, push_in) = Gtk2::StatusIcon::position_menu (menu, x, y, icon)
=for arg menu (Gtk2::Menu)
=for arg x (integer)
=for arg y (integer)
=for arg icon (Gtk2::StatusIcon)
This function takes four arguments so that it may be passed directly as the
menu position callback to Gtk2::Menu::popup(), which passes in initial x and y
values for historical reasons. Otherwise, you need only pass two arguments.
This function can be used as the I<menu_pos_func> argument to
I<Gtk2::Menu::popup>.
=cut
void
gtk_status_icon_position_menu (GtkMenu *menu, ...)
PREINIT:
gboolean push_in;
gint x, y;
GtkStatusIcon *icon;
PPCODE:
if (items == 4) {
xs/GtkTreeView.xs view on Meta::CPAN
#### gboolean gtk_tree_view_get_path_at_pos (GtkTreeView *tree_view, gint x, gint y, GtkTreePath **path, GtkTreeViewColumn **column, gint *cell_x, gint *cell_y)
=for apidoc
=for signature path = $tree_view->get_path_at_pos ($x, $y)
=for signature (path, column, cell_x, cell_y) = $tree_view->get_path_at_pos ($x, $y)
Finds the path at the point (I<$x>, I<$y>), relative to widget
coordinates. That is, I<$x> and I<$y> are relative to an event's
coordinates. I<$x> and I<$y> must come from an event on the I<$tree_view> only
where C<$event-E<gt>window == $tree_view-E<gt>get_bin_window>. It is primarily
for things like popup menus. In scalar context, returns the Gtk2::TreePath, in
array context, adds the Gtk2::TreeViewColumn, and I<$x> and I<$y> translated to
be relative to the cell. This function is only meaningful if I<$tree_view> is
realized.
=cut
void
gtk_tree_view_get_path_at_pos (tree_view, x, y)
GtkTreeView *tree_view
gint x
gint y
xs/GtkWindow.xs view on Meta::CPAN
#include "gtk2perl.h"
MODULE = Gtk2::Window PACKAGE = Gtk2::Window PREFIX = gtk_window_
=for position DESCRIPTION
=head1 DESCRIPTION
A Gtk2::Window is a top-level window displayed on the root window and
interacting (or not) with the window manager. It can be an
application's main window, a dialog, or a temporary such as a popup
splash window.
=head2 Delete Event and Destroy
The default action for a C<delete-event> (normally from the window
manager close button) is to destroy the window with
C<< $window->destroy >>. In your main window you might want to exit
the main loop when that happens.
$toplevel->signal_connect (destroy => sub { Gtk2->main_quit });
If you install a handler for C<delete-event> and return true, meaning
"don't propagate", you can do something other than destroy the window.
For example
$toplevel->signal_connect (delete_event => sub {
if (any_unsaved_documents()) {
popup_ask_save_before_exit_dialog();
return Gtk2::EVENT_STOP; # don't go to default destroy
} else {
return Gtk2::EVENT_PROPAGATE;
}
});
In a dialog or secondary app window you might not want to destroy but
instead just hide ready for later re-use.
$dialog->signal_connect