Class: VRTreeview
Defined Under Namespace
Classes: VRTreeviewItem
Constant Summary
collapse
- WINCLASSINFO =
["SysTreeView32",WStyle::TVS_DEFAULT,0x200]
Instance Attribute Summary
#_vr_notifyarg
Attributes inherited from VRControl
#handlers, #name, #parent
#parent, #screen
Instance Method Summary
collapse
-
#addItem(hparent, *args) ⇒ Object
-
#addMultiItems(hparent, *args) ⇒ Object
-
#clearItems ⇒ Object
-
#countItems ⇒ Object
-
#deleteItem(htreei) ⇒ Object
-
#getChildOf(hitem) ⇒ Object
-
#getItemIconOf(hitem) ⇒ Object
-
#getItemLParamOf(hitem) ⇒ Object
-
#getItemStateOf(hitem) ⇒ Object
-
#getItemTextOf(hitem, textsize = 128) ⇒ Object
-
#getNextItem(hitem, code) ⇒ Object
-
#getNextSiblingOf(hitem) ⇒ Object
-
#getParentOf(hitem) ⇒ Object
-
#hittest(x, y) ⇒ Object
-
#hittest2(x, y) ⇒ Object
-
#indent ⇒ Object
-
#indent=(idt) ⇒ Object
-
#insertItem(hparent, hafter, text, lparam = 0, textsize = text.size) ⇒ Object
-
#insertMultiItems(hparent, hafter, multitext) ⇒ Object
-
#last ⇒ Object
-
#root ⇒ Object
-
#rootItem ⇒ Object
-
#selectedItem ⇒ Object
(also: #selected)
-
#selectItem(hitem) ⇒ Object
-
#setImagelist(imagelist, itype = 0) ⇒ Object
-
#setItemIconOf(hitem, img, simg = nil) ⇒ Object
-
#setItemLParamOf(hitem, lparam) ⇒ Object
-
#setItemStateOf(hitem, state) ⇒ Object
-
#setItemTextOf(hitem, text) ⇒ Object
-
#topItem ⇒ Object
-
#treeviewinit ⇒ Object
-
#vrinit ⇒ Object
#_vr_ntfyhandlers, #addFilterArg, #addNotifyHandler, #deleteFilterArg, #deleteNotifyHandler, #notifycontrolinit
Methods inherited from VRControl
Controltype, #add_parentcall, #call_parenthandler, #create, #setFont
#_init, #create, #exwinstyle, #hide, #maximizebox, #maximizebox=, #minimizebox, #minimizebox=, #setscreen, #sizebox, #sizebox=, #tabstop, #tabstop=, #winstyle
Instance Method Details
#addItem(hparent, *args) ⇒ Object
860
861
862
|
# File 'lib/vr/vrcomctl.rb', line 860
def addItem(hparent,*args)
insertItem(hparent, WConst::TVI_LAST,*args)
end
|
#addMultiItems(hparent, *args) ⇒ Object
880
881
882
|
# File 'lib/vr/vrcomctl.rb', line 880
def addMultiItems(hparent,*args)
insertMultiItems(hparent, WConst::TVI_LAST,*args)
end
|
#clearItems ⇒ Object
887
888
889
|
# File 'lib/vr/vrcomctl.rb', line 887
def clearItems
deleteItem(WConst::TVGN_ROOT)
end
|
#countItems ⇒ Object
890
891
892
|
# File 'lib/vr/vrcomctl.rb', line 890
def countItems
sendMessage WMsg::TVM_GETCOUNT,0,0
end
|
#deleteItem(htreei) ⇒ Object
884
885
886
|
# File 'lib/vr/vrcomctl.rb', line 884
def deleteItem(htreei)
sendMessage WMsg::TVM_DELETEITEM,0,htreei
end
|
#getChildOf(hitem) ⇒ Object
927
|
# File 'lib/vr/vrcomctl.rb', line 927
def getChildOf(hitem) nilnull(getNextItem(hitem,WConst::TVGN_CHILD)) end
|
#getItemIconOf(hitem) ⇒ Object
946
947
948
949
950
951
|
# File 'lib/vr/vrcomctl.rb', line 946
def getItemIconOf(hitem)
tvitem=@screen.application.arg2cstructStr(WStruct::TVITEM,
0x22,hitem.to_i,0,0,"",0,0,0,0,0)
sendMessage WMsg::TVM_GETITEM,0,tvitem
@screen.application.unpack(tvitem,WStruct::TVITEM)[6..7]
end
|
#getItemLParamOf(hitem) ⇒ Object
958
959
960
961
962
963
|
# File 'lib/vr/vrcomctl.rb', line 958
def getItemLParamOf(hitem)
tvitem=@screen.application.arg2cstructStr(WStruct::TVITEM,
4,hitem.to_i,0,0,"",0,0,0,0,0) sendMessage WMsg::TVM_GETITEM,0,tvitem
@screen.application.unpack(tvitem,WStruct::TVITEM)[9]
end
|
#getItemStateOf(hitem) ⇒ Object
981
982
983
984
985
986
|
# File 'lib/vr/vrcomctl.rb', line 981
def getItemStateOf(hitem)
tvitem=@screen.application.arg2cstructStr(WStruct::TVITEM,
8,hitem.to_i,0,0x00ff,"",0,0,0,0,0) sendMessage WMsg::TVM_GETITEM,0,tvitem
@screen.application.unpack(tvitem,WStruct::TVITEM)[2]
end
|
#getItemTextOf(hitem, textsize = 128) ⇒ Object
969
970
971
972
973
974
975
|
# File 'lib/vr/vrcomctl.rb', line 969
def getItemTextOf(hitem,textsize=128)
app=@screen.application
tvitem=app.arg2cstructStr(WStruct::TVITEM,
1,hitem.to_i,0,0,"\0"*textsize,textsize,0,0,0,0) sendMessage WMsg::TVM_GETITEM,0,tvitem
app.pointer2string(app.unpack(tvitem,WStruct::TVITEM)[4])
end
|
#getNextItem(hitem, code) ⇒ Object
917
918
919
|
# File 'lib/vr/vrcomctl.rb', line 917
def getNextItem(hitem,code)
sendMessage WMsg::TVM_GETNEXTITEM,code,hitem
end
|
#getNextSiblingOf(hitem) ⇒ Object
928
|
# File 'lib/vr/vrcomctl.rb', line 928
def getNextSiblingOf(hitem) nilnull(getNextItem(hitem,WConst::TVGN_NEXT)) end
|
#getParentOf(hitem) ⇒ Object
926
|
# File 'lib/vr/vrcomctl.rb', line 926
def getParentOf(hitem) nilnull(getNextItem(hitem,WConst::TVGN_PARENT))end
|
#hittest(x, y) ⇒ Object
904
905
906
907
908
909
|
# File 'lib/vr/vrcomctl.rb', line 904
def hittest(x,y)
tvhit=@screen.application.arg2cstructStr(WStruct::TVHITTEST,
x.to_i,y.to_i,0,0)
sendMessage WMsg::TVM_HITTEST,0,tvhit
@screen.application.unpack(tvhit,WStruct::TVHITTEST)[3]
end
|
#hittest2(x, y) ⇒ Object
910
911
912
913
914
915
|
# File 'lib/vr/vrcomctl.rb', line 910
def hittest2(x,y)
tvhit=@screen.application.arg2cstructStr(WStruct::TVHITTEST,
x.to_i,y.to_i,0,0)
sendMessage WMsg::TVM_HITTEST,0,tvhit
@screen.application.unpack(tvhit,WStruct::TVHITTEST)
end
|
897
898
899
|
# File 'lib/vr/vrcomctl.rb', line 897
def indent
sendMessage WMsg::TVM::TVM_GETINDENT,0,0
end
|
#indent=(idt) ⇒ Object
900
901
902
|
# File 'lib/vr/vrcomctl.rb', line 900
def indent=(idt)
sendMessage WMsg::TVM::TVM_SETINDENT,idt.to_i,0
end
|
#insertItem(hparent, hafter, text, lparam = 0, textsize = text.size) ⇒ Object
854
855
856
857
858
|
# File 'lib/vr/vrcomctl.rb', line 854
def insertItem(hparent,hafter,text,lparam=0,textsize=text.size)
ti=@screen.application.arg2cstructStr(WStruct::TREEINSERTITEM,hparent,hafter,
0x0f,0,0,0,text.to_s,textsize,0,0,0,lparam)
sendMessage WMsg::TVM_INSERTITEM,0,ti
end
|
#insertMultiItems(hparent, hafter, multitext) ⇒ Object
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
|
# File 'lib/vr/vrcomctl.rb', line 864
def insertMultiItems(hparent,hafter,multitext)
ha = if hafter then hafter else WConst::TVI_LAST end
multitext.each do |item|
if item.is_a?(Array)
item[1] = 0 unless item[1]
h=insertItem(hparent,ha,item[0],item[1])
if item.size>2 and item[2].is_a?(Array) then
insertMultiItems(h,WConst::TVI_LAST,item[2])
end
ha=h
else
raise ArgumentError,"Arg2 illegal"
end
end
end
|
922
|
# File 'lib/vr/vrcomctl.rb', line 922
def last() WCONST::TVI_LAST end
|
#selectedItem ⇒ Object
Also known as:
selected
924
|
# File 'lib/vr/vrcomctl.rb', line 924
def selectedItem() nilnull(getNextItem(0,WConst::TVGN_CARET)) end
|
#selectItem(hitem) ⇒ Object
893
894
895
|
# File 'lib/vr/vrcomctl.rb', line 893
def selectItem(hitem)
sendMessage WMsg::TVM_SELECTITEM,9,hitem
end
|
#setImagelist(imagelist, itype = 0) ⇒ Object
930
931
932
933
934
|
# File 'lib/vr/vrcomctl.rb', line 930
def setImagelist(imagelist,itype=0)
raise "not Imagelist" unless imagelist.is_a?(SWin::Imagelist)
self.properties["imagelist"]=imagelist
sendMessage WMsg::TVM_SETIMAGELIST,itype,imagelist.himagelist
end
|
#setItemIconOf(hitem, img, simg = nil) ⇒ Object
936
937
938
939
940
941
942
943
944
945
|
# File 'lib/vr/vrcomctl.rb', line 936
def setItemIconOf(hitem,img,simg=nil)
mask=0; image=0; simage=0
if img then mask |= 2; image = img end
if simg then mask |= 0x20; simage = simg end
tvitem=@screen.application.arg2cstructStr(WStruct::TVITEM,
mask,hitem.to_i,0,0,"",0,image,simage,0,0)
sendMessage WMsg::TVM_SETITEM,0,tvitem
end
|
#setItemLParamOf(hitem, lparam) ⇒ Object
953
954
955
956
957
|
# File 'lib/vr/vrcomctl.rb', line 953
def setItemLParamOf(hitem,lparam)
tvitem=@screen.application.arg2cstructStr(WStruct::TVITEM,
4,hitem.to_i,0,0,"",0,0,0,0,lparam.to_i) sendMessage WMsg::TVM_SETITEM,0,tvitem
end
|
#setItemStateOf(hitem, state) ⇒ Object
976
977
978
979
980
|
# File 'lib/vr/vrcomctl.rb', line 976
def setItemStateOf(hitem,state)
tvitem=@screen.application.arg2cstructStr(WStruct::TVITEM,
8,hitem.to_i,state.to_i,0x00ff,"",0,0,0,0,0) sendMessage WMsg::TVM_SETITEM,0,tvitem
end
|
#setItemTextOf(hitem, text) ⇒ Object
964
965
966
967
968
|
# File 'lib/vr/vrcomctl.rb', line 964
def setItemTextOf(hitem,text)
tvitem=@screen.application.arg2cstructStr(WStruct::TVITEM,
1,hitem.to_i,0,0,text.to_s,text.size,0,0,0,0) sendMessage WMsg::TVM_SETITEM,0,tvitem
end
|
920
|
# File 'lib/vr/vrcomctl.rb', line 920
def topItem() getNextItem(0,WConst::TVGN_ROOT) end
|
#treeviewinit ⇒ Object
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
|
# File 'lib/vr/vrcomctl.rb', line 830
def treeviewinit
addNotifyHandler(WMsg::TVN_SELCHANGED,"selchanged",
MSGTYPE::ARGSTRUCT,WStruct::NM_TREEVIEW)
addFilterArg WMsg::TVN_SELCHANGED,"FFFFFFFFFFFFTFFFFFFFTFF" addNotifyHandler(WMsg::TVN_ITEMEXPANDED,"itemexpanded",
MSGTYPE::ARGSTRUCT,WStruct::NM_TREEVIEW)
addFilterArg WMsg::TVN_ITEMEXPANDED,"FFFFFFFFFFFFTTFFFFFFTFF" addNotifyHandler(WMsg::TVN_DELETEITEM,"deleteitem",
MSGTYPE::ARGSTRUCT,WStruct::NM_TREEVIEW)
addFilterArg WMsg::TVN_DELETEITEM,"FFTFFFFFFFTFFFFFFFFFFFF" addNotifyHandler(WMsg::TVN_BEGINDRAG,"begindrag",
MSGTYPE::ARGSTRUCT,WStruct::NM_TREEVIEW)
addFilterArg WMsg::TVN_BEGINDRAG,"FFFFFFFFFFFFTTFFFFFFTFF" addNotifyHandler(WMsg::TVN_BEGINRDRAG,"beginrdrag",
MSGTYPE::ARGSTRUCT,WStruct::NM_TREEVIEW)
addFilterArg WMsg::TVN_BEGINRDRAG,"FFFFFFFFFFFFTTFFFFFFTFF" end
|
849
850
851
852
|
# File 'lib/vr/vrcomctl.rb', line 849
def vrinit
super
treeviewinit
end
|