Sha256: a4d8ecce66dfdb2feb5639454c21498e377ecbc4a51c4f0ac1b054f6d53c14ee

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

# encoding: utf-8
require 'jldrill/model/items/DictionaryEntry'
require 'jldrill/views/gtk/widgets/WordTable'

module JLDrill::Gtk
    class SearchTable < WordTable

        attr_reader :kanji, :reading

        def initialize(container, kanji, reading)
            @container = container
            @reading = reading
            @kanji = kanji
            candidates = @container.search(kanji, reading)
            super(candidates, JLDrill::DictionaryEntry) do |item|
                @container.searchActivated(item)
            end
        end

        def searchEqual(model, column, key, iter)
            retVal = true
            vocab = iter[0]
            if !vocab.nil?
                retVal = !vocab.startsWith?(key)
            end
            return retVal
        end

        def getContents(item)
            return item
        end

        def getContentsAsVocab(item)
            return item.toVocab
        end

        def selectClosestMatch(vocab)
            super(vocab)
            if hasSelection?
                focusTable
            end
        end

    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jldrill-0.6.0.1 lib/jldrill/views/gtk/widgets/SearchTable.rb