Class: Fzeet::TreeViewMethods::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/fzeet/windows/comctl/TreeView.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ Item

Returns a new instance of Item.



220
# File 'lib/fzeet/windows/comctl/TreeView.rb', line 220

def initialize(text) @text = text end

Instance Attribute Details

#handleObject

Returns the value of attribute handle.



222
223
224
# File 'lib/fzeet/windows/comctl/TreeView.rb', line 222

def handle
  @handle
end

#parentObject

Returns the value of attribute parent.



222
223
224
# File 'lib/fzeet/windows/comctl/TreeView.rb', line 222

def parent
  @parent
end

#rootObject

Returns the value of attribute root.



222
223
224
# File 'lib/fzeet/windows/comctl/TreeView.rb', line 222

def root
  @root
end

#textObject (readonly)

Returns the value of attribute text.



222
223
224
# File 'lib/fzeet/windows/comctl/TreeView.rb', line 222

def text
  @text
end

Instance Method Details

#append(text) ⇒ Object



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# 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