Class: View

Inherits:
Object
  • Object
show all
Includes:
Fenetre
Defined in:
app/core/View.rb

Overview

Visualization of the data that model contains.

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 collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#initializeView

Returns a new instance of View



15
16
17
18
19
20
# File 'app/core/View.rb', line 15

def initialize()
	@content    = Hash.new()
	@controller = nil
	@window     = Fenetre::fenetre
	@headerBar  = Fenetre::enteteFenetre
end

Instance Attribute Details

#content=(value) ⇒ Object (writeonly)

Sets the attribute content

Parameters:

  • value

    the value to set the attribute content to.



13
14
15
# File 'app/core/View.rb', line 13

def content=(value)
  @content = value
end

#controllerObject

Returns the value of attribute controller



12
13
14
# File 'app/core/View.rb', line 12

def controller
  @controller
end

#headerBarObject

Returns the value of attribute headerBar



12
13
14
# File 'app/core/View.rb', line 12

def headerBar
  @headerBar
end

#windowObject

Returns the value of attribute window



12
13
14
# File 'app/core/View.rb', line 12

def window
  @window
end

Class Method Details

.inherited(subclass) ⇒ Object

Invoke methods when inherited

Parameters:

  • subclass

    The subclass

Returns:

  • Itself



29
30
31
32
33
34
# File 'app/core/View.rb', line 29

def self.inherited(subclass)
	self.new()
	super

	return self
end

Instance Method Details

#runObject

Invoke all methods from view



50
51
52
53
54
# File 'app/core/View.rb', line 50

def run()
	if Core::DEBUG
		raise "View #{self.class.name} can't be build because run method is not redefined."		
	end
end

#setInstanceVarsObject

Create instance variables from @content provided by controller.

Returns:

  • Itself



40
41
42
43
44
# File 'app/core/View.rb', line 40

def setInstanceVars ()
	@content.each { |name, value| instance_variable_set("@" + name, value) }

	return self
end