Sha256: 8d2e5e586747812f81667a91d4e8af05ef5961088fef890ac43313438d740fab
Contents?: true
Size: 1.21 KB
Versions: 19
Compression:
Stored size: 1.21 KB
Contents
# Copyright (c) 2015-2016 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # =begin = Revealer GtkRevealer is a container that animates showing and hiding of its sole child with nice transitions. =end class RevealerDemo def initialize(main_window) @builder = Gtk::Builder.new(:resource => "/revealer/revealer.ui") @builder.connect_signals {} @timeout = nil @count = 0 @window = @builder["window"] @window.screen = main_window.screen @window.signal_connect "destroy" do if @timeout GLib::Source.remove(@timeout) @timeout = nil end end end def run if !@window.visible? add_timeout @window.show_all else @window.destroy end @window end private def add_timeout @timeout = GLib::Timeout.add(690) do name = "revealer#{@count}" revealer = @builder[name] revealer.reveal_child = true revealer.signal_connect "notify::child-revealed" do |widget| revealed = widget.child_revealed? widget.reveal_child = revealed end @count += 1 if @count >= 9 @timeout = nil false else true end end end end
Version data entries
19 entries across 11 versions & 2 rubygems