Class: GerminalTermOverview

Inherits:
Gtk::ScrolledWindow
  • Object
show all
Defined in:
lib/terminal_overview.rb

Overview

Copyright 2015-2016 Cédric LE MOIGNE, [email protected] This file is part of Germinal.

Germinal is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

Germinal is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Germinal. If not, see <www.gnu.org/licenses/>.

Instance Method Summary collapse

Constructor Details

#initialize(window) ⇒ GerminalTermOverview

Returns a new instance of GerminalTermOverview.



17
18
19
20
21
22
23
24
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
50
51
52
53
54
55
56
57
58
59
# File 'lib/terminal_overview.rb', line 17

def initialize(window)
  puts "new term chooser"
  @window = window
  super(nil, nil)
  vbox = Gtk::Box.new(:vertical, 0)
  add(vbox)
  current_page = @window.notebook.page
  @window.notebook.children.each_with_index do |child, i|
    child.show
    _x,_y,w,h = child.allocation.to_a
    done, x, y = child.translate_coordinates(@window.notebook, 0, 0)
    t_hadjustment = child.hadjustment
    t_vadjustment = child.vadjustment
    
    puts t_hadjustment.class
    #@window.notebook.set_current_page(i)
    #@window.notebook.queue_draw
    #@window.show_all
    child.window.show
    term_pixbuf = child.window.to_pixbuf(0,0,w,h)
    #surf = child.window.create_similar_surface(Cairo::CONTENT_COLOR,
    #                                          w,
    #                                          h)
    #an = surf.to_pixbuf(0,0,w,h) 
    #child.unmap
    ratio = term_pixbuf.width / term_pixbuf.height
    term_pixbuf = term_pixbuf.scale(100, 100 / ratio, Gdk::Pixbuf::INTERP_BILINEAR)
    img = Gtk::Image.new(:pixbuf => term_pixbuf)
    img.show
    vbox.pack_start(img, :expand => true, :fill => true)
  end
  @window.notebook.current.window.show
  @window.notebook.current.window.raise
#vbox.pack_start(img, :expand => true, :fill => true)
#    img = Gtk::Image.new(:file => "2.png")
#    img.show
#    vbox.pack_start(img, :expand => true, :fill => true)
  vbox.show
  set_size_request(75,100)
  set_halign(:end)
  set_valign(:center)
  show_all
end