class Fzeet::TreeViewMethods::Item

Attributes

handle[R]
parent[R]
root[R]
text[R]

Public Class Methods

new(text) click to toggle source
# File lib/fzeet/windows/comctl/TreeView.rb, line 220
def initialize(text) @text = text end

Public Instance Methods

append(text) click to toggle source
# File lib/fzeet/windows/comctl/TreeView.rb, line 228
def append(text)
        item = Item.new(text)

        tvis = Windows::TVINSERTSTRUCT.new

        tvis[:hInsertAfter] = Windows::TVI_LAST
        tvis[:hParent] = @handle

        tvi = tvis[:item]

        tvi[:mask] = Windows::TVIF_TEXT
        tvi[:pszText] = ptext = FFI::MemoryPointer.from_string(item.text)

        item.root, item.parent = @root, self
        item.handle = @root.sendmsg(:insertitem, 0, tvis.pointer)

        item
ensure
        ptext.free
end
handle=(handle) click to toggle source
# File lib/fzeet/windows/comctl/TreeView.rb, line 226
def handle=(handle) raise 'Can\'t change established @handle.' if @handle; @handle = handle end
parent=(parent) click to toggle source
# File lib/fzeet/windows/comctl/TreeView.rb, line 225
def parent=(parent) raise 'Can\'t change established @parent.' if @parent; @parent = parent end
root=(root) click to toggle source
# File lib/fzeet/windows/comctl/TreeView.rb, line 224
def root=(root) raise 'Can\'t change established @root.' if @root; @root = root end