Class: MenuUI

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

Overview

PAS UTILISE DANS LE VERSION FINALE

Auteur

Brabant Mano

Version

0.1

Date

09/04/2020

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(racine) ⇒ MenuUI

Returns a new instance of MenuUI.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/Hashiparmentier/UI/MenuUI.rb', line 27

def initialize(racine)

  super(:vertical, 0)

  @racine = racine

  @titre = Gtk::Label.new("Bienvenue dans le Hashiparmentier")

  @choixNom = ChoixNomUI.new(self)

  @choixTaille = ChoixTailleUI.new(self)
  @taille = 7

  @choixDifficulte = ChoixDifficulteUI.new(self)
  @difficulte = 0

  @regles = Gtk::Button.new(:label => "Règles")
  @regles.signal_connect "clicked" do
    afficheRegles()
  end

  @valide = Gtk::Button.new(:label => "Valider")
  @valide.signal_connect "clicked" do
    valide(@choixNom.entry.text(), @taille, @difficulte)
  end
  @fenetreRegles = FenetreReglesUI.new()
  @boxValide = Gtk::Box.new(:horizontal)
  @surBoxValide = Gtk::Box.new(:vertical)

  @boxValide.pack_start(@regles, :expand => true, :fill => true)
  @boxValide.pack_start(@valide)
  @boxValide.pack_start(Gtk::Alignment.new(0,0,0,0), :expand => true, :fill => true)
  @surBoxValide.pack_start(@boxValide, :expand => true)

end

Instance Attribute Details

#choixDifficulteObject (readonly)

Returns the value of attribute choixDifficulte.



22
23
24
# File 'lib/Hashiparmentier/UI/MenuUI.rb', line 22

def choixDifficulte
  @choixDifficulte
end

#choixNomObject (readonly)

Returns the value of attribute choixNom.



17
18
19
# File 'lib/Hashiparmentier/UI/MenuUI.rb', line 17

def choixNom
  @choixNom
end

#choixTailleObject (readonly)

Returns the value of attribute choixTaille.



19
20
21
# File 'lib/Hashiparmentier/UI/MenuUI.rb', line 19

def choixTaille
  @choixTaille
end

#difficulteObject

Returns the value of attribute difficulte.



23
24
25
# File 'lib/Hashiparmentier/UI/MenuUI.rb', line 23

def difficulte
  @difficulte
end

#racineObject (readonly)

Returns the value of attribute racine.



25
26
27
# File 'lib/Hashiparmentier/UI/MenuUI.rb', line 25

def racine
  @racine
end

#tailleObject

Returns the value of attribute taille.



20
21
22
# File 'lib/Hashiparmentier/UI/MenuUI.rb', line 20

def taille
  @taille
end

Instance Method Details

#afficheLabel(label) ⇒ Object



93
94
95
96
97
98
99
# File 'lib/Hashiparmentier/UI/MenuUI.rb', line 93

def afficheLabel(label)

  pack_start(@label = Gtk::Label.new(label), :expand => true, :fill => true)

  show_all

end

#afficheReglesObject



101
102
103
104
105
# File 'lib/Hashiparmentier/UI/MenuUI.rb', line 101

def afficheRegles

  @fenetreRegles.show_all

end

#retourMenuObject



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/Hashiparmentier/UI/MenuUI.rb', line 63

def retourMenu()

  each_all do |c|
    remove(c)
  end

  pack_start(@titre, :expand => true, :fill => true)
  pack_start(@choixNom, :expand => true, :fill => true)
  pack_start(@choixTaille, :expand => true, :fill => true)
  pack_start(@choixDifficulte, :expand => true, :fill => true)
  pack_start(@surBoxValide, :expand => true, :fill => true)

end