Class: JLDrill::Gtk::CommandView::Menu

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view) ⇒ Menu

Returns a new instance of Menu.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/jldrill/views/gtk/widgets/MenuWidget.rb', line 12

def initialize(view)
          @view = view
          @context = @view.context
          super()
          @accelGroup = Gtk::AccelGroup.new
          @menu = Gtk::ItemFactory.new(Gtk::ItemFactory::TYPE_MENU_BAR,
                                         '<main>', @accelGroup)
          @menuItems = [
              ["/_File"],
              ["/File/_New",
                  "<StockItem>",    "<control>N",     Gtk::Stock::NEW,
                  Proc.new {@context.createNew} ],
              ["/File/_Save",
                  "<StockItem>",    "<control>S",     Gtk::Stock::SAVE, 
                  Proc.new{@context.save} ],
              ["/File/Save _As...",
                  "<StockItem>",     "<control>A",    Gtk::Stock::SAVE, 
                  Proc.new{@context.saveAs} ],
              ["/File/_Open...",
                  "<StockItem>",     "<control>O",    Gtk::Stock::OPEN, 
                  Proc.new{@context.open} ],
  ["/File/A_ppend...",
  				"<Item>",          "<control>P",    nil, 
      Proc.new{@context.appendFile} ],
              ["/File/Load Reference _Dictionary",
                  "<Item>",          "<control>D",    nil, 
                  Proc.new{@context.loadReference} ],
					["/File/Load _Examples DB", 
"<Item>",		   "<control>E", 	nil,
Proc.new{@context.loadExamples} ],
              ["/File/_Quit",
                  "<StockItem>",     "<control>Q",    Gtk::Stock::QUIT, 
                  Proc.new{@context.quit} ],

              ["/_Drill"],
              ["/Drill/_Info...",
                  "<Item>",          "<control>I",    nil, 
                  Proc.new{@context.info} ],
              ["/Drill/_Statistics...",
                  "<Item>",          "<alt>S",        nil, 
                  Proc.new{@context.statistics} ],
              ["/Drill/_Next Problem",
                  "<Item>",          "N",             nil,
                  Proc.new{@context.drill} ],
              ["/Drill/_Check",
                  "<Item>",          "Z",             nil, 
                  Proc.new{@context.check} ],
              ["/Drill/_Incorrect",
                  "<Item>",          "X",             nil, 
                  Proc.new{@context.incorrect} ],
              ["/Drill/_Correct",
                  "<Item>",          "C",             nil, 
                  Proc.new{@context.correct} ],
              ["/Drill/_Learn",
                  "<Item>",          "L",             nil,
                   Proc.new{@context.learn} ],
              ["/Drill/Show _All...",
                  "<Item>",          "<control>T",    nil, 
                  Proc.new{@context.vocabTable} ],
              ["/Drill/_Options",
                  "<StockItem>",     "O",    Gtk::Stock::PREFERENCES, 
                  Proc.new{@context.options} ],
              ["/Drill/_Reset",
                  "<Item>",          "<control>R",    nil, 
                  Proc.new{@context.resetQuiz} ],
              ["/Drill/_Remove Duplicates",
                  "<Item>",          "R",    nil, 
                  Proc.new{@context.removeDups} ],

              ["/_Vocab"],
              ["/Vocab/_Edit...",
                  "<Item>",          "E",             nil, 
                  Proc.new{@context.editVocab} ],
              ["/Vocab/_Add...",
                  "<Item>",          "A",             nil, 
                  Proc.new{@context.addNewVocabulary} ],
              ["/Vocab/_Delete...",
                  "<Item>",          "D",             nil, 
                  Proc.new{@context.deleteVocab} ],


              ["/_Help"],
              ["/Help/Ac_knowlegements...",
                  "<Item>",          "K",             nil, 
                  Proc.new{@context.ack} ],
              ["/Help/_About...", 
                  "<Item>",          "?",             nil, 
                  Proc.new{@context.about} ]
          ]
          @menu.create_items(@menuItems)
 self.pack_start(@menu.get_widget('<main>'), true, true)
end

Instance Attribute Details

#accelGroupObject (readonly)

Returns the value of attribute accelGroup.



10
11
12
# File 'lib/jldrill/views/gtk/widgets/MenuWidget.rb', line 10

def accelGroup
  @accelGroup
end