Class: VRListview
Overview
Constant Summary
collapse
- WINCLASSINFO =
["SysListView32",WStyle::LVS_REPORT,0x200]
Instance Attribute Summary
#_vr_notifyarg
Attributes inherited from VRControl
#handlers, #name, #parent
#parent, #screen
Instance Method Summary
collapse
-
#addColumn(*args) ⇒ Object
-
#addItem(*args) ⇒ Object
-
#bkcolor=(color) ⇒ Object
-
#clearColumns ⇒ Object
-
#clearItems ⇒ Object
-
#countColumns ⇒ Object
-
#countItems ⇒ Object
-
#countSelectedItems ⇒ Object
-
#deleteColumn(column) ⇒ Object
-
#deleteItem(idx) ⇒ Object
-
#eachSelectedItems ⇒ Object
-
#ensureVisible(i, partial = true) ⇒ Object
-
#extended_select ⇒ Object
-
#extended_select=(bool) ⇒ Object
-
#focused?(idx) ⇒ Boolean
-
#focusedItem ⇒ Object
-
#getColumnFormatOf(column) ⇒ Object
-
#getColumnTextOf(column) ⇒ Object
-
#getColumnWidthOf(column) ⇒ Object
-
#getItemIconOf(idx) ⇒ Object
-
#getItemLParamOf(idx) ⇒ Object
-
#getItemRect(item, code = 0) ⇒ Object
-
#getItemStateOf(idx) ⇒ Object
-
#getItemTextOf(idx, subitem = 0, textsize = 128) ⇒ Object
-
#getNextItem(start, flag) ⇒ Object
-
#getViewMode ⇒ Object
-
#grid_lines ⇒ Object
-
#grid_lines=(bool) ⇒ Object
-
#hide_selection ⇒ Object
-
#hide_selection=(bool) ⇒ Object
-
#hittest(x, y) ⇒ Object
-
#hittest2(x, y) ⇒ Object
-
#iconview ⇒ Object
-
#insertColumn(column, title, width = 50, style = 0, textsize = title.size) ⇒ Object
-
#insertItem(index, texts, lparam = 0, textsize = 128) ⇒ Object
-
#insertMultiItems(index, multitexts, textsize = 128) ⇒ Object
-
#listview ⇒ Object
-
#listviewinit ⇒ Object
-
#lvexstyle ⇒ Object
-
#lvexstyle=(sty) ⇒ Object
-
#reportview ⇒ Object
-
#row_select ⇒ Object
# Instance Methods.
-
#row_select=(bool) ⇒ Object
-
#selected?(idx) ⇒ Boolean
-
#selectItem(idx, flag) ⇒ Object
-
#setBkColor(color) ⇒ Object
-
#setColumnFormatOf(column, format) ⇒ Object
-
#setColumnTextOf(column, text) ⇒ Object
-
#setColumnWidthOf(column, width) ⇒ Object
-
#setImagelist(imagelist, itype = 0) ⇒ Object
-
#setItemIconOf(idx, imageid) ⇒ Object
-
#setItemLParamOf(idx, lparam) ⇒ Object
-
#setItemStateOf(idx, state) ⇒ Object
-
#setItemTextOf(idx, subitem, text, textsize = text.size) ⇒ Object
-
#setListviewExStyle(sty, mask = 0xffffffff) ⇒ Object
-
#setViewMode(mode) ⇒ Object
-
#smalliconview ⇒ 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
#addColumn(*args) ⇒ Object
489
490
491
|
# File 'lib/vr/vrcomctl.rb', line 489
def addColumn(*args)
insertColumn(30000,*args) end
|
#addItem(*args) ⇒ Object
544
545
546
|
# File 'lib/vr/vrcomctl.rb', line 544
def addItem(*args)
insertItem(30000,*args)
end
|
#bkcolor=(color) ⇒ Object
456
457
458
|
# File 'lib/vr/vrcomctl.rb', line 456
def bkcolor=(color)
setBkColor(color)
end
|
#clearColumns ⇒ Object
479
480
481
|
# File 'lib/vr/vrcomctl.rb', line 479
def clearColumns
while sendMessage(WMsg::LVM_DELETECOLUMN,0,0)!=0 do; end
end
|
#countColumns ⇒ Object
483
484
485
486
487
|
# File 'lib/vr/vrcomctl.rb', line 483
def countColumns
r=0
while getColumnTextOf(r) do r+=1; end
r
end
|
#countSelectedItems ⇒ Object
665
666
667
|
# File 'lib/vr/vrcomctl.rb', line 665
def countSelectedItems()
sendMessage WMsg::LVM_GETSELECTED,0,0
end
|
#deleteColumn(column) ⇒ Object
476
477
478
|
# File 'lib/vr/vrcomctl.rb', line 476
def deleteColumn(column)
sendMessage(WMsg::LVM_DELETECOLUMN,column.to_i,0)
end
|
#deleteItem(idx) ⇒ Object
555
556
557
|
# File 'lib/vr/vrcomctl.rb', line 555
def deleteItem(idx)
sendMessage WMsg::LVM_DELETEITEM,idx.to_i,0
end
|
#eachSelectedItems ⇒ Object
656
657
658
659
660
661
662
663
|
# File 'lib/vr/vrcomctl.rb', line 656
def eachSelectedItems
n=countItems
0.upto(n-1) do |i|
if (getItemStateOf(i)&WConst::LVIS_SELECTED)>0 then
yield i
end
end
end
|
#ensureVisible(i, partial = true) ⇒ Object
675
676
677
678
|
# File 'lib/vr/vrcomctl.rb', line 675
def ensureVisible(i,partial=true)
flag = if partial then 1 else 0 end
sendMessage WMsg::LVM_ENSUREVISIBLE,i.to_i,flag
end
|
#extended_select ⇒ Object
59
60
61
|
# File 'lib/vr/contrib/vrlistviewex.rb', line 59
def extended_select
return !self.winstyle.getter(WStyle::LVS_SINGLESEL)
end
|
#extended_select=(bool) ⇒ Object
63
64
65
|
# File 'lib/vr/contrib/vrlistviewex.rb', line 63
def extended_select=(bool)
self.winstyle.setter(WStyle::LVS_SINGLESEL, !bool)
end
|
#focused?(idx) ⇒ Boolean
654
|
# File 'lib/vr/vrcomctl.rb', line 654
def focused?(idx) (getItemStateOf(idx)&2)>0 end
|
#focusedItem ⇒ Object
589
590
591
|
# File 'lib/vr/vrcomctl.rb', line 589
def focusedItem
getNextItem(0,1)
end
|
522
523
524
525
526
527
528
529
530
531
|
# File 'lib/vr/vrcomctl.rb', line 522
def getColumnFormatOf(column)
p=@screen.application.arg2cstructStr(WStruct::LVCOLUMN,
1,0,0,"",0,0)
rv=sendMessage WMsg::LVM_GETCOLUMN,column.to_i,p
if rv!=0 then
@screen.application.unpack(p,WStruct::LVCOLUMN)[1]
else
nil
end
end
|
#getColumnTextOf(column) ⇒ Object
511
512
513
514
515
516
517
518
519
520
521
|
# File 'lib/vr/vrcomctl.rb', line 511
def getColumnTextOf(column)
p=@screen.application.arg2cstructStr(WStruct::LVCOLUMN,
4,0,0,"\0"*128,128,0)
rv=sendMessage WMsg::LVM_GETCOLUMN,column.to_i,p
r=@screen.application.unpack(p,WStruct::LVCOLUMN)[3]
if rv!=0 then
@screen.application.pointer2string(r)
else
nil
end
end
|
#getColumnWidthOf(column) ⇒ Object
493
494
495
|
# File 'lib/vr/vrcomctl.rb', line 493
def getColumnWidthOf(column)
sendMessage(WMsg::LVM_GETCOLUMNWIDTH,column.to_i,0)
end
|
#getItemIconOf(idx) ⇒ Object
604
605
606
607
608
609
|
# File 'lib/vr/vrcomctl.rb', line 604
def getItemIconOf(idx)
lvitem=@screen.application.arg2cstructStr(WStruct::LVITEM,
0x2,idx,0,0,0,"",0,0,0)
sendMessage( WMsg::LVM_GETITEM,0,lvitem )
@screen.application.unpack(lvitem,WStruct::LVITEM)[7]
end
|
#getItemLParamOf(idx) ⇒ Object
646
647
648
649
650
651
|
# File 'lib/vr/vrcomctl.rb', line 646
def getItemLParamOf(idx)
lvitem=@screen.application.arg2cstructStr(WStruct::LVITEM,
0x4,idx,0,0,0,"",0,0,0)
sendMessage( WMsg::LVM_GETITEM,0,lvitem )
@screen.application.unpack(lvitem,WStruct::LVITEM)[8]
end
|
#getItemRect(item, code = 0) ⇒ Object
669
670
671
672
673
|
# File 'lib/vr/vrcomctl.rb', line 669
def getItemRect(item,code=0)
prc = [code,0,0,0].pack("iiii")
sendMessage WMsg::LVM_GETITEMRECT,item,prc
prc.unpack("iiii")
end
|
#getItemStateOf(idx) ⇒ Object
616
617
618
|
# File 'lib/vr/vrcomctl.rb', line 616
def getItemStateOf(idx)
sendMessage WMsg::LVM_GETITEMSTATE,idx.to_i,0xffff
end
|
#getItemTextOf(idx, subitem = 0, textsize = 128) ⇒ Object
633
634
635
636
637
638
639
|
# File 'lib/vr/vrcomctl.rb', line 633
def getItemTextOf(idx,subitem=0,textsize=128)
app=@screen.application
lvitem=app.arg2cstructStr(WStruct::LVITEM,
0,0,subitem,0,0,"\0"*textsize,textsize,0,0)
sendMessage( WMsg::LVM_GETITEMTEXT,idx,lvitem )
app.pointer2string(app.unpack(lvitem,WStruct::LVITEM)[5])
end
|
#getNextItem(start, flag) ⇒ Object
577
578
579
580
581
582
583
584
585
586
587
|
# File 'lib/vr/vrcomctl.rb', line 577
def getNextItem(start,flag)
r=sendMessage WMsg::LVM_GETNEXTITEM,start,MAKELPARAM(flag,0)
case(r)
when -1
0
when 0
nil
else
r
end
end
|
#getViewMode ⇒ Object
443
444
445
|
# File 'lib/vr/vrcomctl.rb', line 443
def getViewMode
self.style & 0xfffffff8
end
|
#grid_lines=(bool) ⇒ Object
47
48
49
|
# File 'lib/vr/contrib/vrlistviewex.rb', line 47
def grid_lines=(bool)
exstyle_setter(WExStyle::LVS_EX_GRIDLINES, bool)
end
|
#hide_selection ⇒ Object
51
52
53
|
# File 'lib/vr/contrib/vrlistviewex.rb', line 51
def hide_selection
return !self.winstyle.getter(WStyle::LVS_SHOWSELALWAYS)
end
|
#hide_selection=(bool) ⇒ Object
55
56
57
|
# File 'lib/vr/contrib/vrlistviewex.rb', line 55
def hide_selection=(bool)
self.winstyle.setter(WStyle::LVS_SHOWSELALWAYS, !bool)
end
|
#hittest(x, y) ⇒ Object
564
565
566
567
568
569
|
# File 'lib/vr/vrcomctl.rb', line 564
def hittest(x,y)
lvhit=@screen.application.arg2cstructStr(WStruct::LVHITTEST,
x.to_i,y.to_i,0,0)
sendMessage WMsg::LVM_HITTEST,0,lvhit
@screen.application.unpack(lvhit,WStruct::LVHITTEST)[3]
end
|
446
|
# File 'lib/vr/vrcomctl.rb', line 446
def iconview() setViewMode(0) end
|
#insertColumn(column, title, width = 50, style = 0, textsize = title.size) ⇒ Object
470
471
472
473
474
|
# File 'lib/vr/vrcomctl.rb', line 470
def insertColumn(column,title,width=50,style=0,textsize=title.size)
lv=@screen.application.arg2cstructStr(WStruct::LVCOLUMN,
0xf,style.to_i,width.to_i,title.to_s,textsize,column,0,0)
sendMessage WMsg::LVM_INSERTCOLUMN,column.to_i,lv
end
|
#insertItem(index, texts, lparam = 0, textsize = 128) ⇒ Object
533
534
535
536
537
538
539
540
541
542
|
# File 'lib/vr/vrcomctl.rb', line 533
def insertItem(index,texts,lparam=0,textsize=128)
lvitem=@screen.application.arg2cstructStr(WStruct::LVITEM,
0xf,index,0,0,0,texts[0].to_s,textsize,0,lparam)
item=sendMessage(WMsg::LVM_INSERTITEM,0,lvitem)
1.upto(texts.size-1) do |subitem|
setItemTextOf(item,subitem,texts[subitem],textsize)
end
item
end
|
#insertMultiItems(index, multitexts, textsize = 128) ⇒ Object
548
549
550
551
552
553
|
# File 'lib/vr/vrcomctl.rb', line 548
def insertMultiItems(index,multitexts,textsize=128)
n=multitexts.size
0.upto(n-1) do |i|
insertItem(index+i,*multitexts[i])
end
end
|
449
|
# File 'lib/vr/vrcomctl.rb', line 449
def listview() setViewMode(3) end
|
#listviewinit ⇒ Object
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
|
# File 'lib/vr/vrcomctl.rb', line 416
def listviewinit
addNotifyHandler(WMsg::LVN_ITEMCHANGED,"itemchanged",
MSGTYPE::ARGSTRUCT,WStruct::NM_LISTVIEW)
addFilterArg WMsg::LVN_ITEMCHANGED,"TFFTFFFF"
addNotifyHandler(WMsg::LVN_ITEMCHANGING,"itemchanging",
MSGTYPE::ARGSTRUCT,WStruct::NM_LISTVIEW)
addFilterArg WMsg::LVN_ITEMCHANGING,"TFFTFFFF"
addNotifyHandler(WMsg::LVN_COLUMNCLICK,"columnclick",
MSGTYPE::ARGSTRUCT,WStruct::NM_LISTVIEW)
addFilterArg WMsg::LVN_COLUMNCLICK,"FTFFFFFF"
addNotifyHandler(WMsg::LVN_BEGINDRAG,"begindrag",
MSGTYPE::ARGNONE,nil)
addNotifyHandler(WMsg::LVN_BEGINRDRAG,"beginrdrag",
MSGTYPE::ARGNONE,nil)
end
|
#lvexstyle=(sty) ⇒ Object
463
464
465
|
# File 'lib/vr/vrcomctl.rb', line 463
def lvexstyle=(sty)
setListviewExStyle(sty)
end
|
#reportview ⇒ Object
447
|
# File 'lib/vr/vrcomctl.rb', line 447
def reportview() setViewMode(1) end
|
#selected?(idx) ⇒ Boolean
653
|
# File 'lib/vr/vrcomctl.rb', line 653
def selected?(idx) (getItemStateOf(idx)&1)>0 end
|
#selectItem(idx, flag) ⇒ Object
619
620
621
622
623
624
625
626
|
# File 'lib/vr/vrcomctl.rb', line 619
def selectItem(idx,flag)
if flag then
s = getItemStateOf(idx) | WConst::LVIS_SELECTED
else
s = getItemStateOf(idx) & (~ WConst::LVIS_SELECTED)
end
setItemStateOf(idx,s)
end
|
#setBkColor(color) ⇒ Object
452
453
454
|
# File 'lib/vr/vrcomctl.rb', line 452
def setBkColor(color)
sendMessage WMsg::LVM_SETBKCOLOR,0,color.to_i
end
|
506
507
508
509
510
|
# File 'lib/vr/vrcomctl.rb', line 506
def setColumnFormatOf(column,format)
p=@screen.application.arg2cstructStr(WStruct::LVCOLUMN,
1,format,0,"",0,0)
sendMessage WMsg::LVM_SETCOLUMN,column.to_i,p
end
|
#setColumnTextOf(column, text) ⇒ Object
501
502
503
504
505
|
# File 'lib/vr/vrcomctl.rb', line 501
def setColumnTextOf(column,text)
p=@screen.application.arg2cstructStr(WStruct::LVCOLUMN,
4,0,0,text,text.size,0)
sendMessage WMsg::LVM_SETCOLUMN,column.to_i,p
end
|
#setColumnWidthOf(column, width) ⇒ Object
497
498
499
|
# File 'lib/vr/vrcomctl.rb', line 497
def setColumnWidthOf(column,width)
sendMessage(WMsg::LVM_SETCOLUMNWIDTH,column.to_i,width.to_i)
end
|
#setImagelist(imagelist, itype = 0) ⇒ Object
593
594
595
596
597
|
# File 'lib/vr/vrcomctl.rb', line 593
def setImagelist(imagelist,itype=0)
raise "not Imagelist" unless imagelist.is_a?(SWin::Imagelist)
self.properties["imagelist"]=imagelist
sendMessage WMsg::LVM_SETIMAGELIST,itype,imagelist.himagelist
end
|
#setItemIconOf(idx, imageid) ⇒ Object
599
600
601
602
603
|
# File 'lib/vr/vrcomctl.rb', line 599
def setItemIconOf(idx,imageid)
lvitem=@screen.application.arg2cstructStr(WStruct::LVITEM,
2,idx,0,0,0xffff,"",0,imageid.to_i,0) sendMessage WMsg::LVM_SETITEM,idx.to_i,lvitem
end
|
#setItemLParamOf(idx, lparam) ⇒ Object
641
642
643
644
645
|
# File 'lib/vr/vrcomctl.rb', line 641
def setItemLParamOf(idx,lparam)
lvitem=@screen.application.arg2cstructStr(WStruct::LVITEM,
0x4,idx,0,0,0,"",0,0,lparam.to_i)
sendMessage WMsg::LVM_SETITEM,0,lvitem
end
|
#setItemStateOf(idx, state) ⇒ Object
611
612
613
614
615
|
# File 'lib/vr/vrcomctl.rb', line 611
def setItemStateOf(idx,state)
lvitem=@screen.application.arg2cstructStr(WStruct::LVITEM,
0,0,0,state,0xffff,"",0,0,0)
sendMessage WMsg::LVM_SETITEMSTATE,idx.to_i,lvitem
end
|
#setItemTextOf(idx, subitem, text, textsize = text.size) ⇒ Object
628
629
630
631
632
|
# File 'lib/vr/vrcomctl.rb', line 628
def setItemTextOf(idx,subitem,text,textsize=text.size)
lvitem=@screen.application.arg2cstructStr(WStruct::LVITEM,
0,0,subitem,0,0,text.to_s,textsize,0,0)
sendMessage WMsg::LVM_SETITEMTEXT,idx.to_i,lvitem
end
|
#setListviewExStyle(sty, mask = 0xffffffff) ⇒ Object
#setViewMode(mode) ⇒ Object
440
441
442
|
# File 'lib/vr/vrcomctl.rb', line 440
def setViewMode(mode)
self.style = (self.style & 0xfffffff8) + (mode&3)
end
|
#smalliconview ⇒ Object
448
|
# File 'lib/vr/vrcomctl.rb', line 448
def smalliconview() setViewMode(2) end
|
435
436
437
438
|
# File 'lib/vr/vrcomctl.rb', line 435
def vrinit
super
listviewinit
end
|