Class: FenetreNouvellePartie

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

Overview

classe FenetreNouvellePartie

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

#initializeFenetreNouvellePartie

Initialize



24
25
26
27
28
29
30
31
32
33
# File 'app/view/FenetreNouvellePartie.rb', line 24

def initialize()
    # VI box
    @boxTop = Gtk::Box.new(:vertical,0)
    @boxBottom = Fenetre::creerBoxBottom()
    # VI bouton
    @boutonApprentissage = Gtk::Button.new(:label => "Apprentissage avec aides")
    @boutonJeuLibre = Gtk::Button.new(:label => "Jeu libre")
    # VI label
    @titreLabel = Fenetre::creerLabelType("<u>Nouvelle partie</u>",Fenetre::SIZE_TITRE)
end

Instance Method Details

#ajoutCssObject

Ajoute les classes css au widget



69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'app/view/FenetreNouvellePartie.rb', line 69

def ajoutCss()
    #css label
    @titreLabel.override_color(:normal, Fenetre::COULEUR_BLANC)
    @titreLabel.set_margin_top(30)
    #css bouton
    @boutonApprentissage.set_margin_top(100)
    @boutonApprentissage.set_margin_bottom(50)
    @boutonApprentissage.set_margin_left(100)
    @boutonApprentissage.set_margin_right(100)
    @boutonJeuLibre.set_margin_bottom(50)
    @boutonJeuLibre.set_margin_left(100)
    @boutonJeuLibre.set_margin_right(100)
end

#creerBoxTopObject

Créer la box verticale contenant les boutons des choix du mode de jeu et le titre



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'app/view/FenetreNouvellePartie.rb', line 50

def creerBoxTop()
		#Action des boutons
    @boutonApprentissage.signal_connect('clicked'){
        Core::changeTo("Apprentissage", "pseudo": @pseudo)
    }

    @boutonJeuLibre.signal_connect('clicked'){
        Core::changeTo("Niveau", "pseudo": @pseudo)
    }

    #add des boutons à la box
    @boxTop.add(@titreLabel)
    @boxTop.add(@boutonApprentissage)
    @boxTop.add(@boutonJeuLibre)
end

#miseEnPlaceObject

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



39
40
41
42
43
44
# File 'app/view/FenetreNouvellePartie.rb', line 39

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



88
89
90
91
# File 'app/view/FenetreNouvellePartie.rb', line 88

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