Module: GamesParadise::GUI::Gtk::Mastermind::IconAndLabelModule

Includes:
Gtk::BaseModule
Included in:
IconAndLabel
Defined in:
lib/games_paradise/mastermind/shared_code/icon_and_label_module.rb

Constant Summary collapse

NAMESPACE =
#

NAMESPACE

#
inspect
TITLE =
#

TITLE

#
'Icon and Label'
WIDTH =
#

WIDTH

#
1200
HEIGHT =
#

HEIGHT

#
1000

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.runObject

#

GamesParadise::GUI::Gtk::IconAndLabelModule.run

#


140
141
142
143
144
145
146
147
# File 'lib/games_paradise/mastermind/shared_code/icon_and_label_module.rb', line 140

def self.run
  require 'gtk_paradise/run'
  _ = ::GamesParadise::GUI::Gtk::Mastermind::IconAndLabel.new
  r = ::Gtk.run
  r << _
  r.set_size_request(_.width?, _.height?)
  r.top_left_then_run
end

Instance Method Details

#change_markup_to(how = :normal) ⇒ Object

#

change_markup_to

#


98
99
100
101
102
103
104
105
# File 'lib/games_paradise/mastermind/shared_code/icon_and_label_module.rb', line 98

def change_markup_to(how = :normal)
  case how
  when :bold
    @label.set_markup("<b>#{@text_on_button}</b>")
  else
    @label.set_markup(@text_on_button)
  end
end

#connect_skeletonObject

#

connect_skeleton

#


124
125
126
127
# File 'lib/games_paradise/mastermind/shared_code/icon_and_label_module.rb', line 124

def connect_skeleton
  minimal(@image, 1)
  maximal(@label, 1)
end

#hide_imgObject

#

hide_img

#


117
118
119
# File 'lib/games_paradise/mastermind/shared_code/icon_and_label_module.rb', line 117

def hide_img
  @image.hide
end

#initialize(text_on_button = 'Hello world!', reveal_or_dont_reveal = false, run_already = true) ⇒ Object

#

initialize

#


50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/games_paradise/mastermind/shared_code/icon_and_label_module.rb', line 50

def initialize(
    text_on_button        = 'Hello world!',
    reveal_or_dont_reveal = false,
    run_already           = true
  )
  super(:horizontal)
  reset
  @text_on_button = text_on_button.to_s
  @image = gtk_image(url_for(:pfeil1))
  @label = gtk_label 
  case reveal_or_dont_reveal
  when true
    reveal_img
  when false
    hide_img
  end
  change_markup_to # default, normal
  run if run_already
end

#resetObject

#

reset

#


73
74
75
76
77
78
79
80
# File 'lib/games_paradise/mastermind/shared_code/icon_and_label_module.rb', line 73

def reset
  reset_the_internal_variables
  # ======================================================================= #
  # === @configuration
  # ======================================================================= #
  @configuration = [true, __dir__, NAMESPACE]
  use_project_css_file
end

#reveal_imgObject

#

reveal_img

#


110
111
112
# File 'lib/games_paradise/mastermind/shared_code/icon_and_label_module.rb', line 110

def reveal_img
  @image.show
end

#runObject

#

run

#


132
133
134
135
# File 'lib/games_paradise/mastermind/shared_code/icon_and_label_module.rb', line 132

def run
  connect_skeleton
  show
end

#url_for(i) ⇒ Object

#

url_for

Get beautiful URL here.

#


87
88
89
90
91
92
93
# File 'lib/games_paradise/mastermind/shared_code/icon_and_label_module.rb', line 87

def url_for(i)
  case i
  when :pfeil1
    i = ENV['IMG']+'/STD/PFEIL1.png'
  end
  i
end