Class: Gtk2AppLib::AppMenu

Inherits:
Widgets::Menu show all
Defined in:
lib/gtk2applib/app_menu.rb

Overview

This is the application/program menu

Constant Summary

Constant Summary

Constants included from Missing

Missing::REQUIRES

Instance Attribute Summary

Attributes included from Widgets

#hold, #is, #options

Instance Method Summary collapse

Methods inherited from Widgets::Menu

#append_menu_item, #append_menu_items

Methods included from Widgets

_each, autoloads, autoloads_buttons, autoloads_others, autoloads_texts, #class_symbol, #common, #connect, define, define_composite, define_evented, #execute, execute, get_options, #initialize_image, method_missing, #pack, pack, #set_options, #set_signals, symbol_check, widgets

Methods included from Missing

missing

Constructor Details

#initialize(window, &block) ⇒ AppMenu

Creates a new application window and appends :fs, :about, :help, :dock, :close, :quit

Parameters:

  • window (Gtk::Window, Hildon::Window)


24
25
26
27
28
29
30
31
32
33
# File 'lib/gtk2applib/app_menu.rb', line 24

def initialize(window, &block)
  super()
  [:fs, :about, :help, :dock, :close, :quit].each do |type|
    if prompt = SysConfig::MENU[type] then
      append_menu_item(prompt, type, &block)
    end
  end
  _set_menu(window)
  show_all
end

Instance Method Details

#_set_menu(window) ⇒ Object

Sets (connects) the main aplication window

Parameters:

  • window (Gtk::Window, Hildon::Window)


10
11
12
13
14
15
16
17
18
# File 'lib/gtk2applib/app_menu.rb', line 10

def _set_menu(window)
  # linux's version
  window.add_events(Gdk::Event::BUTTON_PRESS_MASK)
  window.signal_connect('button_press_event') do |widget, event|
    if event.button == 3 then
      self.popup(nil, nil, 3, event.time)
    end
  end
end