class MittensUi::HeaderBar
Public Class Methods
new(widgets, options = {})
click to toggle source
Calls superclass method
MittensUi::Core::new
# File lib/mittens_ui/header_bar.rb, line 5 def initialize(widgets, options = {}) title = options[:title].nil? ? "" : options[:title] position = options[:position].nil? ? :left : options[:position] box = Gtk::Box.new(:horizontal, 0) box.style_context.add_class("linked") @header = Gtk::HeaderBar.new @header.show_close_button = true @header.title = title @header.has_subtitle = false widgets.each do |w| w.remove case position when :left box.pack_start(w.core_widget) when :right box.pack_end(w.core_widget) else box.pack_start(w.core_widget) end end if position == :left @header.pack_start(box) end if position == :right @header.pack_end(box) end super(@header, options) end
Public Instance Methods
render()
click to toggle source
# File lib/mittens_ui/header_bar.rb, line 40 def render $app_window.titlebar = @header return self end