class CssPixbufsDemo

# Copyright © 2015-2016 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. #

Theming/Animated Backgrounds

This demo is done in honour of the Pixbufs demo further down.
It is done exclusively with CSS as the background of the window.

Public Class Methods

new(main_window) click to toggle source
# File gtk3/sample/gtk-demo/css_pixbufs.rb, line 11
def initialize(main_window)
  @window = Gtk::Window.new(:toplevel)
  @window.title = "Animated Backgrounds"
  @window.transient_for = main_window
  @window.set_default_size(400, 300)

  @default_css = Gio::Resources.lookup_data("/css_pixbufs/gtk.css", 0).to_s

  initialize_text_buffer
  initialize_provider

  paned = Gtk::Paned.new(:vertical)
  @window.add(paned)

  child = Gtk::Box.new(:vertical, 0)
  paned.add(child)

  container = Gtk::ScrolledWindow.new
  paned.add(container)

  child = Gtk::TextView.new(@text)
  container.add(child)

  apply_style(@window, @provider)
end

Public Instance Methods

run() click to toggle source
# File gtk3/sample/gtk-demo/css_pixbufs.rb, line 37
def run
  if !@window.visible?
    @window.show_all
  else
    @window.destroy
  end
  @window
end