Class: JLDrill::Gtk::VocabularyHintBox
- Inherits:
-
Gtk::HBox
- Object
- Gtk::HBox
- JLDrill::Gtk::VocabularyHintBox
- Includes:
- Context::Gtk::Widget
- Defined in:
- lib/jldrill/views/gtk/widgets/VocabularyHintBox.rb
Instance Attribute Summary
Attributes included from Context::Gtk::Widget
Instance Method Summary collapse
- #clear ⇒ Object
- #differs=(state) ⇒ Object
- #getMarkup(label, state) ⇒ Object
- #getSpan(label, state) ⇒ Object
- #gtkAddWidget(widget) ⇒ Object
- #gtkRemoveWidget(widget) ⇒ Object
- #honourific=(state) ⇒ Object
- #humble=(state) ⇒ Object
-
#initialize ⇒ VocabularyHintBox
constructor
A new instance of VocabularyHintBox.
- #pol=(state) ⇒ Object
- #set(vocab, differs = false) ⇒ Object
- #uk=(state) ⇒ Object
- #vi=(state) ⇒ Object
- #vs=(state) ⇒ Object
Methods included from Context::Gtk::Widget
#addToThisWidget, #afterWidgetIsAdded, #afterWidgetIsRemoved, #expandWidgetHeight, #expandWidgetHeight?, #expandWidgetWidth, #expandWidgetWidth?, #isAMainWindow, #isInTests?, #removeFromThisWidget, #setupWidget, #widgetWasAddedTo, #widgetWasRemovedFrom
Constructor Details
#initialize ⇒ VocabularyHintBox
Returns a new instance of VocabularyHintBox.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/jldrill/views/gtk/widgets/VocabularyHintBox.rb', line 10 def initialize super @uk = Gtk::Label.new @humble = Gtk::Label.new @honourific = Gtk::Label.new @pol = Gtk::Label.new @vs = Gtk::Label.new @vi = Gtk::Label.new @differs = Gtk::Label.new pack_start(@uk, true, true, 0) pack_start(@humble, true, true, 0) pack_start(@honourific, true, true, 0) pack_start(@pol, true, true, 0) pack_start(@vs, true, true, 0) pack_start(@vi, true, true, 0) pack_start(@differs, true, true, 0) clear setupWidget end |
Instance Method Details
#clear ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/jldrill/views/gtk/widgets/VocabularyHintBox.rb', line 41 def clear self.uk = false self.humble = false self.honourific = false self.pol = false self.vs = false self.vi = false self.differs = false end |
#differs=(state) ⇒ Object
100 101 102 |
# File 'lib/jldrill/views/gtk/widgets/VocabularyHintBox.rb', line 100 def differs=(state) @differs.set_markup(getMarkup(" Differs ", state)) end |
#getMarkup(label, state) ⇒ Object
72 73 74 |
# File 'lib/jldrill/views/gtk/widgets/VocabularyHintBox.rb', line 72 def getMarkup(label, state) "<markup>" + getSpan(label, state) + "</markup>" end |
#getSpan(label, state) ⇒ Object
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/jldrill/views/gtk/widgets/VocabularyHintBox.rb', line 61 def getSpan(label, state) if state span = %Q[<span foreground = "white" background="red" weight="bold">] else span = "<span>" end span = span + label + "</span>" return span end |
#gtkAddWidget(widget) ⇒ Object
31 32 33 34 35 |
# File 'lib/jldrill/views/gtk/widgets/VocabularyHintBox.rb', line 31 def gtkAddWidget() pack_start(, ., .) end |
#gtkRemoveWidget(widget) ⇒ Object
37 38 39 |
# File 'lib/jldrill/views/gtk/widgets/VocabularyHintBox.rb', line 37 def gtkRemoveWidget() remove() end |
#honourific=(state) ⇒ Object
84 85 86 |
# File 'lib/jldrill/views/gtk/widgets/VocabularyHintBox.rb', line 84 def honourific=(state) @honourific.set_markup(getMarkup(" Honourific ", state)) end |
#humble=(state) ⇒ Object
80 81 82 |
# File 'lib/jldrill/views/gtk/widgets/VocabularyHintBox.rb', line 80 def humble=(state) @humble.set_markup(getMarkup(" Humble ", state)) end |
#pol=(state) ⇒ Object
88 89 90 |
# File 'lib/jldrill/views/gtk/widgets/VocabularyHintBox.rb', line 88 def pol=(state) @pol.set_markup(getMarkup(" Polite ", state)) end |
#set(vocab, differs = false) ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/jldrill/views/gtk/widgets/VocabularyHintBox.rb', line 51 def set(vocab, differs=false) self.uk = vocab.markers.include?("uk") self.humble = vocab.markers.include?("hum") self.honourific = vocab.markers.include?("hon") self.pol = vocab.markers.include?("pol") self.vs = vocab.markers.include?("vs") self.vi = vocab.markers.include?("vi") self.differs = differs end |
#uk=(state) ⇒ Object
76 77 78 |
# File 'lib/jldrill/views/gtk/widgets/VocabularyHintBox.rb', line 76 def uk=(state) @uk.set_markup(getMarkup(" Usually Kana ", state)) end |
#vi=(state) ⇒ Object
96 97 98 |
# File 'lib/jldrill/views/gtk/widgets/VocabularyHintBox.rb', line 96 def vi=(state) @vi.set_markup(getMarkup(" Intransitive ", state)) end |
#vs=(state) ⇒ Object
92 93 94 |
# File 'lib/jldrill/views/gtk/widgets/VocabularyHintBox.rb', line 92 def vs=(state) @vs.set_markup(getMarkup(" Suru Noun ", state)) end |