Chinaunix首页 | 论坛 | 博客
  • 博客访问: 236388
  • 博文数量: 41
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 441
  • 用 户 组: 普通用户
  • 注册时间: 2015-04-11 11:05
个人简介

123

文章分类

全部博文(41)

文章存档

2019年(2)

2018年(3)

2017年(2)

2016年(11)

2015年(23)

我的朋友

分类: PERL

2015-04-24 15:10:52

在“perl-Gtk2编程-第一步 安装软件” 中可以看到,perl-Gtk2是有相应的图形化组件帮助手册的,因此可以使用man Gtk2::组件名称 进行查询,如下命令:
 man -a  Gtk2::Window |tee a.txt
Gtk2::Window(3)                                                                      User Contributed Perl Documentation                                                                      Gtk2::Window(3)



NAME
       Gtk2::Window

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.

   Delete Event and Destroy
       The default action for a "delete-event" (normally from the window manager close button) is to destroy the window with "$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 "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
             (delete_event => \&Gtk2::Widget::hide_on_delete);

       The choice between destroying or hiding is normally just a matter of memory saved against the time to re-create, and how likely the dialog might be needed again.  (However if you build windows with
       Glade it's not particularly easy to re-create them there, so you'll mostly want to just hide in that case.)

       A hidden toplevel window is still in "Gtk2::Window->list_toplevels" and that's a good place to search for an existing window of a desired type to "$window->present" again.

HIERARCHY
         Glib::Object
         +----Glib::InitiallyUnowned
              +----Gtk2::Object
                   +----Gtk2::Widget
                        +----Gtk2::Container
                             +----Gtk2::Bin
                                  +----Gtk2::Window

下面通过使用以下bash脚本获取所有Gtk2组件的帮助手册信息:
for file in $(rpm -ql perl-Gtk2|grep "Gtk2::");
do 
    object=$(basename $file|sed 's/.3pm.gz//g'); 
    man $object >>Gtk2_man.txt;
done
将txt转换为pdf后,文件如下:
Gtk2帮助手册.zip
阅读(2092) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~