Module JSON::Editor::MenuExtension
In: lib/json/editor.rb
StringScanner Parser JSONTreeView MainWindow Gtk::TreeView OptionsMenu EditMenu PopUpMenu FileMenu Gtk::Window Enumerable TreeIter Gtk State lib/json.rb lib/json/editor.rb MenuExtension lib/json/editor.rb Gtk Editor JSON dot/m_1_0.png

This module bundles some method, that can be used to create a menu. It should be included into the class in question.

Methods

Included Modules

Gtk

Attributes

menu  [R]  Returns the menu.
treeview  [R]  Returns the Gtk::TreeView of this menu.

Public Class methods

Creates a Menu, that includes MenuExtension. treeview is the Gtk::TreeView, on which it operates.

[Source]

     # File lib/json/editor.rb, line 190
190:       def initialize(treeview)
191:         @treeview = treeview
192:         @menu = Menu.new
193:       end

Public Instance methods

Adds a Gtk::MenuItem to this instance‘s menu. label is the label string, klass is the item type, and callback is the procedure, that is called if the item is activated.

[Source]

     # File lib/json/editor.rb, line 209
209:       def add_item(label, klass = MenuItem, &callback)
210:         item = klass.new(label)
211:         item.signal_connect(:activate, &callback)
212:         menu.append item
213:         item
214:       end

Adds a Gtk::SeparatorMenuItem to this instance‘s menu.

[Source]

     # File lib/json/editor.rb, line 202
202:       def add_separator
203:         menu.append SeparatorMenuItem.new
204:       end

This method should be implemented in subclasses to create the menu of this instance. It has to be called after an instance of this class is created, to build the menu.

[Source]

     # File lib/json/editor.rb, line 219
219:       def create
220:         raise NotImplementedError
221:       end

[Source]

     # File lib/json/editor.rb, line 223
223:       def method_missing(*a, &b)
224:         treeview.__send__(*a, &b)
225:       end

[Validate]