module AsciiParadise::GUI::Gtk::AnimatedFrameModule

Constants

HEIGHT
#

HEIGHT

#
NAMESPACE
#

NAMESPACE

#
TITLE
#

TITLE

#
USE_THIS_FONT
#

USE_THIS_FONT

#
WIDTH
#

WIDTH

#

Public Class Methods

new( run_already = true ) click to toggle source
#

initialize

#
Calls superclass method
# File lib/ascii_paradise/gui/shared_code/animated_frame/animated_frame_module.rb, line 52
def initialize(
    run_already = true
  )
  super(:vertical)
  reset
  set_font(USE_THIS_FONT)
  run if run_already
end
run() click to toggle source
#

AsciiParadise::GUI::Gtk::AnimatedFrameModule.run

#
# File lib/ascii_paradise/gui/shared_code/animated_frame/animated_frame_module.rb, line 168
def self.run
  require 'gtk_paradise/run'
  r = ::Gtk.run
  r.set_title(
    'Animated Frame Module'
  )
  _ = ::AsciiParadise::GUI::Gtk::AnimatedFrame.new
  r.automatic_title
  r.automatic_size
  r.set_width(_.default_width?)
  r.set_height(_.default_height?)
  r << _
  r.show_all
  r.top_left_then_run
end

Public Instance Methods

border_size?() click to toggle source
#

border_size?

#
# File lib/ascii_paradise/gui/shared_code/animated_frame/animated_frame_module.rb, line 161
def border_size?
  10
end
create_skeleton() click to toggle source
#

create_skeleton

Create the GUI-skeleton via this method.

#
# File lib/ascii_paradise/gui/shared_code/animated_frame/animated_frame_module.rb, line 98
def create_skeleton
  label_on_top = bold_label('Showing the individual frames')
  minimal(label_on_top, 0)
  @text_buffer = gtk_text_buffer
  @text_view = gtk_text_view(@text_buffer)
  @text_view.set_editable(true)
  @text_view.cursor_visible = false

  @scrolled_window = gtk_scrolled_window(@text_view)
  if @scrolled_window.respond_to? :min_content_height
    @scrolled_window.min_content_height = 500
  end
  @scrolled_window.show_scrollbars

  maximal(@scrolled_window, 2)
  create_the_combo_box_entry
  populate_the_combo_box
  @combo_box_entry.active = 0
  @combo_box_entry.on_changed {
    if @combo_box_entry.active_iter
      active_text = @combo_box_entry.active_text
      @array_dataset = AsciiParadise.dataset_for(
        active_text,
        :do_not_uppercase
      )
      # =================================================================== #
      # We will display the first element of the Array.
      # =================================================================== #
      if @array_dataset.respond_to? :first
        set_text(@array_dataset.first)
      end
    end
  }
  maximal(@combo_box_entry, 0)
  show_all
end
create_the_combo_box_entry() click to toggle source
#

create_the_combo_box_entry

#
# File lib/ascii_paradise/gui/shared_code/animated_frame/animated_frame_module.rb, line 204
def create_the_combo_box_entry
  # ======================================================================= #
  # Add the combobox next.
  # ======================================================================= #
  if ::Gtk.use_gtk2?
    @combo_box_entry = gtk_combo_box_entry(:text_only)
  else
    @combo_box_entry = gtk_combo_box_text
  end
  @combo_box_entry.css_class('combo_box1')
end
minimum_height?() click to toggle source
#

minimum_height?

#
# File lib/ascii_paradise/gui/shared_code/animated_frame/animated_frame_module.rb, line 147
def minimum_height?
  200
end
minimum_width?() click to toggle source
#

minimum_width?

#
# File lib/ascii_paradise/gui/shared_code/animated_frame/animated_frame_module.rb, line 154
def minimum_width?
  120
end
populate_the_combo_box() click to toggle source
#

populate_the_combo_box

#
# File lib/ascii_paradise/gui/shared_code/animated_frame/animated_frame_module.rb, line 194
def populate_the_combo_box
  # Populate the combo-box.
  @available_components.each {|entry|
    @combo_box_entry.append_text(entry)
  }
end
reset() click to toggle source
#

reset

#
# File lib/ascii_paradise/gui/shared_code/animated_frame/animated_frame_module.rb, line 64
def reset
  reset_the_internal_variables
  # ======================================================================= #
  # === @configuration
  # ======================================================================= #
  @configuration = [true, __dir__, NAMESPACE]
  # ======================================================================= #
  # === @title
  # ======================================================================= #
  @title = TITLE
  # ======================================================================= #
  # === @width
  # ======================================================================= #
  set_width(WIDTH)
  # ======================================================================= #
  # === @height
  # ======================================================================= #
  set_height(HEIGHT)
  # ======================================================================= #
  # === @array_dataset
  # ======================================================================= #
  @array_dataset = [] # This variable will contain the whole Array.
  # ======================================================================= #
  # === @available_components
  # ======================================================================= #
  @available_components = ::AsciiParadise.available_components? - [:AnimatedProgressBar]
  append_project_css_file
end
run() click to toggle source
#

run

#
# File lib/ascii_paradise/gui/shared_code/animated_frame/animated_frame_module.rb, line 187
def run
  create_skeleton
end
set_text(i) click to toggle source
#

set_text

This method can be used to set a new text for the main buffer.

#
# File lib/ascii_paradise/gui/shared_code/animated_frame/animated_frame_module.rb, line 140
def set_text(i)
  @text_view.buffer.set_text(i)
end