Class: KeepYourHead::FlashcardViewController

Inherits:
Object
  • Object
show all
Defined in:
lib/Keepyourhead/gui/FlashcardViewController.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gtkImage, gtkScale, gtkScaleContainer) ⇒ FlashcardViewController

Returns a new instance of FlashcardViewController.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/Keepyourhead/gui/FlashcardViewController.rb', line 24

def initialize( gtkImage, gtkScale, gtkScaleContainer )
	@gtkImage, @gtkScale, @gtkScaleContainer = gtkImage, gtkScale, gtkScaleContainer

	@width = nil

	@gtkScale.signal_connect( "value_changed" ) {
		onPageChange
	}

	@gtkImage.signal_connect( "size-allocate") { |widget, event|
		width_ = @gtkImage.allocation.width
		self.width = (width_ * 0.98 - 5).to_i
	}
end

Instance Attribute Details

#filenameObject

Returns the value of attribute filename.



21
22
23
# File 'lib/Keepyourhead/gui/FlashcardViewController.rb', line 21

def filename
  @filename
end

#filenamesObject

Returns the value of attribute filenames.



21
22
23
# File 'lib/Keepyourhead/gui/FlashcardViewController.rb', line 21

def filenames
  @filenames
end

#pageObject (readonly)

Returns the value of attribute page.



21
22
23
# File 'lib/Keepyourhead/gui/FlashcardViewController.rb', line 21

def page
  @page
end

#pixbufObject

Returns the value of attribute pixbuf.



22
23
24
# File 'lib/Keepyourhead/gui/FlashcardViewController.rb', line 22

def pixbuf
  @pixbuf
end

Instance Method Details

#onPageChangeObject



39
40
41
42
# File 'lib/Keepyourhead/gui/FlashcardViewController.rb', line 39

def onPageChange
	page = @gtkScale.value
	self.filename = self.filenames[page]
end