Class: ChoixDifficulteUI

Inherits:
Gtk::Box
  • Object
show all
Defined in:
lib/Hashiparmentier/UI/ChoixDifficulteUI.rb

Overview

PAS UTILISE DANS LE VERSION FINALE

Auteur

Brabant Mano

Version

0.1

Date

09/04/2020

Cette classe permet à l’utilisateur de choisir entre plusieurs difficulté

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(menu) ⇒ ChoixDifficulteUI

Returns a new instance of ChoixDifficulteUI.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/Hashiparmentier/UI/ChoixDifficulteUI.rb', line 18

def initialize(menu)

  super(:vertical, 0)

  @menu = menu
  @boutons = Gtk::Box.new(:horizontal, 0)

  for i in [[0, 'Facile'], [1, 'Normal'], [2, 'Difficile']]

    temp = Gtk::Button.new(:label => "#{i[1]}")
    temp.name=i[0].to_s()
    temp.signal_connect "clicked" do |widget, event|
      @menu.difficulte=widget.name.to_i()
    end
    @boutons.pack_start(temp, :expand => true, :fill => true)

  end

  temp = Gtk::Box.new(:vertical, 0)

  temp.pack_start(Gtk::Label.new("Difficulté de la grille"), :expand => true, :fill => true)
  temp.pack_start(@boutons, :expand => true, :fill => true)

  pack_start(temp, :expand => true, :fill => true)

end

Instance Attribute Details

Returns the value of attribute menu.



15
16
17
# File 'lib/Hashiparmentier/UI/ChoixDifficulteUI.rb', line 15

def menu
  @menu
end