class MarkupDemo

Text View/Markup

Gtk::TextBuffer lets you define your own tags that can influence text formatting in a variety of ways. In this example, we show that Gtk::TextBuffer can load Pango markup and automatically generate suitable tags.

Public Class Methods

new(main_window) click to toggle source
# File gtk3/sample/gtk-demo/markup.rb, line 14
def initialize(main_window)
  @window = Gtk::Window.new(:toplevel)
  @window.screen = main_window.screen
  @window.title = "Markup"
  @window.set_default_size(450, 450)

  initialize_stack
  initialize_show_source
  initialize_headerbar

  sw = generate_sourceview
  @view = sw.child
  @stack.add_named(sw, "formatted")

  sw = generate_sourceview
  @view2 = sw.child
  @stack.add_named(sw, "source")

  populate_sourceviews
end

Public Instance Methods

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