Code: Select all
; Subclass ListIcon so we can customdraw the header text and colour the header area
;============================================================================================================================
Procedure SubclassedListIcon(hwnd, msg, wparam, lparam)
Protected hdi.hd_item
result = CallWindowProc_(form\oldListIconCallback, hwnd, msg, wparam, lparam)
Select msg
Case #WM_NOTIFY
*pnmh.NMHDR = lparam ;--> Get handle to ListIcon header control
If *pnmh\code = #NM_CUSTOMDRAW
*pnmcd.NMCUSTOMDRAW = lparam ;--> Determine drawing stage
Select *pnmcd\dwDrawStage
Case #CDDS_PREPAINT
result = #CDRF_NOTIFYITEMDRAW
Case #CDDS_ITEMPREPAINT ; Get header text.
text$ = Space(100)
hdi\mask = #HDI_TEXT
hdi\psztext = @text$
hdi\cchtextmax = Len(text$)
SendMessage_(form\hHeader, #HDM_GETITEM, *pnmcd\dwItemSpec, hdi) ; Check button state.
If *pnmcd\uItemState & #CDIS_SELECTED
DrawFrameControl_(*pnmcd\hdc, *pnmcd\rc, #DFC_BUTTON, #DFCS_BUTTONPUSH | #DFCS_PUSHED) ; Offset text because of the selected button.
InflateRect_(*pnmcd\rc, -1, -1)
Else
DrawFrameControl_(*pnmcd\hdc, *pnmcd\rc, #DFC_BUTTON, #DFCS_BUTTONPUSH)
EndIf ; Draw background. ; Here we alternate red text on blue background.
InflateRect_(*pnmcd\rc, -1, -1)
SetBkMode_(*pnmcd\hdc, #TRANSPARENT)
;If *pnmcd\dwItemSpec & 1
FillRect_(*pnmcd\hdc, *pnmcd\rc, form\brush)
SetTextColor_(*pnmcd\hdc, $000000)
;Else
; FillRect_(*pnmcd\hdc, *pnmcd\rc, Colour)
; SetTextColor_(*pnmcd\hdc, $000000)
;EndIf
DrawText_(*pnmcd\hdc, @text$, Len(text$), *pnmcd\rc, #DT_CENTER | #DT_VCENTER | #DT_END_ELLIPSIS)
result = #CDRF_SKIPDEFAULT
EndSelect
EndIf
EndSelect
ProcedureReturn result
EndProcedure
Code: Select all
;------------------------------------------------------------------------------------------------
; Sublcass ListIconGadget to allow header to be painted
;------------------------------------------------------------------------------------------------
form\hHeader = SendMessage_(GadgetID(#Gadget_ebackup_items), #LVM_GETHEADER, 0, 0) ; Subclass ListIcon so we can customdraw the header text
form\oldListIconCallback = SetWindowLong_(GadgetID(#Gadget_ebackup_items), #GWL_WNDPROC, @SubclassedListIcon())