-
Notifications
You must be signed in to change notification settings - Fork 0
/
Toolbar2.ctl
2180 lines (2054 loc) · 80.8 KB
/
Toolbar2.ctl
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
VERSION 5.00
Begin VB.UserControl asxToolbar
Alignable = -1 'True
CanGetFocus = 0 'False
ClientHeight = 390
ClientLeft = 0
ClientTop = 0
ClientWidth = 4440
ControlContainer= -1 'True
PropertyPages = "Toolbar2.ctx":0000
ScaleHeight = 26
ScaleMode = 3 'Pixel
ScaleWidth = 296
ToolboxBitmap = "Toolbar2.ctx":005E
Begin VB.Timer tmrTip
Enabled = 0 'False
Interval = 1000
Left = 315
Top = 0
End
Begin VB.Timer tmrCheck
Enabled = 0 'False
Interval = 10
Left = 945
Top = 0
End
End
Attribute VB_Name = "asxToolbar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Attribute VB_HelpID = 2889
Attribute VB_Description = "The <b>asxToolbar</b> is a powerful toolbar control "
Attribute VB_Ext_KEY = "PropPageWizardRun" ,"Yes"
'-------------------------------'
' Ariad Development Library 2.0 '
'-------------------------------'
' Toolbar '
' Version 2.0 '
'-------------------------------'
'Copyright © 1998-9 by Ariad Software. All Rights Reserved
'
'Date Created:
'Date Completed: 23/03/99
'Last Updated: 24/08/99
'
'25/03/99
' - MousePointer, MouseIcon properties added
'16/04/99
' - CaptionOptions, ButtonAlwaysShowCaption() properties added
' - Depending on settings of the above properties, the toolbar can now
' selectivly display captions, similar to IE5's behaviour.
' - BUGFIX: Seperators on vertical toolbars drawn incorrectly
' - BUGFIX: FontStrikethru property fixed
' - BUGFIX: MouseUp event not raised when clicking button
' - BUGFIX: Click event raised after ButtonClick event fired
'21/04/99
' - New ForceClick event added
' - New GroupID properties added, for creating pushed group buttons
' - New CurrentGroupID property added
' - New ButtonGap property added
' - New SolidChecked property added - checked buttons in Flat toolbar mode
' displayed as Standard
' - New ShowSeparators property add - allows automatic seperators displayed
' between buttons in Flat toolbar mode and ButtonGap is greater than 3
' - BUGFIX: Vertical Separators 1 pixel too small
'22/04/99
' - BUGFIX: Horizontal Separators 1 pixel too small
' - Vertical Captions finally supported!!!
'23/04/99
' - New HotTracking* properties added
'24/04/99
' - BUGFIX: Group button update not executed before click
' - New RightClick event
'02/05/99
' - New CaptionAlignment property added
'03/05/99
' - New AutoSize property added
'06/05/99
' - New ToolTipFont property added
' - BUGFIX: ToolTips crash on modal forms
' - New Style property added
' - New FixedSize property added
'12/05/99
' - Error handling replaced with new private centralised system
'13/05/99
' - BUGFIX: AddButton or AddButtonEx resets Redraw flag
' - New DisabledText3D property
' - BUGFIX: Non-standard font size cause infinite refresh loop
'14/05/99
' - New BackStyle property added
'20/05/99
' - BUGFIX: Invisible buttons drawn when properties set
' - BUGFIX: RefreshButton method will draw invisible buttons
' - Button size for vertical buttons with captions increased by 3 pixels
'22/05/99
' - BUGFIX: Borders not drawn on checked buttons when button not highlighted
' - When mouse over checked button, dither no longer drawn (Office 97 behaviour)
' - BUGFIX: Error raised when AutoSize set to False with Align set
'27/05/99
' - Custom tooltips now work correctly on modal forms!
'18/06/99
' - Borders now drawn at all times when in Design Mode
'06/07/99
' - Documentation added via Document! VB
'12/07/99
' - Multiple PaintEffects classes replaced with single instance
' - Button template modifications
' - Tile picture routine replaced with fast API version
'20/08/99
' - MoveButton function renamed to SwapButton
' - BUGFIX: Property page would reset the first object on Apply changes
'24/08/99
' - Event declaration parmeters modified !BREAKS COMPATIBILITY WITH USER APPLICATIONS!
' - Two new border styles available (tbbsInsetButton, tbbsRaisedButton)
'##CD The <b>asxToolbar</b> is a powerful toolbar control
'Custom Errors (vbObjectError + ...)
'1 - AutoSize property cannot be set to True when Align property is set.
Option Explicit
DefInt A-Z
Public Event ButtonClick(ByVal ButtonIndex As Integer, ByVal ButtonKey$)
Attribute ButtonClick.VB_HelpID = 4297
Public Event ButtonRightClick(ByVal ButtonIndex As Integer, ByVal ButtonKey$, CancelBeep As Boolean)
Attribute ButtonRightClick.VB_HelpID = 4298
Public Event ButtonMouseOver(ByVal ButtonIndex As Integer, ByVal ButtonKey$)
Attribute ButtonMouseOver.VB_HelpID = 4299
Public Event BeforeButtonClick(ByVal ButtonIndex As Integer, ByVal ButtonKey$, Cancel As Boolean)
Attribute BeforeButtonClick.VB_HelpID = 4300
Public Event Click()
Attribute Click.VB_Description = "Occurs when the user presses and then releases a mouse button over a Toolbar control "
Attribute Click.VB_HelpID = 2894
'##ED Occurs when the user presses and then releases a mouse button over a Toolbar control
Public Event DblClick()
Attribute DblClick.VB_Description = "Occurs when the user presses and releases a mouse button and then presses and releases it again over a Toolbar control "
Attribute DblClick.VB_HelpID = 2895
'##ED Occurs when the user presses and releases a mouse button and then presses and releases it again over a Toolbar control
Public Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Attribute MouseUp.VB_Description = "Occurs when the user presses (MouseDown) or releases (MouseUp) a mouse button "
Attribute MouseUp.VB_HelpID = 2896
'##ED Occurs when the user presses (MouseDown) or releases (MouseUp) a mouse button
Public Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Attribute MouseDown.VB_Description = "Occurs when the user presses (MouseDown) or releases (MouseUp) a mouse button "
Attribute MouseDown.VB_HelpID = 2897
'##ED Occurs when the user presses (MouseDown) or releases (MouseUp) a mouse button
Public Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Attribute MouseMove.VB_Description = "Occurs when the user moves the mouse. "
Attribute MouseMove.VB_HelpID = 2898
'##ED Occurs when the user moves the mouse.
Public Event Resize(ByVal NewWidth As Single, ByVal NewHeight As Single)
Attribute Resize.VB_Description = "Occurs when Toolbar control window size is changed "
Attribute Resize.VB_HelpID = 2899
'##ED Occurs when Toolbar control window size is changed
Public Event RightClick()
Attribute RightClick.VB_HelpID = 2900
Dim BrdrVis(3) As Boolean, MseDwn As Boolean
Dim NoBorder As Boolean, DoClick As Boolean
Dim LastButton, BtnDown, CurrentButton
Dim m_ShowToolTips As Boolean
Dim m_Appearance As IFCAppearances
Dim m_BackColor As OLE_COLOR
Dim m_HighlightColor As OLE_COLOR, m_ShadowColor As OLE_COLOR
Dim m_HighlightDarkColor As OLE_COLOR, m_ShadowDarkColor As OLE_COLOR
Dim m_TextColor As OLE_COLOR, m_TextDisabledColor As OLE_COLOR
Dim m_HotTrackingColor As OLE_COLOR
Dim m_BorderStyle As IFCTBBorderStyles
Dim m_DoubleTopBorder As Boolean, m_DoubleBottomBorder As Boolean
Dim m_ButtonCount, m_ButtonGap
Dim m_Buttons() As New clsBSButton
Dim m_PlaySounds As Boolean, m_HotTracking As Boolean
Dim m_CaptionOptions As IFCCaptionOptions
Dim m_SolidChecked As Boolean, m_ShowSeparators As Boolean
Dim m_BoldOnChecked As Boolean, m_AutoSize As Boolean
Dim m_CaptionAlignment As IFCCaptionAlignments
Dim m_ToolTipFont As StdFont
Dim m_Style As IFCTBStyle
Dim m_FixedSize As Single
Dim m_DisabledText3D As Boolean
Dim m_BackStyle As IFCBackStyles
Public Redraw As Boolean
Attribute Redraw.VB_VarMemberFlags = "400"
Attribute Redraw.VB_VarProcData = ";Behavior"
Attribute Redraw.VB_VarHelpID = 2903
Attribute Redraw.VB_VarDescription = "When this property is set to False, calls to any Refresh methods, either internal or external, will be ignored. "
'##VD Redraw When this property is set to False, calls to any Refresh methods, either internal or external, will be ignored.
Dim MB As New ascMemoryBitmap
Dim LF As New clsLogFont
Dim MX As Single, MY As Single
Dim NoClk As Boolean
Dim RanOnce As Boolean
Public Property Get ToolTipFont() As StdFont
Attribute ToolTipFont.VB_Description = "Returns or sets the font used for displaying popup tooltips. "
Attribute ToolTipFont.VB_HelpID = 2904
'##BD Returns or sets the font used for displaying popup tooltips.
Set ToolTipFont = m_ToolTipFont
End Property
Public Property Set ToolTipFont(ByVal ToolTipFont As StdFont)
If ToolTipFont Is Nothing Then
RaiseErrorEx "ToolTipFont", 424
Else
Set m_ToolTipFont = ToolTipFont
PropertyChanged "ToolTipFont"
End If
End Property
Public Property Get MousePointer() As MousePointerConstants
Attribute MousePointer.VB_Description = "Returns or sets a value indicating the type of mouse pointer displayed when the mouse is over a Toolbar control. "
Attribute MousePointer.VB_HelpID = 2905
Attribute MousePointer.VB_ProcData.VB_Invoke_Property = ";Appearance"
'##BD Returns or sets a value indicating the type of mouse pointer displayed when the mouse is over a Toolbar control.
MousePointer = UserControl.MousePointer
End Property
Public Property Let MousePointer(ByVal MousePointer As MousePointerConstants)
UserControl.MousePointer = MousePointer
PropertyChanged "MousePointer"
End Property
Public Property Get MouseIcon() As StdPicture
Attribute MouseIcon.VB_Description = "Returns or sets a custom mouse icon. "
Attribute MouseIcon.VB_HelpID = 2906
Attribute MouseIcon.VB_ProcData.VB_Invoke_Property = ";Appearance"
'##BD Returns or sets a custom mouse icon.
Set MouseIcon = UserControl.MouseIcon
End Property
Public Property Set MouseIcon(ByVal MouseIcon As StdPicture)
Set UserControl.MouseIcon = MouseIcon
PropertyChanged "MouseIcon"
End Property
Public Property Get hWnd() As Long
Attribute hWnd.VB_Description = "Returns a handle to a Toolbar control "
Attribute hWnd.VB_HelpID = 2907
Attribute hWnd.VB_MemberFlags = "400"
'##BD Returns a handle to a Toolbar control
hWnd = UserControl.hWnd
End Property
Public Property Get hDC() As Long
Attribute hDC.VB_Description = "Returns a handle provided by the Microsoft Windows operating environment to the device context of a Toolbar control. "
Attribute hDC.VB_HelpID = 2908
Attribute hDC.VB_MemberFlags = "400"
'##BD Returns a handle provided by the Microsoft Windows operating environment to the device context of a Toolbar control.
hDC = UserControl.hDC
End Property
Private Sub ResetTip()
Attribute ResetTip.VB_HelpID = 2909
On Error Resume Next
tmrTip.Enabled = 0
HideTip
tmrCheck.Enabled = -1
Extender.ToolTipText = ""
On Error GoTo 0
End Sub
Public Property Get PlaySounds() As Boolean
Attribute PlaySounds.VB_Description = "Returns or sets if sounds are played when buttons in a Toolbar control are clicked "
Attribute PlaySounds.VB_HelpID = 2911
Attribute PlaySounds.VB_ProcData.VB_Invoke_Property = ";Behavior"
'##BD Returns or sets if sounds are played when buttons in a Toolbar control are clicked
PlaySounds = m_PlaySounds
End Property
Public Property Let PlaySounds(ByVal State As Boolean)
m_PlaySounds = State
PropertyChanged "PlaySounds"
End Property
Public Function KeyToIndex(ByVal Index As Variant) As Integer
Attribute KeyToIndex.VB_Description = "Returns the integer index value of a button identified by either it's Key property or index. "
Attribute KeyToIndex.VB_HelpID = 2912
'##BD Returns the integer index value of a button identified by either it's Key property or index.
Dim I
If Val(Index) = 0 Then
For I = 1 To m_ButtonCount
If UCase$(m_Buttons(I).Key) = UCase$(Index) Then
KeyToIndex = I
Exit Function
End If
Next
Else
KeyToIndex = Val(Index)
End If
If KeyToIndex = 0 And Index <> 0 Then
RaiseErrorEx "KeyToIndex", 35601, "Element not found. Key is missing or illegal."
End If
End Function
Private Sub tmrCheck_Timer()
Attribute tmrCheck_Timer.VB_HelpID = 2913
If IsInControl(hWnd) = 0 Then
MX = 0
MY = 0
ResetButton LastButton
LastButton = 0
tmrCheck.Enabled = 0
tmrTip.Enabled = 0
End If
End Sub
Private Sub tmrTip_Timer()
Attribute tmrTip_Timer.VB_HelpID = 2914
On Error Resume Next
ResetTip
If IsInControl(hWnd) Then
If ShowTip(tmrTip.Tag, GetActiveWindow(), m_ToolTipFont) = 0 Then
Extender.ToolTipText = tmrTip.Tag
End If
End If
On Error GoTo 0
End Sub
Private Sub UserControl_Click()
Attribute UserControl_Click.VB_HelpID = 2915
If NoClk = 0 Then RaiseEvent Click
NoClk = 0
End Sub
Private Sub UserControl_DblClick()
Attribute UserControl_DblClick.VB_HelpID = 2916
RaiseEvent DblClick
End Sub
Public Property Get BorderStyle() As IFCTBBorderStyles
Attribute BorderStyle.VB_Description = "Returns or sets the border style of a Toolbar control "
Attribute BorderStyle.VB_HelpID = 2917
Attribute BorderStyle.VB_ProcData.VB_Invoke_Property = ";Appearance"
Attribute BorderStyle.VB_MemberFlags = "200"
'##BD Returns or sets the border style of a Toolbar control
BorderStyle = m_BorderStyle
End Property
Public Property Let BorderStyle(ByVal NewStyle As IFCTBBorderStyles)
Dim I
If BorderStyle < tbbsNone Or BorderStyle > tbbsRaisedButton Then
RaiseErrorEx "BorderStyle", 380
Else
m_BorderStyle = NewStyle
If m_BorderStyle = 3 Then
DoubleTopBorder = 0
DoubleBottomBorder = 0
BorderBottom = -1
BorderTop = -1
BorderLeft = -1
BorderRight = -1
End If
Refresh
End If
PropertyChanged "BorderStyle"
End Property
Private Sub UserControl_Initialize()
CtlCount = CtlCount + 1
Redraw = 0
AutoRedraw = -1
MB.CreateByResource "DITHER"
LF.Rotation = 90
End Sub
Private Sub UserControl_InitProperties()
Attribute UserControl_InitProperties.VB_HelpID = 2919
Dim I
For I = 0 To 3
BrdrVis(I) = -1
Next
m_BackStyle = ifbsOpaque
m_DisabledText3D = -1
m_CaptionOptions = iftoShowLabels
m_BorderStyle = tbbsRaised
m_BackColor = vbButtonFace
m_HighlightColor = vb3DHighlight
m_ShadowColor = vb3DShadow
m_HighlightDarkColor = vb3DLight
m_ShadowDarkColor = vb3DDKShadow
m_TextColor = vbWindowText
m_TextDisabledColor = vbGrayText
m_HotTrackingColor = vbHighlight
m_PlaySounds = -1
m_ShowToolTips = -1
m_CaptionAlignment = ifcaCaptionOnRight
Set UserControl.Font = Ambient.Font
Set m_ToolTipFont = Ambient.Font
Redraw = -1
Refresh
End Sub
Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Attribute UserControl_MouseDown.VB_HelpID = 2920
MseDwn = -1
BtnDown = LastButton
LastButton = 0
ResetTip
UserControl_MouseMove Button, Shift, X, Y
RaiseEvent MouseDown(Button, Shift, X, Y)
End Sub
Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Attribute UserControl_MouseMove.VB_HelpID = 2921
Dim I
MX = X
MY = Y
I = IsWithinButton(X, Y)
CurrentButton = I
If IsInControl(hWnd) = 0 Then CurrentButton = 0
If I Then
'Button is Highlighted
If I <> LastButton Then
If m_Buttons(I).Style = tbbsButton Then
ShowCtlTip m_Buttons(I).ToolTipText
Else
tmrTip.Enabled = 0
HideTip
Extender.ToolTipText = ""
End If
ResetButton LastButton
If m_Buttons(I).Enabled Then
If m_Buttons(I).Style = tbbsButton Then
RefreshButton I, MseDwn
tmrCheck.Enabled = -1
RaiseEvent ButtonMouseOver(I, m_Buttons(I).Key)
End If
Else
RaiseEvent ButtonMouseOver(I, m_Buttons(I).Key)
End If
LastButton = I
End If
Else
'Clear Last Button
If LastButton Then
ResetButton LastButton
LastButton = 0
tmrCheck.Enabled = 0
End If
tmrTip.Enabled = 0
HideTip
Extender.ToolTipText = ""
RaiseEvent MouseMove(Button, Shift, X, Y)
End If
End Sub
Private Sub ShowCtlTip(Tip$)
Attribute ShowCtlTip.VB_HelpID = 2922
On Error Resume Next
If Tip$ = "" Or m_ShowToolTips = 0 Then
HideTip
tmrTip.Enabled = 0
Extender.ToolTipText = ""
Else
tmrTip.Enabled = Ambient.UserMode
tmrTip.Tag = Tip$
End If
On Error GoTo 0
End Sub
Private Sub UserControl_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Attribute UserControl_MouseUp.VB_HelpID = 2923
Dim I
Dim CancelBeep As Boolean, Cancel As Boolean
MseDwn = 0
LastButton = BtnDown
ResetTip
RaiseEvent MouseUp(Button, Shift, X, Y)
If Button Then
I = IsWithinButton(X, Y)
If I Then
RefreshButton I
If m_Buttons(I).Style = tbbsButton And m_Buttons(I).Enabled Then
If Button = 1 Then
RaiseEvent BeforeButtonClick(I, m_Buttons(I).Key, Cancel)
If Cancel = 0 Then
PlaySnd "BUTTON_CLICK", m_PlaySounds
NoClk = -1
UpdateGroups I
RaiseEvent ButtonClick(I, m_Buttons(I).Key)
End If
Else
RaiseEvent ButtonRightClick(I, m_Buttons(I).Key, CancelBeep)
If CancelBeep = 0 Then Beep
End If
Else
ResetButton I
End If
Else
ResetButton I
If Button = 2 Then RaiseEvent RightClick
End If
Else
ResetButton I
End If
ResetTip
End Sub
Private Sub Outline(ByVal X, ByVal Y, ByVal W, ByVal H, C1 As OLE_COLOR, C2 As OLE_COLOR)
Attribute Outline.VB_HelpID = 2924
Line (X, Y)-(X + W + 1, Y), C1
Line (X + W, Y)-(X + W, Y + H + 1), C2
Line (X, Y + H)-(X + W + 1, Y + H), C2
Line (X, Y)-(X, Y + H), C1
End Sub
Public Property Get ScaleWidth() As Single
Attribute ScaleWidth.VB_Description = "Returns the width, in pixels, of the control. "
Attribute ScaleWidth.VB_HelpID = 2925
Attribute ScaleWidth.VB_ProcData.VB_Invoke_Property = ";Data"
'##BD Returns the width, in pixels, of the control.
ScaleWidth = UserControl.ScaleWidth
End Property
Public Property Get ScaleHeight() As Single
Attribute ScaleHeight.VB_Description = "Returns the height, in pixels, of the control. "
Attribute ScaleHeight.VB_HelpID = 2926
Attribute ScaleHeight.VB_ProcData.VB_Invoke_Property = ";Data"
'##BD Returns the height, in pixels, of the control.
ScaleHeight = UserControl.ScaleHeight
End Property
Public Property Get BorderTop() As Boolean
Attribute BorderTop.VB_Description = "Returns or sets if the top border is drawn "
Attribute BorderTop.VB_HelpID = 2927
Attribute BorderTop.VB_ProcData.VB_Invoke_Property = ";Appearance"
'##BD Returns or sets if the top border is drawn
BorderTop = BrdrVis(1)
End Property
Public Property Let BorderTop(ByVal Vis As Boolean)
BrdrVis(1) = Vis
If m_BorderStyle = 3 Then BrdrVis(1) = -1
Refresh
PropertyChanged "BorderTop"
End Property
Public Property Get BorderLeft() As Boolean
Attribute BorderLeft.VB_Description = "Returns or sets if the left border is drawn "
Attribute BorderLeft.VB_HelpID = 2928
Attribute BorderLeft.VB_ProcData.VB_Invoke_Property = ";Appearance"
'##BD Returns or sets if the left border is drawn
BorderLeft = BrdrVis(0)
End Property
Public Property Let BorderLeft(ByVal Vis As Boolean)
BrdrVis(0) = Vis
If m_BorderStyle = 3 Then BrdrVis(0) = -1
Refresh
PropertyChanged "BorderLeft"
End Property
Public Property Get BorderRight() As Boolean
Attribute BorderRight.VB_Description = "Returns or sets if the right border is drawn "
Attribute BorderRight.VB_HelpID = 2929
Attribute BorderRight.VB_ProcData.VB_Invoke_Property = ";Appearance"
'##BD Returns or sets if the right border is drawn
BorderRight = BrdrVis(2)
End Property
Public Property Let BorderRight(ByVal Vis As Boolean)
BrdrVis(2) = Vis
If m_BorderStyle = 3 Then BrdrVis(2) = -1
Refresh
PropertyChanged "BorderRight"
End Property
Public Property Get BorderBottom() As Boolean
Attribute BorderBottom.VB_Description = "Returns or sets if the bottom border is drawn "
Attribute BorderBottom.VB_HelpID = 2930
Attribute BorderBottom.VB_ProcData.VB_Invoke_Property = ";Appearance"
'##BD Returns or sets if the bottom border is drawn
BorderBottom = BrdrVis(3)
End Property
Public Property Let BorderBottom(ByVal Vis As Boolean)
BrdrVis(3) = Vis
If m_BorderStyle = 3 Then BrdrVis(3) = -1
Refresh
PropertyChanged "BorderBottom"
End Property
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
Attribute UserControl_ReadProperties.VB_HelpID = 2931
Dim I
Redraw = 0
With PropBag
m_DisabledText3D = .ReadProperty("DisabledText3D", -1)
m_FixedSize = .ReadProperty("FixedSize", 0)
m_Style = .ReadProperty("Style", tbtsVariable)
Set m_ToolTipFont = .ReadProperty("ToolTipFont", Ambient.Font)
m_TextColor = .ReadProperty("TextColor", vbWindowText)
m_TextDisabledColor = .ReadProperty("TextDisabledColor", vbGrayText)
m_SolidChecked = .ReadProperty("SolidChecked", 0)
m_ButtonGap = .ReadProperty("ButtonGap", 0)
m_BorderStyle = .ReadProperty("BorderStyle", tbbsRaised)
BrdrVis(0) = .ReadProperty("BorderLeft", -1)
BrdrVis(1) = .ReadProperty("BorderTop", -1)
BrdrVis(2) = .ReadProperty("BorderRight", -1)
BrdrVis(3) = .ReadProperty("BorderBottom", -1)
m_DoubleTopBorder = .ReadProperty("DoubleTopBorder", 0)
m_DoubleBottomBorder = .ReadProperty("DoubleBottomBorder", 0)
m_BackColor = .ReadProperty("BackColor", vbButtonFace)
m_HighlightColor = .ReadProperty("HighlightColor", vb3DHighlight)
m_ShadowColor = .ReadProperty("ShadowColor", vb3DShadow)
m_HighlightDarkColor = .ReadProperty("HighlightDarkColor", vb3DLight)
m_ShadowDarkColor = .ReadProperty("ShadowDarkColor", vb3DDKShadow)
m_PlaySounds = .ReadProperty("PlaySounds", -1)
Set UserControl.Font = .ReadProperty("Font", Ambient.Font)
m_Appearance = .ReadProperty("Appearance", ifcaStandard)
m_ButtonCount = .ReadProperty("ButtonCount", 0)
m_ShowToolTips = .ReadProperty("ShowToolTips", -1)
UserControl.MousePointer = .ReadProperty("MousePointer", vbDefault)
Set UserControl.MouseIcon = .ReadProperty("MouseIcon", Nothing)
ReDim m_Buttons(m_ButtonCount) As New clsBSButton
Enabled = .ReadProperty("Enabled", -1)
m_CaptionOptions = .ReadProperty("CaptionOptions", iftoShowLabels)
m_ShowSeparators = .ReadProperty("ShowSeparators", 0)
m_HotTracking = .ReadProperty("HotTracking", 0)
m_HotTrackingColor = .ReadProperty("HotTrackingColor", vbHighlight)
m_BoldOnChecked = .ReadProperty("BoldOnChecked", 0)
m_CaptionAlignment = .ReadProperty("CaptionAlignment", ifcaCaptionOnRight)
m_AutoSize = .ReadProperty("AutoSize", 0)
If Extender.Align Then m_AutoSize = 0
m_BackStyle = .ReadProperty("BackStyle", ifbsOpaque)
For I = 1 To m_ButtonCount
'Load Buttons
With m_Buttons(I)
.Enabled = PropBag.ReadProperty("ButtonEnabled" & I, -1)
.Checked = PropBag.ReadProperty("ButtonChecked" & I, 0)
.Caption = PropBag.ReadProperty("ButtonCaption" & I, "")
.Description = PropBag.ReadProperty("ButtonDescription" & I, "")
.Key = PropBag.ReadProperty("ButtonKey" & I, "")
.UseMaskColor = PropBag.ReadProperty("ButtonUseMaskColor" & I, -1)
.MaskColor = PropBag.ReadProperty("ButtonMaskColor" & I, QBColor(13))
Set .APicture(ifwpPicNormal) = PropBag.ReadProperty("ButtonPicture" & I, Nothing)
Set .APicture(ifwpPicOver) = PropBag.ReadProperty("ButtonPictureOver" & I, Nothing)
Set .APicture(ifwpPicDown) = PropBag.ReadProperty("ButtonPictureDown" & I, Nothing)
.PlaceholderSize = PropBag.ReadProperty("ButtonWidth" & I, 0)
.Style = PropBag.ReadProperty("ButtonStyle" & I, tbbsButton)
.ToolTipText = PropBag.ReadProperty("ButtonToolTipText" & I, "")
.Visible = PropBag.ReadProperty("ButtonVisible" & I, -1)
.AlwaysShowCaption = PropBag.ReadProperty("ButtonAlwaysShowCaption" & I, 0)
.GroupID = PropBag.ReadProperty("ButtonGroupID" & I, 0)
End With
Next
End With
Redraw = -1
UserControl.BackStyle = m_BackStyle
Refresh
End Sub
Private Sub UserControl_Resize()
Attribute UserControl_Resize.VB_HelpID = 2932
Refresh
RaiseEvent Resize(ScaleWidth, ScaleHeight)
End Sub
Private Sub UserControl_Terminate()
Dim I
Set LF.LogFont = Nothing
CtlCount = CtlCount - 1
If CtlCount = 0 Then Set PE = Nothing
MB.ClearUp
Set MB = Nothing
Set LF = Nothing
Redraw = 0
On Error Resume Next
tmrCheck.Enabled = 0
For I = 1 To m_ButtonCount
Set m_Buttons(I) = Nothing
Next
Erase m_Buttons()
On Error GoTo 0
HideTip
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
Attribute UserControl_WriteProperties.VB_HelpID = 2934
Dim I
With PropBag
.WriteProperty "DisabledText3D", m_DisabledText3D, -1
.WriteProperty "FixedSize", m_FixedSize, 0
.WriteProperty "Style", m_Style, tbtsVariable
.WriteProperty "ToolTipFont", m_ToolTipFont, Ambient.Font
.WriteProperty "TextColor", m_TextColor, vbWindowText
.WriteProperty "TextDisabledColor", m_TextDisabledColor, vbGrayText
.WriteProperty "ButtonGap", m_ButtonGap, 0
.WriteProperty "BorderStyle", m_BorderStyle, tbbsRaised
.WriteProperty "BorderLeft", BrdrVis(0), -1
.WriteProperty "BorderTop", BrdrVis(1), -1
.WriteProperty "BorderRight", BrdrVis(2), -1
.WriteProperty "BorderBottom", BrdrVis(3), -1
.WriteProperty "DoubleTopBorder", m_DoubleTopBorder, 0
.WriteProperty "DoubleBottomBorder", m_DoubleBottomBorder, 0
.WriteProperty "BackColor", m_BackColor, vbButtonFace
.WriteProperty "HighlightColor", m_HighlightColor, vb3DHighlight
.WriteProperty "ShadowColor", m_ShadowColor, vb3DShadow
.WriteProperty "HighlightDarkColor", m_HighlightDarkColor, vb3DLight
.WriteProperty "ShadowDarkColor", m_ShadowDarkColor, vb3DDKShadow
.WriteProperty "Font", Font, Ambient.Font
.WriteProperty "Appearance", m_Appearance, ifcaStandard
.WriteProperty "Enabled", Enabled, -1
.WriteProperty "ButtonCount", m_ButtonCount
.WriteProperty "PlaySounds", m_PlaySounds, -1
.WriteProperty "ShowToolTips", m_ShowToolTips, -1
.WriteProperty "MousePointer", MousePointer, vbDefault
.WriteProperty "MouseIcon", MouseIcon, Nothing
.WriteProperty "CaptionOptions", m_CaptionOptions, iftoShowLabels
.WriteProperty "SolidChecked", m_SolidChecked, 0
.WriteProperty "ShowSeparators", m_ShowSeparators, 0
.WriteProperty "HotTracking", m_HotTracking, 0
.WriteProperty "HotTrackingColor", m_HotTrackingColor, vbHighlight
.WriteProperty "BoldOnChecked", m_BoldOnChecked, 0
.WriteProperty "CaptionAlignment", m_CaptionAlignment, ifcaCaptionOnRight
.WriteProperty "AutoSize", m_AutoSize, 0
.WriteProperty "BackStyle", m_BackStyle, ifbsOpaque
For I = 1 To m_ButtonCount
With m_Buttons(I)
PropBag.WriteProperty "ButtonEnabled" & I, .Enabled, -1
PropBag.WriteProperty "ButtonChecked" & I, .Checked, 0
PropBag.WriteProperty "ButtonCaption" & I, .Caption, ""
PropBag.WriteProperty "ButtonDescription" & I, .Description, ""
PropBag.WriteProperty "ButtonKey" & I, .Key, ""
PropBag.WriteProperty "ButtonUseMaskColor" & I, .UseMaskColor, -1
PropBag.WriteProperty "ButtonMaskColor" & I, .MaskColor, QBColor(13)
PropBag.WriteProperty "ButtonPicture" & I, .APicture(ifwpPicNormal), Nothing
PropBag.WriteProperty "ButtonPictureOver" & I, .APicture(ifwpPicOver), Nothing
PropBag.WriteProperty "ButtonPictureDown" & I, .APicture(ifwpPicDown), Nothing
PropBag.WriteProperty "ButtonWidth" & I, .PlaceholderSize, 0
PropBag.WriteProperty "ButtonStyle" & I, .Style, tbbsButton
PropBag.WriteProperty "ButtonToolTipText" & I, .ToolTipText, ""
PropBag.WriteProperty "ButtonVisible" & I, .Visible, -1
PropBag.WriteProperty "ButtonAlwaysShowCaption" & I, .AlwaysShowCaption, 0
PropBag.WriteProperty "ButtonGroupID" & I, .GroupID, 0
End With
Next
End With
End Sub
Public Sub Refresh()
Attribute Refresh.VB_Description = "Forces a complete repaint of a Toolbar control "
Attribute Refresh.VB_HelpID = 2935
'##BD Forces a complete repaint of a Toolbar control
Dim I, G
Dim O As IFCOrientations
Dim X As Single, Y As Single, W As Single, H As Single, Z As Single
Dim B As Boolean
Dim Size As Single, CurrentSize As Single
On Error GoTo ProcErr
InitPaintEffects
If Redraw Then
UserControl.BackColor = m_BackColor
Line (-1, -1)-(ScaleWidth + 1, ScaleHeight + 1), m_BackColor, BF
HideTip
Extender.ToolTipText = ""
tmrTip.Enabled = 0
DrawBorders
X = BorderOffset(0)
Y = BorderOffset(1)
If Width >= Height Then
'Horizontal
O = ifcoHorizontal
Z = ScaleHeight - (BorderOffset(1) + BorderOffset(3))
CurrentSize = ScaleWidth
Else
'Vertical
O = ifcoVertical
Z = ScaleWidth - (BorderOffset(0) + BorderOffset(2))
CurrentSize = ScaleHeight
End If
For I = 1 To m_ButtonCount
W = 0
With m_Buttons(I)
If .Visible Then
B = UserControl.FontBold
If m_BoldOnChecked Then UserControl.FontBold = -1
'Define Size
If O = ifcoHorizontal Then
'horizontal
If m_Style = tbtsFixed Then
W = m_FixedSize
Else
W = IIf(.Style = tbbsPlaceholder And .PlaceholderSize <> 0, .PlaceholderSize, Z)
If .Style = tbbsSeparator Then W = 6
If .Caption <> "" And (m_CaptionOptions = iftoShowLabels Or m_CaptionOptions = iftoSelectedLabels And .AlwaysShowCaption) Then
W = W + TextWidth(.Caption) + 5
End If
End If
H = Z
Else
'vertical
If m_Style = tbtsFixed Then
H = m_FixedSize
Else
H = IIf(.Style = tbbsPlaceholder And .PlaceholderSize <> 0, .PlaceholderSize, Z)
If .Style = tbbsSeparator Then H = 6
If .Caption <> "" And (m_CaptionOptions = iftoShowLabels Or m_CaptionOptions = iftoSelectedLabels And .AlwaysShowCaption) Then
H = H + TextWidth(.Caption) + 3
End If
End If
W = Z
End If
UserControl.FontBold = B
'Update Position
.ClientLeft = X
.ClientTop = Y
.ClientWidth = W
.ClientHeight = H
'Draw
If .Style = tbbsButton And .Checked = 0 Then NoBorder = -1 Else NoBorder = 0
RefreshButton I
If O = ifcoHorizontal Then
If m_ButtonGap >= 4 And m_ShowSeparators And m_Appearance = ifcaFlat Then
G = Int(m_ButtonGap / 2) - 1
Line (X + W + G, Y)-(X + W + G, Y + H), m_ShadowColor
Line (X + W + G + 1, Y)-(X + W + G + 1, Y + H), m_HighlightColor
End If
X = X + W + m_ButtonGap
Size = X + BorderOffset(0)
Else
If m_ButtonGap >= 4 And m_ShowSeparators And m_Appearance = ifcaFlat Then
G = Int(m_ButtonGap / 2) - 1
Line (X, Y + H + G)-(X + W, Y + H + G), m_ShadowColor
Line (X, Y + H + G + 1)-(X + W, Y + H + G + 1), m_HighlightColor
End If
Y = Y + H + m_ButtonGap + BorderOffset(1)
Size = Y
End If
End If
End With
Next
NoBorder = 0
If m_AutoSize And CurrentSize <> Size And Extender.Align = 0 And RanOnce = 0 Then
RanOnce = -1
If O = ifcoHorizontal Then
Width = Size * Screen.TwipsPerPixelX
Else
Height = Size * Screen.TwipsPerPixelY
End If
Refresh
End If
'Make Opaque
If m_BackStyle = ifbsTransparent Then
MaskColor = BackColor
MaskPicture = Image
End If
End If
On Error GoTo 0
Exit Sub
ProcErr:
RaiseError "Refresh"
Resume Next
End Sub
Public Property Get BackStyle() As IFCBackStyles
Attribute BackStyle.VB_Description = "Returns or sets a value indicating whether the background of a Toolbar control is transparent or opaque. "
Attribute BackStyle.VB_HelpID = 2936
'##BD Returns or sets a value indicating whether the background of a Toolbar control is transparent or opaque.
BackStyle = m_BackStyle
End Property
Public Property Let BackStyle(ByVal BackStyle As IFCBackStyles)
If BackStyle <> ifbsOpaque And BackStyle <> ifbsTransparent Then
RaiseErrorEx "BackStyle", 380
Else
m_BackStyle = BackStyle
UserControl.BackStyle = BackStyle
PropertyChanged "BackStyle"
Refresh
End If
End Property
Public Property Get DoubleTopBorder() As Boolean
Attribute DoubleTopBorder.VB_Description = "Returns or sets if the top border is doubled, similar to a Frame border "
Attribute DoubleTopBorder.VB_HelpID = 2937
Attribute DoubleTopBorder.VB_ProcData.VB_Invoke_Property = ";Appearance"
'##BD Returns or sets if the top border is doubled, similar to a Frame border
DoubleTopBorder = m_DoubleTopBorder
End Property
Public Property Let DoubleTopBorder(ByVal State As Boolean)
m_DoubleTopBorder = State
If m_BorderStyle = 3 Then m_DoubleTopBorder = 0
Refresh
PropertyChanged "DoubleTopBorder"
If State Then BorderTop = -1
End Property
Public Property Get BackColor() As OLE_COLOR
Attribute BackColor.VB_Description = "Returns or sets the background color of a Toolbar control. "
Attribute BackColor.VB_HelpID = 2938
Attribute BackColor.VB_ProcData.VB_Invoke_Property = ";Appearance"
'##BD Returns or sets the background color of a Toolbar control.
BackColor = m_BackColor
End Property
Public Property Let BackColor(ByVal NewCol As OLE_COLOR)
m_BackColor = NewCol
Refresh
PropertyChanged "BackColor"
End Property
Public Property Get HighlightColor() As OLE_COLOR
Attribute HighlightColor.VB_Description = "Returns or sets the highlight color of a Toolbar control. "
Attribute HighlightColor.VB_HelpID = 2939
Attribute HighlightColor.VB_ProcData.VB_Invoke_Property = ";Appearance"
'##BD Returns or sets the highlight color of a Toolbar control.
HighlightColor = m_HighlightColor
End Property
Public Property Let HighlightColor(ByVal NewCol As OLE_COLOR)
m_HighlightColor = NewCol
Refresh
PropertyChanged "HighlightColor"
End Property
Public Property Get ShadowColor() As OLE_COLOR
Attribute ShadowColor.VB_Description = "Returns or sets the shadow color of a Toolbar control. "
Attribute ShadowColor.VB_HelpID = 2940
'##BD Returns or sets the shadow color of a Toolbar control.
ShadowColor = m_ShadowColor
End Property
Public Property Let ShadowColor(ByVal NewCol As OLE_COLOR)
m_ShadowColor = NewCol
Refresh
PropertyChanged "ShadowColor"
End Property
Public Property Get Font() As StdFont
Attribute Font.VB_Description = "Returns or sets the font used to display text in a Toolbar control "
Attribute Font.VB_HelpID = 2941
Attribute Font.VB_ProcData.VB_Invoke_Property = ";Font"
'##BD Returns or sets the font used to display text in a Toolbar control
Set Font = UserControl.Font
End Property
Public Property Set Font(ByVal Font As StdFont)
Set UserControl.Font = Font
Refresh
PropertyChanged "Font"
End Property
Public Property Get DoubleBottomBorder() As Boolean
Attribute DoubleBottomBorder.VB_Description = "Returns or sets if the bottom border is doubled, similar to a Frame border "
Attribute DoubleBottomBorder.VB_HelpID = 2942
Attribute DoubleBottomBorder.VB_ProcData.VB_Invoke_Property = ";Appearance"
'##BD Returns or sets if the bottom border is doubled, similar to a Frame border
DoubleBottomBorder = m_DoubleBottomBorder
End Property
Public Property Let DoubleBottomBorder(ByVal State As Boolean)
m_DoubleBottomBorder = State
If m_BorderStyle = 3 Then m_DoubleBottomBorder = 0
Refresh
PropertyChanged "DoubleBottomBorder"
If State Then BorderBottom = -1
End Property
Private Function BorderOffset(Side As Integer) As Integer
Attribute BorderOffset.VB_HelpID = 2943
Dim FB, DT, DB, O
FB = IIf(m_BorderStyle = tbbsFrame Or m_BorderStyle = tbbsInsetButton Or m_BorderStyle = tbbsRaisedButton, 1, 0)
DT = IIf(m_DoubleTopBorder, 1, 0)
DB = IIf(m_DoubleBottomBorder, 1, 0)
Select Case Side
Case 0 'Left
O = Abs(BrdrVis(0)) + FB
Case 1 'Right
O = Abs(BrdrVis(2)) + FB + DT
Case 2 'Top
O = Abs(BrdrVis(1)) + FB
Case 3 'Bottom
O = Abs(BrdrVis(3)) + FB + DB
End Select
BorderOffset = O + 1
End Function
Public Property Get ButtonCount() As Integer
Attribute ButtonCount.VB_Description = "Returns the total number of buttons in the control. "
Attribute ButtonCount.VB_HelpID = 2944
Attribute ButtonCount.VB_ProcData.VB_Invoke_Property = ";Data"
Attribute ButtonCount.VB_MemberFlags = "400"
'##BD Returns the total number of buttons in the control.
ButtonCount = m_ButtonCount
End Property
Public Function AddButton() As Integer
Attribute AddButton.VB_Description = "Adds a new blank button to the control. "
Attribute AddButton.VB_HelpID = 2945
'##BD Adds a new blank button to the control.
AddButton = AddButtonEx()
End Function