vbAccelerator - Contents of code file: cToolBoxBar.clsVERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "cToolBoxBar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
'
===============================================================================
=======
' Name: cToolBoxBar.cls
' Author: Steve McMahon (steve@vbaccelerator.com)
' Date: 9 February 2003
'
' Requires: -
'
' Copyright 2003 Steve McMahon for vbAccelerator
'
-------------------------------------------------------------------------------
-------
' Visit vbAccelerator - advanced free source code for VB programmers
' http://vbaccelerator.com
'
-------------------------------------------------------------------------------
-------
'
' Public access to tab properties for the vbalDTab6 control.
'
' FREE SOURCE CODE - ENJOY!
' Do not sell this code. Credit vbAccelerator.
'
===============================================================================
=======
Private Declare Function IsWindow Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDest As
Any, pSrc As Any, ByVal ByteLen As Long)
Private m_lOwner As Long
Private m_hWnd As Long
Private m_lId As Long
Friend Sub fInit(ByVal lPtr As Long, ByVal lhWnd As Long, ByVal lId As Long)
m_lOwner = lPtr
m_hWnd = lhWnd
m_lId = lId
End Sub
Public Property Get OwnerControl() As vbalToolBoxBarCtl
Attribute OwnerControl.VB_Description = "Gets the owning control of this bar."
If Not (m_hWnd = 0) Then
If (IsWindow(m_hWnd)) Then
If Not (m_lOwner = 0) Then
Dim oT As Object
CopyMemory oT, m_lOwner, 4
Set OwnerControl = oT
CopyMemory oT, 0&, 4
Exit Property
End If
End If
End If
Err.Raise 9, App.EXEName & ".vbalToolBoxBarCtl"
End Property
Public Property Get SelectedItem() As cToolItem
Attribute SelectedItem.VB_Description = "Gets the selected item (if any) within
this bar."
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
Set SelectedItem = oT.fSelectedItem(m_lId)
End If
End Property
Public Property Get NextBar( _
Optional ByVal bVisibleOnly As Boolean = True _
) As cToolBoxBar
Attribute NextBar.VB_Description = "Gets the next bar along in the control."
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
Set NextBar = oT.fNextBar(m_lId, 1, bVisibleOnly)
End If
End Property
Public Property Get PreviousBar( _
Optional ByVal bVisibleOnly As Boolean = True _
) As cToolBoxBar
Attribute PreviousBar.VB_Description = "Gets the previous bar along in the
control."
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
Set PreviousBar = oT.fNextBar(m_lId, -1, bVisibleOnly)
End If
End Property
Public Sub MovePrevious()
Attribute MovePrevious.VB_Description = "Moves this bar to the previous
position along in the control."
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
oT.fBarMove m_lId, -1
End If
End Sub
Public Sub MoveNext()
Attribute MoveNext.VB_Description = "Moves this bar to the next position along
in the control."
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
oT.fBarMove m_lId, 1
End If
End Sub
Public Property Get Caption() As String
Attribute Caption.VB_Description = "Gets/sets the caption of the bar."
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
Caption = oT.fBarCaption(m_lId)
End If
End Property
Public Property Let Caption(ByVal sCaption As String)
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
oT.fBarCaption(m_lId) = sCaption
End If
End Property
Public Property Get Tag() As String
Attribute Tag.VB_Description = "Gets/sets a string value associated with the
bar."
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
Tag = oT.fBarTag(m_lId)
End If
End Property
Public Property Let Tag(ByVal sTag As String)
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
oT.fBarTag(m_lId) = sTag
End If
End Property
Public Property Get ItemData() As Long
Attribute ItemData.VB_Description = "Gets/sets a long value associated with
this bar."
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
ItemData = oT.fBarItemData(m_lId)
End If
End Property
Public Property Let ItemData(ByVal lItemData As Long)
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
oT.fBarItemData(m_lId) = lItemData
End If
End Property
Public Property Get Key() As String
Attribute Key.VB_Description = "Gets the key of this bar."
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
Key = oT.fBarKey(m_lId)
End If
End Property
Public Property Get Index() As Long
Attribute Index.VB_Description = "Gets the index of the bar in the control."
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
Index = oT.fBarIndex(m_lId)
End If
End Property
Public Property Get Selected() As Boolean
Attribute Selected.VB_Description = "Gets/sets whether this bar is selected."
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
Selected = oT.fBarSelected(m_lId)
End If
End Property
Public Property Let Selected(ByVal bSelected As Boolean)
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
oT.fBarSelected(m_lId) = bSelected
End If
End Property
Public Property Get Sorted() As Boolean
Attribute Sorted.VB_Description = "Gets/sets whether items are sorted
alphabetically in the control."
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
Sorted = oT.fBarSorted(m_lId)
End If
End Property
Public Property Let Sorted(ByVal bSorted As Boolean)
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
oT.fBarSorted(m_lId) = bSorted
End If
End Property
Public Property Get Visible() As Boolean
Attribute Visible.VB_Description = "Gets/sets whether this bar is visible or
not."
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
Visible = oT.fBarVisible(m_lId)
End If
End Property
Public Property Let Visible(ByVal bVisible As Boolean)
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
oT.fBarVisible(m_lId) = bVisible
End If
End Property
Public Property Get ListStyle() As Boolean
Attribute ListStyle.VB_Description = "Gets/sets whether items are displayed in
a list style with captions. Defaults to True."
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
ListStyle = oT.fBarListStyle(m_lId)
End If
End Property
Public Property Let ListStyle(ByVal bListStyle As Boolean)
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
oT.fBarListStyle(m_lId) = bListStyle
End If
End Property
Public Property Get Items() As cToolItemCollection
Attribute Items.VB_Description = "Gets the collection of items associated with
this bar."
Dim oT As vbalToolBoxBarCtl
Set oT = OwnerControl()
If Not oT Is Nothing Then
Set Items = oT.fBarItems(m_lId)
End If
End Property
Private Sub Class_Initialize()
'Debug.Print "cToolBoxBar:Initialize", ObjPtr(Me)
End Sub
Private Sub Class_Terminate()
'Debug.Print "cToolBoxBar:Terminate", ObjPtr(Me)
End Sub
|
|