$OPTION EXPLICIT
CONST RGN_XOR_QCBar = 3
DECLARE FUNCTION GetDC_QCBar LIB "user32" ALIAS "GetDC" _
(BYVAL hwnd AS LONG) AS LONG
DECLARE FUNCTION ReleaseDC_QCBar LIB "user32" ALIAS "ReleaseDC" _
(BYVAL hwnd AS LONG, BYVAL hdc AS LONG) AS LONG
DECLARE FUNCTION DeleteObject_QCBar LIB "gdi32" ALIAS "DeleteObject" _
(BYVAL hObject AS LONG) AS LONG
DECLARE FUNCTION CreateRectRgn_QCBar LIB "gdi32" ALIAS "CreateRectRgn" _
(BYVAL X1 AS LONG, BYVAL Y1 AS LONG, BYVAL X2 AS LONG, BYVAL Y2 AS LONG) AS LONG
DECLARE FUNCTION CombineRgn_QCBar LIB "gdi32" ALIAS "CombineRgn" _
(BYVAL hDestRgn AS LONG, BYVAL hSrcRgn1 AS LONG, BYVAL hSrcRgn2 AS LONG, BYVAL nCombineMode AS LONG) AS LONG
DECLARE FUNCTION SetWindowRgn_QCBar LIB "user32" ALIAS "SetWindowRgn" _
(BYVAL hWnd AS LONG, BYVAL hRgn AS LONG, BYVAL bRedraw AS INTEGER) AS LONG
$IFNDEF __RQINC
CONST False = 0
CONST True = 1
CONST clBtnFace = -2147483633
CONST clHilight = -2147483635
CONST clGrayText = -2147483631
CONST clBtnText = -2147483630
CONST clPurple = &HFF00FF
CONST pf15bit = 4
$ENDIF
CONST rqNullChr_CBar = CHR$(0)
CONST DefPixelFormat_CBar = 4
DIM QCBarOptimize AS INTEGER
QCBarOptimize = False
DIM QCBarBMP AS QBITMAP
$IFNDEF __RQOBJDRAWING
$DEFINE __RQOBJDRAWING
TYPE RECT_QTBtn
Left AS LONG
Top AS LONG
Right AS LONG
Bottom AS LONG
END TYPE
CONST DT_SINGLELINE_QTBtn AS LONG = &H20
CONST DT_CENTER_QTBtn = &H1
CONST DT_VCENTER_QTBtn AS LONG = &H4
DECLARE FUNCTION DrawText_QTBtn LIB "user32" ALIAS "DrawTextA" ( _
BYVAL hdc AS LONG, _
BYVAL lpStr AS STRING, _
BYVAL nCount AS LONG, _
lpRect AS RECT_QTBtn, _
BYVAL wFormat AS LONG) AS LONG
DECLARE FUNCTION SetBkMode_QTBtn LIB "gdi32" ALIAS "SetBkMode" _
(BYVAL hdc AS LONG, BYVAL nBkMode AS LONG) AS LONG
DECLARE FUNCTION OpenThemeData_QTBtn LIB "uxtheme.dll" ALIAS "OpenThemeData" ( _
BYVAL hwnd AS LONG, _
BYVAL pszClassList AS LONG) AS LONG
DECLARE FUNCTION CloseThemeData_QTBtn LIB "uxtheme.dll" ALIAS "CloseThemeData" ( _
BYVAL hTheme AS LONG) AS LONG
DECLARE FUNCTION DrawThemeBackground_QTBtn LIB "uxtheme.dll" ALIAS "DrawThemeBackground" ( _
BYVAL hTheme AS LONG, _
BYVAL hdc AS LONG, _
BYVAL iPartID AS LONG, _
BYVAL iStateID AS LONG, _
pRect AS RECT_QTBtn, _
pClipRect AS RECT_QTBtn) AS LONG
CONST xpt_PushBtn = "Button"
CONST xpt_ToolBarBtn = "Toolbar"
CONST xpt_TabBtn = "Tab"
$ENDIF
CONST xpt_ReBar = "ReBar"
$IFNDEF __RQGETVERSION
$DEFINE __RQGETVERSION
DIM isXP_QTBtn AS INTEGER
isXP_QTBtn = False
TYPE OSVERSIONINFO_QTBtn
dwOSVersionInfoSize AS LONG
dwMajorVersion AS LONG
dwMinorVersion AS LONG
dwBuildNumber AS LONG
dwPlatformId AS LONG
szCSDVersion AS STRING *128
END TYPE
DECLARE FUNCTION GetVersionEx_QTBtn LIB "kernel32.dll" ALIAS "GetVersionExA" _
(BYVAL lpVersionInformation AS LONG) AS LONG
DIM rtn_QTBtn AS LONG
DIM OSV_QTBtn AS OSVERSIONINFO_QTBtn, Mem_QTBtn AS QMEMORYSTREAM
DIM PixelFormatFix_QTBtn AS INTEGER
PixelFormatFix_QTBtn = pf15bit
SUB GetVersion_QTBtn
OSV_QTBtn.dwOSVersionInfoSize = SIZEOF(OSV_QTBtn)
Mem_QTBtn.WriteUDT(OSV_QTBtn)
rtn_QTBtn = GetVersionEx_QTBtn(Mem_QTBtn.Pointer)
IF rtn_QTBtn <> False THEN
Mem_QTBtn.Position = False
Mem_QTBtn.ReadUDT(OSV_QTBtn)
IF OSV_QTBtn.dwPlatformId = True THEN
isXP_QTBtn = False
ELSEIF OSV_QTBtn.dwPlatformId = 2 THEN
IF OSV_QTBtn.dwMajorVersion = 5 THEN _
IF OSV_QTBtn.dwMinorVersion = True THEN _
isXP_QTBtn = True
END IF
END IF
Mem_QTBtn.CLOSE
END SUB
CALL GetVersion_QTBtn
$ENDIF
DIM maxnumbmp_QCBar AS INTEGER
maxnumbmp_QCBar = 5
SUB Fast_QCBarToQTBtn( _
BtnType AS STRING, _
PartID AS INTEGER, _
Sender AS QBITMAP, _
CAPTION AS STRING, _
wMenu AS INTEGER, _
Grouped AS INTEGER, _
Hwnd AS LONG)
DIM Dest AS QRECT, Source AS QRECT
DIM tmpBitmap1 AS QBITMAP, _
NBitmap1 AS QBITMAP, _
XPBitmap1 AS QBITMAP
DIM XPBtnType AS STRING
DIM XPPartID AS INTEGER
DIM Width1 AS INTEGER, Height1 AS INTEGER
DIM Width2 AS INTEGER, Height2 AS INTEGER
DIM btnCount AS INTEGER
btnCount = maxnumbmp_QCBar
DIM fixTab AS INTEGER
fixTab = False
IF isXP_QTBtn AND BtnType = xpt_TabBtn THEN _
fixTab = True
IF isXP_QTBtn AND (BtnType = xpt_pushbtn OR BtnType = xpt_toolbarbtn OR BtnType = xpt_TabBtn) THEN _
PartID = True
Width1 = ((Sender.Width +3) *btnCount) +True
Height1 = Sender.Height +3
DOEVENTS
IF QCBarOptimize <> True OR _
(isXP_QTBtn = True AND (XPBtnType <> BtnType OR PartID <> XPPartID)) OR _
(tmpBitmap1.Width <> Width1 AND tmpBitmap1.Height <> Height1 AND _
Width2 <> tmpBitmap1.Width AND Height2 <> tmpBitmap1.Width) THEN
WITH NBitmap1
.Width = Width1
.Height = Height1
.FillRect(False, False, .Width, .Height, clBtnFace)
END WITH
WITH XPBitmap1
.Width = Width1
.Height = Height1
.FillRect(False, False, .Width, .Height, clBtnFace)
END WITH
Width1 = Sender.Width *btnCount
Height1 = Sender.Height
tmpBitmap1.Font.Name = Sender.Font.Name
tmpBitmap1.Font.Size = Sender.Font.Size
tmpBitmap1.Font.COLOR = Sender.Font.COLOR
tmpBitmap1.Font.Bold = Sender.Font.Bold
tmpBitmap1.Font.Italic = Sender.Font.Italic
tmpBitmap1.Font.Underline = Sender.Font.Underline
IF isXP_QTBtn = False THEN
DIM J AS INTEGER, I AS INTEGER
FOR J = False TO btnCount -True
WITH Dest
.Left = ((Width1 \btnCount) *J) +3 +(True *(J +True)) +(J *2) -IIF(J = 2, True, False)
.Top = 4 -IIF(J=2, True, False)
.Right = .Left +(Width1 \btnCount) -6
.Bottom = Height1 -2 -IIF(J = 2, True, False)
END WITH
WITH Source: .Left = ((QCBarBMP.Width \btnCount) *J) +3: .Top = 3: _
.Right = .Left +(QCBarBMP.Width \btnCount) -6
.Bottom = QCBarBMP.Height -3
END WITH
NBitmap1.CopyRect(Dest, QCBarBMP, Source)
FOR I = False TO 3
WITH Dest
.Left = ((Width1 \btnCount) *J) _
+IIF(I = False OR I = 2, False, (Width1 \btnCount) -3) +(True *(J +True)) +(J *2) _
-IIF(J = 2, True, False)
.Top = IIF(I<2, True, Height1 -2) -IIF(J = 2, True, False)
.Right = .Left +3
.Bottom = .Top +3
END WITH
WITH Source
.Left = ((QCBarBMP.Width \btnCount) *J) _
+IIF(I = False OR I = 2, False, (QCBarBMP.Width \btnCount) -3)
.Top = IIF(I < 2, False, QCBarBMP.Height -3)
.Right = .Left +3
.Bottom = .Top +3
END WITH
NBitmap1.CopyRect(Dest, QCBarBMP, Source)
NEXT I
FOR I = False TO True
WITH Dest
.Left = ((Width1 \btnCount) *J) +3 +(True *(J +True)) +(J *2) -IIF(J = 2, True, False)
.Top = IIF(I = False, True, Height1 -2) -IIF(J = 2, True, False)
.Right = .Left +(Width1 \btnCount) -6
.Bottom = .Top +3
END WITH
WITH Source
.Left = (QCBarBMP.Width \btnCount) *J +3
.Top = IIF(I = False, False, QCBarBMP.Height -3)
.Right = .Left +(QCBarBMP.Width \btnCount) -6
.Bottom = .Top +3
END WITH
NBitmap1.CopyRect(Dest, QCBarBMP, Source)
NEXT I
FOR I = False TO True
WITH Dest
.Left = ((Width1 \btnCount) *J) _
+IIF(I = False, False, (Width1 \btnCount) -3) +(True *(J +True)) +(J *2) _
-IIF(J = 2, True, False)
.Top = 4 -IIF(J = 2, True, False)
.Right = .Left +3
.Bottom = Height1 -2 -IIF(J = 2, True, False)
END WITH
WITH Source
.Left = ((QCBarBMP.Width \btnCount) *J) +IIF(I = False, False, (QCBarBMP.Width \btnCount) -3)
.Top = 3
.Right = .Left +3
.Bottom = QCBarBMP.Height -3
END WITH
NBitmap1.CopyRect(Dest, QCBarBMP, Source)
NEXT I
NEXT J
NBitmap1.PixelFormat = DefPixelFormat_CBar
ELSE
DIM hTheme AS LONG
DIM rtButton AS STRING
rtButton = ""
DIM lR AS LONG
DIM m_hDC AS LONG
DIM m_lPartId AS LONG, m_lStateId AS LONG
DIM tR AS RECT_QTBtn
FOR I = True TO LEN(BtnType)
rtButton = rtButton +MID$(BtnType, I, True) +rqNullChr_CBar
NEXT I
rtButton = rtButton +rqNullChr_CBar
hTheme = OpenThemeData_QTBtn(Hwnd, VARPTR(rtButton))
IF hTheme <> False THEN
m_hDC = XPBitmap1.Handle
DIM mLeft AS INTEGER
mLeft = False
IF wMenu > False THEN
m_lPartId = 3
mLeft = 12
ELSEIF PartID > True THEN
m_lPartId = PartID
ELSE
m_lPartId = True
END IF
FOR I = False TO 2 STEP 2
m_lStateId = I +True
tR.Left = ((I *(Sender.Width +3)) +IIF(I <> 2, True, False))
tR.Top = True -IIF(I <> 2, False, True) +fixTab
tR.Right = (tR.Left +Sender.Width) -mLeft
tR.Bottom = (Sender.Height +True -IIF(I <> 2, False, True) +fixTab) -True
lR = DrawThemeBackground_QTBtn(hTheme, _
m_hDC, _
m_lPartId, _
m_lStateId, _
tR, tR)
NEXT I
FOR I = True TO 3 STEP 2
m_lStateId = (I +True) +IIF(I = True, True +Grouped, False)
tR.Left = (((I +IIF(I = True, 2, -2)) *(Sender.Width +3)) +IIF(I = True, False, True))
tR.Top = IIF(I = True, False, True +fixTab)
tR.Right = (tR.Left +Sender.Width) -mLeft
tR.Bottom = Sender.Height +True +fixTab -True
lR = DrawThemeBackground_QTBtn( hTheme, _
m_hDC, _
m_lPartId, _
m_lStateId, _
tR, tR)
NEXT I
m_lStateId = 2
tR.Left = (4 *(Sender.Width +3)) +True
tR.Top = True
tR.Right = (tR.Left +Sender.Width) -mLeft
tR.Bottom = Sender.Height +fixTab +True
lR = DrawThemeBackground_QTBtn( hTheme, _
m_hDC, _
m_lPartId, _
m_lStateId, _
tR, tR)
IF wMenu > False THEN
mLeft = Sender.Width -11
m_lPartId = 4
FOR I = False TO 2 STEP 2
m_lStateId = I +True
tR.Left = ((I *(Sender.Width +3)) +IIF(I <> 2, True, False)) +mLeft
tR.Top = True -IIF(I <> 2, False, True) +fixTab
tR.Right = (tR.Left +Sender.Width) -mLeft
tR.Bottom = (Sender.Height +True -IIF(I <> 2, False, True) +fixTab) -True
lR = DrawThemeBackground_QTBtn(hTheme, _
m_hDC, _
m_lPartId, _
m_lStateId, _
tR, tR)
NEXT I
FOR I = True TO 3 STEP 2
m_lStateId = (I +True) +IIF(I = True, True, False)
tR.Left = (((I +IIF(I = True, 2, -2)) *(Sender.Width +3)) +IIF(I = True, False, True)) +mLeft
tR.Top = IIF(I = True, False, True +fixTab)
tR.Right = (tR.Left +Sender.Width) -mLeft
tR.Bottom = Sender.Height +True +fixTab -True
lR = DrawThemeBackground_QTBtn(hTheme, _
m_hDC, _
m_lPartId, _
m_lStateId, _
tR, tR)
NEXT I
m_lStateId = 2
tR.Left = (4 *(Sender.Width +3)) +True +mLeft
tR.Top = True
tR.Right = (tR.Left +Sender.Width) -mLeft
tR.Bottom = Sender.Height +True +fixTab
lR = DrawThemeBackground_QTBtn(hTheme, _
m_hDC, _
m_lPartId, _
m_lStateId, _
tR, tR)
END IF
END IF
CloseThemeData_QTBtn hTheme
CloseThemeData_QTBtn hTheme
XPBitmap1.PixelFormat = DefPixelFormat_CBar
END IF
END IF
Width2 = ((Sender.Width +3) *btnCount) +True
Height2 = Sender.Height +3
IF isXP_QTBtn THEN
tmpBitmap1.BMP = XPBitmap1.BMP
ELSE
tmpBitmap1.BMP = NBitmap1.BMP
END IF
tmpBitmap1.PixelFormat = DefPixelFormat_CBar
XPBtnType = BtnType
IF PartID <> True THEN PartID = True
XPPartID = True
Sender.BMP = tmpBitmap1.BMP
END SUB
SUB XPPart ( _
BtnType AS STRING, _
PartID AS INTEGER, _
Orientation AS INTEGER, _
DisableXPThemeBG AS INTEGER, _
COLOR, _
Sender AS QIMAGE, _
hWnd AS LONG)
IF isXP_QTBtn THEN
DIM XPBitmap1 AS QBITMAP
XPBitmap1.Width = Sender.Width
XPBitmap1.Height = Sender.Height
IF DisableXPThemeBG OR PartID <> 6 THEN _
XPBitmap1.FillRect(False, False, Sender.Width, Sender.Height, COLOR)
DIM hTheme AS LONG
DIM rtButton AS STRING
rtButton = ""
DIM I AS INTEGER
FOR I = True TO LEN(BtnType)
rtButton = rtButton +MID$(BtnType, I, True) +rqNullChr_CBar
NEXT I
rtButton = rtButton +rqNullChr_CBar
hTheme = OpenThemeData_QTBtn(hWnd, VARPTR(rtButton))
IF hTheme <> False THEN
DIM lR AS LONG
DIM m_hDC AS LONG
DIM m_lPartId AS LONG, m_lStateId AS LONG
DIM tR AS RECT_QTBtn
m_hDC = XPBitmap1.Handle
IF PartID > True THEN _
m_lPartId = PartID _
ELSE _
m_lPartId = True
m_lStateId = True
IF Orientation THEN
tR.Left = False -IIF(PartID =< 2, True, False)
tR.Top = False
tR.Right = Sender.Width -IIF(PartID =< 2, True, False)
tR.Bottom = IIF(PartID =< 2, 8, Sender.Height)
ELSE
tR.Left = False
tR.Top = False -IIF(PartID =< 2, True, False)
tR.Right = IIF(PartID =< 2, 5, Sender.Width)
tR.Bottom = Sender.Height -IIF(PartID =< 2, True, False)
END IF
lR = DrawThemeBackground_QTBtn(hTheme, _
m_hDC, _
m_lPartId, _
m_lStateId, _
tR, tR)
Sender.BMP = XPBitmap1.BMP
END IF
CloseThemeData_QTBtn hTheme
CloseThemeData_QTBtn hTheme
END IF
END SUB
DECLARE FUNCTION SetCapture_QCBar LIB "user32" ALIAS "SetCapture" _
(BYVAL hwnd AS LONG) AS LONG
DECLARE FUNCTION ReleaseCapture_QCBar LIB "user32" ALIAS "ReleaseCapture" () AS LONG
DECLARE FUNCTION GetCapture_QCBar LIB "user32" ALIAS "GetCapture" () AS LONG
CONST BDR_SUNKENOUTER_QCBar = &H2
CONST BF_LEFT_QCBar = &H1
CONST BF_TOP_QCBar = &H2
CONST BF_RIGHT_QCBar = &H4
CONST BF_BOTTOM_QCBar = &H8
CONST BF_RECT_QCBar = (BF_LEFT_QCBar OR BF_TOP_QCBar OR BF_RIGHT_QCBar OR BF_BOTTOM_QCBar)
CONST BF_FLAT_QCBar = &H4000
DECLARE FUNCTION DrawEdge_QCBar LIB "user32" ALIAS "DrawEdge" _
(BYVAL hdc AS LONG, qrc AS RECT_QTBtn, BYVAL edge AS LONG, BYVAL grfFlags AS LONG) _
AS LONG
DECLARE FUNCTION SetRect_QCBar LIB "user32" ALIAS "SetRect" _
(lpRect AS RECT_QTBtn, BYVAL X1 AS LONG, BYVAL Y1 AS LONG, BYVAL X2 AS LONG, BYVAL Y2 AS LONG) _
AS LONG
DECLARE FUNCTION GetMenuItemCount_QCBar LIB "user32" ALIAS "GetMenuItemCount" ( _
BYVAL hMenu AS LONG) AS LONG
CONST HTCAPTION_QCBar = 2
CONST WM_NCLBUTTONDOWN_QCBar = &HA1
DECLARE FUNCTION SendMessage_QCBar LIB "user32" ALIAS "SendMessageA" _
(BYVAL hwnd AS LONG, BYVAL wMsg AS LONG, BYVAL wParam AS LONG,lParam AS LONG) _
AS LONG
DIM Style AS INTEGER
Style = False
DECLARE SUB OnMouseEnter_EventTemplate (X AS INTEGER, Y AS INTEGER, Shift AS INTEGER, ItemIndex AS INTEGER, Sender AS QPANEL)
DECLARE SUB OnMouseLeave_EventTemplate (X AS INTEGER, Y AS INTEGER, Shift AS INTEGER, Sender AS QPANEL)
DECLARE SUB OnChange_EventTemplate (ItemIndex AS INTEGER, Sender AS QPANEL)
SUB DrawMyText( _
Left AS INTEGER, _
Top AS INTEGER, _
Right AS INTEGER, _
Bottom AS INTEGER, _
CAPTION AS STRING, _
nFontName AS STRING, _
nColor AS INTEGER, _
Sender AS QBITMAP)
DIM tR AS RECT_QTBtn
SetRect_QCBar(tR, Left, Top, Right, Bottom)
DIM sFontName AS STRING
IF nFontName <> "" AND nFontName <> Sender.Font.Name THEN
sFontName = Sender.Font.Name
Sender.Font.Name = nFontName
END IF
DIM sColor AS INTEGER
IF nColor <> -True AND nColor <> Sender.Font.COLOR THEN
sColor = Sender.Font.COLOR
Sender.Font.COLOR = nColor
END IF
SetBkMode_QTBtn Sender.Handle, True
DrawText_QTBtn (Sender.Handle, CAPTION, LEN(CAPTION), _
tR, DT_SINGLELINE_QTBtn OR DT_VCENTER_QTBtn)
IF nFontName <> "" AND nFontName = Sender.Font.Name THEN _
Sender.Font.Name = sFontName
IF nColor <> False AND nColor = Sender.Font.COLOR THEN _
Sender.Font.COLOR = sColor
nFontName = ""
sFontName = ""
nColor = -True
sColor = -True
SetRect_QCBar(tR, False, False, False, False)
END SUB
TYPE QCoolBarXP EXTENDS QPANEL
WITH This
PRIVATE:
IsPainted AS INTEGER
dummypanel AS QPANEL
FlickeringFree AS QPANEL
Dest AS QRECT
Src AS QRECT
PnlExceed AS QPANEL
CBtnExceed AS QCOOLBTN
CBtnExceedHot AS QIMAGE
CBtnExceedHotTrack AS QIMAGE
mnuExceed AS QPOPUPMENU
mnuItemExceed(30) AS QMENUITEM
mnuItemCount AS INTEGER
CoolBtnBMP AS QBITMAP
CoolBtn(30) AS QCOOLBTN
ImgBtnHot(30) AS QIMAGE
BMPtmp AS QBITMAP
BtnsHotTrack AS QIMAGE
IMGBackGround AS QIMAGE
IMGStretchedBackGround AS QIMAGE
IMGStretchedBackGround2 AS QIMAGE
IMGBackGroundFix AS QBITMAP
PUBLIC:
mnuPopup(29) AS QPOPUPMENU
imgLA AS QIMAGELIST
imgLD AS QIMAGELIST
imgLS AS QIMAGELIST
imgLH AS QIMAGELIST
PRIVATE:
imgLBK AS QBITMAP
CanvasRight AS QCANVAS
CaptionWidth AS INTEGER
CaptionHeight AS INTEGER
Btn(30) AS STRING
ShowBtnCapt(30) AS INTEGER
BtnLeft(30) AS INTEGER
BtnWidth(30) AS INTEGER
BtnCount AS INTEGER
PUBLIC:
ShowGrip AS INTEGER
DisableXPThemeBG AS INTEGER
SharedBG AS QBITMAP
PRIVATE:
GripWidth AS INTEGER
BtnMenu(30) AS INTEGER
WidthChanged AS INTEGER
EditCount AS INTEGER
EditCtrl(4) AS LONG
EditLeft(4) AS INTEGER
EditWidth(4) AS INTEGER
EditHeight(4) AS INTEGER
ComboBoxCount AS INTEGER
ComboBoxCtrl(4) AS LONG
ComboBoxLeft(4) AS INTEGER
ComboBoxWidth(4) AS INTEGER
ComboBoxHeight(4) AS INTEGER
PUBLIC:
HideCaption AS INTEGER PROPERTY SET SetHideCaption
ItemsWidth AS INTEGER PROPERTY SET SetItemsWidth
Orientation AS INTEGER PROPERTY SET SetOrientation
OnMouseLeave AS EVENT(OnMouseLeave_EventTemplate)
OnMouseEnter AS EVENT(OnMouseEnter_EventTemplate)
OnChange AS EVENT(OnChange_EventTemplate)
PRIVATE:
FUNCTION TextWidth(text AS STRING) AS INTEGER: Result = .IMGBackGround.TextWidth(text)
END FUNCTION
FUNCTION TextHeight(text AS STRING) AS INTEGER: Result = .IMGBackGround.TextHeight(text)
END FUNCTION
SUB mnuItem_Click(Sender AS QMENUITEM)
IF Sender.CAPTION <> "-" THEN
IF .CoolBtn(Sender.Tag).GroupIndex > True THEN _
.CoolBtn(Sender.Tag).Down = True
CALLFUNC(.OnChange, Sender.Tag, This)
END IF
END SUB
PUBLIC:
SUBI AddItems (...)
DIM I AS INTEGER
.BtnCount = PARAMSTRCOUNT
IF .ItemsWidth = False THEN
IF .Orientation THEN
.ItemsWidth = .ClientWidth -2
ELSE
.ItemsWidth = .ClientHeight -2
END IF
END IF
.BtnLeft(False) = False
.BtnWidth(False) = False
FOR I = True TO PARAMSTRCOUNT
.Btn(I -True) = PARAMSTR$(I)
.mnuItemExceed(I -True).CAPTION = PARAMSTR$(I)
.mnuItemExceed(I -True).Tag = I -True
.mnuItemExceed(I -True).OnClick = This.mnuItem_Click
IF PARAMSTR$(I) = "-" THEN
.BtnWidth(I -True) = 5
ELSE
.BtnWidth(I -True) = .ItemsWidth +_
IIF(.ShowBtnCapt(I -True) = True AND .Orientation = False, _
.TextWidth(PARAMSTR$(I)) +3, _
False)
.CoolBtn(I -True).GroupIndex = True
.CoolBtn(I -True).AllowAllUp = True
END IF
NEXT I
FOR I = False TO .BtnCount -True
.BtnLeft(I +True) = .BtnLeft(I) +.BtnWidth(I)
NEXT I
IF .Orientation THEN _
.ClientHeight = .BtnLeft(.BtnCount -True) +.BtnWidth(.BtnCount -True) +2 _
ELSE _
.ClientWidth = .BtnLeft(.BtnCount -True) +.BtnWidth(.BtnCount -True) +2
END SUBI
SUB AddEditCtrl (Sender AS QEDIT)
Sender.Left = .btnLeft(.BtnCount) +6
Sender.Top = (This.FlickeringFree.Height -Sender.Height) \2 -True
Sender.PARENT = This.FlickeringFree
.EditCtrl(.EditCount) = Sender.Handle
.EditLeft(.EditCount) = Sender.Left
.EditWidth(.EditCount) = Sender.Width
.EditHeight(.EditCount) = Sender.Height
.EditCount ++
END SUB
SUB AddComboBoxCtrl (Sender AS QCOMBOBOX)
Sender.Left = .btnLeft(.BtnCount) +5
Sender.Top = (This.FlickeringFree.Height -Sender.Height +6) \2 -True
Sender.PARENT = This.FlickeringFree
.ComboBoxCtrl(.ComboBoxCount) = Sender.Handle
.ComboBoxLeft(.ComboBoxCount) = Sender.Left
.ComboBoxWidth(.ComboBoxCount) = Sender.Width
.ComboBoxHeight(.ComboBoxCount) = Sender.Height
.ComboBoxCount ++
END SUB
SUBI DefineBtnsGroup (...)
DIM I AS INTEGER
DIM modSepState AS INTEGER
modSepState = False
DIM Index AS INTEGER
Index = IIF(PARAMVAL(True) = False, True, False)
IF PARAMVALCOUNT = True AND (PARAMVAL(True) <= False) THEN
FOR I = False TO .BtnCount -True
IF .Btn(I) <> "-" THEN
.CoolBtn(I).GroupIndex = True
.CoolBtn(I).AllowAllUp = True
END IF
NEXT I
ELSEIF PARAMVALCOUNT > True THEN
FOR I = 2 TO PARAMVALCOUNT
IF .Btn(PARAMVAL(I)) <> "-" THEN
.CoolBtn(PARAMVAL(I)).GroupIndex = PARAMVAL(True) +Index +True
.CoolBtn(PARAMVAL(I)).AllowAllUp = False
ELSE
modSepState ++
END IF
NEXT I
ELSE
SHOWMESSAGE "Erreur: paramètre(s) manquant(s) ou incorrect(s)"
END IF
IF modSepState THEN _
SHOWMESSAGE "Avertissement: vous tentez de redéfinir le " +CHR$(10) +_
" groupe d'un séparateur..."
END SUBI
SUBI InitBtnsDownUp (...)
DIM I AS INTEGER
DIM modSepState AS INTEGER
modSepState = False
DIM Index AS INTEGER
Index = IIF(PARAMVAL(True) = False, True, False)
IF PARAMVALCOUNT = True AND (PARAMVAL(True) = False OR PARAMVAL(True) = True) THEN
FOR I = False TO .BtnCount -True
IF .Btn(I) <> "-" THEN _
.CoolBtn(I).Down = PARAMVAL(True)
NEXT I
ELSEIF PARAMVALCOUNT > True AND (PARAMVAL(True) = False OR PARAMVAL(True) = True) THEN
FOR I = 2 TO PARAMVALCOUNT
IF .Btn(PARAMVAL(I)) <> "-" THEN
.CoolBtn(PARAMVAL(I)).Down = PARAMVAL(True)
ELSE
modSepState ++
END IF
NEXT I
ELSE
SHOWMESSAGE "Erreur: paramètre(s) manquant(s) ou incorrect(s)"
END IF
IF modSepState THEN _
SHOWMESSAGE "Avertissement: vous tentez de modifier l'état " +CHR$(10) +_
" enfoncé d'un séparateur..."
END SUBI
SUBI EnableBtns (...)
DIM I AS INTEGER
DIM modSepState AS INTEGER
modSepState = False
IF PARAMVALCOUNT = True AND (PARAMVAL(True) = False OR PARAMVAL(True) = True) THEN
FOR I = False TO .BtnCount -True
IF .Btn(I) <> "-" THEN _
.CoolBtn(I).Enabled = PARAMVAL(True)
NEXT I
ELSEIF PARAMVALCOUNT > True THEN
FOR I = 2 TO PARAMVALCOUNT
IF .Btn(PARAMVAL(I)) <> "-" THEN
.CoolBtn(PARAMVAL(I)).Enabled = PARAMVAL(True)
ELSE
modSepState ++
END IF
NEXT I
ELSE
SHOWMESSAGE "Erreur: paramètre(s) manquant(s) ou incorrect(s)"
END IF
IF modSepState THEN _
SHOWMESSAGE "Avertissement: vous tentez de modifier l'état " +CHR$(10) +_
" active/inactive d'un séparateur..."
END SUBI
SUBI ShowBtnsCaption (...)
DIM I AS INTEGER
DIM modSepState AS INTEGER
modSepState = False
IF PARAMVALCOUNT = True AND (PARAMVAL(True) = False OR PARAMVAL(True) = True) THEN
FOR I = False TO .BtnCount -True
IF .Btn(I) <> "-" THEN _
.ShowBtnCapt(I) = PARAMVAL(True)
NEXT I
ELSEIF PARAMVALCOUNT > True THEN
FOR I = 2 TO PARAMVALCOUNT
IF .Btn(PARAMVAL(I)) <> "-" THEN
.ShowBtnCapt(PARAMVAL(I)) = PARAMVAL(True)
ELSE
modSepState ++
END IF
NEXT I
ELSE
SHOWMESSAGE "Erreur: paramètre(s) manquant(s) ou incorrect(s)"
END IF
IF modSepState THEN _
SHOWMESSAGE "Avertissement: vous tentez de modifier " +CHR$(10) +_
" un séparateur..."
END SUBI
PRIVATE:
SUB ShapeBar(Sender AS QPANEL)
DIM hRgn AS LONG, _
hRgn2 AS LONG
DIM hDC AS LONG
DIM I AS INTEGER
SetWindowRgn_QCBar Sender.Handle, False, True
hDC = GetDC_QCBar(Sender.Handle)
DeleteObject_QCBar hRgn
DeleteObject_QCBar hRgn2
IF .Orientation THEN
hRgn = CreateRectRgn_QCBar(False, False, False, False)
IF .ShowGrip = True THEN
hRgn2 = CreateRectRgn_QCBar(True, True, Sender.Width, .GripWidth)
CombineRgn_QCBar hRgn, hRgn, hRgn2, RGN_XOR_QCBar
DeleteObject_QCBar hRgn2
END IF
FOR I = False TO .BtnCount -True
hRgn2 = CreateRectRgn_QCBar(True, .BtnLeft(I), Sender.Width -True, .BtnLeft(I) +.BtnWidth(I))
CombineRgn_QCBar hRgn, hRgn, hRgn2, RGN_XOR_QCBar
DeleteObject_QCBar hRgn2
NEXT I
ELSE
hRgn = CreateRectRgn_QCBar(False, False, False, False)
IF .ShowGrip = True THEN
hRgn2 = CreateRectRgn_QCBar ( True, _
True, _
.GripWidth, _
Sender.Height -True)
CombineRgn_QCBar hRgn, hRgn, hRgn2, RGN_XOR_QCBar
DeleteObject_QCBar hRgn2
END IF
IF .HideCaption = False THEN
hRgn2 = CreateRectRgn_QCBar ( .GripWidth, _
.CaptionHeight, _
.GripWidth +.CaptionWidth, _
This.ClientHeight -.CaptionHeight)
CombineRgn_QCBar hRgn, hRgn, hRgn2, RGN_XOR_QCBar
DeleteObject_QCBar hRgn2
END IF
FOR I = False TO .BtnCount -True
hRgn2 = CreateRectRgn_QCBar(.BtnLeft(I), False, .BtnLeft(I) +.BtnWidth(I), Sender.Height)
CombineRgn_QCBar hRgn, hRgn, hRgn2, RGN_XOR_QCBar
DeleteObject_QCBar hRgn2
NEXT I
IF .EditCount THEN
FOR I = False TO .EditCount -True
hRgn2 = CreateRectRgn_QCBar ( .EditLeft(I), _
(Sender.Height \2) -(.EditHeight(I) \2) -True, _
.EditLeft(I) +.EditWidth(I), _
(Sender.Height \2) +(.EditHeight(I) \2) +True)
CombineRgn_QCBar hRgn, hRgn, hRgn2, RGN_XOR_QCBar
DeleteObject_QCBar hRgn2
NEXT I
END IF
IF .ComboBoxCount THEN
FOR I = False TO .ComboBoxCount -True
hRgn2 = CreateRectRgn_QCBar ( .ComboBoxLeft(I), _
(Sender.Height \2) -(.ComboBoxHeight(I) \2) -True, _
.ComboBoxLeft(I) +.ComboBoxWidth(I), _
(Sender.Height \2) +(.ComboBoxHeight(I) \2) +True)
CombineRgn_QCBar hRgn, hRgn, hRgn2, RGN_XOR_QCBar
DeleteObject_QCBar hRgn2
NEXT I
END IF
END IF
SetWindowRgn_QCBar Sender.Handle, hRgn, True
DeleteObject_QCBar hRgn
DeleteObject_QCBar hRgn2
ReleaseDC_QCBar (Sender.Handle, hDC)
END SUB
PUBLIC:
SUB RePaint
DIM btnStandSet AS INTEGER, _
btnMenuSet AS INTEGER
DIM I AS INTEGER, _
J AS INTEGER
DIM R AS RECT_QTBtn
DIM curLeft AS INTEGER
STATIC wasgripped AS INTEGER
IF .ShowGrip = True THEN
IF wasgripped = False THEN
FOR I = False TO .BtnCount
INC(.BtnLeft(I), IIF(.Orientation, 8, 5))
NEXT I
END IF
wasgripped = True
ELSE
IF wasgripped = True THEN
FOR I = False TO .BtnCount
DEC(.BtnLeft(I), IIF(.Orientation, 8, 5))
NEXT I
END IF
.GripWidth = False
wasgripped = False
END IF
STATIC wascaptioned AS INTEGER
IF .HideCaption = False THEN
.CaptionHeight = (.ClientHeight -.TextHeight(.CAPTION)) \2
.CaptionWidth = .TextWidth(.CAPTION) +5
IF wascaptioned = False THEN
FOR I = False TO .BtnCount
INC(.BtnLeft(I), .CaptionWidth)
NEXT I
END IF
wascaptioned = True
ELSE
.CaptionHeight = False
.CaptionWidth = False
IF wascaptioned = True THEN
FOR I = False TO .BtnCount -True
DEC(.BtnLeft(I), .CaptionWidth)
NEXT I
END IF
.CaptionWidth = False
wascaptioned = False
END IF
STATIC MenuCount AS INTEGER
IF MenuCount = False THEN
FOR I = False TO .BtnCount
IF MenuCount > False THEN _
.BtnLeft(I) = .BtnLeft(I) +(MenuCount *8)
IF GetMenuItemCount_QCBar (This.mnuPopup(I).Handle) > False THEN
MenuCount ++
.BtnMenu(I) = True
.BtnWidth(I) = .BtnWidth(I) +8
.mnuPopup(I).Alignment = True
ELSE
.BtnMenu(I) = False
END IF
NEXT I
END IF
IF .Orientation THEN
.ClientHeight = .BtnLeft(.BtnCount -True) +.BtnWidth(.BtnCount -True) +3
.FlickeringFree.Width = .ClientWidth
ELSE
.ClientWidth = .BtnLeft(.BtnCount -True) +.BtnWidth(.BtnCount -True) +3 _
+IIF(.EditCount > False, .EditLeft(.EditCount -True) +.EditWidth(.EditCount -True), False) + _
+IIF(.ComboBoxCount > False, .ComboBoxLeft(.ComboBoxCount -True) +.ComboBoxWidth(.ComboBoxCount -True), False)
.FlickeringFree.Width = .BtnLeft(.BtnCount -True) +.BtnWidth(.BtnCount -True) +3 _
+IIF(.EditCount > False, .EditLeft(.EditCount -True) +.EditWidth(.EditCount -True), False) + _
+IIF(.ComboBoxCount > False, .ComboBoxLeft(.ComboBoxCount -True) +.ComboBoxWidth(.ComboBoxCount -True), False)
END IF
.FlickeringFree.Height = .Height -(.BevelWidth *2)
.IMGBackGround.Font.COLOR = .Font.COLOR
.IMGBackGround.Font.Name = .Font.Name
.IMGBackGround.Font.Size = .Font.Size
.IMGBackGround.Font.Bold = .Font.Bold
.IMGBackGround.Font.Italic = .Font.Italic
.IMGBackGround.Font.Underline = .Font.Underline
.IMGStretchedBackGround.Stretch = False
.IMGBackGroundFix.Width = .FlickeringFree.Width
.IMGBackGroundFix.Height = .FlickeringFree.Height
.IMGBackGroundFix.FillRect (False, False, .IMGBackGroundFix.Width, .IMGBackGroundFix.Height, _
This.COLOR)
.IMGBackGround.Transparent = False
.IMGBackGround.BMP = .IMGBackGroundFix.BMP
.IMGStretchedBackGround2.BMP = .IMGBackGroundFix.BMP
IF isXP_QTBtn THEN
.IMGStretchedBackGround.Visible = True
.IMGBackGroundFix.Width = Screen.Width
.IMGBackGroundFix.FillRect(False, False, .IMGBackGroundFix.Width, .IMGBackGroundFix.Height, This.COLOR)
.IMGStretchedBackGround.BMP = .IMGBackGroundFix.BMP
ELSE
.IMGStretchedBackGround.Visible = False
END IF
IF isXP_QTBtn AND .DisableXPThemeBG = False THEN
IF .SharedBG.Empty = False THEN
WITH Dest: .Left = False: .Right = This.IMGStretchedBackGround.Width
.Top = False: .Bottom = This.ClientHeight
END WITH
WITH Src: .Left = This.SharedBG.Width -(This.SharedBG.Width \4)
.Right = This.Left +This.SharedBG.Width
.Top = This.Top: .Bottom = This.Top +This.Height +2
END WITH
.IMGStretchedBackGround.CopyRect(This.Dest, This.SharedBG, This.Src)
.Dest.Right = This.ClientWidth
.Src.Left = .Left
.IMGStretchedBackGround2.CopyRect(This.Dest, This.SharedBG, This.Src)
ELSE
XPPart ( _
xpt_ReBar, _
6, _
False, _
True, _
False, _
This.IMGStretchedBackGround, _
This.Handle)
XPPart ( _
xpt_ReBar, _
6, _
False, _
True, _
False, _
This.IMGStretchedBackGround2, _
This.Handle)
END IF
END IF
.IMGStretchedBackGround.Stretch = True
IF .ShowGrip = True THEN
.GripWidth = IIF(.Orientation, 8, 5)
IF isXP_QTBtn THEN
XPPart ( xpt_ReBar, _
True, _
This.Orientation, _
This.DisableXPThemeBG, _
This.COLOR, _
This.IMGBackGround, _
This.Handle)
ELSE
IF .Orientation THEN
FOR I = 2 TO (.ClientWidth -5) STEP 3
.IMGBackGround.Line ( I, True, I, 3, -2147483632 )
NEXT I
ELSE
FOR I = 2 TO (.ClientHeight -IIF(.Orientation, 8, 5)) STEP 3
.IMGBackGround.Line ( True, I, 3, I, -2147483632 )
NEXT I
END IF
END IF
END IF
curLeft = False
DIM sepBefore AS INTEGER
sepBefore = False
FOR I = False TO .BtnCount -True
IF .btn(I) <> "-" THEN
.CoolBtn(I).Visible = False
.CoolBtn(I).PARENT = This.FlickeringFree
.CoolBtn(I).Width = .btnwidth(I)
.CoolBtn(I).Height = .ItemsWidth -2
.ImgBtnHot(I).Visible = False
.ImgBtnHot(I).Enabled = False
.ImgBtnHot(I).PARENT = This.FlickeringFree
.ImgBtnHot(I).Width = .btnwidth(I)
.ImgBtnHot(I).Height = .ItemsWidth -2
IF .Orientation THEN
.CoolBtn(I).Left = True
.CoolBtn(I).Top = .btnleft(I)
.ImgBtnHot(I).Left = True
.ImgBtnHot(I).Top = .btnleft(I)
ELSE
.CoolBtn(I).Left = .btnleft(I)
.CoolBtn(I).Top = IIF(.BevelWidth, False, True)
.ImgBtnHot(I).Left = .btnleft(I)
.ImgBtnHot(I).Top = IIF(.BevelWidth, False, True)
END IF
.CoolBtn(I).Flat = True
.CoolBtn(I).NumBMPs = maxnumbmp_QCBar
.CoolBtn(I).Spacing = False
IF .CoolBtn(I).CAPTION = "" THEN _
.CoolBtn(I).Layout = False _
ELSE _
.CoolBtn(I).Layout = 3
IF isXP_QTBtn = False THEN
.CoolBtnBMP.Width = ((.btnwidth(I) +3) *maxnumbmp_QCBar) +2
.CoolBtnBMP.Height = .btnwidth(I) +True
.CoolBtnBMP.FillRect(False, False, .CoolBtnBMP.Width, .CoolBtnBMP.Height, clBtnFace)
ELSE
.CoolBtnBMP.Width = .btnwidth(I)
.CoolBtnBMP.Height = .ItemsWidth -2
Fast_QCBarToQTBtn( xpt_ToolBarBtn, _
True, _
This.CoolBtnBMP, _
"", _
This.BtnMenu(I), _
IIF(This.CoolBtn(I).GroupIndex > True, 2, False), _
This.Handle)
END IF
.imgLBK.Width = .imgLA.Width
.imgLBK.Height = .imgLA.Height
DIM Left AS INTEGER
Left = False
FOR J = False TO 3
IF (I -True =< .imgLA.Count) THEN
IF J = False OR _
(J = True AND (I +True > .imgLD.Count)) OR _
(J = 2 AND (I +True > .imgLS.Count)) OR _
(J = 3 AND (I +True > .imgLS.Count)) THEN
.imgLBK.BMP = .imgLA.GetBMP(I -sepBefore)
ELSEIF J = True THEN
.imgLBK.BMP = .imgLD.GetBMP(I -sepBefore)
ELSEIF J = 2 THEN
.imgLBK.BMP = .imgLS.GetBMP(I -sepBefore)
ELSEIF J = 3 THEN
.imgLBK.BMP = .imgLS.GetBMP(I -sepBefore)
END IF
.imgLBK.TransparentColor = .imgLBK.Pixel(False, False)
.imgLBK.Transparent = True
IF .ShowBtnCapt(I) = True AND .Btn(I) <> "" THEN
Left = J *(.CoolBtnBMP.Width \5) +3
ELSE
Left = J *(.CoolBtnBMP.Width \5) -IIF(.BtnMenu(I), 6, False) _
+(((.CoolBtnBMP.Width \5) -.imgLBK.Width) \2)
END IF
.CoolBtnBMP.Draw( _
Left, _
((This.CoolBtnBMP.Height -.imgLBK.Height) \2), _
.imgLBK.BMP)
END IF
IF isXP_QTBtn = False AND .BtnMenu(I) THEN
DrawMyText( _
((J +True) *(This.CoolBtnBMP.Width \5)) -14, _
False, _
((J +True) *(This.CoolBtnBMP.Width \5)), _
This.CoolBtnBMP.Height -True -IIF(.ShowBtnCapt(I) = True, True, False), _
"6", _
"Marlett", _
IIF(.CoolBtn(I).Enabled, -2147483630, -2147483631), _
This.CoolBtnBMP)
END IF
NEXT J
IF .ShowBtnCapt(I) = True AND .Btn(I) <> "" THEN
FOR J = False TO 4
IF .CoolBtn(I).Enabled = False THEN
DrawMyText( _
((This.CoolBtnBMP.Width \5) *J) +2, _
2, _
(This.CoolBtnBMP.Width \5) *(J +True) -IIF(.BtnMenu(I), 12, False) +True, _
This.CoolBtnBMP.Height, _
This.Btn(I), _
"", _
-2147483628, _
This.CoolBtnBMP)
END IF
DrawMyText( _
((This.CoolBtnBMP.Width \5) *J) +.imgLBK.Width +4, _
True, _
(This.CoolBtnBMP.Width \5) *(J +True) -IIF(.BtnMenu(I), 12, False), _
This.CoolBtnBMP.Height -True, _
This.Btn(I), _
"", _
IIF(J <> True AND .CoolBtn(I).Enabled, -2147483630, -2147483631), _
This.CoolBtnBMP)
NEXT J
END IF
WITH Dest: .Left = False: .Right = This.CoolBtn(I).Width
.Top = False: .Bottom = This.CoolBtnBMP.Height
END WITH
WITH Src: .Left = ((This.CoolBtn(I).Width +3) *4) +True
.Right = .Left +This.CoolBtn(I).Width
.Top = True: .Bottom = This.CoolBtnBMP.Height +True
END WITH
.BMPtmp.Width = .Dest.Right: .BMPtmp.Height = .Dest.Bottom
IF isXP_QTBtn THEN
.BMPtmp.CopyRect(This.Dest, This.CoolBtnBMP, This.Src)
ELSE
.BMPtmp.Rectangle( False, _
False, _
.btnWidth(I), _
.ItemsWidth -2, _
-2147483632)
.BMPtmp.FillRect( True, _
True, _
.btnWidth(I) -True, _
.ItemsWidth -3, _
-2147483638)
IF .ShowBtnCapt(I) = True AND .Btn(I) <> "" THEN
IF .CoolBtn(I).Enabled = False THEN
DrawMyText( _
2, _
2, _
This.BMPtmp.Width -IIF(.BtnMenu(I), 12, False) +True, _
This.ItemsWidth, _
This.Btn(I), _
"", _
-2147483628, _
This.BMPtmp)
END IF
DrawMyText( _
.imgLBK.Width +3, _
True, _
This.BMPtmp.Width -IIF(.BtnMenu(I), 12, False), _
This.ItemsWidth -True, _
This.Btn(I), _
"", _
IIF(J <> True AND .CoolBtn(I).Enabled, -2147483630, -2147483631), _
This.BMPtmp)
END IF
IF .BtnMenu(I) THEN
DrawMyText( _
.btnWidth(I) -12, _
False, _
.btnWidth(I), _
(.ItemsWidth /2) +9, _
"6", _
"Marlett", _
IIF(.CoolBtn(I).Enabled, -2147483630, -2147483631), _
This.BMPtmp)
END IF
END IF
IF (I -True =< .imgLA.Count) THEN
IF (I +True > .imgLH.Count) THEN
.imgLBK.BMP = .imgLA.GetBMP(I -sepBefore)
ELSE
.imgLBK.BMP = .imgLH.GetBMP(I -sepBefore)
END IF
.imgLBK.TransparentColor = .imgLBK.Pixel(False, False)
.imgLBK.Transparent = True
IF .ShowBtnCapt(I) = True AND .Btn(I) <> "" THEN
Left = 2
ELSE
Left = (.BtnWidth(I) -IIF(.BtnMenu(I) = True, 12, False) -.imgLBK.Width) \2
END IF
.BMPtmp.Draw(Left, _
((.ItemsWidth -2 -.imgLBK.Height) \2) , _
.imgLBK.BMP)
END IF
.BMPtmp.PixelFormat = pf15bit
.BMPtmp.Transparent = True
.BMPtmp.TransparentColor = .BMPtmp.Pixel(False, False)
.ImgBtnHot(I).BMP = .BMPtmp.BMP
IF isXP_QTBtn THEN _
.ImgBtnHot(I).Transparent = True _
ELSE _
.ImgBtnHot(I).Transparent = False
.CoolBtnBMP.Width = ((.CoolBtn(I).Width +3) *4) +True
.CoolBtn(I).BMP = .CoolBtnBMP.BMP
.CoolBtn(I).Visible = True
ELSE
IF .Orientation THEN
SetRect_QCBar ( R, _
False +IIF(.BevelWidth = False, 2, False), _
.btnLeft(I) +True, _
This.ClientWidth -3, _
.btnLeft(I) +IIF(Style < 2 OR isXP_QTBtn = False, 3, 2))
ELSE
SetRect_QCBar ( R, _
.btnLeft(I) +True, _
2, _
.btnLeft(I) +IIF(Style < 2 OR isXP_QTBtn = False, 3, 2), _
This.Height -3)
END IF
DrawEdge_QCBar .IMGBackGround.Handle, R, BDR_SUNKENOUTER_QCBar, BF_RECT_QCBar
sepBefore ++
END IF
NEXT I
IF wascaptioned = True THEN
.IMGBackGround.TextOut(.GripWidth +2, .CaptionHeight, .CAPTION, .Font.COLOR, -True)
END IF
.WidthChanged = False
.BtnsHotTrack.PARENT = .DummyPanel
.BtnsHotTrack.PARENT = This.FlickeringFree
.IMGBackGround.Transparent = True
IF .Orientation THEN
.PnlExceed.Align = 2
.PnlExceed.Top = This.Height -12
.PnlExceed.Width = This.ClientWidth
.PnlExceed.Height = 12
.CBtnExceed.Height = 12
.CBtnExceed.Width = This.PnlExceed.ClientWidth
.CoolBtnBMP.Width = .CBtnExceed.Width
.CoolBtnBMP.Height = .CBtnExceed.Height
ELSE
.PnlExceed.Align = 4
.PnlExceed.Left = This.Width -12
.PnlExceed.Width = 12
.PnlExceed.Height = This.ClientHeight
.CBtnExceed.Height = This.PnlExceed.ClientHeight
.CBtnExceed.Width = 12
.CoolBtnBMP.Width = .CBtnExceed.Width
.CoolBtnBMP.Height = This.PnlExceed.ClientHeight
END IF
.CBtnExceedHot.Width = .CBtnExceed.Width
.CBtnExceedHot.Height = .CBtnExceed.Height
.PnlExceed.PARENT = .DummyPanel
.PnlExceed.PARENT = This
IF isXP_QTBtn = False THEN
.CoolBtnBMP.Width = ((.btnwidth(I) +3) *4) +2
.CoolBtnBMP.Height = .btnwidth(I) +True
.CoolBtnBMP.FillRect(False, False, .CoolBtnBMP.Width, .CoolBtnBMP.Height, clBtnFace)
.CoolBtnBMP.Font.Name = "MS Sans Serif"
.CoolBtnBMP.Font.Bold = True
.CoolBtnBMP.Font.Size = 12
FOR I = False TO 3
.BMPtmp.TextOut((I *.PnlExceed.Width) +((.PnlExceed.Width -.TextWidth("»") -True) \2), _
-6, _
"»", _
.Font.COLOR, _
-True)
NEXT I
.CoolBtnBMP.Font.Name = This.Font.Name
.CoolBtnBMP.Font.Bold = This.Font.Bold
.CoolBtnBMP.Font.Size = This.Font.Size
.BMPtmp.Width = .PnlExceed.Width: .BMPtmp.Height = .PnlExceed.Height
.BMPtmp.Rectangle( False, _
False, _
.BMPtmp.Width, _
.BMPtmp.Height, _
-2147483632)
.BMPtmp.FillRect( True, _
True, _
.BMPtmp.Width -True, _
.BMPtmp.Height -True, _
-2147483638)
.BMPtmp.Font.Name = "MS Sans Serif"
.BMPtmp.Font.Bold = True
.BMPtmp.Font.Size = 12
.BMPtmp.TextOut((.BMPtmp.Width -.TextWidth("»") -True) \2, -6, "»", .Font.COLOR, -True)
.BMPtmp.Font.Name = This.Font.Name
.BMPtmp.Font.Bold = This.Font.Bold
.BMPtmp.Font.Size = This.Font.Size
.CBtnExceedHot.BMP = .BMPtmp.BMP
ELSE
Fast_QCBarToQTBtn( xpt_ReBar, _
IIF(.Orientation, 5, 4), _
This.CoolBtnBMP, _
"", _
False, _
False, _
This.Handle)
WITH Dest: .Left = False: .Right = This.CBtnExceed.Width
.Top = False: .Bottom = This.CoolBtnBMP.Height
END WITH
WITH Src: .Left = ((This.CBtnExceed.Width +3) *4) +True
.Right = .Left +This.CBtnExceed.Width +True
.Top = True: .Bottom = This.CoolBtnBMP.Height +True
END WITH
.BMPtmp.Width = .Dest.Right: .CBtnExceedHot.Height = .Dest.Bottom
.BMPtmp.CopyRect(This.Dest, This.CoolBtnBMP, This.Src)
.CBtnExceedHot.BMP = .BMPtmp.BMP
.CoolBtnBMP.Width = ((.CBtnExceed.Width +3) *3) +True
.CBtnExceed.NumBMPs = 3
.CBtnExceed.BMP = .CoolBtnBMP.BMP
END IF
.ShapeBar(This.FlickeringFree)
END SUB
PROPERTY SET SetHideCaption(hide AS INTEGER)
.HideCaption = hide
.RePaint
END PROPERTY
PROPERTY SET SetItemsWidth(width AS INTEGER)
.ItemsWidth = width
DIM I AS INTEGER
.BtnWidth(False) = False
FOR I = False TO .BtnCount
IF .Btn(I) = "-" THEN _
.BtnWidth(I) = 5 _
ELSE _
.BtnWidth(I) = .ItemsWidth
NEXT I
FOR I = False TO .BtnCount -True
.BtnLeft(I +True) = .BtnLeft(I) +.BtnWidth(I)
NEXT I
.WidthChanged = True
END PROPERTY
PROPERTY SET SetOrientation(orientation AS INTEGER)
.Orientation = orientation
END PROPERTY
PRIVATE:
EVENT IMGBackGround.OnMouseMove (X AS INTEGER, Y AS INTEGER, Shift AS INTEGER)
SetCapture_QCBar This.Handle
END EVENT
EVENT BtnsHotTrack.OnMouseMove (X AS INTEGER, Y AS INTEGER, Shift AS INTEGER)
SetCapture_QCBar This.Handle
END EVENT
EVENT CBtnExceedHotTrack.OnMouseMove (X AS INTEGER, Y AS INTEGER, Shift AS INTEGER)
SetCapture_QCBar This.Handle
END EVENT
EVENT CanvasRight.OnPaint
IF .IsPainted = False THEN
.IsPainted = True
.RePaint
.FlickeringFree.Visible = True
END IF
DIM btnNum AS INTEGER
DIM I AS INTEGER
FOR I = -(.BtnCount -True) TO False
IF .Btn(I *-True) <> "-" THEN
btnNum = I *-True
EXIT FOR
END IF
NEXT I
IF .Orientation = False THEN
IF .Width < (.BtnLeft(btnNum) +(.BtnWidth(btnNum) \.66)) AND _
.Btn(btnNum) <> "-" AND _
.PnlExceed.Visible = False THEN
.PnlExceed.Visible = True
ELSEIF .Width > (.BtnLeft(btnNum) +(.BtnWidth(btnNum) \.66)) AND .PnlExceed.Visible = True THEN
.PnlExceed.Visible = False
END IF
ELSEIF .Orientation THEN
IF .Height < (.BtnLeft(btnNum) +(.BtnWidth(btnNum) \.66)) AND _
.Btn(btnNum) <> "-" AND _
.PnlExceed.Visible = False THEN
.PnlExceed.Visible = True
ELSEIF .Height > (.BtnLeft(btnNum) +(.BtnWidth(btnNum) \.66)) AND .PnlExceed.Visible = True THEN
.PnlExceed.Visible = False
END IF
END IF
END EVENT
EVENT OnMouseMove (X AS INTEGER, Y AS INTEGER, Shift AS INTEGER)
DIM curPosX AS INTEGER
DIM curBtn AS INTEGER
DIM btnWidth AS INTEGER
DIM I AS INTEGER
DIM R AS RECT_QTBtn
STATIC firstAction AS INTEGER
STATIC wasBtn AS INTEGER
STATIC PosX AS INTEGER, PosY AS INTEGER
DIM sepBefore AS INTEGER
IF .Orientation THEN _
btnWidth = (This.ClientHeight -2) /5 _
ELSE _
btnWidth = (This.ClientWidth -2) /5
IF (X < False) OR (Y < False) OR (X > This.Width) _
OR (Y > This.Height) THEN
ReleaseCapture_QCBar
wasBtn = -True
IF curBtn > -True THEN
sepBefore = False
FOR I = False TO curBtn
IF .btn(I) = "-" THEN _
sepBefore ++
NEXT I
IF .btn(curBtn) <> "-" THEN
.ImgBtnHot(curBtn).Visible = False
.CoolBtn(curBtn).Down = False
.Hint = ""
END IF
END IF
IF .CBtnExceedHot.Visible THEN _
.CBtnExceedHot.Visible = False
CALLFUNC(.OnMouseLeave, X, Y, Shift, This)
ELSEIF (GetCapture_QCBar() <> This.Handle) AND _
(PosX <> X AND PosY <> Y) THEN
PosX = X
PosY = Y
SetCapture_QCBar This.Handle
ELSE
IF .EditCount > False THEN
FOR I = False TO .EditCount -True
IF X >= .EditLeft(I) AND X <= .EditLeft(I) +.EditWidth(I) THEN
IF .CBtnExceedHot.Visible THEN _
.CBtnExceedHot.Visible = False
ReleaseCapture_QCBar
EXIT FOR
END IF
NEXT I
END IF
IF .ComboBoxCount > False THEN
FOR I = False TO .ComboBoxCount -True
IF X >= .ComboBoxLeft(I) AND X <= .ComboBoxLeft(I) +.ComboBoxWidth(I) THEN
IF .CBtnExceedHot.Visible THEN _
.CBtnExceedHot.Visible = False
ReleaseCapture_QCBar
EXIT FOR
END IF
NEXT I
END IF
FOR I = False TO .BtnCount -True
IF .Orientation THEN
IF Y >= .BtnLeft(I) AND Y <= .BtnLeft(I +True) THEN
curBtn = I
EXIT FOR
ELSE
curBtn = -True
END IF
ELSE
IF X >= .BtnLeft(I) AND X <= .BtnLeft(I +True) THEN
curBtn = I
EXIT FOR
ELSE
curBtn = -True
END IF
END IF
NEXT I
IF (curBtn > -True AND curBtn < .btnCount) THEN
IF firstAction = False OR (wasBtn <> curBtn OR wasBtn = -True) THEN
firstAction = True
IF .btn(curBtn) = "-" THEN .Hint = "" ELSE .Hint = .Btn(curBtn)
sepBefore = False
.imgLBK.Width = .imgLA.Width
.imgLBK.Height = .imgLA.Height
FOR I = False TO .BtnCount -True
IF .btn(I) <> "-" THEN
ELSE
sepBefore ++
END IF
NEXT I
.ImgBtnHot(wasBtn).Visible = False
.CoolBtn(wasBtn).Down = False
IF .CBtnExceedHot.Visible THEN _
.CBtnExceedHot.Visible = False
END IF
wasBtn = curBtn
IF .CoolBtn(curBtn).Down = False THEN
IF (.Orientation AND Y < This.Height -IIF(.PnlExceed.Visible, 12, False)) OR _
(.Orientation = False AND X < This.Width -IIF(.PnlExceed.Visible, 12, False)) THEN
.ImgBtnHot(curBtn).Visible = True
ELSE
.ImgBtnHot(curBtn).Visible = False
END IF
END IF
CALLFUNC(.OnMouseEnter, X, Y, Shift, curBtn, This)
IF .PnlExceed.Visible THEN
IF .Orientation THEN
IF (X > False AND X < This.Width) AND _
(Y >= This.Height -12 AND Y <= This.Height) THEN
.CBtnExceedHot.Visible = True
CALLFUNC(.OnMouseEnter, X, Y, Shift, 99, This)
ELSE
.CBtnExceedHot.Visible = False
END IF
ELSE
IF (X >= This.Width -12 AND X <= This.Width) AND _
(Y > False AND Y < This.Height) THEN
.CBtnExceedHot.Visible = True
CALLFUNC(.OnMouseEnter, X, Y, Shift, 99, This)
ELSE
.CBtnExceedHot.Visible = False
END IF
END IF
END IF
ELSE
IF .Orientation THEN
IF (Y > .btnLeft(.btnCount -True) +.btnWidth(.btnCount -True) OR _
Y < .btnLeft(0)) AND wasBtn <> -True THEN
.ImgBtnHot(wasBtn).Visible = False
.ImgBtnHot(curBtn).Visible = False
.CoolBtn(wasBtn).Down = False
.Hint = ""
CALLFUNC(.OnMouseEnter, X, Y, Shift, curBtn, This)
wasBtn = -True
END IF
ELSE
IF (X > .btnLeft(.btnCount -True) +.btnWidth(.btnCount -True) OR _
X < .btnLeft(0)) AND wasBtn <> -True THEN
.ImgBtnHot(wasBtn).Visible = False
.ImgBtnHot(curBtn).Visible = False
.CoolBtn(wasBtn).Down = False
.Hint = ""
CALLFUNC(.OnMouseEnter, X, Y, Shift, curBtn, This)
wasBtn = -True
END IF
END IF
END IF
END IF
END EVENT
EVENT OnMouseDown (btn AS INTEGER, X AS INTEGER, Y AS INTEGER, Shift AS INTEGER)
DIM I AS INTEGER
DIM curBtn AS INTEGER
DIM R AS RECT_QTBtn
FOR I = False TO .BtnCount -True
IF .Orientation = False AND (X >= .BtnLeft(I) AND X <= .BtnLeft(I +True)) THEN
curBtn = I
EXIT FOR
ELSEIF .Orientation AND (Y >= .BtnLeft(I) AND Y <= .BtnLeft(I +True)) THEN
curBtn = I
EXIT FOR
ELSE
curBtn = -True
END IF
NEXT I
IF .Orientation = False AND (curBtn = -True AND X >= False AND X <= 7) AND _
.Width > 29 THEN
ReleaseCapture_QCBar
SendMessage_QCBar(This.Handle, WM_NCLBUTTONDOWN_QCBar, HTCAPTION_QCBar, False)
ELSEIF .Orientation AND (curBtn = -True AND Y >= False AND Y <= 7) AND _
.Height > 29 THEN
ReleaseCapture_QCBar
SendMessage_QCBar(This.Handle, WM_NCLBUTTONDOWN_QCBar, HTCAPTION_QCBar, False)
ELSEIF .Orientation = False AND .PnlExceed.Visible AND (X >= .Width -12 AND X <= .Width) THEN
IF .mnuItemCount THEN
FOR I = False TO .mnuItemCount -True
.mnuExceed.DelIndex (False)
NEXT I
.mnuItemCount = False
END IF
FOR I = -(.BtnCount -True) TO False
IF .Width < (.BtnLeft(I *-True) +(.BtnWidth(I *-True) \.66)) THEN
.mnuExceed.AddItems (This.mnuItemExceed(I *-True))
.mnuItemCount ++
ELSE
EXIT FOR
END IF
NEXT I
IF .mnuItemCount THEN
.CBtnExceed.Down = True
.CBtnExceedHot.Visible = False
.mnuExceed.Alignment = True
.mnuExceed.Popup(Screen.MOUSEX +(.PnlExceed.Left -X +.pnlExceed.Width), _
Screen.MOUSEY +(.ClientHeight -Y) -2)
END IF
.CBtnExceed.Down = False
ELSEIF .Orientation AND .PnlExceed.Visible AND (Y >= .Height -12 AND X <= .Height) THEN
DIM MenuHeight AS INTEGER
MenuHeight = False
IF .mnuItemCount THEN
FOR I = False TO .mnuItemCount -True
.mnuExceed.DelIndex (False)
NEXT I
.mnuItemCount = False
MenuHeight = False
END IF
FOR I = -(.BtnCount -True) TO False
IF .Height < (.BtnLeft(I *-True) +(.BtnWidth(I *-True) \.66)) THEN
.mnuExceed.Insert (False, This.mnuItemExceed(I *-True))
MenuHeight = MenuHeight +IIF(.mnuItemExceed(I *-True).CAPTION <> "-", 17, 9)
.mnuItemCount ++
ELSE
EXIT FOR
END IF
NEXT I
IF .mnuItemCount THEN
MenuHeight = MenuHeight +6
.CBtnExceed.Down = True
.CBtnExceedHot.Visible = False
.mnuExceed.Alignment = False
.mnuExceed.Popup(Screen.MOUSEX +(.PnlExceed.Left -X +.pnlExceed.Width) +True, _
Screen.MOUSEY +(.ClientHeight -Y) -MenuHeight)
END IF
.CBtnExceed.Down = False
ELSE
IF Btn = False THEN
DIM sepBefore AS INTEGER
sepBefore = False
IF curBtn > -True THEN
sepBefore = False
FOR I = False TO curBtn
IF .btn(I) = "-" THEN _
sepBefore ++
NEXT I
IF .btn(curBtn) <> "-" THEN
.ImgBtnHot(curBtn).Visible = False
.CoolBtn(curBtn).Down = True
IF .Orientation = False AND .BtnMenu(curBtn) AND X >= .BtnLeft(curBtn +True) -12 THEN
IF .CoolBtn(curBtn).Enabled THEN _
.mnuPopup(curBtn).Popup(Screen.MOUSEX +(.BtnLeft(curBtn +True) -X) +True, _
Screen.MOUSEY +(.ClientHeight -Y) -2)
.CoolBtn(curBtn).Down = False
ELSEIF .Orientation AND .BtnMenu(curBtn) AND X >= .BtnWidth(curBtn) -12 THEN
IF .CoolBtn(curBtn).Enabled THEN _
.mnuPopup(curBtn).Popup(Screen.MOUSEX +(.BtnWidth(curBtn) -X) +True, _
Screen.MOUSEY +(.ClientHeight -Y) -2)
.CoolBtn(curBtn).Down = False
END IF
END IF
END IF
ELSEIF .BtnMenu(curBtn) THEN
.mnuPopup(curBtn).Popup(Screen.MOUSEX, _
Screen.MOUSEY)
.CoolBtn(curBtn).Down = False
END IF
END IF
END EVENT
EVENT OnMouseUp (btn AS INTEGER, X AS INTEGER, Y AS INTEGER, Shift AS INTEGER)
.Align = .Align
DIM curBtn AS INTEGER
DIM I AS INTEGER
FOR I = False TO .BtnCount -True
IF (.Orientation = False AND (X >= .BtnLeft(I) AND X <= .BtnLeft(I +True))) OR _
(.Orientation AND (Y >= .BtnLeft(I) AND Y <= .BtnLeft(I +True))) THEN
curBtn = I
EXIT FOR
ELSE
curBtn = -True
END IF
NEXT I
DIM sepBefore AS INTEGER
sepBefore = False
IF (.Orientation = False AND .PnlExceed.Visible AND (X >= .Width -12 AND X <= .Width)) OR _
(.Orientation AND .PnlExceed.Visible AND (Y >= .Height -12 AND Y <= .Height)) THEN _
.CBtnExceedHot.Visible = True
IF .Orientation = False AND (.PnlExceed.Visible = False OR (.PnlExceed.Visible AND X < .Width -12)) OR _
.Orientation AND (.PnlExceed.Visible = False OR (.PnlExceed.Visible AND Y < .Height -12)) THEN
IF curBtn > -True THEN
sepBefore = False
FOR I = False TO curBtn
IF .btn(I) = "-" THEN _
sepBefore ++
NEXT I
IF .btn(curBtn) <> "-" THEN
.ImgBtnHot(curBtn).Visible = False
IF .CoolBtn(curBtn).GroupIndex > True AND .CoolBtn(curBtn).Down = False THEN _
.CoolBtn(curBtn).Down = True _
ELSE _
.CoolBtn(curBtn).Down = False
IF .Orientation = False AND .BtnMenu(curBtn) AND X >= .BtnLeft(curBtn +True) -12 THEN
ELSEIF .Orientation AND .BtnMenu(curBtn) AND X >= .BtnWidth(curBtn) -12 THEN
ELSE
IF .CoolBtn(curBtn).Enabled THEN _
CALLFUNC(.OnChange, curBtn, This)
END IF
END IF
END IF
END IF
END EVENT
PUBLIC:
CONSTRUCTOR
Align = False
Alignment = False
CAPTION = "CoolBar"
Width = 120
Height = 24
IMGStretchedBackGround.Align = 4
IMGStretchedBackGround.Enabled = False
IMGStretchedBackGround.Stretch = True
IMGStretchedBackGround.AutoSize = True
IMGStretchedBackGround.PARENT = This
IMGStretchedBackGround2.Align = 5
IMGStretchedBackGround2.Enabled = False
IMGStretchedBackGround2.Stretch = True
IMGStretchedBackGround2.AutoSize = True
IMGStretchedBackGround2.PARENT = This.FlickeringFree
FlickeringFree.Align = 3
FlickeringFree.BevelWidth = False
FlickeringFree.Visible = False
FlickeringFree.PARENT = This
IMGBackGround.Align = 5
IMGBackGround.Enabled = False
IMGBackGround.AutoSize = True
IMGBackGround.Transparent = True
IMGBackGround.PARENT = This.FlickeringFree
BtnsHotTrack.PARENT = This.FlickeringFree
BtnsHotTrack.Align = 5
BtnsHotTrack.Transparent = True
PnlExceed.Left = This.Width -12
PnlExceed.Width = 12
PnlExceed.Align = 4
PnlExceed.BevelWidth = False
PnlExceed.Visible = False
PnlExceed.PARENT = This
CBtnExceed.Flat = True
CBtnExceed.Width = 12
CBtnExceed.GroupIndex = True
CBtnExceed.AllowAllUp = True
CBtnExceed.Spacing = False
CBtnExceed.Layout = False
CBtnExceed.NumBMPs = 4
CBtnExceed.PARENT = This.PnlExceed
CBtnExceedHot.Enabled = False
CBtnExceedHot.Width = 12
CBtnExceedHot.Visible = False
CBtnExceedHot.PARENT = This.PnlExceed
CBtnExceedHotTrack.PARENT = This.PnlExceed
CBtnExceedHotTrack.Align = 5
CBtnExceedHotTrack.Transparent = True
CanvasRight.Width = True
CanvasRight.Height = True
CanvasRight.PARENT = This
HideCaption = True
Hint = "CoolBar"
ShowHint = True
ItemsWidth = 24
imgLA.BkColor = This.COLOR
Orientation = False
END CONSTRUCTOR
END WITH
END TYPE
|
|