gtk2 0.20.1 → 0.90.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +30 -0
- data/Rakefile +60 -54
- data/ext/gtk2/Makefile +163 -0
- data/ext/gtk2/depend +10 -0
- data/ext/gtk2/extconf.rb +202 -0
- data/{src → ext/gtk2}/global.h +0 -0
- data/ext/gtk2/gtk2.def +27 -0
- data/{src → ext/gtk2}/init.c +0 -0
- data/{src → ext/gtk2}/rbgdk.c +0 -0
- data/{src → ext/gtk2}/rbgdk.h +0 -0
- data/{src → ext/gtk2}/rbgdkatom.c +0 -0
- data/{src → ext/gtk2}/rbgdkcairo.c +0 -0
- data/{src → ext/gtk2}/rbgdkcolor.c +0 -0
- data/{src → ext/gtk2}/rbgdkcolormap.c +0 -0
- data/{src → ext/gtk2}/rbgdkconst.c +0 -0
- data/{src → ext/gtk2}/rbgdkconversions.h +0 -0
- data/{src → ext/gtk2}/rbgdkcursor.c +0 -0
- data/{src → ext/gtk2}/rbgdkdevice.c +0 -0
- data/{src → ext/gtk2}/rbgdkdisplay.c +0 -0
- data/{src → ext/gtk2}/rbgdkdisplaymanager.c +0 -0
- data/{src → ext/gtk2}/rbgdkdragcontext.c +0 -0
- data/{src → ext/gtk2}/rbgdkdraw.c +0 -0
- data/{src → ext/gtk2}/rbgdkevent.c +0 -0
- data/{src → ext/gtk2}/rbgdkgc.c +0 -0
- data/{src → ext/gtk2}/rbgdkgeometry.c +0 -0
- data/{src → ext/gtk2}/rbgdkimage.c +0 -0
- data/{src → ext/gtk2}/rbgdkinput.c +0 -0
- data/{src → ext/gtk2}/rbgdkkeymap.c +0 -0
- data/{src → ext/gtk2}/rbgdkkeysyms.h +0 -466
- data/{src → ext/gtk2}/rbgdkkeyval.c +0 -0
- data/{src → ext/gtk2}/rbgdkpango.c +0 -0
- data/{src → ext/gtk2}/rbgdkpangorenderer.c +0 -0
- data/{src → ext/gtk2}/rbgdkpixbuf.c +0 -0
- data/{src → ext/gtk2}/rbgdkpixmap.c +0 -0
- data/{src → ext/gtk2}/rbgdkproperty.c +0 -0
- data/{src → ext/gtk2}/rbgdkrectangle.c +0 -0
- data/{src → ext/gtk2}/rbgdkregion.c +0 -0
- data/{src → ext/gtk2}/rbgdkrgb.c +0 -0
- data/{src → ext/gtk2}/rbgdkscreen.c +0 -0
- data/{src → ext/gtk2}/rbgdkselection.c +0 -0
- data/{src → ext/gtk2}/rbgdkthreads.c +0 -0
- data/{src → ext/gtk2}/rbgdktimecoord.c +0 -0
- data/{src → ext/gtk2}/rbgdkvisual.c +0 -0
- data/{src → ext/gtk2}/rbgdkwindow.c +0 -0
- data/{src → ext/gtk2}/rbgdkwindowattr.c +0 -0
- data/{src → ext/gtk2}/rbgdkx11.c +0 -0
- data/{src → ext/gtk2}/rbgtk.c +0 -0
- data/{src → ext/gtk2}/rbgtk.h +0 -4
- data/{src → ext/gtk2}/rbgtkaboutdialog.c +0 -0
- data/{src → ext/gtk2}/rbgtkaccelerator.c +0 -0
- data/{src → ext/gtk2}/rbgtkaccelgroup.c +0 -0
- data/{src → ext/gtk2}/rbgtkaccelgroupentry.c +0 -0
- data/{src → ext/gtk2}/rbgtkaccelkey.c +0 -0
- data/{src → ext/gtk2}/rbgtkaccellabel.c +0 -0
- data/{src → ext/gtk2}/rbgtkaccelmap.c +0 -0
- data/{src → ext/gtk2}/rbgtkaccessible.c +0 -0
- data/{src → ext/gtk2}/rbgtkaction.c +0 -0
- data/{src → ext/gtk2}/rbgtkactiongroup.c +0 -0
- data/{src → ext/gtk2}/rbgtkadjustment.c +0 -0
- data/{src → ext/gtk2}/rbgtkalignment.c +0 -0
- data/{src → ext/gtk2}/rbgtkallocation.c +0 -0
- data/{src → ext/gtk2}/rbgtkarrow.c +0 -0
- data/{src → ext/gtk2}/rbgtkaspectframe.c +0 -0
- data/{src → ext/gtk2}/rbgtkassistant.c +0 -0
- data/{src → ext/gtk2}/rbgtkbbox.c +0 -0
- data/{src → ext/gtk2}/rbgtkbin.c +0 -0
- data/{src → ext/gtk2}/rbgtkbindingset.c +0 -0
- data/{src → ext/gtk2}/rbgtkborder.c +0 -0
- data/{src → ext/gtk2}/rbgtkbox.c +0 -0
- data/{src → ext/gtk2}/rbgtkbuildable.c +0 -0
- data/{src → ext/gtk2}/rbgtkbuilder.c +0 -0
- data/{src → ext/gtk2}/rbgtkbutton.c +0 -0
- data/{src → ext/gtk2}/rbgtkcalendar.c +0 -0
- data/{src → ext/gtk2}/rbgtkcelleditable.c +0 -0
- data/{src → ext/gtk2}/rbgtkcelllayout.c +0 -0
- data/{src → ext/gtk2}/rbgtkcellrenderer.c +0 -0
- data/{src → ext/gtk2}/rbgtkcellrendereraccel.c +0 -0
- data/{src → ext/gtk2}/rbgtkcellrenderercombo.c +0 -0
- data/{src → ext/gtk2}/rbgtkcellrendererpixbuf.c +0 -0
- data/{src → ext/gtk2}/rbgtkcellrendererprogress.c +0 -0
- data/{src → ext/gtk2}/rbgtkcellrendererspin.c +0 -0
- data/{src → ext/gtk2}/rbgtkcellrenderertext.c +0 -0
- data/{src → ext/gtk2}/rbgtkcellrenderertoggle.c +0 -0
- data/{src → ext/gtk2}/rbgtkcellview.c +0 -0
- data/{src → ext/gtk2}/rbgtkcheckbutton.c +0 -0
- data/{src → ext/gtk2}/rbgtkcheckmenuitem.c +0 -0
- data/{src → ext/gtk2}/rbgtkclipboard.c +0 -0
- data/{src → ext/gtk2}/rbgtkcolorbutton.c +0 -0
- data/{src → ext/gtk2}/rbgtkcolorsel.c +0 -0
- data/{src → ext/gtk2}/rbgtkcolorselectiondialog.c +0 -0
- data/{src → ext/gtk2}/rbgtkcombo.c +0 -0
- data/{src → ext/gtk2}/rbgtkcombobox.c +0 -0
- data/{src → ext/gtk2}/rbgtkcomboboxentry.c +0 -0
- data/{src → ext/gtk2}/rbgtkconst.c +0 -0
- data/{src → ext/gtk2}/rbgtkcontainer.c +0 -0
- data/{src → ext/gtk2}/rbgtkconversions.h +0 -0
- data/{src → ext/gtk2}/rbgtkcurve.c +0 -0
- data/{src → ext/gtk2}/rbgtkdialog.c +0 -0
- data/{src → ext/gtk2}/rbgtkdrag.c +0 -0
- data/{src → ext/gtk2}/rbgtkdrawingarea.c +0 -0
- data/{src → ext/gtk2}/rbgtkeditable.c +0 -0
- data/{src → ext/gtk2}/rbgtkentry.c +0 -0
- data/{src → ext/gtk2}/rbgtkentrycompletion.c +0 -0
- data/{src → ext/gtk2}/rbgtkeventbox.c +0 -0
- data/{src → ext/gtk2}/rbgtkexpander.c +0 -0
- data/{src → ext/gtk2}/rbgtkfilechooser.c +0 -0
- data/{src → ext/gtk2}/rbgtkfilechooserbutton.c +0 -0
- data/{src → ext/gtk2}/rbgtkfilechooserdialog.c +0 -0
- data/{src → ext/gtk2}/rbgtkfilechooserwidget.c +0 -0
- data/{src → ext/gtk2}/rbgtkfilefilter.c +0 -0
- data/{src → ext/gtk2}/rbgtkfilesel.c +0 -0
- data/{src → ext/gtk2}/rbgtkfixed.c +0 -0
- data/{src → ext/gtk2}/rbgtkfontbutton.c +0 -0
- data/{src → ext/gtk2}/rbgtkfontselection.c +0 -0
- data/{src → ext/gtk2}/rbgtkfontselectiondialog.c +0 -0
- data/{src → ext/gtk2}/rbgtkframe.c +0 -0
- data/{src → ext/gtk2}/rbgtkgamma.c +0 -0
- data/{src → ext/gtk2}/rbgtkhandlebox.c +0 -0
- data/{src → ext/gtk2}/rbgtkhbbox.c +0 -0
- data/{src → ext/gtk2}/rbgtkhbox.c +0 -0
- data/{src → ext/gtk2}/rbgtkhpaned.c +0 -0
- data/{src → ext/gtk2}/rbgtkhruler.c +0 -0
- data/{src → ext/gtk2}/rbgtkhscale.c +0 -0
- data/{src → ext/gtk2}/rbgtkhscrollbar.c +0 -0
- data/{src → ext/gtk2}/rbgtkhseparator.c +0 -0
- data/{src → ext/gtk2}/rbgtkiconfactory.c +0 -0
- data/{src → ext/gtk2}/rbgtkiconinfo.c +0 -0
- data/{src → ext/gtk2}/rbgtkiconset.c +0 -0
- data/{src → ext/gtk2}/rbgtkiconsize.c +0 -0
- data/{src → ext/gtk2}/rbgtkiconsource.c +0 -0
- data/{src → ext/gtk2}/rbgtkicontheme.c +0 -0
- data/{src → ext/gtk2}/rbgtkiconview.c +0 -0
- data/{src → ext/gtk2}/rbgtkimage.c +0 -0
- data/{src → ext/gtk2}/rbgtkimagemenuitem.c +0 -0
- data/{src → ext/gtk2}/rbgtkimcontext.c +0 -0
- data/{src → ext/gtk2}/rbgtkimcontextsimple.c +0 -0
- data/{src → ext/gtk2}/rbgtkimmulticontext.c +0 -0
- data/{src → ext/gtk2}/rbgtkinits.c +2 -6
- data/{src → ext/gtk2}/rbgtkinputdialog.c +0 -0
- data/{src → ext/gtk2}/rbgtkinvisible.c +0 -0
- data/{src → ext/gtk2}/rbgtkitem.c +0 -0
- data/{src → ext/gtk2}/rbgtkitemfactory.c +0 -0
- data/{src → ext/gtk2}/rbgtklabel.c +0 -0
- data/{src → ext/gtk2}/rbgtklayout.c +0 -0
- data/{src → ext/gtk2}/rbgtklinkbutton.c +0 -0
- data/{src → ext/gtk2}/rbgtkliststore.c +0 -0
- data/{src → ext/gtk2}/rbgtkmacros.h +0 -0
- data/{src → ext/gtk2}/rbgtkmain.c +0 -0
- data/{src → ext/gtk2}/rbgtkmenu.c +0 -0
- data/{src → ext/gtk2}/rbgtkmenubar.c +0 -0
- data/{src → ext/gtk2}/rbgtkmenuitem.c +0 -0
- data/{src → ext/gtk2}/rbgtkmenushell.c +0 -0
- data/{src → ext/gtk2}/rbgtkmenutoolbutton.c +0 -0
- data/{src → ext/gtk2}/rbgtkmessagedialog.c +0 -0
- data/{src → ext/gtk2}/rbgtkmisc.c +0 -0
- data/{src → ext/gtk2}/rbgtknotebook.c +0 -0
- data/{src → ext/gtk2}/rbgtkobject.c +0 -0
- data/{src → ext/gtk2}/rbgtkoptionmenu.c +0 -0
- data/{src → ext/gtk2}/rbgtkpagesetup.c +0 -0
- data/{src → ext/gtk2}/rbgtkpagesetupunixdialog.c +0 -0
- data/{src → ext/gtk2}/rbgtkpaned.c +0 -0
- data/{src → ext/gtk2}/rbgtkpapersize.c +0 -0
- data/{src → ext/gtk2}/rbgtkplug.c +0 -0
- data/{src → ext/gtk2}/rbgtkprintcontext.c +0 -0
- data/{src → ext/gtk2}/rbgtkprinter.c +0 -0
- data/{src → ext/gtk2}/rbgtkprintjob.c +0 -0
- data/{src → ext/gtk2}/rbgtkprintoperation.c +0 -0
- data/{src → ext/gtk2}/rbgtkprintoperationpreview.c +0 -0
- data/{src → ext/gtk2}/rbgtkprintsettings.c +0 -0
- data/{src → ext/gtk2}/rbgtkprintunixdialog.c +0 -0
- data/{src → ext/gtk2}/rbgtkprogress.c +0 -0
- data/{src → ext/gtk2}/rbgtkprogressbar.c +0 -0
- data/{src → ext/gtk2}/rbgtkradioaction.c +0 -0
- data/{src → ext/gtk2}/rbgtkradiobutton.c +0 -0
- data/{src → ext/gtk2}/rbgtkradiomenuitem.c +0 -0
- data/{src → ext/gtk2}/rbgtkradiotoolbutton.c +0 -0
- data/{src → ext/gtk2}/rbgtkrange.c +0 -0
- data/{src → ext/gtk2}/rbgtkrc.c +0 -0
- data/{src → ext/gtk2}/rbgtkrcstyle.c +0 -0
- data/{src → ext/gtk2}/rbgtkrecentaction.c +0 -0
- data/{src → ext/gtk2}/rbgtkrecentchooser.c +0 -0
- data/{src → ext/gtk2}/rbgtkrecentchooserdialog.c +0 -0
- data/{src → ext/gtk2}/rbgtkrecentchoosermenu.c +0 -0
- data/{src → ext/gtk2}/rbgtkrecentchooserwidget.c +0 -0
- data/{src → ext/gtk2}/rbgtkrecentdata.c +0 -0
- data/{src → ext/gtk2}/rbgtkrecentfilter.c +0 -0
- data/{src → ext/gtk2}/rbgtkrecentfilterinfo.c +0 -0
- data/{src → ext/gtk2}/rbgtkrecentinfo.c +0 -0
- data/{src → ext/gtk2}/rbgtkrecentmanager.c +0 -0
- data/{src → ext/gtk2}/rbgtkruler.c +0 -0
- data/{src → ext/gtk2}/rbgtkscale.c +0 -0
- data/{src → ext/gtk2}/rbgtkscalebutton.c +0 -0
- data/{src → ext/gtk2}/rbgtkscrollbar.c +0 -0
- data/{src → ext/gtk2}/rbgtkscrolledwindow.c +0 -0
- data/{src → ext/gtk2}/rbgtkselection.c +0 -0
- data/{src → ext/gtk2}/rbgtkselectiondata.c +0 -0
- data/{src → ext/gtk2}/rbgtkseparator.c +0 -0
- data/{src → ext/gtk2}/rbgtkseparatormenuitem.c +0 -0
- data/{src → ext/gtk2}/rbgtkseparatortoolitem.c +0 -0
- data/{src → ext/gtk2}/rbgtksettings.c +0 -0
- data/{src → ext/gtk2}/rbgtksizegroup.c +0 -0
- data/{src → ext/gtk2}/rbgtksocket.c +0 -0
- data/{src → ext/gtk2}/rbgtkspinbutton.c +0 -0
- data/{src → ext/gtk2}/rbgtkstatusbar.c +0 -0
- data/{src → ext/gtk2}/rbgtkstatusicon.c +0 -0
- data/{src → ext/gtk2}/rbgtkstock.c +0 -0
- data/{src → ext/gtk2}/rbgtkstyle.c +0 -0
- data/{src → ext/gtk2}/rbgtktable.c +0 -0
- data/{src → ext/gtk2}/rbgtktargetlist.c +0 -0
- data/{src → ext/gtk2}/rbgtktearoffmenuitem.c +0 -0
- data/{src → ext/gtk2}/rbgtktextappearance.c +0 -0
- data/{src → ext/gtk2}/rbgtktextattributes.c +0 -0
- data/{src → ext/gtk2}/rbgtktextbuffer.c +0 -0
- data/{src → ext/gtk2}/rbgtktextchild.c +0 -0
- data/{src → ext/gtk2}/rbgtktextiter.c +0 -0
- data/{src → ext/gtk2}/rbgtktextmark.c +0 -0
- data/{src → ext/gtk2}/rbgtktexttag.c +0 -0
- data/{src → ext/gtk2}/rbgtktexttagtable.c +0 -0
- data/{src → ext/gtk2}/rbgtktextview.c +0 -0
- data/{src → ext/gtk2}/rbgtktoggleaction.c +0 -0
- data/{src → ext/gtk2}/rbgtktogglebutton.c +0 -0
- data/{src → ext/gtk2}/rbgtktoggletoolbutton.c +0 -0
- data/{src → ext/gtk2}/rbgtktoolbar.c +0 -0
- data/{src → ext/gtk2}/rbgtktoolbutton.c +0 -0
- data/{src → ext/gtk2}/rbgtktoolitem.c +0 -0
- data/{src → ext/gtk2}/rbgtktooltip.c +0 -0
- data/{src → ext/gtk2}/rbgtktooltips.c +0 -0
- data/{src → ext/gtk2}/rbgtktreedragdest.c +0 -0
- data/{src → ext/gtk2}/rbgtktreedragsource.c +0 -0
- data/{src → ext/gtk2}/rbgtktreeiter.c +0 -0
- data/{src → ext/gtk2}/rbgtktreemodel.c +0 -0
- data/{src → ext/gtk2}/rbgtktreemodelfilter.c +0 -0
- data/{src → ext/gtk2}/rbgtktreemodelsort.c +0 -0
- data/{src → ext/gtk2}/rbgtktreepath.c +0 -0
- data/{src → ext/gtk2}/rbgtktreerowreference.c +0 -0
- data/{src → ext/gtk2}/rbgtktreeselection.c +0 -0
- data/{src → ext/gtk2}/rbgtktreesortable.c +0 -0
- data/{src → ext/gtk2}/rbgtktreestore.c +0 -0
- data/{src → ext/gtk2}/rbgtktreeview.c +0 -0
- data/{src → ext/gtk2}/rbgtktreeviewcolumn.c +0 -0
- data/{src → ext/gtk2}/rbgtkuimanager.c +0 -0
- data/{src → ext/gtk2}/rbgtkvbbox.c +0 -0
- data/{src → ext/gtk2}/rbgtkvbox.c +0 -0
- data/{src → ext/gtk2}/rbgtkviewport.c +0 -0
- data/{src → ext/gtk2}/rbgtkvolumebutton.c +0 -0
- data/{src → ext/gtk2}/rbgtkvpaned.c +0 -0
- data/{src → ext/gtk2}/rbgtkvruler.c +0 -0
- data/{src → ext/gtk2}/rbgtkvscale.c +0 -0
- data/{src → ext/gtk2}/rbgtkvscrollbar.c +0 -0
- data/{src → ext/gtk2}/rbgtkvseparator.c +0 -0
- data/{src → ext/gtk2}/rbgtkwidget.c +0 -0
- data/{src → ext/gtk2}/rbgtkwindow.c +0 -0
- data/{src → ext/gtk2}/rbgtkwindowgroup.c +0 -0
- data/extconf.rb +48 -113
- data/{src/lib → lib}/gtk2.rb +0 -0
- data/{src/lib → lib}/gtk2/base.rb +12 -1
- data/sample/gtk-demo/README +7 -0
- data/sample/gtk-demo/alphatest.png +0 -0
- data/sample/gtk-demo/apple-red.png +0 -0
- data/sample/gtk-demo/appwindow.rb +233 -0
- data/sample/gtk-demo/background.jpg +0 -0
- data/sample/gtk-demo/builder.rb +51 -0
- data/sample/gtk-demo/button_box.rb +84 -0
- data/sample/gtk-demo/cairo-arc-negative.rb +41 -0
- data/sample/gtk-demo/cairo-arc.rb +41 -0
- data/sample/gtk-demo/cairo-clip-image.rb +51 -0
- data/sample/gtk-demo/cairo-clip-rectangle.rb +35 -0
- data/sample/gtk-demo/cairo-clip.rb +35 -0
- data/sample/gtk-demo/cairo-curve-rectangle.rb +76 -0
- data/sample/gtk-demo/cairo-curve-to.rb +43 -0
- data/sample/gtk-demo/cairo-dash.rb +39 -0
- data/sample/gtk-demo/cairo-fill-and-stroke.rb +32 -0
- data/sample/gtk-demo/cairo-fill-and-stroke2.rb +38 -0
- data/sample/gtk-demo/cairo-gradient.rb +35 -0
- data/sample/gtk-demo/cairo-image-pattern.rb +39 -0
- data/sample/gtk-demo/cairo-image.rb +49 -0
- data/sample/gtk-demo/cairo-line-cap.rb +53 -0
- data/sample/gtk-demo/cairo-line-join.rb +41 -0
- data/sample/gtk-demo/cairo-long-lines.rb +41 -0
- data/sample/gtk-demo/cairo-operator.rb +83 -0
- data/sample/gtk-demo/cairo-path.rb +28 -0
- data/sample/gtk-demo/cairo-pattern-fill.rb +88 -0
- data/sample/gtk-demo/cairo-self-intersect.rb +32 -0
- data/sample/gtk-demo/cairo-text-align-center.rb +45 -0
- data/sample/gtk-demo/cairo-text-extents.rb +46 -0
- data/sample/gtk-demo/cairo-text.rb +43 -0
- data/sample/gtk-demo/changedisplay.rb +408 -0
- data/sample/gtk-demo/clipboard.rb +72 -0
- data/sample/gtk-demo/colorsel.rb +84 -0
- data/sample/gtk-demo/common.rb +88 -0
- data/sample/gtk-demo/demo.ui +258 -0
- data/sample/gtk-demo/dialog.rb +137 -0
- data/sample/gtk-demo/drawingarea.rb +226 -0
- data/sample/gtk-demo/editable_cells.rb +172 -0
- data/sample/gtk-demo/entry_completion.rb +63 -0
- data/sample/gtk-demo/expander.rb +40 -0
- data/sample/gtk-demo/floppybuddy.gif +0 -0
- data/sample/gtk-demo/gnome-applets.png +0 -0
- data/sample/gtk-demo/gnome-calendar.png +0 -0
- data/sample/gtk-demo/gnome-foot.png +0 -0
- data/sample/gtk-demo/gnome-fs-directory.png +0 -0
- data/sample/gtk-demo/gnome-fs-regular.png +0 -0
- data/sample/gtk-demo/gnome-gimp.png +0 -0
- data/sample/gtk-demo/gnome-gmush.png +0 -0
- data/sample/gtk-demo/gnome-gsame.png +0 -0
- data/sample/gtk-demo/gnu-keys.png +0 -0
- data/sample/gtk-demo/gtk-logo-rgb.gif +0 -0
- data/sample/gtk-demo/hypertext.rb +211 -0
- data/sample/gtk-demo/iconview.rb +109 -0
- data/sample/gtk-demo/images.rb +197 -0
- data/sample/gtk-demo/item_factory.rb +94 -0
- data/sample/gtk-demo/list_store.rb +138 -0
- data/sample/gtk-demo/main.rb +380 -0
- data/sample/gtk-demo/menus.rb +172 -0
- data/sample/gtk-demo/panes.rb +156 -0
- data/sample/gtk-demo/pixbufs.rb +176 -0
- data/sample/gtk-demo/printing.rb +128 -0
- data/sample/gtk-demo/rotated_text.rb +84 -0
- data/sample/gtk-demo/ruby-gnome2-logo.png +0 -0
- data/sample/gtk-demo/sizegroup.rb +118 -0
- data/sample/gtk-demo/stock_browser.rb +235 -0
- data/sample/gtk-demo/textview.rb +435 -0
- data/sample/gtk-demo/tree_store.rb +270 -0
- data/sample/misc/aboutdialog.rb +42 -0
- data/sample/misc/aboutdialog2.rb +42 -0
- data/sample/misc/alpha-demo.rb +70 -0
- data/sample/misc/assistant.rb +347 -0
- data/sample/misc/bindings.rb +107 -0
- data/sample/misc/button.rb +69 -0
- data/sample/misc/button2.rb +28 -0
- data/sample/misc/buttonbox.rb +93 -0
- data/sample/misc/cairo-pong.rb +215 -0
- data/sample/misc/calendar.rb +62 -0
- data/sample/misc/checkbutton.rb +46 -0
- data/sample/misc/colorselection.rb +25 -0
- data/sample/misc/combo_check.rb +71 -0
- data/sample/misc/combobox.rb +86 -0
- data/sample/misc/composited-windows.rb +113 -0
- data/sample/misc/cursor.rb +32 -0
- data/sample/misc/dialog.rb +44 -0
- data/sample/misc/dialog2.rb +39 -0
- data/sample/misc/dnd.rb +65 -0
- data/sample/misc/dndtreeview.rb +56 -0
- data/sample/misc/drag-move.rb +131 -0
- data/sample/misc/drawing.rb +90 -0
- data/sample/misc/entry.rb +34 -0
- data/sample/misc/entrycompletion.rb +39 -0
- data/sample/misc/expander.rb +27 -0
- data/sample/misc/filechooser.rb +49 -0
- data/sample/misc/fileselection.rb +26 -0
- data/sample/misc/frame.rb +69 -0
- data/sample/misc/gc.rb +59 -0
- data/sample/misc/gdkscreen.rb +32 -0
- data/sample/misc/gnome-logo-icon.png +0 -0
- data/sample/misc/helloworld.rb +35 -0
- data/sample/misc/iconview.rb +38 -0
- data/sample/misc/image.rb +42 -0
- data/sample/misc/itemfactory.rb +73 -0
- data/sample/misc/itemfactory2.rb +74 -0
- data/sample/misc/keyboard_grab.rb +29 -0
- data/sample/misc/label.rb +33 -0
- data/sample/misc/linkbutton.rb +42 -0
- data/sample/misc/listview.rb +92 -0
- data/sample/misc/menu.rb +81 -0
- data/sample/misc/misc_button.rb +59 -0
- data/sample/misc/mouse-gesture.rb +465 -0
- data/sample/misc/pangorenderer.rb +66 -0
- data/sample/misc/pointer_grab.rb +34 -0
- data/sample/misc/print.rb +247 -0
- data/sample/misc/properties.rb +85 -0
- data/sample/misc/radiobutton.rb +47 -0
- data/sample/misc/recentchooserdialog.rb +59 -0
- data/sample/misc/rgtk+cairo.rb +44 -0
- data/sample/misc/scalebutton.rb +25 -0
- data/sample/misc/settings.rb +41 -0
- data/sample/misc/statusicon.rb +123 -0
- data/sample/misc/stock.rb +36 -0
- data/sample/misc/style_property.rb +67 -0
- data/sample/misc/style_property.rc +19 -0
- data/sample/misc/t-gtkplug.rb +58 -0
- data/sample/misc/t-gtksocket.rb +65 -0
- data/sample/misc/test.xpm +92 -0
- data/sample/misc/textbuffer_serialize.rb +130 -0
- data/sample/misc/threads.rb +72 -0
- data/sample/misc/to_drawable.rb +42 -0
- data/sample/misc/togglebutton.rb +34 -0
- data/sample/misc/toolbar.rb +55 -0
- data/sample/misc/tooltips.rb +204 -0
- data/sample/misc/tree_combo.rb +85 -0
- data/sample/misc/tree_progress.rb +69 -0
- data/sample/misc/treemodelfilter.rb +55 -0
- data/sample/misc/treeview.rb +71 -0
- data/sample/misc/uimanager.rb +148 -0
- data/sample/misc/uimanager2.rb +91 -0
- data/sample/misc/uimanager2.xml +36 -0
- data/sample/misc/window.rb +24 -0
- data/sample/misc/xbm_cursor.rb +43 -0
- data/sample/testgtk/3DRings.xpm +116 -0
- data/sample/testgtk/FilesQueue.xpm +98 -0
- data/sample/testgtk/Modeller.xpm +117 -0
- data/sample/testgtk/README +14 -0
- data/sample/testgtk/button.rb +133 -0
- data/sample/testgtk/buttonbox.rb +108 -0
- data/sample/testgtk/check-n.xpm +21 -0
- data/sample/testgtk/check-y.xpm +21 -0
- data/sample/testgtk/checkbutton.rb +67 -0
- data/sample/testgtk/circles.xbm +46 -0
- data/sample/testgtk/colorselect.rb +33 -0
- data/sample/testgtk/dialog.rb +47 -0
- data/sample/testgtk/entry.rb +73 -0
- data/sample/testgtk/filesel.rb +67 -0
- data/sample/testgtk/fontselection.rb +56 -0
- data/sample/testgtk/gammacurve.rb +70 -0
- data/sample/testgtk/labels.rb +73 -0
- data/sample/testgtk/layout.rb +108 -0
- data/sample/testgtk/marble.xpm +408 -0
- data/sample/testgtk/menu.rb +79 -0
- data/sample/testgtk/notebook.rb +281 -0
- data/sample/testgtk/pixmap.rb +58 -0
- data/sample/testgtk/progressbar.rb +181 -0
- data/sample/testgtk/radiobutton.rb +61 -0
- data/sample/testgtk/range.rb +65 -0
- data/sample/testgtk/reparent.rb +91 -0
- data/sample/testgtk/rulers.rb +46 -0
- data/sample/testgtk/sample.rb +80 -0
- data/sample/testgtk/savedposition.rb +87 -0
- data/sample/testgtk/scrolledwindow.rb +67 -0
- data/sample/testgtk/shapedwindow.rb +99 -0
- data/sample/testgtk/spinbutton.rb +181 -0
- data/sample/testgtk/statusbar.rb +89 -0
- data/sample/testgtk/test.xpm +92 -0
- data/sample/testgtk/testgtk.rb +179 -0
- data/sample/testgtk/testgtkrc +146 -0
- data/sample/testgtk/testgtkrc2 +21 -0
- data/sample/testgtk/togglebutton.rb +53 -0
- data/sample/testgtk/toolbar.rb +82 -0
- data/sample/testgtk/tooltips.rb +41 -0
- data/sample/testgtk/wmhints.rb +40 -0
- data/test/run-test.rb +10 -8
- data/test/test_gtk_builder.rb +1 -1
- metadata +495 -334
- data/src/makeinits.rb +0 -57
- data/src/makekeysyms.rb +0 -5
@@ -0,0 +1,63 @@
|
|
1
|
+
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
|
2
|
+
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
|
+
# $Id: entry_completion.rb,v 1.3 2005/02/25 17:09:24 kzys Exp $
|
4
|
+
=begin
|
5
|
+
= Entry Completion (EntryCompletion)
|
6
|
+
|
7
|
+
GtkEntryCompletion provides a mechanism for adding support for
|
8
|
+
completion in GtkEntry.
|
9
|
+
=end
|
10
|
+
|
11
|
+
require 'common'
|
12
|
+
|
13
|
+
module Demo
|
14
|
+
class EntryCompletion < Gtk::Dialog
|
15
|
+
def initialize
|
16
|
+
super('GtkEntryCompletion',
|
17
|
+
nil, # parent
|
18
|
+
0,
|
19
|
+
[Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE])
|
20
|
+
|
21
|
+
self.resizable = false
|
22
|
+
|
23
|
+
signal_connect('response') do
|
24
|
+
self.destroy
|
25
|
+
end
|
26
|
+
|
27
|
+
vbox = Gtk::VBox.new(false, 5)
|
28
|
+
self.vbox.pack_start(vbox, true, true)
|
29
|
+
vbox.border_width = 5
|
30
|
+
|
31
|
+
label = Gtk::Label.new
|
32
|
+
label.markup = 'Completion demo, try writing <b>total</b> or <b>gnome</b> for example'
|
33
|
+
vbox.pack_start(label, false, false)
|
34
|
+
|
35
|
+
# Create our entry
|
36
|
+
entry = Gtk::Entry.new
|
37
|
+
vbox.pack_start(entry, false, false)
|
38
|
+
|
39
|
+
# Create the completion object
|
40
|
+
completion = Gtk::EntryCompletion.new
|
41
|
+
|
42
|
+
# Assign the completion to the entry
|
43
|
+
entry.completion = completion
|
44
|
+
|
45
|
+
# Create a tree model and use it as the completion model
|
46
|
+
completion.model = create_completion_model
|
47
|
+
|
48
|
+
# Use model column 0 as the text column
|
49
|
+
completion.text_column = 0
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
def create_completion_model
|
54
|
+
store = Gtk::ListStore.new(String)
|
55
|
+
%w(GNOME total totally).each do |word|
|
56
|
+
iter = store.append
|
57
|
+
iter[0] = word
|
58
|
+
end
|
59
|
+
|
60
|
+
store
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
|
2
|
+
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
|
+
# $Id: expander.rb,v 1.2 2005/02/25 17:09:25 kzys Exp $
|
4
|
+
=begin
|
5
|
+
= Expander (Expander)
|
6
|
+
|
7
|
+
GtkExpander allows to provide additional content that is initially hidden.
|
8
|
+
This is also known as "disclosure triangle".
|
9
|
+
=end
|
10
|
+
|
11
|
+
require 'common'
|
12
|
+
|
13
|
+
module Demo
|
14
|
+
class Expander < Gtk::Dialog
|
15
|
+
def initialize
|
16
|
+
super('GtkExpander',
|
17
|
+
nil, # parent
|
18
|
+
0,
|
19
|
+
[Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE])
|
20
|
+
self.resizable = false
|
21
|
+
|
22
|
+
signal_connect('response') do
|
23
|
+
self.destroy
|
24
|
+
end
|
25
|
+
|
26
|
+
vbox = Gtk::VBox.new(false, 5)
|
27
|
+
self.vbox.pack_start(vbox, true, true)
|
28
|
+
vbox.border_width = 5
|
29
|
+
|
30
|
+
label = Gtk::Label.new('Expander demo. CLick on the triangle for details.')
|
31
|
+
vbox.pack_start(label, false, false)
|
32
|
+
|
33
|
+
# Create the expander
|
34
|
+
expander = Gtk::Expander.new('Details')
|
35
|
+
vbox.pack_start(expander, false, false)
|
36
|
+
|
37
|
+
expander.add(Gtk::Label.new('Details can be shown or hidden.'))
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,211 @@
|
|
1
|
+
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
|
2
|
+
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
|
+
#
|
4
|
+
# $Id: hypertext.rb,v 1.2 2005/12/01 09:27:01 ktou Exp $
|
5
|
+
=begin
|
6
|
+
= Text Widget/Hypertext
|
7
|
+
|
8
|
+
Usually, tags modify the appearance of text in the view, e.g. making it
|
9
|
+
bold or colored or underlined. But tags are not restricted to appearance.
|
10
|
+
They can also affect the behavior of mouse and key presses, as this demo
|
11
|
+
shows.
|
12
|
+
=end
|
13
|
+
|
14
|
+
require 'common'
|
15
|
+
|
16
|
+
module Demo
|
17
|
+
class Hypertext < BasicWindow
|
18
|
+
def initialize
|
19
|
+
super('Hypertext')
|
20
|
+
|
21
|
+
@hand_cursor = Gdk::Cursor.new(Gdk::Cursor::HAND2)
|
22
|
+
@regular_cursor = Gdk::Cursor.new(Gdk::Cursor::XTERM)
|
23
|
+
@hovering = false
|
24
|
+
|
25
|
+
set_default_size(450, 450)
|
26
|
+
self.border_width = 0
|
27
|
+
|
28
|
+
view = Gtk::TextView.new
|
29
|
+
|
30
|
+
view.wrap_mode = Gtk::TextTag::WRAP_WORD
|
31
|
+
|
32
|
+
view.signal_connect('key-press-event') do |*args|
|
33
|
+
key_press_event(*args)
|
34
|
+
end
|
35
|
+
view.signal_connect('event-after') do |*args|
|
36
|
+
event_after(*args)
|
37
|
+
end
|
38
|
+
view.signal_connect('motion-notify-event') do |*args|
|
39
|
+
motion_notify_event(*args)
|
40
|
+
end
|
41
|
+
view.signal_connect('visibility-notify-event') do |*args|
|
42
|
+
visibility_notify_event(*args)
|
43
|
+
end
|
44
|
+
|
45
|
+
buffer = view.buffer
|
46
|
+
|
47
|
+
sw = Gtk::ScrolledWindow.new
|
48
|
+
sw.set_policy(Gtk::POLICY_AUTOMATIC,
|
49
|
+
Gtk::POLICY_AUTOMATIC)
|
50
|
+
|
51
|
+
add(sw)
|
52
|
+
sw.add(view)
|
53
|
+
|
54
|
+
show_page(buffer, 1)
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
# Inserts a piece of text into the buffer, giving it the usual
|
59
|
+
# appearance of a hyperlink in a web browser: blue and underlined.
|
60
|
+
# Additionally, attaches some data on the tag, to make it recognizable
|
61
|
+
# as a link.
|
62
|
+
def insert_link(buffer, iter, text, page)
|
63
|
+
tag = buffer.create_tag(nil,
|
64
|
+
{
|
65
|
+
'foreground' => 'blue',
|
66
|
+
'underline' => Pango::AttrUnderline::SINGLE,
|
67
|
+
})
|
68
|
+
tag.page = page
|
69
|
+
|
70
|
+
buffer.insert(iter, text, tag)
|
71
|
+
print("Insert #{tag}:#{page}\n")
|
72
|
+
end
|
73
|
+
|
74
|
+
# Fills the buffer with text and interspersed links. In any real
|
75
|
+
# hypertext app, this method would parse a file to identify the links.
|
76
|
+
def show_page(buffer, page)
|
77
|
+
puts
|
78
|
+
|
79
|
+
buffer.text = ''
|
80
|
+
iter = buffer.get_iter_at_offset(0)
|
81
|
+
|
82
|
+
case page
|
83
|
+
when 1
|
84
|
+
buffer.insert(iter, 'Some text ot show that simple ')
|
85
|
+
insert_link(buffer, iter, 'hypertext', 3)
|
86
|
+
buffer.insert(iter, ' can easily be realized with ')
|
87
|
+
insert_link(buffer, iter, 'tags', 2)
|
88
|
+
buffer.insert(iter, '.')
|
89
|
+
when 2
|
90
|
+
buffer.insert(iter,
|
91
|
+
%Q[A tag is an attribute that can be applied to some range of text. For example, a tag might be called "bold" and make the text insid the tag bold. However, the tag concept is more general than that; tags don't have to affect appearance. They can instead affect the behavior of mouse and key presses, "lock" a range of text so the user can't edit it, or countless other things.])
|
92
|
+
buffer.insert(iter, "\n")
|
93
|
+
insert_link(buffer, iter, 'Go back', 1)
|
94
|
+
when 3
|
95
|
+
tag = buffer.create_tag(nil,
|
96
|
+
{
|
97
|
+
'weight' =>
|
98
|
+
Pango::FontDescription::WEIGHT_BOLD
|
99
|
+
})
|
100
|
+
buffer.insert(iter, "hypertext:\n", tag);
|
101
|
+
buffer.insert(iter, %Q[machine-readable text that is not sequential but is organized so that related items of information are connected.\n])
|
102
|
+
insert_link(buffer, iter, 'Go back', 1)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# Looks at all tags covering the position of iter in the text view,
|
107
|
+
# and if one of them is a link, follow it by showing the page identified
|
108
|
+
# by the data attached to it.
|
109
|
+
def follow_if_link(text_view, iter)
|
110
|
+
tags = iter.tags
|
111
|
+
tags.each do |tag|
|
112
|
+
print("Follow #{tag}:#{tag.page}\n")
|
113
|
+
if tag.page
|
114
|
+
show_page(text_view.buffer, tag.page)
|
115
|
+
break
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
# Links can be activated by pressing Enter.
|
121
|
+
def key_press_event(text_view, event)
|
122
|
+
case event.keyval
|
123
|
+
when Gdk::Keyval::GDK_Return, Gdk::Keyval::GDK_KP_Enter
|
124
|
+
buffer = text_view.buffer
|
125
|
+
iter = buffer.get_iter_at_mark(buffer.get_mark("insert"))
|
126
|
+
follow_if_link(text_view, iter)
|
127
|
+
end
|
128
|
+
|
129
|
+
false
|
130
|
+
end
|
131
|
+
|
132
|
+
# Links can also be activated by clicking.
|
133
|
+
def event_after(text_view, event)
|
134
|
+
unless event.kind_of?(Gdk::EventButton) and event.button == 1
|
135
|
+
return false
|
136
|
+
end
|
137
|
+
|
138
|
+
buffer = text_view.buffer
|
139
|
+
|
140
|
+
# we shouldn't follow a link if the user has selected something
|
141
|
+
range = buffer.selection_bounds
|
142
|
+
if range and range[0].offset != range[1].offset
|
143
|
+
return false
|
144
|
+
end
|
145
|
+
|
146
|
+
x, y = text_view.window_to_buffer_coords(Gtk::TextView::WINDOW_WIDGET,
|
147
|
+
event.x, event.y)
|
148
|
+
iter = text_view.get_iter_at_location(x, y)
|
149
|
+
|
150
|
+
follow_if_link(text_view, iter)
|
151
|
+
end
|
152
|
+
|
153
|
+
# Looks at all tags covering the position (x, y) in the text view,
|
154
|
+
# and if one of them is a link, change the cursor to the "hands" cursor
|
155
|
+
# typically used by web browsers.
|
156
|
+
def set_cursor_if_appropriate(text_view, x, y)
|
157
|
+
|
158
|
+
buffer = text_view.buffer
|
159
|
+
iter = text_view.get_iter_at_location(x, y)
|
160
|
+
|
161
|
+
hovering = false
|
162
|
+
|
163
|
+
tags = iter.tags
|
164
|
+
tags.each do |t|
|
165
|
+
if t.page
|
166
|
+
hovering = true
|
167
|
+
break
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
if hovering != @hovering
|
172
|
+
@hovering = hovering
|
173
|
+
|
174
|
+
window = text_view.get_window(Gtk::TextView::WINDOW_TEXT)
|
175
|
+
|
176
|
+
window.cursor = if @hovering
|
177
|
+
@hand_cursor
|
178
|
+
else
|
179
|
+
@regular_cursor
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
# Update the cursor image if the pointer moved.
|
185
|
+
def motion_notify_event(text_view, event)
|
186
|
+
x, y = text_view.window_to_buffer_coords(Gtk::TextView::WINDOW_WIDGET,
|
187
|
+
event.x, event.y)
|
188
|
+
set_cursor_if_appropriate(text_view, x, y)
|
189
|
+
text_view.window.pointer
|
190
|
+
|
191
|
+
false
|
192
|
+
end
|
193
|
+
|
194
|
+
# Also update the cursor image if the window becomes visible
|
195
|
+
# (e.g. when a window covering it got iconified).
|
196
|
+
def visibility_notify_event (text_view, event)
|
197
|
+
window, wx, wy = text_view.window.pointer
|
198
|
+
bx, by = text_view.window_to_buffer_coords(Gtk::TextView::WINDOW_WIDGET,
|
199
|
+
wx, wy)
|
200
|
+
set_cursor_if_appropriate(text_view, bx, by)
|
201
|
+
|
202
|
+
false
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
module Gtk
|
208
|
+
class TextTag
|
209
|
+
attr_accessor :page
|
210
|
+
end
|
211
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# Copyright (c) 2005 Ruby-GNOME2 Project Team
|
2
|
+
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
|
+
#
|
4
|
+
# $Id: iconview.rb,v 1.7 2007/08/05 15:41:31 mutoh Exp $
|
5
|
+
=begin
|
6
|
+
= Icon View (IconView)
|
7
|
+
|
8
|
+
The Gtk::IconView widget is used to display and manipulate icons.
|
9
|
+
It uses a Gtk::TreeModel for data storage, so the list store example
|
10
|
+
might be helpful.
|
11
|
+
=end
|
12
|
+
$KCODE="u"
|
13
|
+
require 'common'
|
14
|
+
|
15
|
+
module Demo
|
16
|
+
class IconView < Demo::BasicWindow
|
17
|
+
COL_PATH, COL_DISPLAY_NAME, COL_IS_DIR, COL_PIXBUF = (0..3).to_a
|
18
|
+
|
19
|
+
def fill_store
|
20
|
+
@store.clear
|
21
|
+
Dir.glob(File.join(@parent, "*")).each do |path|
|
22
|
+
is_dir = FileTest.directory?(path)
|
23
|
+
iter = @store.append
|
24
|
+
# set COL_DISPLAY_NAME first because changing an iter will trigger the
|
25
|
+
# sort function; if we set something else first, the value of
|
26
|
+
# COL_DISPLAY_NAME for this row will be "nil" and the sort function will fail
|
27
|
+
puts path
|
28
|
+
#puts GLib.convert(GLib.filename_to_utf8(path), "Shift_JIS", "UTF-8")
|
29
|
+
#puts File.basename(GLib.convert(GLib.filename_to_utf8(path), "Shift_JIS", "UTF-8"))
|
30
|
+
# iter[COL_DISPLAY_NAME] = File.basename(GLib.filename_to_utf8(path))
|
31
|
+
iter[COL_DISPLAY_NAME] = GLib.filename_to_utf8(path)
|
32
|
+
iter[COL_PATH] = path
|
33
|
+
iter[COL_IS_DIR] = is_dir
|
34
|
+
iter[COL_PIXBUF] = is_dir ? @folder_pixbuf : @file_pixbuf
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def initialize
|
39
|
+
super('Gtk::IconView demo')
|
40
|
+
@file_pixbuf = Gdk::Pixbuf.new(Demo.find_file("gnome-fs-regular.png"))
|
41
|
+
@folder_pixbuf = Gdk::Pixbuf.new(Demo.find_file("gnome-fs-directory.png"))
|
42
|
+
|
43
|
+
@store = Gtk::ListStore.new(String, String, TrueClass, Gdk::Pixbuf)
|
44
|
+
@parent = "/"
|
45
|
+
|
46
|
+
@store.set_default_sort_func do |a, b|
|
47
|
+
if !a[COL_IS_DIR] and b[COL_IS_DIR]
|
48
|
+
1
|
49
|
+
elsif a[COL_IS_DIR] and !b[COL_IS_DIR]
|
50
|
+
-1
|
51
|
+
else
|
52
|
+
a[COL_DISPLAY_NAME] <=> b[COL_DISPLAY_NAME]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
@store.set_sort_column_id(Gtk::TreeSortable::DEFAULT_SORT_COLUMN_ID,
|
56
|
+
Gtk::SORT_ASCENDING)
|
57
|
+
|
58
|
+
fill_store
|
59
|
+
set_default_size(650, 400)
|
60
|
+
set_border_width(8)
|
61
|
+
|
62
|
+
vbox = Gtk::VBox.new(false, 0)
|
63
|
+
add(vbox)
|
64
|
+
|
65
|
+
toolbar = Gtk::Toolbar.new
|
66
|
+
vbox.pack_start(toolbar, false, false, 0)
|
67
|
+
|
68
|
+
up_button = Gtk::ToolButton.new(Gtk::Stock::GO_UP)
|
69
|
+
up_button.important = true
|
70
|
+
up_button.sensitive = false
|
71
|
+
toolbar.insert(-1, up_button)
|
72
|
+
up_button.signal_connect("clicked") do
|
73
|
+
@parent = File.dirname(@parent)
|
74
|
+
fill_store
|
75
|
+
up_button.sensitive = @parent != "/"
|
76
|
+
end
|
77
|
+
|
78
|
+
home_button = Gtk::ToolButton.new(Gtk::Stock::HOME)
|
79
|
+
home_button.important = true
|
80
|
+
toolbar.insert(-1, home_button)
|
81
|
+
home_button.signal_connect("clicked") do
|
82
|
+
@parent = GLib.home_dir
|
83
|
+
fill_store
|
84
|
+
up_button.sensitive = true
|
85
|
+
end
|
86
|
+
|
87
|
+
sw = Gtk::ScrolledWindow.new
|
88
|
+
sw.shadow_type = Gtk::SHADOW_ETCHED_IN
|
89
|
+
sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
90
|
+
vbox.pack_start(sw, true, true, 0)
|
91
|
+
|
92
|
+
iconview = Gtk::IconView.new(@store)
|
93
|
+
iconview.selection_mode = Gtk::SELECTION_MULTIPLE
|
94
|
+
iconview.text_column = COL_DISPLAY_NAME
|
95
|
+
iconview.pixbuf_column = COL_PIXBUF
|
96
|
+
iconview.signal_connect("item_activated") do |iview, path|
|
97
|
+
iter = @store.get_iter(path)
|
98
|
+
if iter[COL_DISPLAY_NAME]
|
99
|
+
@parent = iter[COL_PATH]
|
100
|
+
fill_store
|
101
|
+
up_button.sensitive = true
|
102
|
+
end
|
103
|
+
end
|
104
|
+
sw.add(iconview)
|
105
|
+
iconview.grab_focus
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
@@ -0,0 +1,197 @@
|
|
1
|
+
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
|
2
|
+
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
|
+
#
|
4
|
+
# $Id: images.rb,v 1.5 2006/04/08 12:30:03 mutoh Exp $
|
5
|
+
=begin
|
6
|
+
= Images
|
7
|
+
|
8
|
+
Gtk::Image is used to display an image; the image can be in a number of formats.
|
9
|
+
Typically, you load an image into a Gdk::Pixbuf, then display the pixbuf.
|
10
|
+
|
11
|
+
This demo code shows some of the more obscure cases, in the simple
|
12
|
+
case a call to Gtk::Image.new is all you need.
|
13
|
+
|
14
|
+
If you want to put image data in your program as a String variable,
|
15
|
+
use the make-inline-pixbuf program that comes with GTK+.
|
16
|
+
This way you won't need to depend on loading external files, your
|
17
|
+
application binary can be self-contained.
|
18
|
+
=end
|
19
|
+
require 'common'
|
20
|
+
|
21
|
+
module Demo
|
22
|
+
class Images < BasicWindow
|
23
|
+
def initialize
|
24
|
+
@pixbuf_loader = nil
|
25
|
+
@load_timeout = 0
|
26
|
+
@image_stream = nil
|
27
|
+
|
28
|
+
super('Images')
|
29
|
+
signal_connect('destroy') do
|
30
|
+
cleanup_callback
|
31
|
+
end
|
32
|
+
|
33
|
+
self.border_width = 8
|
34
|
+
|
35
|
+
vbox = Gtk::VBox.new(false, 8)
|
36
|
+
vbox.border_width = 8
|
37
|
+
add(vbox)
|
38
|
+
|
39
|
+
label = Gtk::Label.new
|
40
|
+
label.set_markup('<u>Image loaded from a file</u>')
|
41
|
+
vbox.pack_start(label, false, false, 0)
|
42
|
+
|
43
|
+
frame = Gtk::Frame.new
|
44
|
+
frame.shadow_type = Gtk::SHADOW_IN
|
45
|
+
|
46
|
+
# The alignment keeps the frame from growing when users resize
|
47
|
+
# the window
|
48
|
+
align = Gtk::Alignment.new(0.5, 0.5, 0, 0)
|
49
|
+
align.add(frame)
|
50
|
+
vbox.pack_start(align, false, false, 0)
|
51
|
+
|
52
|
+
# demo_find_file looks in the the current directory first,
|
53
|
+
# so you can run gtk-demo without installing GTK, then looks
|
54
|
+
# in the location where the file is installed.
|
55
|
+
pixbuf = nil
|
56
|
+
begin
|
57
|
+
filename = Demo.find_file('gtk-logo-rgb.gif')
|
58
|
+
pixbuf = Gdk::Pixbuf.new(filename)
|
59
|
+
rescue
|
60
|
+
# This code shows off error handling. You can just use
|
61
|
+
# Gtk::Image.new instead if you don't want to report
|
62
|
+
# errors to the user. If the file doesn't load when using
|
63
|
+
# Gtk::Image.new, a 'missing image' icon will
|
64
|
+
# be displayed instead.
|
65
|
+
dialog = Gtk::MessageDialog.new(self,
|
66
|
+
Gtk::Dialog::DESTROY_WITH_PARENT,
|
67
|
+
Gtk::MessageDialog::ERROR,
|
68
|
+
Gtk::MessageDialog::BUTTONS_CLOSE,
|
69
|
+
"Unable to open image file 'gtk-logo-rgb.gif': #{$1}")
|
70
|
+
|
71
|
+
dialog.signal_connect('response') do |widget, data|
|
72
|
+
widget.destroy
|
73
|
+
end
|
74
|
+
dialog.show
|
75
|
+
end
|
76
|
+
|
77
|
+
image = Gtk::Image.new(pixbuf)
|
78
|
+
frame.add(image)
|
79
|
+
|
80
|
+
|
81
|
+
# Animation
|
82
|
+
label = Gtk::Label.new
|
83
|
+
label.set_markup('<u>Animation loaded from a file</u>')
|
84
|
+
vbox.pack_start(label, false, false, 0)
|
85
|
+
|
86
|
+
frame = Gtk::Frame.new
|
87
|
+
frame.shadow_type = Gtk::SHADOW_IN
|
88
|
+
|
89
|
+
# The alignment keeps the frame from growing when users resize
|
90
|
+
# the window
|
91
|
+
align = Gtk::Alignment.new(0.5, 0.5, 0, 0)
|
92
|
+
align.add(frame)
|
93
|
+
vbox.pack_start(align, false, false, 0)
|
94
|
+
|
95
|
+
filename = Demo.find_file('floppybuddy.gif')
|
96
|
+
image = Gtk::Image.new(filename)
|
97
|
+
frame.add(image)
|
98
|
+
|
99
|
+
|
100
|
+
# Progressive
|
101
|
+
label = Gtk::Label.new
|
102
|
+
label.set_markup('<u>Progressive image loading</u>')
|
103
|
+
vbox.pack_start(label, false, false, 0)
|
104
|
+
|
105
|
+
frame = Gtk::Frame.new(nil)
|
106
|
+
frame.shadow_type = Gtk::SHADOW_IN
|
107
|
+
|
108
|
+
# The alignment keeps the frame from growing when users resize
|
109
|
+
# the window
|
110
|
+
align = Gtk::Alignment.new(0.5, 0.5, 0, 0)
|
111
|
+
align.add(frame)
|
112
|
+
vbox.pack_start(align, false, false, 0)
|
113
|
+
|
114
|
+
# Create an empty image for now; the progressive loader
|
115
|
+
# will create the pixbuf and fill it in.
|
116
|
+
image = Gtk::Image.new
|
117
|
+
frame.add(image)
|
118
|
+
|
119
|
+
start_progressive_loading(image)
|
120
|
+
|
121
|
+
# Sensitivity control
|
122
|
+
button = Gtk::ToggleButton.new('_Insensitive', true)
|
123
|
+
vbox.pack_start(button, false, false, 0)
|
124
|
+
|
125
|
+
button.signal_connect('toggled') do |widget|
|
126
|
+
vbox.children.each do |widget|
|
127
|
+
if widget != button
|
128
|
+
widget.sensitive = ! button.active?
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def start_progressive_loading(image)
|
135
|
+
@load_timeout = Gtk.timeout_add(150) do
|
136
|
+
progressive_timeout(image)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
def progressive_timeout(image)
|
141
|
+
if @image_stream
|
142
|
+
buf = @image_stream.read(256)
|
143
|
+
|
144
|
+
@pixbuf_loader.write(buf)
|
145
|
+
|
146
|
+
if @image_stream.eof?
|
147
|
+
@image_stream.close
|
148
|
+
@image_stream = nil
|
149
|
+
|
150
|
+
@pixbuf_loader.close
|
151
|
+
@pixbuf_loader = nil
|
152
|
+
end
|
153
|
+
else
|
154
|
+
filename = Demo.find_file('alphatest.png')
|
155
|
+
@image_stream = File.open(filename, 'rb')
|
156
|
+
|
157
|
+
if @pixbuf_loader != nil
|
158
|
+
@pixbuf_loader.close
|
159
|
+
@pixbuf_loader = nil
|
160
|
+
end
|
161
|
+
|
162
|
+
@pixbuf_loader = Gdk::PixbufLoader.new
|
163
|
+
|
164
|
+
@pixbuf_loader.signal_connect('area_prepared') do |loader|
|
165
|
+
pixbuf = loader.pixbuf
|
166
|
+
|
167
|
+
# Avoid displaying random memory contents, since the pixbuf
|
168
|
+
# isn't filled in yet.
|
169
|
+
pixbuf.fill!(0xaaaaaaff)
|
170
|
+
|
171
|
+
image.pixbuf = pixbuf
|
172
|
+
end
|
173
|
+
|
174
|
+
@pixbuf_loader.signal_connect('area_updated') do
|
175
|
+
# We know the pixbuf inside the Gtk::Image has changed, but the image
|
176
|
+
# itself doesn't know this; so queue a redraw. If we wanted to be
|
177
|
+
# really efficient, we could use a drawing area or something
|
178
|
+
# instead of a Gtk::Image, so we could control the exact position of
|
179
|
+
# the pixbuf on the display, then we could queue a draw for only
|
180
|
+
# the updated area of the image.
|
181
|
+
image.queue_draw
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
# leave timeout installed
|
186
|
+
return true
|
187
|
+
end
|
188
|
+
|
189
|
+
def cleanup_callback
|
190
|
+
@pixbuf_loader.close if @pixbuf_loader
|
191
|
+
@pixbuf_loader = nil
|
192
|
+
if @load_timeout != 0
|
193
|
+
Gtk.timeout_remove(@load_timeout)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|