Class: TK::ShowLyricsDialog

Inherits:
BaseDialog show all
Defined in:
lib/wiki_lyrics/gui/gui-tk.rb

Instance Attribute Summary

Attributes inherited from BaseDialog

#accepted, #values

Instance Method Summary collapse

Methods inherited from BaseDialog

#accept, #destroy, #exec, #get_position, get_screen_size, #get_size, #set_position, #set_size

Constructor Details

#initialize(values) ⇒ ShowLyricsDialog

Returns a new instance of ShowLyricsDialog.



1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
# File 'lib/wiki_lyrics/gui/gui-tk.rb', line 1080

def initialize( values )
	super( values )

	set_size( 350, 400 )

	title = I18n.get( "gui.lyrics.title", @values["title"], @values["artist"] )
	title += " [#{@values["site_name"]}]" if @values["site_name"]
	@shell.title( title )

	lyrics_frame = TkFrame.new( @shell )
	lyrics_frame.grid( "row"=>1, "column"=>1, "sticky"=>"nesw" )
	bar = TkScrollbar.new( lyrics_frame, "orient"=>"ver" )
	bar.pack( "side"=>"right", "fill"=>"y" )
	@lyrics_text = TextArea.new( lyrics_frame ) { yscrollcommand { |first, last| bar.set( first, last ) } }
	@lyrics_text.set_text( @values["lyrics"] )
	@lyrics_text.pack( "side"=>"left", "fill"=>"both", "expand"=>true )
	bar.command( proc { |*args| @lyrics_text.yview( *args ) } )

	@shell.grid_rowconfigure( 1, "weight"=>1 )
	@shell.grid_columnconfigure( 1, "weight"=>1 )
end