Class: FenetreRegles
Overview
classe FenetreRegles
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
-
#ajoutCss ⇒ Object
Ajoute les classes css au widget.
-
#creerBoxTop ⇒ Object
Créer la box verticale contenant le texte explicatif et le titre.
-
#initialize ⇒ FenetreRegles
constructor
Initialize.
-
#miseEnPlace ⇒ Object
Permet de créer et d'ajouter les box au conteneur principal.
-
#run ⇒ Object
Lance la construction du modèle de la vue.
Methods inherited from View
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
#initialize ⇒ FenetreRegles
Initialize
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/view/FenetreRegles.rb', line 25 def initialize() # VI box @boxTop = Gtk::Box.new(:vertical,0) @boxBottom = Fenetre::creerBoxBottom() # VI label @titreLabel = Fenetre::creerLabelType("<u>Règles</u>", Fenetre::SIZE_TITRE) @regle0Label = Fenetre::creerLabelType("*************************************************************", Fenetre::SIZE_TITRE_REGLE) @regle1Label = Fenetre::creerLabelType("*************************************************************", Fenetre::SIZE_TITRE_REGLE) # VI règles @tabRegle = [ " - Un sudoku classique contient 9 lignes et 9 colonnes,", "soit 81 cases au total.", " - Le but du jeu est de remplir ces cases avec des chiffres", "allant de 1 à 9 en veillant toujours à ce qu'un même chiffre", "ne figure qu'une seule fois par colonne, une seule fois par", "ligne et une seule fois par carré de 9 cases (appelé région).", " - Au début du jeu, une vingtaine de chiffres sont déjà placés", "et il vous reste à trouver les autres. En effet, une grille", "initiale de sudoku correctement constituée ne peut aboutir qu'à", "une et une seule solution. Pour trouver les chiffres manquants,", "tout est une question de logique et d'observation.", " - Suivez le tutoriel pour vous faciliter la tache et", "apprendre certaines techniques..." ] end |
Instance Method Details
#ajoutCss ⇒ Object
Ajoute les classes css au widget
90 91 92 93 94 95 96 97 98 99 100 |
# File 'app/view/FenetreRegles.rb', line 90 def ajoutCss() #css label @titreLabel.override_color(:normal, Fenetre::COULEUR_BLANC) @titreLabel.set_margin_top(30) @regle0Label.override_color(:normal, Fenetre::COULEUR_ORANGE) @regle1Label.override_color(:normal, Fenetre::COULEUR_ORANGE) @regle0Label.set_margin_top(10) @regle0Label.set_margin_bottom(5) @regle1Label.set_margin_top(10) @regle1Label.set_margin_bottom(5) end |
#creerBoxTop ⇒ Object
Créer la box verticale contenant le texte explicatif et le titre
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'app/view/FenetreRegles.rb', line 66 def creerBoxTop() #regles enoncées table=Gtk::Table.new(1,15,false) table.attach(@regle0Label,0,1,0,1) table.attach(@regle1Label,0,1,14,15) @tabRegle.each_with_index{|tab,index| id=index+1 regleLabel=Fenetre::creerLabelType("#{tab}", Fenetre::SIZE_CONTENU_REGLE) regleLabel.override_color(:normal, Fenetre::COULEUR_BLANC) regleLabel.set_margin_top(5) regleLabel.set_margin_left(10) regleLabel.halign = :start table.attach(regleLabel,0,1,id,id+1) } #add des boutons à la box @boxTop.add(@titreLabel) @boxTop.add(table) end |
#miseEnPlace ⇒ Object
Permet de créer et d'ajouter les box au conteneur principal
55 56 57 58 59 60 |
# File 'app/view/FenetreRegles.rb', line 55 def miseEnPlace() creerBoxTop() ajoutCss() Fenetre::box.add(@boxTop) Fenetre::box.add(@boxBottom) end |
#run ⇒ Object
Lance la construction du modèle de la vue. Méthode à définir dans tout les cas ! Autrement pas de rendu de la page.
107 108 109 110 |
# File 'app/view/FenetreRegles.rb', line 107 def run() self.miseEnPlace() return self end |