Class: JLDrill::Gtk::Popup

Inherits:
Object
  • Object
show all
Defined in:
lib/jldrill/views/gtk/widgets/Popup.rb

Direct Known Subclasses

KanjiPopup, VocabPopup

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(character, mainWindow, x, y) ⇒ Popup

Returns a new instance of Popup.



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/jldrill/views/gtk/widgets/Popup.rb', line 8

def initialize(character, mainWindow, x, y)
    @x = x
    @y = y
    @character = character
    
    @popup = Gtk::Window.new(Gtk::Window::POPUP)
    @popup.set_transient_for(mainWindow)
    @popup.set_destroy_with_parent(true)
    @popup.set_window_position(Gtk::Window::POS_NONE)
    
    @hbox = Gtk::HBox.new
    @popup.add(@hbox)
end

Instance Attribute Details

#characterObject (readonly)

Returns the value of attribute character.



6
7
8
# File 'lib/jldrill/views/gtk/widgets/Popup.rb', line 6

def character
  @character
end

#xObject (readonly)

Returns the value of attribute x.



6
7
8
# File 'lib/jldrill/views/gtk/widgets/Popup.rb', line 6

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



6
7
8
# File 'lib/jldrill/views/gtk/widgets/Popup.rb', line 6

def y
  @y
end

Instance Method Details

#closeObject



27
28
29
# File 'lib/jldrill/views/gtk/widgets/Popup.rb', line 27

def close
    @popup.destroy                
end

#displayObject



22
23
24
25
# File 'lib/jldrill/views/gtk/widgets/Popup.rb', line 22

def display
    @popup.move(x, y)
    @popup.show_all
end

#showBusy(bool) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/jldrill/views/gtk/widgets/Popup.rb', line 31

def showBusy(bool)
    if bool
        @popup.window.set_cursor(Gdk::Cursor.new(Gdk::Cursor::WATCH))
    else
        @popup.window.set_cursor(nil)
    end
    Gdk::flush()
end