From: Rod O. <rod...@us...> - 2006-06-11 09:26:40
|
Update of /cvsroot/win32forth/win32forth/src/lib In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv3624/src/lib Modified Files: Listview.f Log Message: Rod: updated to use SendMessage:Self, removed incorrect window message processing Index: Listview.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/src/lib/Listview.f,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Listview.f 5 Jun 2006 12:08:07 -0000 1.10 --- Listview.f 11 Jun 2006 09:26:31 -0000 1.11 *************** *** 1,7 **** \ ListView.f ListView control by Prad anew -ListView.f ! cr .( Loading ListView control...) internal --- 1,9 ---- + \ $Id$ + \ ListView.f ListView control by Prad anew -ListView.f ! cr .( Loading ListView Class...) internal *************** *** 290,297 **** --- 292,301 ---- :Class ListView <Super Control + Comment: int nmhdr // NMHDR nmhdr int nmlv // NM_LISTVIEW nmlv int lvdi // LV_DISPINFO lvdi int lvkd // LV_KEYDOWN lvkd + Comment; :M Start: ( Parent -- ) *************** *** 300,442 **** ;M - :M WindowStyle: ( -- style ) \ return the window style - WindowStyle: super - WS_BORDER or - ;M - ( -------------------------------------------------------------------) ( Items and SubItems ) ! :M DeleteAllItems: ( -- f ) 0 0 LVM_DELETEALLITEMS hWnd Call SendMessage ;M ! :M DeleteItem: ( iitem -- f ) 0 swap LVM_DELETEITEM hWnd Call SendMessage ;M ! :M GetItem: ( ptem -- f ) 0 LVM_GETITEM hWnd Call SendMessage ;M ! :M GetItemCount: ( -- n ) 0 0 LVM_GETITEMCOUNT hWnd Call SendMessage ;M ! :M GetItemSpacing: ( fsmall -- f ) 0 swap LVM_GETITEMSPACING hWnd Call SendMessage ;M ! :M GetItemState: ( mask i -- f ) LVM_GETITEMSTATE hWnd Call SendMessage ;M :M GetItemText: ( pitem iItem -- adr count ) >r dup r> ! LVM_GETITEMTEXT hWnd Call SendMessage swap 5 cells+ @ swap ;M ! :M GetSelectedCount: ( -- n ) 0 0 LVM_GETSELECTEDCOUNT hWnd Call SendMessage ;M ! :M InsertItem: ( pitem -- index | -1 ) 0 LVM_INSERTITEM hWnd Call SendMessage ;M ! :M SetItem: ( pitem -- index | -1 ) 0 LVM_SETITEM hWnd Call SendMessage ;M ! :M SetItemCount: ( cItems -- ) 0 swap LVM_SETITEMCOUNT hWnd Call SendMessage ;M ! :M SetItemState: ( pitem i -- f ) LVM_SETITEMSTATE hWnd Call SendMessage ;M ! :M SetItemText: ( pitem i -- f ) LVM_SETITEMTEXT hWnd Call SendMessage ;M :M SetExtendedStyle: ( fl lvs_ex_style - ) LVM_SETEXTENDEDLISTVIEWSTYLE ! hWnd Call SendMessage drop ;M ( -------------------------------------------------------------------) ( Callback Items ) ! :M GetCallBackMask: ( -- mask ) 0 0 LVM_GETCALLBACKMASK hWnd Call SendMessage ;M ! :M ReDrawItems: ( iLast iFirst -- f ) LVM_REDRAWITEMS hWnd Call SendMessage ;M ! :M SetCallBackMask: ( mask -- f ) 0 swap LVM_SETCALLBACKMASK hWnd Call SendMessage ;M ! :M Update: ( iItem -- f ) 0 swap LVM_UPDATE hWnd Call SendMessage ;M ( -------------------------------------------------------------------) ( Columns ) ! :M DeleteColumn: ( icol -- f ) 0 swap LVM_DELETECOLUMN hWnd Call SendMessage ;M ! :M GetColumn: ( pcol icol -- f ) LVM_GETCOLUMN hWnd Call SendMessage ;M ! :M GetColumnWidth: ( icol -- width|0 ) 0 swap LVM_GETCOLUMNWIDTH hWnd Call SendMessage ;M ! :M GetStringWidth: ( psz -- width|0 ) 0 LVM_GETSTRINGWIDTH hWnd Call SendMessage ;M ! :M InsertColumn: ( pcol icol -- index|-1 ) LVM_INSERTCOLUMN hWnd Call SendMessage ;M ! :M SetColumn: ( pcol icol -- f ) LVM_SETCOLUMN hWnd Call SendMessage ;M ! :M SetColumnWidth: ( cx icol -- ) LVM_SETCOLUMNWIDTH hWnd Call SendMessage drop ;M ( -------------------------------------------------------------------) ( Arranging, Sorting and Finding ) ! :M Arrange: ( code -- f ) 0 swap LVM_ARRANGE hWnd Call SendMessage ;M ! :M FindItem: ( plvfi iStart -- index|-1 ) LVM_FINDITEM hWnd Call SendMessage ;M ! :M GetNextItem: ( flags iStart -- index|-1 ) LVM_GETNEXTITEM hWnd Call SendMessage ;M ! :M SortItems: ( pfnCompare lParamsort -- f ) LVM_SORTITEMS hWnd Call SendMessage ;M ( -------------------------------------------------------------------) ( Items Positions and Scrolling ) ! :M EnsureVisible: ( fPartialOK i -- f ) LVM_ENSUREVISIBLE hWnd Call SendMessage ;M ! :M GetCountPerPage: ( -- n ) 0 0 LVM_GETCOUNTPERPAGE hWnd Call SendMessage ;M ! :M GetItemPosition: ( ppt i -- f ) LVM_GETITEMPOSITION hWnd Call SendMessage ;M ! :M GetItemRect: ( prc i -- f ) LVM_GETITEMRECT hWnd Call SendMessage ;M ! :M GetOrigin: ( lpptOrg -- f ) 0 LVM_GETORIGIN hWnd Call SendMessage ;M ! :M GetTopIndex: ( -- index|0 ) 0 0 LVM_GETTOPINDEX hWnd Call SendMessage ;M ! :M GetViewRect: ( prc -- f ) 0 LVM_GETVIEWRECT hWnd Call SendMessage ;M ! :M HitTest: ( pinfo -- index|-1 ) 0 LVM_HITTEST hWnd Call SendMessage ;M ! :M Scroll: ( dy dx -- f ) LVM_SCROLL hWnd Call SendMessage ;M ! :M SetItemPosition: ( x y i -- f ) >r word-join r> LVM_SETITEMPOSITION hWnd Call SendMessage ;M ! :M SetItemPosition32: ( lpptNewPos iItem -- f ) LVM_SETITEMPOSITION32 hWnd Call SendMessage ;M ( -------------------------------------------------------------------) ( Colours ) ! :M GetBkColor: ( -- col ) 0 0 LVM_GETBKCOLOR hWnd Call SendMessage ;M ! :M GetTextBkColor: ( -- col ) 0 0 LVM_GETTEXTBKCOLOR hWnd Call SendMessage ;M ! :M GetTextColor: ( -- col ) 0 0 LVM_GETTEXTCOLOR hWnd Call SendMessage ;M ! :M SetBkColor: ( clrBk -- f ) 0 LVM_SETBKCOLOR hWnd Call SendMessage ;M ! :M SetTextBkColor: ( clrText -- f ) 0 LVM_SETTEXTBKCOLOR hWnd Call SendMessage ;M ! :M SetTextColor: ( clrText -- f ) 0 LVM_SETTEXTCOLOR hWnd Call SendMessage ;M ( -------------------------------------------------------------------) ( Miscellaneous ) ! :M CreateDragImage: ( lpptUpLeft iItem -- hndl|NULL ) LVM_CREATEDRAGIMAGE hWnd Call SendMessage ;M ! :M EditLabel: ( iItem -- hndl|NULL ) 0 swap LVM_EDITLABEL hWnd Call SendMessage ;M ! :M GetEditControl: ( -- ) 0 0 LVM_GETEDITCONTROL hWnd Call SendMessage ;M ! :M GetImageList: ( iImageList -- hndl|NULL ) 0 swap LVM_GETIMAGELIST hWnd Call SendMessage ;M ! :M SetImageList: ( himl iImageList -- hndl|NULL ) LVM_SETIMAGELIST hWnd Call SendMessage ;M ( -------------------------------------------------------------------) ( -Window Message Processing performed by a list contol- ) ! :M WM_CHAR: ( -- ) ;M ! :M WM_COMMAND: ( -- ) ;M ! :M WM_CREATE: ( -- ) ;M ! :M WM_DESTROY: ( -- ) ;M ! :M WM_ERASEBKGND: ( -- ) ;M ! :M WM_GETDLGCODE: ( -- ) ;M ! :M WM_GETFONT: ( -- ) ;M ! :M WM_HSCROLL: ( -- ) ;M ! :M WM_KEYDOWN: ( -- ) ;M ! :M WM_KILLFOCUS: ( -- ) ;M ! :M WM_LBUTTONDBLCLK: ( -- ) ;M ! :M WM_LBUTTONDOWN: ( -- ) ;M ! :M WM_NCCREATE: ( -- ) ;M ! ! :M WM_NOTIFY: ( h m w l -- ) ! dup @ to nmhdr ! Getcode: nmhdr ! ! ( A list view control sends notification ! ( messages to its owner window when events occur in the control. ) ! ! case ! LVN_BEGINDRAG OF @ to nmlv ENDOF // NM_LISTVIEW ! LVN_BEGINLABELEDITA OF @ to lvdi ENDOF // LV_DISPINFO ! LVN_BEGINRDRAG OF @ to nmlv ENDOF // NM_LISTVIEW ! LVN_COLUMNCLICK OF @ to nmlv ENDOF // NM_LISTVIEW ! LVN_DELETEALLITEMS OF @ to nmlv ENDOF // NM_LISTVIEW ! LVN_DELETEITEM OF @ to nmlv ENDOF // NM_LISTVIEW ! LVN_ENDLABELEDITA OF @ to lvdi ENDOF // LV_DISPINFO ! LVN_GETDISPINFOA OF @ to lvdi ENDOF // LV_DISPINFO ! LVN_INSERTITEM OF @ to nmlv ENDOF // NM_LISTVIEW ! LVN_ITEMCHANGED OF @ to nmlv ENDOF // NM_LISTVIEW ! LVN_ITEMCHANGING OF @ to nmlv ENDOF // NM_LISTVIEW ! LVN_KEYDOWN OF @ to lvkd ENDOF // LV_KEYDOWN ! LVN_SETDISPINFOA OF @ to lvdi ENDOF // LV_DISPINFO ! endcase ! ;M ! :M WM_NCCREATE: ( -- ) ;M ! :M WM_NCDESTROY: ( -- ) ;M ! :M WM_PAINT: ( -- ) ;M ! :M WM_RBUTTONDOWN: ( -- ) ;M ! :M WM_SETFOCUS: ( -- ) ;M ! :M WM_SETFONT: ( -- ) ;M ! :M WM_SETREDRAW: ( -- ) ;M ! :M WM_TIMER: ( -- ) ;M ! :M WM_VSCROLL: ( -- ) ;M ! :M WM_WINDOWPOSCHANGED: ( -- ) ;M ! :M WM_WININICHANGE: ( -- ) ;M ;Class --- 304,428 ---- ;M ( -------------------------------------------------------------------) ( Items and SubItems ) ! :M DeleteAllItems: ( -- f ) 0 0 LVM_DELETEALLITEMS SendMessage:Self ;M ! :M DeleteItem: ( iitem -- f ) 0 swap LVM_DELETEITEM SendMessage:Self ;M ! :M GetItem: ( ptem -- f ) 0 LVM_GETITEM SendMessage:Self ;M ! :M GetItemCount: ( -- n ) 0 0 LVM_GETITEMCOUNT SendMessage:Self ;M ! :M GetItemSpacing: ( fsmall -- f ) 0 swap LVM_GETITEMSPACING SendMessage:Self ;M ! :M GetItemState: ( mask i -- f ) LVM_GETITEMSTATE SendMessage:Self ;M :M GetItemText: ( pitem iItem -- adr count ) >r dup r> ! LVM_GETITEMTEXT SendMessage:Self swap 5 cells+ @ swap ;M ! :M GetSelectedCount: ( -- n ) 0 0 LVM_GETSELECTEDCOUNT SendMessage:Self ;M ! :M InsertItem: ( pitem -- index | -1 ) 0 LVM_INSERTITEM SendMessage:Self ;M ! :M SetItem: ( pitem -- index | -1 ) 0 LVM_SETITEM SendMessage:Self ;M ! :M SetItemCount: ( cItems -- ) 0 swap LVM_SETITEMCOUNT SendMessage:Self ;M ! :M SetItemState: ( pitem i -- f ) LVM_SETITEMSTATE SendMessage:Self ;M ! :M SetItemText: ( pitem i -- f ) LVM_SETITEMTEXT SendMessage:Self ;M :M SetExtendedStyle: ( fl lvs_ex_style - ) LVM_SETEXTENDEDLISTVIEWSTYLE ! SendMessage:SelfDrop ;M ( -------------------------------------------------------------------) ( Callback Items ) ! :M GetCallBackMask: ( -- mask ) 0 0 LVM_GETCALLBACKMASK SendMessage:Self ;M ! :M ReDrawItems: ( iLast iFirst -- f ) LVM_REDRAWITEMS SendMessage:Self ;M ! :M SetCallBackMask: ( mask -- f ) 0 swap LVM_SETCALLBACKMASK SendMessage:Self ;M ! :M Update: ( iItem -- f ) 0 swap LVM_UPDATE SendMessage:Self ;M ( -------------------------------------------------------------------) ( Columns ) ! :M DeleteColumn: ( icol -- f ) 0 swap LVM_DELETECOLUMN SendMessage:Self ;M ! :M GetColumn: ( pcol icol -- f ) LVM_GETCOLUMN SendMessage:Self ;M ! :M GetColumnWidth: ( icol -- width|0 ) 0 swap LVM_GETCOLUMNWIDTH SendMessage:Self ;M ! :M GetStringWidth: ( psz -- width|0 ) 0 LVM_GETSTRINGWIDTH SendMessage:Self ;M ! :M InsertColumn: ( pcol icol -- index|-1 ) LVM_INSERTCOLUMN SendMessage:Self ;M ! :M SetColumn: ( pcol icol -- f ) LVM_SETCOLUMN SendMessage:Self ;M ! :M SetColumnWidth: ( cx icol -- ) LVM_SETCOLUMNWIDTH SendMessage:SelfDrop ;M ( -------------------------------------------------------------------) ( Arranging, Sorting and Finding ) ! :M Arrange: ( code -- f ) 0 swap LVM_ARRANGE SendMessage:Self ;M ! :M FindItem: ( plvfi iStart -- index|-1 ) LVM_FINDITEM SendMessage:Self ;M ! :M GetNextItem: ( flags iStart -- index|-1 ) LVM_GETNEXTITEM SendMessage:Self ;M ! :M SortItems: ( pfnCompare lParamsort -- f ) LVM_SORTITEMS SendMessage:Self ;M ( -------------------------------------------------------------------) ( Items Positions and Scrolling ) ! :M EnsureVisible: ( fPartialOK i -- f ) LVM_ENSUREVISIBLE SendMessage:Self ;M ! :M GetCountPerPage: ( -- n ) 0 0 LVM_GETCOUNTPERPAGE SendMessage:Self ;M ! :M GetItemPosition: ( ppt i -- f ) LVM_GETITEMPOSITION SendMessage:Self ;M ! :M GetItemRect: ( prc i -- f ) LVM_GETITEMRECT SendMessage:Self ;M ! :M GetOrigin: ( lpptOrg -- f ) 0 LVM_GETORIGIN SendMessage:Self ;M ! :M GetTopIndex: ( -- index|0 ) 0 0 LVM_GETTOPINDEX SendMessage:Self ;M ! :M GetViewRect: ( prc -- f ) 0 LVM_GETVIEWRECT SendMessage:Self ;M ! :M HitTest: ( pinfo -- index|-1 ) 0 LVM_HITTEST SendMessage:Self ;M ! :M Scroll: ( dy dx -- f ) LVM_SCROLL SendMessage:Self ;M ! :M SetItemPosition: ( x y i -- f ) >r word-join r> LVM_SETITEMPOSITION SendMessage:Self ;M ! :M SetItemPosition32: ( lpptNewPos iItem -- f ) LVM_SETITEMPOSITION32 SendMessage:Self ;M ( -------------------------------------------------------------------) ( Colours ) ! :M GetBkColor: ( -- col ) 0 0 LVM_GETBKCOLOR SendMessage:Self ;M ! :M GetTextBkColor: ( -- col ) 0 0 LVM_GETTEXTBKCOLOR SendMessage:Self ;M ! :M GetTextColor: ( -- col ) 0 0 LVM_GETTEXTCOLOR SendMessage:Self ;M ! :M SetBkColor: ( clrBk -- f ) 0 LVM_SETBKCOLOR SendMessage:Self ;M ! :M SetTextBkColor: ( clrText -- f ) 0 LVM_SETTEXTBKCOLOR SendMessage:Self ;M ! :M SetTextColor: ( clrText -- f ) 0 LVM_SETTEXTCOLOR SendMessage:Self ;M ( -------------------------------------------------------------------) ( Miscellaneous ) ! :M CreateDragImage: ( lpptUpLeft iItem -- hndl|NULL ) LVM_CREATEDRAGIMAGE SendMessage:Self ;M ! :M EditLabel: ( iItem -- hndl|NULL ) 0 swap LVM_EDITLABEL SendMessage:Self ;M ! :M GetEditControl: ( -- ) 0 0 LVM_GETEDITCONTROL SendMessage:Self ;M ! :M GetImageList: ( iImageList -- hndl|NULL ) 0 swap LVM_GETIMAGELIST SendMessage:Self ;M ! :M SetImageList: ( himl iImageList -- hndl|NULL ) LVM_SETIMAGELIST SendMessage:Self ;M ( -------------------------------------------------------------------) ( -Window Message Processing performed by a list contol- ) ! Comment: ! The following messages are processed by the window procedure of a ListView control. ! To intercept a message eg WM_CHAR :- ! :M WM_CHAR ( h m w l -- f ) ! ( ****Add your code here**** ) ! old-WndProc CallWindowProc ;M ! Failure to send this message to the old window procedure will stop the control working properly. + WM_CHAR + WM_COMMAND + WM_CREATE + WM_DESTROY + WM_ERASEBKGND + WM_GETDLGCODE + WM_GETFONT + WM_HSCROLL + WM_KEYDOWN + WM_KILLFOCUS + WM_LBUTTONDBLCLK + WM_LBUTTONDOWN + WM_NCCREATE + WM_NOTIFY - processes notification messages from the header control. + A list view control also sends WM_NOTIFY to its + owner window when events occur in the control. + WM_NCCREATE + WM_NCDESTROY + WM_PAINT + WM_RBUTTONDOWN + WM_SETFOCUS + WM_SETFONT + WM_SETREDRAW + WM_TIMER + WM_VSCROLL + WM_WINDOWPOSCHANGED + WM_WININICHANGE ! Comment; ;Class |