Sha256: d6ab9af4e444036db09c5b7e0142f30b22cfba847884df22c311f4d4643dc5a1

Contents?: true

Size: 1.55 KB

Versions: 6

Compression:

Stored size: 1.55 KB

Contents

# Copyright (c) 2015 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
=begin
= Header Bar

GtkHeaderBar is a container that is suitable for implementing
window titlebars. One of its features is that it can position
a title (and optional subtitle) centered with regard to the
full width, regardless of variable-width content at the left
or right.

It is commonly used with gtk_window_set_titlebar()
=end
module HeaderbarDemo
  def self.run_demo(main_window)
    window = Gtk::Window.new(:toplevel)
    window.screen = main_window.screen
    window.set_default_size(600, 400)

    header = Gtk::HeaderBar.new
    header.set_show_close_button(true)
    header.set_title("Welcome to Facebook - Log in, sign up or learn more")
    header.set_has_subtitle(false)

    button = Gtk::Button.new()

    icon = Gio::ThemedIcon.new("mail-send-receive-symbolic")
    image = Gtk::Image.new(:icon => icon, :size => :button)

    button.add(image)
    header.pack_end(button)

    box = Gtk::Box.new(:horizontal, 0)
    box.style_context.add_class("linked")

    button = Gtk::Button.new
    image = Gtk::Image.new(:icon_name => "pan-start-symbolic", :size => :button)
    button.add(image)
    box.add(button)

    button = Gtk::Button.new
    image = Gtk::Image.new(:icon_name => "pan-end-symbolic", :size => :button)
    button.add(image)
    box.add(button)

    header.pack_start(box)
    window.set_titlebar(header)
    window.add(Gtk::TextView.new())

    if !window.visible?
      window.show_all
    else
      window.destroy
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gtk3-3.0.9-x64-mingw32 sample/gtk-demo/headerbar.rb
gtk3-3.0.9-x86-mingw32 sample/gtk-demo/headerbar.rb
gtk3-3.0.9 sample/gtk-demo/headerbar.rb
gtk3-3.0.8-x86-mingw32 sample/gtk-demo/headerbar.rb
gtk3-3.0.8-x64-mingw32 sample/gtk-demo/headerbar.rb
gtk3-3.0.8 sample/gtk-demo/headerbar.rb