Class: FenetreNiveau

Inherits:
View
  • Object
show all
Defined in:
app/view/FenetreNiveau.rb

Overview

classe FenetreNiveau

Constant Summary

Constants included from Fenetre

Fenetre::COULEUR_BLANC, Fenetre::COULEUR_BLEU, Fenetre::COULEUR_JAUNE, Fenetre::COULEUR_ORANGE, Fenetre::COULEUR_ROUGE, Fenetre::COULEUR_VERT, Fenetre::FONT_MENU, Fenetre::SIZE_AUTRE_JEU, Fenetre::SIZE_CONTENU_REGLE, Fenetre::SIZE_CONTENU_SCORE, Fenetre::SIZE_CONTENU_STAT, Fenetre::SIZE_LABEL_BOUTON, Fenetre::SIZE_PSEUDO, Fenetre::SIZE_TITRE, Fenetre::SIZE_TITRE_JEU, Fenetre::SIZE_TITRE_REGLAGE, Fenetre::SIZE_TITRE_REGLE, Fenetre::SIZE_TITRE_SCORE, Fenetre::SIZE_TITRE_STAT

Instance Attribute Summary

Attributes inherited from View

#content, #controller, #headerBar, #window

Instance Method Summary collapse

Methods inherited from View

inherited, #setInstanceVars

Methods included from Fenetre

appliquerStyle, boutonAnnuler_barre, boutonMenu_barre, boutonPauseChrono_barre, boutonPlayChrono_barre, boutonQuitter_barre, boutonReinit_barre, boutonRetablir_barre, boutonRetour, boutonSauvegarder_barre, box, creerBarreMenu, creerBoxBottom, creerLabelType, creerPopup, css, detruire, enteteFenetre, fenetre, fenetrePrecedente, fenetrePrecedente=, fenetreStyle, viderFenetre

Constructor Details

#initializeFenetreNiveau

Initialize



25
26
27
28
29
30
31
32
33
34
35
# File 'app/view/FenetreNiveau.rb', line 25

def initialize()
    # VI box
    @boxTop = Gtk::Box.new(:vertical,0)
    @boxBottom = Fenetre::creerBoxBottom()
    # VI bouton
    @boutonFacile = Gtk::Button.new(:label => "Facile")
    @boutonMoyen = Gtk::Button.new(:label => "Moyen")
    @boutonDifficile = Gtk::Button.new(:label => "Difficile")
    # VI label
    @titreLabel = Fenetre::creerLabelType("<u>Choix difficulté</u>", Fenetre::SIZE_TITRE)
end

Instance Method Details

#ajoutCssObject

Ajoute les classes css au widget



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'app/view/FenetreNiveau.rb', line 79

def ajoutCss()
    #css label
    @titreLabel.override_color(:normal, Fenetre::COULEUR_BLANC)
    @titreLabel.set_margin_top(30)
    #css bouton
    @boutonFacile.set_margin_top(70)
    @boutonFacile.set_margin_bottom(40)
    @boutonFacile.set_margin_left(100)
    @boutonFacile.set_margin_right(100)
    @boutonMoyen.set_margin_bottom(40)
    @boutonMoyen.set_margin_left(100)
    @boutonMoyen.set_margin_right(100)
    @boutonDifficile.set_margin_bottom(40)
    @boutonDifficile.set_margin_left(100)
    @boutonDifficile.set_margin_right(100)
end

#creerBoxTopObject

Créer la box verticale contenant les boutons des choix de la difficulté et le titre



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'app/view/FenetreNiveau.rb', line 52

def creerBoxTop()
    #Action des boutons
    @boutonFacile.signal_connect('clicked'){
        supprimerPartieExistante(@pseudo)
        Core::changeTo("JeuLibre", "pseudo": @pseudo, :difficulte=>Jeu::FACILE)
    }

    @boutonMoyen.signal_connect('clicked'){
        supprimerPartieExistante(@pseudo)
        Core::changeTo("JeuLibre", "pseudo": @pseudo, :difficulte=>Jeu::MOYEN)
    }

    @boutonDifficile.signal_connect('clicked'){
        supprimerPartieExistante(@pseudo)
        Core::changeTo("JeuLibre", "pseudo": @pseudo, :difficulte=>Jeu::DIFFICILE)
    }

    #add des boutons à la box
    @boxTop.add(@titreLabel)
    @boxTop.add(@boutonFacile)
    @boxTop.add(@boutonMoyen)
    @boxTop.add(@boutonDifficile)
end

#miseEnPlaceObject

Permet de créer et d'ajouter les box au conteneur principal



41
42
43
44
45
46
# File 'app/view/FenetreNiveau.rb', line 41

def miseEnPlace()
    creerBoxTop()
    ajoutCss()
    Fenetre::box.add(@boxTop)
    Fenetre::box.add(@boxBottom)
end

#runObject

Lance la construction du modèle de la vue. Méthode à définir dans tout les cas ! Autrement pas de rendu de la page.

Returns:

  • self



101
102
103
104
# File 'app/view/FenetreNiveau.rb', line 101

def run()
    self.miseEnPlace()
    return self
end