Class: Fzeet::TreeViewMethods::Item
- Inherits:
-
Object
- Object
- Fzeet::TreeViewMethods::Item
- Defined in:
- lib/fzeet/windows/comctl/TreeView.rb
Instance Attribute Summary collapse
-
#handle ⇒ Object
Returns the value of attribute handle.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#root ⇒ Object
Returns the value of attribute root.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #append(text) ⇒ Object
-
#initialize(text) ⇒ Item
constructor
A new instance of Item.
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
#handle ⇒ Object
Returns the value of attribute handle.
222 223 224 |
# File 'lib/fzeet/windows/comctl/TreeView.rb', line 222 def handle @handle end |
#parent ⇒ Object
Returns the value of attribute parent.
222 223 224 |
# File 'lib/fzeet/windows/comctl/TreeView.rb', line 222 def parent @parent end |
#root ⇒ Object
Returns the value of attribute root.
222 223 224 |
# File 'lib/fzeet/windows/comctl/TreeView.rb', line 222 def root @root end |
#text ⇒ Object (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 |