Class: JLDrill::Gtk::KanjiPopup
- Defined in:
- lib/jldrill/views/gtk/widgets/KanjiPopup.rb
Instance Attribute Summary
Attributes inherited from Popup
#character, #x, #y
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(char, kanjiString, mainWindow, x, y) ⇒ KanjiPopup
constructor
A new instance of KanjiPopup.
- #showBusy(bool) ⇒ Object
Methods inherited from Popup
Constructor Details
#initialize(char, kanjiString, mainWindow, x, y) ⇒ KanjiPopup
Returns a new instance of KanjiPopup.
8 9 10 11 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 |
# File 'lib/jldrill/views/gtk/widgets/KanjiPopup.rb', line 8 def initialize(char, kanjiString, mainWindow, x, y) super(char, mainWindow, x, y) color = Gdk::Color.parse("lightblue1") @kanji = Gtk::TextView.new @kanji.wrap_mode = Gtk::TextTag::WRAP_NONE @kanji.editable = false @kanji.cursor_visible = false @kanji.set_pixels_above_lines(0) @kanji.set_pixels_below_lines(0) @kanji.modify_base(Gtk::STATE_NORMAL, color) @kanjiBuffer = @kanji.buffer @kanjiBuffer.create_tag("strokeOrder", "size" => 120 * Pango::SCALE, "justification" => Gtk::JUSTIFY_CENTER, "family" => "KanjiStrokeOrders") @kanjiBuffer.insert(@kanjiBuffer.start_iter, @character + "\n", "strokeOrder") @hbox.add(@kanji) if !kanjiString.empty? @contents = Gtk::TextView.new @contents.wrap_mode = Gtk::TextTag::WRAP_WORD @contents.editable = false @contents.cursor_visible = false @contents.set_pixels_above_lines(0) @contents.modify_base(Gtk::STATE_NORMAL, color) @contents.set_width_request(250) @buffer = @contents.buffer @buffer.create_tag("popupText", "size" => 10 * Pango::SCALE, "justification" => Gtk::JUSTIFY_LEFT) @buffer.insert(@buffer.end_iter, kanjiString, "popupText") @hbox.add(@contents) end display end |
Instance Method Details
#close ⇒ Object
48 49 50 |
# File 'lib/jldrill/views/gtk/widgets/KanjiPopup.rb', line 48 def close @popup.destroy end |
#showBusy(bool) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/jldrill/views/gtk/widgets/KanjiPopup.rb', line 52 def showBusy(bool) # TextViews have a hidden subwindow that houses the cursor subwindow = @contents.get_window(Gtk::TextView::WINDOW_TEXT) if bool subwindow.set_cursor(Gdk::Cursor.new(Gdk::Cursor::WATCH)) else subwindow.set_cursor(nil) end Gdk::flush() super(bool) end |