Class: Gtk3App::AppMenu

Inherits:
Menu
  • Object
show all
Defined in:
lib/gtk3app/widgets.rb

Instance Method Summary collapse

Constructor Details

#initialize(logo, *par, &block) ⇒ AppMenu

Returns a new instance of AppMenu.



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/gtk3app/widgets.rb', line 15

def initialize(, *par, &block)
  @block = block
  .add_events(Gdk::EventMask::BUTTON_PRESS_MASK)
  .signal_connect('button_press_event') do |w,e|
    if e.button == 3
      #self.popup(nil, nil, 3, e.time)
      self.popup_at_pointer #(nil, nil, 3, e.time)
    else
      block.call(w,e,'button_press_event')
    end
  end
  super(*par)
end

Instance Method Details

#add_menu_item(key, &block) ⇒ Object



29
30
31
# File 'lib/gtk3app/widgets.rb', line 29

def add_menu_item(key, &block)
  super(key, &(block || @block))
end