forked from syntax53/Nightmare-Redux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NMRTask_clsIcon.cls
232 lines (182 loc) · 5.99 KB
/
NMRTask_clsIcon.cls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "clsIcon"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Description = "This stores all the information about each button."
Attribute VB_Ext_KEY = "SavedWithClassBuilder" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Option Explicit
Option Compare Text
' an object of this class represents a window
' icon displayed in application task bar
' the concept of 'touch' is for iterating through
' a collection of objects of the clsIcon type
' untouched items will be then marked (for delete ?)
Private m_strTitle As String ' holds the caption from the window
Private m_hWnd As Long ' the windows handle
Private m_nState As FormWindowStateConstants ' minimized/maximozed/normal
Private m_hIcon As Long ' handle to the icon
Private m_Selected_Backcolour As Long ' Holds a colour
Private m_Flash As Boolean 'Tells us wether or not the Button is flashing
Private m_Unselected_Backcolour As Long ' Hold a Colour
Private m_FlashColour As Long 'Holds the flash colour
Private m_FlashOn As Boolean 'Used as a Switch
Private m_FlashCount As Integer 'the Count of flashes.
Private m_FlashTimes As Integer 'The Amount of time that the window will flash
Private m_Change_Font_Colour As Boolean 'Change the color??
Private m_FontColour As Long 'Hold the Font Colour
' m_ref_Icons refers to icon to be presented
Private m_bTouch As Boolean
Private m_bNew As Boolean ' is the icon new?
Private m_bChanged As Boolean ' has the window changed?
Public Property Get FontColour() As Long
FontColour = m_FontColour
End Property
Public Property Let FontColour(ByVal Colour As Long)
m_FontColour = Colour
End Property
Public Property Get FlashColour() As Long
FlashColour = m_FlashColour
End Property
Public Property Let FlashColour(ByVal Colour As Long)
m_FlashColour = Colour
End Property
Public Property Get Change_Font_Colour() As Boolean
Change_Font_Colour = m_Change_Font_Colour
End Property
Public Property Let Change_Font_Colour(ByVal Colour As Boolean)
m_Change_Font_Colour = Colour
m_bChanged = True
End Property
Public Property Get SetFlashCount() As Integer
SetFlashCount = m_FlashTimes
End Property
Public Property Let SetFlashCount(ByVal FlashTimes As Integer)
m_FlashTimes = FlashTimes
End Property
Public Property Get IsNew() As Boolean
IsNew = m_bNew
End Property
Public Property Get Title() As String
Title = m_strTitle
End Property
Public Property Let Title(ByVal strNewValue As String)
m_strTitle = strNewValue
m_bChanged = True
End Property
Public Property Get Selected_BackColour() As Long
Selected_BackColour = m_Selected_Backcolour
End Property
Public Property Let Selected_BackColour(ByVal Colour As Long)
m_Selected_Backcolour = Colour
m_bChanged = True
End Property
Public Property Get Unselected_BackColour() As Long
Unselected_BackColour = m_Unselected_Backcolour
End Property
Public Property Let Unselected_BackColour(ByVal Colour As Long)
m_Unselected_Backcolour = Colour
m_bChanged = True
End Property
Public Property Get IsFlashing() As Boolean
IsFlashing = m_Flash
End Property
Public Property Let IsFlashing(ByVal Flashing As Boolean)
m_Flash = Flashing
m_bChanged = True
End Property
Public Property Get FlashOn() As Boolean
FlashOn = m_FlashOn
End Property
Public Property Let FlashOn(ByVal FlashOn As Boolean)
m_FlashOn = FlashOn
End Property
Public Property Get FlashCount() As Integer
FlashCount = m_FlashCount
End Property
Public Property Let FlashCount(ByVal Count As Integer)
m_FlashCount = Count
End Property
Public Property Get hWnd() As Long
hWnd = m_hWnd
End Property
Public Property Let hWnd(ByVal hNewValue As Long)
m_hWnd = hNewValue
End Property
Public Property Get State() As FormWindowStateConstants
State = m_nState
End Property
Public Property Let State(ByVal newStateValue As FormWindowStateConstants)
m_nState = newStateValue
End Property
Friend Sub ClearTouch()
m_bNew = False
m_bTouch = False
m_bChanged = False
End Sub
Friend Sub Touch()
m_bTouch = True
End Sub
Friend Function IsTaught() As Boolean
IsTaught = m_bTouch
End Function
Private Sub Class_Initialize()
m_bNew = True
m_bTouch = True
m_bChanged = True
m_Selected_Backcolour = vbButtonFace
m_Unselected_Backcolour = vbButtonFace
m_FlashTimes = 5
m_Change_Font_Colour = False
m_FontColour = vbBlack
End Sub
Public Property Get IsChanged() As Boolean
IsChanged = m_bChanged
End Property
Public Property Let IconPtr(ByVal hIcon As Long)
m_hIcon = hIcon
End Property
Public Property Get IconPtr() As Long
On Error GoTo ErrorHandler
'IconPtr = m_hIcon
' this gets the icon's handle and creates a local copy
' so we can use it
Dim hIcon As Long
Dim hLocalIcon As Long
If hWnd <> 0 Then
hIcon = GetWndIcon(m_hWnd, False)
hLocalIcon = CopyIcon(hIcon)
IconPtr = hLocalIcon
If hLocalIcon <> 0 And m_hIcon <> 0 Then
' we had an icon already and are now replacing it.
' so we have to destroy the old one
DestroyIcon m_hIcon
End If
' now set the new one
m_hIcon = hLocalIcon
Else
IconPtr = 0
m_hIcon = 0
End If
Done:
Exit Property
ErrorHandler:
Dim lngErrNum As Long: Dim strErrDesc As String: lngErrNum = Err.Number: strErrDesc = Err.Description
If InDesign = True Then: Stop: Else: Call HandleError("Class clsIcon_IconPtr" & vbCrLf & "Line# " & Erl & vbCrLf & "Err#" & Err.Number & vbCrLf & "Desc. " & Err.Description, App.Title, "")
GoTo Done
End Property
Private Sub Class_Terminate()
' destroy our local copy of the icon ...
If m_hIcon <> 0 Then
DestroyIcon m_hIcon
End If
End Sub