Private mlIndex As Long ' index of icon on Menu (1 based)
Private picButton As Picture ' icon picture
Private msCaptionX As Long
Private msCaptionY As Long
Private mlButtonHeight As Long
Private mbButtonDownOnMe As Boolean
Private msPictureURL As String
Private msKey As String
Private msTag As String
Private Type BUTTON_STRUCT
RECT As RECT
State As Long
OnScreen As Boolean
End Type
Private mButtonStruct As BUTTON_STRUCT
Private mHitStruct As RECT
Private m3DStruct As RECT
#If USE_WING Then
Private Declare Function WinGBitBlt Lib "wing32.dll" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long) As Long
#Else
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
#End If
Private Declare Function CreateRectRgnIndirect Lib "gdi32" (lpRect As RECT) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hMF As Long) As Long
Private Declare Function SelectClipRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long) As Long
Private Declare Function SaveDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function RestoreDC Lib "gdi32" (ByVal hdc As Long, ByVal SavedDC As Long) As Long
Const SRCCOPY = &HCC0020
Const ICON_SIZE = 32
Const MOUSE_UP = 1
Const MOUSE_DOWN = -1
Const MOUSE_MOVE = 0
Const RAISED = 1
Const SUNKEN = -1
Const NONE = 0
Const HITTEXT_EXTRA_PIXELS = 4
Const CLIPPING_NO = True
Const CLIPPING_YES = False
Public Property Get Caption() As String
On Error Resume Next
Caption = msCaption
End Property
Public Property Let Caption(ByVal sNewValue As String)
On Error Resume Next
msCaption = sNewValue
End Property
Public Property Get Index() As Long
On Error Resume Next
Index = mlIndex
End Property
Public Property Let Index(ByVal lNewValue As Long)
On Error Resume Next
mlIndex = lNewValue
End Property
Public Property Get Button() As Object
On Error Resume Next
Set Button = picButton
End Property
Public Property Set Button(ByVal vNewValue As Object)
On Error Resume Next
Set picButton = vNewValue
End Property
Public Property Get Left() As Long
On Error Resume Next
Left = mButtonStruct.RECT.Left
End Property
Public Property Let Left(ByVal lNewValue As Long)
On Error Resume Next
With mButtonStruct.RECT
.Left = lNewValue
.Right = lNewValue + ICON_SIZE
End With
End Property
Public Property Get Top() As Long
On Error Resume Next
Top = mButtonStruct.RECT.Top
End Property
Public Property Let Top(ByVal lNewValue As Long)
On Error Resume Next
With mButtonStruct.RECT
.Top = lNewValue
.Bottom = lNewValue + ICON_SIZE
End With
End Property
Public Property Get Right() As Long
On Error Resume Next
Right = mButtonStruct.RECT.Right
End Property
Public Property Get Bottom() As Long
On Error Resume Next
Bottom = mButtonStruct.RECT.Bottom
End Property
Public Property Get State() As Long
On Error Resume Next
State = mButtonStruct.State
End Property
Public Property Let State(ByVal lNewValue As Long)
On Error Resume Next
mButtonStruct.State = lNewValue
End Property
Public Property Get CaptionX() As Long
On Error Resume Next
CaptionX = msCaptionX
End Property
Public Property Let CaptionX(ByVal lNewValue As Long)
On Error Resume Next
msCaptionX = lNewValue
End Property
Public Property Get CaptionY() As Long
On Error Resume Next
CaptionY = msCaptionY
End Property
Public Property Let CaptionY(ByVal lNewValue As Long)
On Error Resume Next
msCaptionY = lNewValue
End Property
' paint the icon (32x32) and its caption
Public Function PaintButton(lTopMenuItemDisplayed, lIconStart As Long, lMenuCur As Long, lClipY As Long) As Boolean