Class: Rabbit::Menu

Inherits:
Object
  • Object
show all
Includes:
ERB::Util, GetText
Defined in:
lib/rabbit/menu.rb

Constant Summary collapse

@@icon =
nil

Constants included from GetText

GetText::DOMAIN

Instance Method Summary collapse

Methods included from GetText

included

Constructor Details

#initialize(actions) ⇒ Menu

Returns a new instance of Menu.


35
36
37
38
39
40
41
42
43
# File 'lib/rabbit/menu.rb', line 35

def initialize(actions)
  @merge = Gtk::UIManager.new
  @merge.insert_action_group(actions, 0)
  @jump_to_actions = nil
  @jump_to_merge_id = nil
  @theme_actions = nil
  @theme_merge_id = nil
  update_ui
end

Instance Method Details

#attach(window) ⇒ Object


45
46
47
# File 'lib/rabbit/menu.rb', line 45

def attach(window)
  window.add_accel_group(accel_group)
end

#detach(window) ⇒ Object


49
50
51
# File 'lib/rabbit/menu.rb', line 49

def detach(window)
  window.remove_accel_group(accel_group)
end

64
65
66
# File 'lib/rabbit/menu.rb', line 64

def popup(button, time)
  @menu.popup(nil, nil, button, time)
end

#update_menu(canvas) ⇒ Object


53
54
55
56
57
58
59
60
61
62
# File 'lib/rabbit/menu.rb', line 53

def update_menu(canvas)
  update_jump_to_menu(canvas)
  update_theme_menu(canvas)
  Action.update_move_slide_action_status(canvas)
  Action.update_graffiti_action_status(canvas)
  Action.update_theme_action_status(canvas)
  Action.update_quit_action_status(canvas)
  @merge.ensure_update
  show_tearoff
end