#include-once
#include <GUIConstants.au3>

; #FUNCTION# ====================================================================================================================
; Name ..........: _GuiCtrlCreateGroup
; Description ...: Create a Group in which you can set the Border-Color
; Syntax ........: _GuiCtrlCreateGroup($sText, $iX, $iY, $iW, $iH[, $iRectCol = -1[, $iTextCol = -1[, $iTextBkColor = -2[,
;                  $iFontAttribute = -1]]]])
; Parameters ....: $sText               - The text of the control.
;                  $iX                  - The left side of the control.
;                  $iY                  - The top of the control.
;                  $iW                  - The width of the control.
;                  $iH                  - The height of the control.
;                  $iRectCol            - [optional] The Rectangle-Color. Default is Black (0x000000).
;                  $iTextCol            - [optional] The Text-Color. Default is Black (0x000000).
;                  $iTextBkColor        - [optional] The Text-Background-Color. Default is transparent (-2).
;                  $iFontAttribute      - [optional] The Font-Attributes. Default is -1. (italic:2; underlined:4; strike:8)
; Return values .: $aGroup
;                  $aGroup[0]           - The Handle of the Graphic.
;                  $aGroup[1]           - The Handle of the Line (Label with 1px height) which overdraws the Graphic below the Text with the GUI-Background-Color.
;                  $aGroup[2]           - The Handle of the Text-Label.
; Author ........: funkey (autoit.de)
; Modified ......: Joriktos
; Remarks .......: Tip: If you want to set another font, use $aGroup[2] to get the Handle of the Text-Label.
;                       But if you want to change the width, don't forget to change the width of $aGroup[1] too.
; Related .......:
; Link ..........:
; Example .......:
; ===============================================================================================================================
Func _GuiCtrlCreateGroup($sText, $iX, $iY, $iW, $iH, $iRectCol = -1, $iTextCol = -1, $iTextBkColor = -2, $iFontAttribute = -1)
	Local $aGroup[3]
	$aGroup[0] = GUICtrlCreateGraphic($iX, $iY, $iW, $iH, 0) ; Create a Graphic
	If $iRectCol <> -1 Then GUICtrlSetGraphic($aGroup[0], $GUI_GR_COLOR, $iRectCol) ; Set the Rectangle-Color - Standard: Black (0x000000)
	GUICtrlSetGraphic($aGroup[0], $GUI_GR_RECT, 0, 0, $iW, $iH) ; Draws the Graphic into a Rectangle
	$aGroup[1] = GUICtrlCreateLabel($sText, $iX + 5, $iY, Default, 1, 0x1) ; Overdraw the Rectangle-Graphic with a Line (Label with 1px height) for the Text. The line is colored like the GUI-Background.
	$aGroup[2] = GUICtrlCreateLabel($sText, $iX + 5, $iY - 6, Default, Default, 0x1) ; Label for the Text - 0x1 = $SS_CENTER
	If $iTextCol <> -1 Then GUICtrlSetColor($aGroup[2], $iTextCol) ; Set the Text-Color - Standard: Black (0x000000)
	If $iTextBkColor <> -1 Then GUICtrlSetBkColor($aGroup[2], $iTextBkColor) ; Set the Text-Backgound-Color - Standard: Transparent (-2)
	If $iFontAttribute <> -1 Then GUICtrlSetFont($aGroup[2], Default, Default, $iFontAttribute) ; Set the Font-Attributes

	GUIStartGroup() ; For a full functional Group ;)

	Return $aGroup ; Returns the 3 Handles
EndFunc   ;==>_GuiCtrlCreateGroup


; #FUNCTION# ====================================================================================================================
; Name ..........: _GUICtrlDeleteGroup
; Description ...: This deletes a Group which was created with _GUICtrlCreateGroup() before.
; Syntax ........: _GUICtrlDeleteGroup($aGroup)
; Parameters ....: $aGroup              - An array of unknowns.
; Return values .: None
; Author ........: Joriktos
; Modified ......: -
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GUICtrlDeleteGroup($aGroup)
	For $i = 0 To UBound($aGroup) - 1
		GUICtrlDelete($aGroup[$i])
	Next
EndFunc   ;==>_GUICtrlDeleteGroup