[TypedSDK] Fixed a problem with standard file dialogs not setting NULL_STRING to their FileName access when canceled (which is what they do in VO)

USING VOSDK := XSharp.VO.SDK

CLASS OpenDialog INHERIT StandardFileDialog

	PROTECT oOpen AS System.Windows.Forms.OpenFileDialog

	CONSTRUCTOR(oOwnWnd,cInitPath,dwFlag)
		SUPER(oOwnWnd,cInitPath,dwFlag)
		oDlg := oOpen := System.Windows.Forms.OpenFileDialog{}

		IsOpen := TRUE
		oOpen:CheckFileExists:= TRUE
		oOpen:CheckPathExists := TRUE
		Flags := _OR(OFN_EXPLORER, OFN_ALLOWMULTISELECT, OFN_FILEMUSTEXIST, OFN_PATHMUSTEXIST,OFN_ENABLEHOOK)
		SELF:PostInit()
		RETURN

	METHOD Destroy() AS USUAL STRICT
		oOpen := NULL_OBJECT
		RETURN SUPER:Destroy()

	METHOD Show()
		oOpen:ReadOnlyChecked	:= _AND(Flags, OFN_READONLY) != 0
		oOpen:Multiselect		:= _AND(Flags , OFN_ALLOWMULTISELECT) != 0
		oOpen:ShowReadOnly		:= _AND(Flags , OFN_HIDEREADONLY ) != 0

		RETURN SUPER:Show()

END CLASS
CLASS PaletteDialog INHERIT StandardColorDialog

	CONSTRUCTOR(uOwner,oColor)

		IF !IsNil(uOwner)
			IF !IsInstanceOfUsual(uOwner,#Window)
				WCError{#Init,#PaletteDialog,__WCSTypeError,uOwner,1}:@@Throw()
			ENDIF
		ENDIF
		SUPER(oColor)

		IF IsInstanceOfUsual(uOwner, #Window)
			SELF:oOwner := uOwner
		ENDIF

		RETURN

END CLASS

CLASS SaveAsDialog INHERIT StandardFileDialog

	PROTECT oSave AS System.Windows.Forms.SaveFileDialog

	CONSTRUCTOR(oOwnWnd, cInitPath, dwFlag)

		SUPER(oOwnWnd,cInitPath, dwFlag)
		oDlg := oSave := System.Windows.Forms.SaveFileDialog{}
		SELF:IsOpen := FALSE
		oSave:CheckPathExists := TRUE
		oSave:OverwritePrompt := TRUE
		oSave:CreatePrompt := FALSE
		Flags := _OR(OFN_EXPLORER, OFN_PATHMUSTEXIST, OFN_HIDEREADONLY, OFN_ENABLESIZING, OFN_ENABLEHOOK)
		SELF:PostInit()
		RETURN

	METHOD Destroy() AS USUAL STRICT
		oSave := NULL_OBJECT
		RETURN SUPER:Destroy()

END CLASS

CLASS SelectDialog INHERIT StandardColorDialog

	CONSTRUCTOR(uOwner,oColor)

		IF !IsNil(uOwner)
			IF !IsInstanceOfUsual(uOwner,#Window)
				WCError{#Init,#SelectDialog,__WCSTypeError,uOwner,1}:@@Throw()
			ENDIF
		ENDIF
		SUPER(oColor)

		IF IsInstanceOfUsual(uOwner, #Window)
			SELF:oOwner := uOwner
		ENDIF

		RETURN

END CLASS

CLASS StandardColorDialog INHERIT StandardDialog
	PROTECT liFlags AS LONGINT
	PROTECT oDefColor AS Color
	PROTECT oOwner AS Window

	CLASS VOCOlorDialog INHERIT System.Windows.Forms.ColorDialog
		CONSTRUCTOR() STRICT
			SUPER()
	END CLASS

	STATIC PROPERTY CustomColors AS INT[] AUTO

	METHOD Color()
		RETURN oDefColor

	//METHOD Destroy() AS USUAL STRICT
		//RETURN SELF

	CONSTRUCTOR(oColor)

		SUPER()
		oDefColor := Color{COLORBLACK}

		IF !IsNil(oColor)
			IF !IsInstanceOfUsual(oColor,#Color)
				WCError{#Init,#StandardColorDialog,__WCSTypeError,oColor,1}:@@Throw()
			ENDIF
			oDefColor := oColor
		ENDIF

		RETURN

	METHOD Show()
		LOCAL lRet AS LOGIC
		LOCAL oColorDlg as VOColorDialog
		LOCAL oRes AS System.Windows.Forms.DialogResult
		oColorDlg := VOColorDialog{}
		oColorDlg:Color := oDefColor
		oColorDlg:CustomColors := CustomColors
		if _and(liFlags, CC_PREVENTFULLOPEN) != 0
			oColorDlg:AllowFullOpen := FALSE
		ELSE
			oColorDlg:AllowFullOpen := TRUE
		ENDIF

		if _and(liFlags, CC_RGBINIT) != 0
			oColorDlg:AnyColor := FALSE
		ELSE
			oColorDlg:AnyColor := TRUE
		ENDIF

		IF oOwner != NULL_OBJECT
			oRes := oColorDlg:ShowDialog(oOwner:__Form)
		ELSE
			oRes := oColorDlg:ShowDialog()
		ENDIF

		lRet := (oRes ==System.Windows.Forms.DialogResult.OK)
		IF lRet
			CustomColors := oColorDlg:CustomColors
			oDefColor := oColorDlg:Color
		ENDIF

		RETURN lRet

END CLASS

CLASS StandardDialog INHERIT VObject

	CONSTRUCTOR()
		SUPER()
		RETURN
END CLASS

CLASS StandardFileDialog INHERIT StandardDialog
	PROTECT cInitPath	AS STRING
	PROTECT Flags		AS DWORD
	PROTECT FlagsEx		AS DWORD
	PROTECT IsOpen		AS LOGIC
	PROTECT oOwner		AS Window
	PROTECT oDlg		AS System.Windows.Forms.FileDialog

	METHOD __AddFilter(sFilter AS STRING, sFilterDesc AS STRING) AS VOID STRICT
		LOCAL sOldFilter as STRING
		sOldFilter := oDlg:Filter
		IF !STRING.IsNullOrEmpty(sOldFilter) .and. !sOldFilter:EndsWith("|")
			sOldFilter += "|"
		ENDIF
		oDlg:Filter := sOldFilter+sFilterDesc+"|"+sFilter
		RETURN

	METHOD __ClearFilters() AS VOID STRICT
		oDlg:Filter := String.Empty
		RETURN

	ACCESS __Flags AS DWORD STRICT
		RETURN Flags

	ACCESS Caption  AS STRING
		RETURN oDlg:Title

	ASSIGN Caption(cNewCaption AS STRING)
		oDlg:Title := cNewCaption
		RETURN

	ACCESS DefExt AS STRING
		RETURN oDlg:DefaultExt

	ASSIGN DefExt( cNew  AS STRING)
		//PP-040101
		oDlg:DefaultExt := cNew

	NEW METHOD Destroy() AS USUAL STRICT
		IF oDlg != null_OBJECT
			oDlg:Dispose()
			oDlg := NULL_OBJECT
		ENDIF
		RETURN SELF

	METHOD Dispatch(oEvt, hDlg)
		RETURN 0L

	ASSIGN DlgStyle(flag as LOGIC)
		IF flag
			Flags := _OR(Flags, DWORD(_CAST, OFN_EXPLORER))
		ELSE
			Flags := _AND(Flags, DWORD(_CAST, _NOT(OFN_EXPLORER)))
		ENDIF

		RETURN

	ACCESS FileName AS STRING
		RETURN oDlg:FileName

	ACCESS FilterIndex AS LONG
		RETURN oDlg:FilterIndex

	ASSIGN  FilterIndex (nIndex AS LONG)
		oDlg:FilterIndex := nIndex

	METHOD Help()
		RETURN NIL

	METHOD HelpRequest(oObject as Object, e as System.EventArgs) as VOID
		SELF:Help()
		RETURN

	ASSIGN HideReadOnly(flag AS LOGIC)
		IF flag
			Flags := _OR(Flags, OFN_HIDEREADONLY)
		ELSE
			Flags := _AND(Flags, _NOT(OFN_HIDEREADONLY))
		ENDIF

		RETURN

	CONSTRUCTOR(uOwner, uInitPath)

		SUPER()
		IF !IsNil(uOwner)
			IF !IsInstanceOfUsual(uOwner,#Window)
				WCError{#Init,#TextBox,__WCSTypeError,uOwner,1}:@@Throw()
			ELSE
				oOwner:=uOwner
			ENDIF
		ENDIF
		IF IsString(uInitPath)
			cInitPath := uInitPath
		ENDIF
		IsOpen := FALSE

	METHOD PostInit() AS VOID STRICT
		LOCAL iPos AS INT
		LOCAL cTest, cRest, cAllFiles AS STRING
		LOCAL lHasWildCard := FALSE AS LOGIC
		LOCAL sFilters AS STRING
		LOCAL Result as STRING
		// needed for changing dialog's style (by OFN_EXPLORER)
		Flags := OFN_ALLOWMULTISELECT

		//cAllFiles := ResourceString{__WCSAllFiles}:Value
		cAllFiles := "All Files (*.*)|*.*"
		Result := IIF(IsNil(cInitPath), "*.*", cInitPath)

		// Find default extension
		iPos := INT(_CAST, RAt2(".", Result))
		cTest := CharPos(Result, 2)

		IF (iPos # 0 .AND. cTest # NULL_STRING)
			cRest := SubStr(Result, ++iPos) // skip '.'
			IF InStr("*", cRest) .OR. InStr("?", cRest)
				lHasWildCard := FALSE
			ENDIF

			// Set as default extension if there are no wildcards
			IF !lHasWildCard
				SELF:DefExt := cRest
			ENDIF

			// Set up filter string
			IF !(cRest == "*") // its not the standard wildcard
				cTest := "*." + cRest
				sFilters := cTest + "|" + cTest + "|" + cAllFiles
			ELSE
				sFilters := cAllFiles
			ENDIF
		ELSE // Set up standard filter string
			sFilters := cAllFiles
		ENDIF
		oDlg:Filter := sFilters
		oDlg:InitialDirectory := System.IO.Path.GetDirectoryName(cInitPath)
		oDlg:AddExtension := TRUE
		oDlg:HelpRequest += HelpRequest
		oDlg:AutoUpgradeEnabled := TRUE
		oDlg:RestoreDirectory := TRUE
		oDlg:FileName := cInitPath

		RETURN

	ACCESS InitialDirectory AS STRING
		RETURN oDlg:InitialDirectory

	ASSIGN InitialDirectory(cNewDir AS STRING)
		IF ! empty(cNewDir)
			IF !cNewDir:EndsWith("\")
				cNewDir += "\"
			ENDIF
			oDlg:InitialDirectory := cNewDir
		ENDIF
		RETURN

	ACCESS NoPlacesBar AS LOGIC
		RETURN LOGIC(_CAST, _AND(FlagsEx, OFN_EX_NOPLACESBAR))

	ASSIGN NoPlacesBar(flag AS LOGIC)

		IF flag
			FlagsEx := _OR(FlagsEx, OFN_EX_NOPLACESBAR)
		ELSE
			FlagsEx := _AND(FlagsEx, _NOT(OFN_EX_NOPLACESBAR))
		ENDIF

		RETURN

	ACCESS ReadOnly AS LOGIC
		RETURN LOGIC(_CAST, _AND(Flags, OFN_READONLY))

	ASSIGN ReadOnly(flag AS LOGIC)
		IF flag
			Flags := _OR(Flags, OFN_READONLY)
		ELSE
			Flags := _AND(Flags, _NOT(OFN_READONLY))
		ENDIF
		RETURN

	METHOD SetFilter(uFilter, uFilterDesc, nIndex)
		LOCAL i AS INT

		IF IsString(uFilter) .AND. IsString(uFilterDesc)
			SELF:__ClearFilters()
			SELF:__AddFilter(uFilter, uFilterDesc)
		ELSEIF IsArray(uFilter) .AND. IsArray(uFilterDesc)
			SELF:__ClearFilters()
			FOR i:=1 TO Min(ALen(uFilter), ALen(uFilterDesc))
				SELF:__AddFilter(AsString(uFilter[i]), AsString(uFilterDesc[i]))
			NEXT
		ENDIF
		IF IsLong(nIndex)
			oDlg:FilterIndex := nIndex
		ENDIF

		RETURN NIL

	METHOD SetStyle(kStyle AS LONG, lOnOff := TRUE AS LOGIC) AS VOID
		IF (lOnOff)
			Flags := _OR(Flags, DWORD(kStyle))
		ELSE
			Flags := _AND(Flags, _NOT(DWORD(kStyle)))
		ENDIF
		RETURN

	METHOD SetStyleEx(kStyle AS LONG, lOnOff := TRUE AS LOGIC) AS VOID
		IF (lOnOff)
			FlagsEx := _OR(Flags, DWORD(kStyle))
		ELSE
			FlagsEx := _AND(Flags, _NOT(DWORD(kStyle)))
		ENDIF
		RETURN

	METHOD Show()
		LOCAL oRes AS System.Windows.Forms.DialogResult
		oDlg:CheckFileExists := _AND(Flags, OFN_FILEMUSTEXIST)  != 0
		oDlg:CheckPathExists := _AND(Flags, OFN_PATHMUSTEXIST) != 0

		IF oOwner != NULL_OBJECT
			oRes := oDlg:ShowDialog(oOwner:__Form)
		ELSE
			oRes := oDlg:ShowDialog()
        ENDIF
		IF oRes == System.Windows.Forms.DialogResult.Cancel
            oDlg:FileName := ""
        ENDIF
		RETURN oRes == System.Windows.Forms.DialogResult.OK

END CLASS

CLASS StandardFolderDialog INHERIT StandardDialog
	PROTECT oOwner as Window
	PROTECT sTitle AS STRING
	PROTECT sStart AS STRING
	PROTECT dwType AS DWORD
	PROTECT sResult AS STRING

	ACCESS __StartFolder AS STRING STRICT
		RETURN sStart

	ACCESS FolderName AS STRING
		RETURN sResult

	CONSTRUCTOR(uOwner, sCaption, sStartFolder, kType)
		SUPER()
		Default(@kType, BIF_RETURNONLYFSDIRS)
		Default(@sCaption, "Browser Folder")
		Default(@sStartFolder, "")

		IF IsInstanceOf(uOwner, #Window)
			oOwner := uOwner
		ENDIF

		sTitle := sCaption
		sStart := sStartFolder
		IF IsNumeric(dwType)
			dwType := kType
		ENDIF
		RETURN

	ACCESS Result AS STRING
		RETURN sResult

	METHOD Show()
		LOCAL oDlg as System.Windows.Forms.FolderBrowserDialog
		LOCAL oRes as System.Windows.Forms.DialogResult
		LOCAL lRet as LOGIC
		oDlg := System.Windows.Forms.FolderBrowserDialog{}
		oDlg:Description := SELF:sTitle
		IF ! String.IsNullOrEmpty(sStart)
			oDlg:SelectedPath := SELF:sStart
		ENDIF
		oDlg:RootFolder  := Environment.SpecialFolder.MyComputer
		oDlg:ShowNewFolderButton := TRUE
		IF oOwner != NULL_OBJECT
			oRes := oDlg:ShowDialog(oOwner:__Form)
		ELSE
			oRes := oDlg:ShowDialog()
		ENDIF

		lRet := oRes == System.Windows.Forms.DialogResult.OK
		IF lRet
			SELF:sResult := oDlg:SelectedPath
		ENDIF
		RETURN lRet

END CLASS

CLASS StandardFontDialog INHERIT StandardDialog
	PROTECT lFlags AS LONGINT
	PROTECT lFixPitchFlag AS LONGINT
	PROTECT lTTYFlag AS LONGINT
	PROTECT lEffectFlag AS LONGINT
	PROTECT lANSIFlag AS LONGINT
	PROTECT lOldFlags AS LONGINT
	PROTECT oColor AS VOSDK.Color
	PROTECT oFont AS VOSDK.Font
	PROTECT iFamily AS INT
	//PROTECT oPrinter AS printer
	PROTECT oOwner as Window

	METHOD EnableANSI(bOnOff := TRUE AS LOGIC) AS VOID
		IF bOnOff
			// lANSIFlag := CF_ANSIONLY // obsolete (see Win32 SDK Help file)
			lANSIFlag := CF_SCRIPTSONLY		// tk new
		ELSE
			lANSIFlag := 0
		ENDIF
		RETURN

	METHOD EnableEffects(bOnOff:= TRUE AS LOGIC) AS VOID
		IF bOnOff
			lEffectFlag := CF_EFFECTS
		ELSE
			lEffectFlag := 0
		ENDIF

		RETURN

	METHOD EnableFixedPitch(bOnOff:= TRUE AS LOGIC) AS VOID
		IF bOnOff
			lFixPitchFlag := CF_FIXEDPITCHONLY
		ELSE
			lFixPitchFlag := 0
		ENDIF
		RETURN

	METHOD EnableTrueType(bOnOff:= TRUE AS LOGIC) AS VOID
		IF bOnOff
			lTTYFlag := CF_TTONLY
		ELSE
			lTTYFlag := 0
		ENDIF
		RETURN

	ASSIGN Flags(lInt as LONG)
		lFlags := _OR(lFlags, LONGINT(_CAST, lInt))
		RETURN

	PROPERTY Font		AS VOSDK.Font	GET oFont	SET oFont	:= VALUE
	PROPERTY FontColor  AS VOSDK.Color  GET oColor	SET oColor	:= VALUE

	CONSTRUCTOR(uOwner)
		IF !IsNil(uOwner)
			IF !IsInstanceOfUsual(uOwner,#Window) .AND. IsInstanceOfUsual( uOwner,#Printer)
				WCError{#Init,#StandardFontDialog,__WCSTypeError,uOwner,1}:@@Throw()
			ENDIF
			IF IsInstanceOf(uOwner, #Window)
				oOwner := uOwner
			ENDIF

		ENDIF

		SUPER()

		oColor := Color{COLORBLACK}

		IF IsInstanceOfUsual(uOwner, #Printer)
			lFlags := CF_PRINTERFONTS
			//oPrinter := uOwner
		ELSE
			lFlags := CF_SCREENFONTS
		ENDIF

		SELF:EnableEffects(TRUE)

		RETURN

	METHOD Show()
		LOCAL oDlg as System.Windows.Forms.FontDialog
		LOCAL oRes as System.Windows.Forms.DialogResult
		LOCAL lRet as LOGIC
		oDlg := System.Windows.Forms.FontDialog{}

		IF (oFont != NULL_OBJECT)
			oDlg:Font := oFont
		ENDIF
		oDlg:FixedPitchOnly := lFixPitchFlag != 0
		oDlg:ShowEffects := lEffectFlag != 0
		oDlg:ScriptsOnly := lANSIFlag		 != 0
		oDlg:AllowVectorFonts := lTTYFlag != 0
		oDlg:AllowScriptChange := TRUE
		oDlg:AllowSimulations := TRUE
		oDlg:FontMustExist := TRUE
		oDlg:ShowColor := TRUE
		oDlg:Color := oColor
		IF oOwner != NULL_OBJECT
			oRes := oDlg:ShowDialog(oOwner:__Form)
		ELSE
			oRes := oDlg:ShowDialog()
		ENDIF
		lRet := oRes == System.Windows.Forms.DialogResult.OK
		IF lRet
			oFont  := oDlg:Font
			oColor := oDlg:Color
		ENDIF
		RETURN lRet

END CLASS

#region defines
DEFINE BFFM_ENABLEOK := (WM_USER + 101)
DEFINE BFFM_INITIALIZED := 1
DEFINE BFFM_SELCHANGED := 2
DEFINE BFFM_SETSELECTION := (WM_USER + 102)
DEFINE BFFM_SETSTATUSTEXT := (WM_USER + 100)
DEFINE BIF_BROWSEFORCOMPUTER := 0x1000
DEFINE BIF_BROWSEFORPRINTER := 0x2000
DEFINE BIF_BROWSEINCLUDEFILES := 0x4000
DEFINE BIF_DONTGOBELOWDOMAIN := 0x0002
DEFINE BIF_RETURNFSANCESTORS := 0x0008
DEFINE BIF_RETURNONLYFSDIRS := 0x0001
DEFINE BIF_STATUSTEXT := 0x0004
#endregion

USING VOSDK := XSharp.VO.SDK

CLASS OpenDialog INHERIT StandardFileDialog

	PROTECT oOpen AS System.Windows.Forms.OpenFileDialog

	CONSTRUCTOR(oOwnWnd,cInitPath,dwFlag)
		SUPER(oOwnWnd,cInitPath,dwFlag)
		oDlg := oOpen := System.Windows.Forms.OpenFileDialog{}

		IsOpen := TRUE
		oOpen:CheckFileExists:= TRUE
		oOpen:CheckPathExists := TRUE
		Flags := _OR(OFN_EXPLORER, OFN_ALLOWMULTISELECT, OFN_FILEMUSTEXIST, OFN_PATHMUSTEXIST,OFN_ENABLEHOOK)
		SELF:PostInit()
		RETURN

	METHOD Destroy() AS USUAL STRICT
		oOpen := NULL_OBJECT
		RETURN SUPER:Destroy()

	METHOD Show()
		oOpen:ReadOnlyChecked	:= _AND(Flags, OFN_READONLY) != 0
		oOpen:Multiselect		:= _AND(Flags , OFN_ALLOWMULTISELECT) != 0
		oOpen:ShowReadOnly		:= _AND(Flags , OFN_HIDEREADONLY ) != 0

		RETURN SUPER:Show()

END CLASS
CLASS PaletteDialog INHERIT StandardColorDialog

	CONSTRUCTOR(uOwner,oColor)

		IF !IsNil(uOwner)
			IF !IsInstanceOfUsual(uOwner,#Window)
				WCError{#Init,#PaletteDialog,__WCSTypeError,uOwner,1}:@@Throw()
			ENDIF
		ENDIF
		SUPER(oColor)

		IF IsInstanceOfUsual(uOwner, #Window)
			SELF:oOwner := uOwner
		ENDIF

		RETURN

END CLASS

CLASS SaveAsDialog INHERIT StandardFileDialog

	PROTECT oSave AS System.Windows.Forms.SaveFileDialog

	CONSTRUCTOR(oOwnWnd, cInitPath, dwFlag)

		SUPER(oOwnWnd,cInitPath, dwFlag)
		oDlg := oSave := System.Windows.Forms.SaveFileDialog{}
		SELF:IsOpen := FALSE
		oSave:CheckPathExists := TRUE
		oSave:OverwritePrompt := TRUE
		oSave:CreatePrompt := FALSE
		Flags := _OR(OFN_EXPLORER, OFN_PATHMUSTEXIST, OFN_HIDEREADONLY, OFN_ENABLESIZING, OFN_ENABLEHOOK)
		SELF:PostInit()
		RETURN

	METHOD Destroy() AS USUAL STRICT
		oSave := NULL_OBJECT
		RETURN SUPER:Destroy()

END CLASS

CLASS SelectDialog INHERIT StandardColorDialog

	CONSTRUCTOR(uOwner,oColor)

		IF !IsNil(uOwner)
			IF !IsInstanceOfUsual(uOwner,#Window)
				WCError{#Init,#SelectDialog,__WCSTypeError,uOwner,1}:@@Throw()
			ENDIF
		ENDIF
		SUPER(oColor)

		IF IsInstanceOfUsual(uOwner, #Window)
			SELF:oOwner := uOwner
		ENDIF

		RETURN

END CLASS

CLASS StandardColorDialog INHERIT StandardDialog
	PROTECT liFlags AS LONGINT
	PROTECT oDefColor AS Color
	PROTECT oOwner AS Window

	CLASS VOCOlorDialog INHERIT System.Windows.Forms.ColorDialog
		CONSTRUCTOR() STRICT
			SUPER()
	END CLASS

	STATIC PROPERTY CustomColors AS INT[] AUTO

	METHOD Color()
		RETURN oDefColor

	//METHOD Destroy() AS USUAL STRICT
		//RETURN SELF

	CONSTRUCTOR(oColor)

		SUPER()
		oDefColor := Color{COLORBLACK}

		IF !IsNil(oColor)
			IF !IsInstanceOfUsual(oColor,#Color)
				WCError{#Init,#StandardColorDialog,__WCSTypeError,oColor,1}:@@Throw()
			ENDIF
			oDefColor := oColor
		ENDIF

		RETURN

	METHOD Show()
		LOCAL lRet AS LOGIC
		LOCAL oColorDlg as VOColorDialog
		LOCAL oRes AS System.Windows.Forms.DialogResult
		oColorDlg := VOColorDialog{}
		oColorDlg:Color := oDefColor
		oColorDlg:CustomColors := CustomColors
		if _and(liFlags, CC_PREVENTFULLOPEN) != 0
			oColorDlg:AllowFullOpen := FALSE
		ELSE
			oColorDlg:AllowFullOpen := TRUE
		ENDIF

		if _and(liFlags, CC_RGBINIT) != 0
			oColorDlg:AnyColor := FALSE
		ELSE
			oColorDlg:AnyColor := TRUE
		ENDIF

		IF oOwner != NULL_OBJECT
			oRes := oColorDlg:ShowDialog(oOwner:__Form)
		ELSE
			oRes := oColorDlg:ShowDialog()
		ENDIF

		lRet := (oRes ==System.Windows.Forms.DialogResult.OK)
		IF lRet
			CustomColors := oColorDlg:CustomColors
			oDefColor := oColorDlg:Color
		ENDIF

		RETURN lRet

END CLASS

CLASS StandardDialog INHERIT VObject

	CONSTRUCTOR()
		SUPER()
		RETURN
END CLASS

CLASS StandardFileDialog INHERIT StandardDialog
	PROTECT cInitPath	AS STRING
	PROTECT Flags		AS DWORD
	PROTECT FlagsEx		AS DWORD
	PROTECT IsOpen		AS LOGIC
	PROTECT oOwner		AS Window
	PROTECT oDlg		AS System.Windows.Forms.FileDialog

	METHOD __AddFilter(sFilter AS STRING, sFilterDesc AS STRING) AS VOID STRICT
		LOCAL sOldFilter as STRING
		sOldFilter := oDlg:Filter
		IF !STRING.IsNullOrEmpty(sOldFilter) .and. !sOldFilter:EndsWith("|")
			sOldFilter += "|"
		ENDIF
		oDlg:Filter := sOldFilter+sFilterDesc+"|"+sFilter
		RETURN

	METHOD __ClearFilters() AS VOID STRICT
		oDlg:Filter := String.Empty
		RETURN

	ACCESS __Flags AS DWORD STRICT
		RETURN Flags

	ACCESS Caption  AS STRING
		RETURN oDlg:Title

	ASSIGN Caption(cNewCaption AS STRING)
		oDlg:Title := cNewCaption
		RETURN

	ACCESS DefExt AS STRING
		RETURN oDlg:DefaultExt

	ASSIGN DefExt( cNew  AS STRING)
		//PP-040101
		oDlg:DefaultExt := cNew

	NEW METHOD Destroy() AS USUAL STRICT
		IF oDlg != null_OBJECT
			oDlg:Dispose()
			oDlg := NULL_OBJECT
		ENDIF
		RETURN SELF

	METHOD Dispatch(oEvt, hDlg)
		RETURN 0L

	ASSIGN DlgStyle(flag as LOGIC)
		IF flag
			Flags := _OR(Flags, DWORD(_CAST, OFN_EXPLORER))
		ELSE
			Flags := _AND(Flags, DWORD(_CAST, _NOT(OFN_EXPLORER)))
		ENDIF

		RETURN

	ACCESS FileName AS STRING
		RETURN oDlg:FileName

	ACCESS FilterIndex AS LONG
		RETURN oDlg:FilterIndex

	ASSIGN  FilterIndex (nIndex AS LONG)
		oDlg:FilterIndex := nIndex

	METHOD Help()
		RETURN NIL

	METHOD HelpRequest(oObject as Object, e as System.EventArgs) as VOID
		SELF:Help()
		RETURN

	ASSIGN HideReadOnly(flag AS LOGIC)
		IF flag
			Flags := _OR(Flags, OFN_HIDEREADONLY)
		ELSE
			Flags := _AND(Flags, _NOT(OFN_HIDEREADONLY))
		ENDIF

		RETURN

	CONSTRUCTOR(uOwner, uInitPath)

		SUPER()
		IF !IsNil(uOwner)
			IF !IsInstanceOfUsual(uOwner,#Window)
				WCError{#Init,#TextBox,__WCSTypeError,uOwner,1}:@@Throw()
			ELSE
				oOwner:=uOwner
			ENDIF
		ENDIF
		IF IsString(uInitPath)
			cInitPath := uInitPath
		ENDIF
		IsOpen := FALSE

	METHOD PostInit() AS VOID STRICT
		LOCAL iPos AS INT
		LOCAL cTest, cRest, cAllFiles AS STRING
		LOCAL lHasWildCard := FALSE AS LOGIC
		LOCAL sFilters AS STRING
		LOCAL Result as STRING
		// needed for changing dialog's style (by OFN_EXPLORER)
		Flags := OFN_ALLOWMULTISELECT

		//cAllFiles := ResourceString{__WCSAllFiles}:Value
		cAllFiles := "All Files (*.*)|*.*"
		Result := IIF(IsNil(cInitPath), "*.*", cInitPath)

		// Find default extension
		iPos := INT(_CAST, RAt2(".", Result))
		cTest := CharPos(Result, 2)

		IF (iPos # 0 .AND. cTest # NULL_STRING)
			cRest := SubStr(Result, ++iPos) // skip '.'
			IF InStr("*", cRest) .OR. InStr("?", cRest)
				lHasWildCard := FALSE
			ENDIF

			// Set as default extension if there are no wildcards
			IF !lHasWildCard
				SELF:DefExt := cRest
			ENDIF

			// Set up filter string
			IF !(cRest == "*") // its not the standard wildcard
				cTest := "*." + cRest
				sFilters := cTest + "|" + cTest + "|" + cAllFiles
			ELSE
				sFilters := cAllFiles
			ENDIF
		ELSE // Set up standard filter string
			sFilters := cAllFiles
		ENDIF
		oDlg:Filter := sFilters
		oDlg:InitialDirectory := System.IO.Path.GetDirectoryName(cInitPath)
		oDlg:AddExtension := TRUE
		oDlg:HelpRequest += HelpRequest
		oDlg:AutoUpgradeEnabled := TRUE
		oDlg:RestoreDirectory := TRUE
		oDlg:FileName := cInitPath

		RETURN

	ACCESS InitialDirectory AS STRING
		RETURN oDlg:InitialDirectory

	ASSIGN InitialDirectory(cNewDir AS STRING)
		IF ! empty(cNewDir)
			IF !cNewDir:EndsWith("\")
				cNewDir += "\"
			ENDIF
			oDlg:InitialDirectory := cNewDir
		ENDIF
		RETURN

	ACCESS NoPlacesBar AS LOGIC
		RETURN LOGIC(_CAST, _AND(FlagsEx, OFN_EX_NOPLACESBAR))

	ASSIGN NoPlacesBar(flag AS LOGIC)

		IF flag
			FlagsEx := _OR(FlagsEx, OFN_EX_NOPLACESBAR)
		ELSE
			FlagsEx := _AND(FlagsEx, _NOT(OFN_EX_NOPLACESBAR))
		ENDIF

		RETURN

	ACCESS ReadOnly AS LOGIC
		RETURN LOGIC(_CAST, _AND(Flags, OFN_READONLY))

	ASSIGN ReadOnly(flag AS LOGIC)
		IF flag
			Flags := _OR(Flags, OFN_READONLY)
		ELSE
			Flags := _AND(Flags, _NOT(OFN_READONLY))
		ENDIF
		RETURN

	METHOD SetFilter(uFilter, uFilterDesc, nIndex)
		LOCAL i AS INT

		IF IsString(uFilter) .AND. IsString(uFilterDesc)
			SELF:__ClearFilters()
			SELF:__AddFilter(uFilter, uFilterDesc)
		ELSEIF IsArray(uFilter) .AND. IsArray(uFilterDesc)
			SELF:__ClearFilters()
			FOR i:=1 TO Min(ALen(uFilter), ALen(uFilterDesc))
				SELF:__AddFilter(AsString(uFilter[i]), AsString(uFilterDesc[i]))
			NEXT
		ENDIF
		IF IsLong(nIndex)
			oDlg:FilterIndex := nIndex
		ENDIF

		RETURN NIL

	METHOD SetStyle(kStyle AS LONG, lOnOff := TRUE AS LOGIC) AS VOID
		IF (lOnOff)
			Flags := _OR(Flags, DWORD(kStyle))
		ELSE
			Flags := _AND(Flags, _NOT(DWORD(kStyle)))
		ENDIF
		RETURN

	METHOD SetStyleEx(kStyle AS LONG, lOnOff := TRUE AS LOGIC) AS VOID
		IF (lOnOff)
			FlagsEx := _OR(Flags, DWORD(kStyle))
		ELSE
			FlagsEx := _AND(Flags, _NOT(DWORD(kStyle)))
		ENDIF
		RETURN

	METHOD Show()
		LOCAL oRes AS System.Windows.Forms.DialogResult
		oDlg:CheckFileExists := _AND(Flags, OFN_FILEMUSTEXIST)  != 0
		oDlg:CheckPathExists := _AND(Flags, OFN_PATHMUSTEXIST) != 0

		IF oOwner != NULL_OBJECT
			oRes := oDlg:ShowDialog(oOwner:__Form)
		ELSE
			oRes := oDlg:ShowDialog()
		ENDIF
		RETURN oRes == System.Windows.Forms.DialogResult.OK

END CLASS

CLASS StandardFolderDialog INHERIT StandardDialog
	PROTECT oOwner as Window
	PROTECT sTitle AS STRING
	PROTECT sStart AS STRING
	PROTECT dwType AS DWORD
	PROTECT sResult AS STRING

	ACCESS __StartFolder AS STRING STRICT
		RETURN sStart

	ACCESS FolderName AS STRING
		RETURN sResult

	CONSTRUCTOR(uOwner, sCaption, sStartFolder, kType)
		SUPER()
		Default(@kType, BIF_RETURNONLYFSDIRS)
		Default(@sCaption, "Browser Folder")
		Default(@sStartFolder, "")

		IF IsInstanceOf(uOwner, #Window)
			oOwner := uOwner
		ENDIF

		sTitle := sCaption
		sStart := sStartFolder
		IF IsNumeric(dwType)
			dwType := kType
		ENDIF
		RETURN

	ACCESS Result AS STRING
		RETURN sResult

	METHOD Show()
		LOCAL oDlg as System.Windows.Forms.FolderBrowserDialog
		LOCAL oRes as System.Windows.Forms.DialogResult
		LOCAL lRet as LOGIC
		oDlg := System.Windows.Forms.FolderBrowserDialog{}
		oDlg:Description := SELF:sTitle
		IF ! String.IsNullOrEmpty(sStart)
			oDlg:SelectedPath := SELF:sStart
		ENDIF
		oDlg:RootFolder  := Environment.SpecialFolder.MyComputer
		oDlg:ShowNewFolderButton := TRUE
		IF oOwner != NULL_OBJECT
			oRes := oDlg:ShowDialog(oOwner:__Form)
		ELSE
			oRes := oDlg:ShowDialog()
		ENDIF

		lRet := oRes == System.Windows.Forms.DialogResult.OK
		IF lRet
			SELF:sResult := oDlg:SelectedPath
		ENDIF
		RETURN lRet

END CLASS

CLASS StandardFontDialog INHERIT StandardDialog
	PROTECT lFlags AS LONGINT
	PROTECT lFixPitchFlag AS LONGINT
	PROTECT lTTYFlag AS LONGINT
	PROTECT lEffectFlag AS LONGINT
	PROTECT lANSIFlag AS LONGINT
	PROTECT lOldFlags AS LONGINT
	PROTECT oColor AS VOSDK.Color
	PROTECT oFont AS VOSDK.Font
	PROTECT iFamily AS INT
	//PROTECT oPrinter AS printer
	PROTECT oOwner as Window

	METHOD EnableANSI(bOnOff := TRUE AS LOGIC) AS VOID
		IF bOnOff
			// lANSIFlag := CF_ANSIONLY // obsolete (see Win32 SDK Help file)
			lANSIFlag := CF_SCRIPTSONLY		// tk new
		ELSE
			lANSIFlag := 0
		ENDIF
		RETURN

	METHOD EnableEffects(bOnOff:= TRUE AS LOGIC) AS VOID
		IF bOnOff
			lEffectFlag := CF_EFFECTS
		ELSE
			lEffectFlag := 0
		ENDIF

		RETURN

	METHOD EnableFixedPitch(bOnOff:= TRUE AS LOGIC) AS VOID
		IF bOnOff
			lFixPitchFlag := CF_FIXEDPITCHONLY
		ELSE
			lFixPitchFlag := 0
		ENDIF
		RETURN

	METHOD EnableTrueType(bOnOff:= TRUE AS LOGIC) AS VOID
		IF bOnOff
			lTTYFlag := CF_TTONLY
		ELSE
			lTTYFlag := 0
		ENDIF
		RETURN

	ASSIGN Flags(lInt as LONG)
		lFlags := _OR(lFlags, LONGINT(_CAST, lInt))
		RETURN

	PROPERTY Font		AS VOSDK.Font	GET oFont	SET oFont	:= VALUE
	PROPERTY FontColor  AS VOSDK.Color  GET oColor	SET oColor	:= VALUE

	CONSTRUCTOR(uOwner)
		IF !IsNil(uOwner)
			IF !IsInstanceOfUsual(uOwner,#Window) .AND. IsInstanceOfUsual( uOwner,#Printer)
				WCError{#Init,#StandardFontDialog,__WCSTypeError,uOwner,1}:@@Throw()
			ENDIF
			IF IsInstanceOf(uOwner, #Window)
				oOwner := uOwner
			ENDIF

		ENDIF

		SUPER()

		oColor := Color{COLORBLACK}

		IF IsInstanceOfUsual(uOwner, #Printer)
			lFlags := CF_PRINTERFONTS
			//oPrinter := uOwner
		ELSE
			lFlags := CF_SCREENFONTS
		ENDIF

		SELF:EnableEffects(TRUE)

		RETURN

	METHOD Show()
		LOCAL oDlg as System.Windows.Forms.FontDialog
		LOCAL oRes as System.Windows.Forms.DialogResult
		LOCAL lRet as LOGIC
		oDlg := System.Windows.Forms.FontDialog{}

		IF (oFont != NULL_OBJECT)
			oDlg:Font := oFont
		ENDIF
		oDlg:FixedPitchOnly := lFixPitchFlag != 0
		oDlg:ShowEffects := lEffectFlag != 0
		oDlg:ScriptsOnly := lANSIFlag		 != 0
		oDlg:AllowVectorFonts := lTTYFlag != 0
		oDlg:AllowScriptChange := TRUE
		oDlg:AllowSimulations := TRUE
		oDlg:FontMustExist := TRUE
		oDlg:ShowColor := TRUE
		oDlg:Color := oColor
		IF oOwner != NULL_OBJECT
			oRes := oDlg:ShowDialog(oOwner:__Form)
		ELSE
			oRes := oDlg:ShowDialog()
		ENDIF
		lRet := oRes == System.Windows.Forms.DialogResult.OK
		IF lRet
			oFont  := oDlg:Font
			oColor := oDlg:Color
		ENDIF
		RETURN lRet

END CLASS

#region defines
DEFINE BFFM_ENABLEOK := (WM_USER + 101)
DEFINE BFFM_INITIALIZED := 1
DEFINE BFFM_SELCHANGED := 2
DEFINE BFFM_SETSELECTION := (WM_USER + 102)
DEFINE BFFM_SETSTATUSTEXT := (WM_USER + 100)
DEFINE BIF_BROWSEFORCOMPUTER := 0x1000
DEFINE BIF_BROWSEFORPRINTER := 0x2000
DEFINE BIF_BROWSEINCLUDEFILES := 0x4000
DEFINE BIF_DONTGOBELOWDOMAIN := 0x0002
DEFINE BIF_RETURNFSANCESTORS := 0x0008
DEFINE BIF_RETURNONLYFSDIRS := 0x0001
DEFINE BIF_STATUSTEXT := 0x0004
#endregion


HAbstractTableModel: class updated

HAbstractTableModel: class updated

Modified:
source/QtCore/HAbstractTableModelClass.prg

/*

  Qt4xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 4

  Copyright (C) 2020 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com>

*/

#include "hbclass.ch"

REQUEST QMODELINDEX

CLASS HAbstractTableModel INHERIT QAbstractTableModel

   METHOD new
   METHOD delete

   METHOD setRowCountCB
   METHOD setColumnCountCB

   METHOD setDisplayRoleCB
   METHOD setDecorationRoleCB
   METHOD setEditRoleCB
   METHOD setToolTipRoleCB
   METHOD setStatusTipRoleCB
   METHOD setWhatsThisRoleCB
   METHOD setSizeHintRoleCB
   METHOD setFontRoleCB
   METHOD setTextAlignmentRoleCB
   METHOD setBackgroundRoleCB
   METHOD setForegroundRoleCB

   METHOD setHorizontalHeaderDisplayRoleCB
   METHOD setHorizontalHeaderDecorationRoleCB
   METHOD setHorizontalHeaderFontRoleCB
   METHOD setHorizontalHeaderTextAlignmentRoleCB
   METHOD setHorizontalHeaderBackgroundRoleCB
   METHOD setHorizontalHeaderForegroundRoleCB

   METHOD setVerticalHeaderDisplayRoleCB
   METHOD setVerticalHeaderDecorationRoleCB
   METHOD setVerticalHeaderFontRoleCB
   METHOD setVerticalHeaderTextAlignmentRoleCB
   METHOD setVerticalHeaderBackgroundRoleCB
   METHOD setVerticalHeaderForegroundRoleCB

   METHOD reloadData

   DESTRUCTOR destroyObject

END CLASS

METHOD destroyObject() CLASS HAbstractTableModel
   IF ::self_destruction
      ::delete()
   ENDIF
RETURN NIL

CLASS HDBFTableModel INHERIT HAbstractTableModel
END CLASS

CLASS HArrayTableModel INHERIT HAbstractTableModel
END CLASS

#pragma BEGINDUMP

#include <HAbstractTableModel.h>

#include "qt4xhb_common.h"
#include "qt4xhb_macros.h"
#include "qt4xhb_utils.h"
#include "qt4xhb_events.h"
#include "qt4xhb_signals.h"

/*
HAbstractTableModel( QObject * parent = 0 )
*/
HB_FUNC( HABSTRACTTABLEMODEL_NEW )
{
  if( ISBETWEEN(0,1) && (ISQOBJECT(1)||ISNIL(1)) )
  {
    HAbstractTableModel * obj = new HAbstractTableModel( OPQOBJECT(1,0) );
    Qt4xHb::returnNewObject( obj, false );
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

/*
virtual ~HAbstractTableModel()
*/
HB_FUNC( HABSTRACTTABLEMODEL_DELETE )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
    Events_disconnect_all_events( obj, true );
    Signals_disconnect_all_signals( obj, true );
    delete obj;
    obj = NULL;
    PHB_ITEM self = hb_stackSelfItem();
    PHB_ITEM ptr = hb_itemPutPtr( NULL, NULL );
    hb_objSendMsg( self, "_pointer", 1, ptr );
    hb_itemRelease( ptr );
  }

  hb_itemReturn( hb_stackSelfItem() );
}

// linhas e colunas

/*
void setRowCountCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETROWCOUNTCB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setRowCountCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setColumnCountCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETCOLUMNCOUNTCB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setColumnCountCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

// clulas

/*
void setDisplayRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETDISPLAYROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setDisplayRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setDecorationRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETDECORATIONROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setDecorationRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setEditRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETEDITROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setEditRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setToolTipRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETTOOLTIPROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setToolTipRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setStatusTipRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETSTATUSTIPROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setStatusTipRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setWhatsThisRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETWHATSTHISROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setWhatsThisRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setSizeHintRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETSIZEHINTROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setSizeHintRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setFontRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETFONTROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setFontRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setTextAlignmentRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETTEXTALIGNMENTROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setTextAlignmentRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setBackgroundRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETBACKGROUNDROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setBackgroundRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setForegroundRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETFOREGROUNDROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setForegroundRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

// cabealho horizontal

/*
void setHorizontalHeaderDisplayRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETHORIZONTALHEADERDISPLAYROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setHorizontalHeaderDisplayRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setHorizontalHeaderDecorationRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETHORIZONTALHEADERDECORATIONROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setHorizontalHeaderDecorationRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setHorizontalHeaderFontRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETHORIZONTALHEADERFONTROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setHorizontalHeaderFontRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setHorizontalHeaderTextAlignmentRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETHORIZONTALHEADERTEXTALIGNMENTROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setHorizontalHeaderTextAlignmentRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setHorizontalHeaderBackgroundRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETHORIZONTALHEADERBACKGROUNDROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setHorizontalHeaderBackgroundRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setHorizontalHeaderForegroundRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETHORIZONTALHEADERFOREGROUNDROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setHorizontalHeaderForegroundRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

// cabealho vertical

/*
void setVerticalHeaderDisplayRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETVERTICALHEADERDISPLAYROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setVerticalHeaderDisplayRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setVerticalHeaderDecorationRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETVERTICALHEADERDECORATIONROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setVerticalHeaderDecorationRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setVerticalHeaderFontRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETVERTICALHEADERFONTROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setVerticalHeaderFontRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setVerticalHeaderTextAlignmentRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETVERTICALHEADERTEXTALIGNMENTROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setVerticalHeaderTextAlignmentRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setVerticalHeaderBackgroundRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETVERTICALHEADERBACKGROUNDROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setVerticalHeaderBackgroundRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setVerticalHeaderForegroundRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETVERTICALHEADERFOREGROUNDROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setVerticalHeaderForegroundRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const
*/

/*
QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const
*/

/*
int rowCount( const QModelIndex & parent = QModelIndex() ) const
*/

/*
int columnCount( const QModelIndex & parent = QModelIndex() ) const
*/

/*
void reloadData()
*/
HB_FUNC( HABSTRACTTABLEMODEL_RELOADDATA )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(0) )
    {
#endif
      obj->reloadData();
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

// /*
// QModelIndex createIndex ( int row, int column )
// */
// HB_FUNC( HABSTRACTTABLEMODEL_CREATEINDEX )
// {
//   HAbstractTableModel * obj = (HAbstractTableModel *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
//   if( obj )
//   {
//     QModelIndex * ptr = new QModelIndex( obj->createIndex ( hb_parni(1), hb_parni(2) ) );
//     _qt4xhb_createReturnClass ( ptr, "QMODELINDEX" );  }
// }

#pragma ENDDUMP

/*

  Qt4xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 4

  Copyright (C) 2020 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com>

*/

#include "hbclass.ch"

REQUEST QMODELINDEX

CLASS HAbstractTableModel INHERIT QAbstractTableModel

   DATA self_destruction INIT .F.

   METHOD new
   METHOD delete

   METHOD setRowCountCB
   METHOD setColumnCountCB

   METHOD setDisplayRoleCB
   METHOD setDecorationRoleCB
   METHOD setEditRoleCB
   METHOD setToolTipRoleCB
   METHOD setStatusTipRoleCB
   METHOD setWhatsThisRoleCB
   METHOD setSizeHintRoleCB
   METHOD setFontRoleCB
   METHOD setTextAlignmentRoleCB
   METHOD setBackgroundRoleCB
   METHOD setForegroundRoleCB

   METHOD setHorizontalHeaderDisplayRoleCB
   METHOD setHorizontalHeaderDecorationRoleCB
   METHOD setHorizontalHeaderFontRoleCB
   METHOD setHorizontalHeaderTextAlignmentRoleCB
   METHOD setHorizontalHeaderBackgroundRoleCB
   METHOD setHorizontalHeaderForegroundRoleCB

   METHOD setVerticalHeaderDisplayRoleCB
   METHOD setVerticalHeaderDecorationRoleCB
   METHOD setVerticalHeaderFontRoleCB
   METHOD setVerticalHeaderTextAlignmentRoleCB
   METHOD setVerticalHeaderBackgroundRoleCB
   METHOD setVerticalHeaderForegroundRoleCB

   METHOD reloadData

   DESTRUCTOR destroyObject

END CLASS

METHOD destroyObject() CLASS HAbstractTableModel
   IF ::self_destruction
      ::delete()
   ENDIF
RETURN NIL

CLASS HDBFTableModel INHERIT HAbstractTableModel
END CLASS

CLASS HArrayTableModel INHERIT HAbstractTableModel
END CLASS

#pragma BEGINDUMP

#include <HAbstractTableModel.h>

#include "qt4xhb_common.h"
#include "qt4xhb_macros.h"
#include "qt4xhb_utils.h"
#include "qt4xhb_events.h"
#include "qt4xhb_signals.h"

/*
HAbstractTableModel( QObject * parent = 0 )
*/
HB_FUNC( HABSTRACTTABLEMODEL_NEW )
{
  HAbstractTableModel * o = new HAbstractTableModel( OPQOBJECT(1,0) );
  Qt4xHb::returnNewObject( o, false );
}

/*
virtual ~HAbstractTableModel()
*/
HB_FUNC( HABSTRACTTABLEMODEL_DELETE )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
    Events_disconnect_all_events( obj, true );
    Signals_disconnect_all_signals( obj, true );
    delete obj;
    obj = NULL;
    PHB_ITEM self = hb_stackSelfItem();
    PHB_ITEM ptr = hb_itemPutPtr( NULL, NULL );
    hb_objSendMsg( self, "_pointer", 1, ptr );
    hb_itemRelease( ptr );
  }

  hb_itemReturn( hb_stackSelfItem() );
}

// linhas e colunas

/*
void setRowCountCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETROWCOUNTCB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setRowCountCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setColumnCountCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETCOLUMNCOUNTCB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setColumnCountCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

// clulas

/*
void setDisplayRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETDISPLAYROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setDisplayRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setDecorationRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETDECORATIONROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setDecorationRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setEditRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETEDITROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setEditRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setToolTipRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETTOOLTIPROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setToolTipRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setStatusTipRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETSTATUSTIPROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setStatusTipRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setWhatsThisRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETWHATSTHISROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setWhatsThisRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setSizeHintRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETSIZEHINTROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setSizeHintRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setFontRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETFONTROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setFontRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setTextAlignmentRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETTEXTALIGNMENTROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setTextAlignmentRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setBackgroundRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETBACKGROUNDROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setBackgroundRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setForegroundRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETFOREGROUNDROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setForegroundRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

// cabealho horizontal

/*
void setHorizontalHeaderDisplayRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETHORIZONTALHEADERDISPLAYROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setHorizontalHeaderDisplayRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setHorizontalHeaderDecorationRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETHORIZONTALHEADERDECORATIONROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setHorizontalHeaderDecorationRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setHorizontalHeaderFontRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETHORIZONTALHEADERFONTROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setHorizontalHeaderFontRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setHorizontalHeaderTextAlignmentRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETHORIZONTALHEADERTEXTALIGNMENTROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setHorizontalHeaderTextAlignmentRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setHorizontalHeaderBackgroundRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETHORIZONTALHEADERBACKGROUNDROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setHorizontalHeaderBackgroundRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setHorizontalHeaderForegroundRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETHORIZONTALHEADERFOREGROUNDROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setHorizontalHeaderForegroundRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

// cabealho vertical

/*
void setVerticalHeaderDisplayRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETVERTICALHEADERDISPLAYROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setVerticalHeaderDisplayRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setVerticalHeaderDecorationRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETVERTICALHEADERDECORATIONROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setVerticalHeaderDecorationRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setVerticalHeaderFontRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETVERTICALHEADERFONTROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setVerticalHeaderFontRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setVerticalHeaderTextAlignmentRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETVERTICALHEADERTEXTALIGNMENTROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setVerticalHeaderTextAlignmentRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setVerticalHeaderBackgroundRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETVERTICALHEADERBACKGROUNDROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setVerticalHeaderBackgroundRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setVerticalHeaderForegroundRoleCB( PHB_ITEM block )
*/
HB_FUNC( HABSTRACTTABLEMODEL_SETVERTICALHEADERFOREGROUNDROLECB )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) )
    {
#endif
      obj->setVerticalHeaderForegroundRoleCB( PBLOCKORSYMBOL(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const
*/

/*
QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const
*/

/*
int rowCount( const QModelIndex & parent = QModelIndex() ) const
*/

/*
int columnCount( const QModelIndex & parent = QModelIndex() ) const
*/

/*
void reloadData()
*/
HB_FUNC( HABSTRACTTABLEMODEL_RELOADDATA )
{
  HAbstractTableModel * obj = (HAbstractTableModel *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(0) )
    {
#endif
      obj->reloadData();
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

// /*
// QModelIndex createIndex ( int row, int column )
// */
// HB_FUNC( HABSTRACTTABLEMODEL_CREATEINDEX )
// {
//   HAbstractTableModel * obj = (HAbstractTableModel *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
//   if( obj )
//   {
//     QModelIndex * ptr = new QModelIndex( obj->createIndex ( hb_parni(1), hb_parni(2) ) );
//     _qt4xhb_createReturnClass ( ptr, "QMODELINDEX" );  }
// }

#pragma ENDDUMP


[runtime] Fixes (most contributed by Karl-Heinz Rauscher) for FFirst(), FCount(), FSize()

//
// Copyright (c) XSharp B.V.  All Rights Reserved.
// Licensed under the Apache License, Version 2.0.
// See License.txt in the project root for license information.
//

USING System.Collections.Generic
USING System.IO
USING System.Linq

INTERNAL STATIC CLASS XSharp.FileSearch
    STATIC PRIVATE foundEntries	:= List<OBJECT>{} AS List<OBJECT>
    STATIC PRIVATE enumerator   := NULL AS IEnumerator<OBJECT>
    STATIC PRIVATE currentItem	:= NULL AS OBJECT
    STATIC PRIVATE isAtEnd		:= TRUE AS LOGIC
    CONST timeFormat := "HH:MM:ss" AS STRING

    INTERNAL STATIC METHOD FFCount( filespec AS STRING , attributes AS DWORD ) AS DWORD
        FindFirst(filespec,attributes)
        RETURN (DWORD)foundEntries:Count

    INTERNAL STATIC METHOD FindFirst( filespec AS STRING , attributes AS DWORD ) AS LOGIC
        LOCAL lRet := FALSE AS LOGIC

        TRY

            XSharp.IO.File.clearErrorState()

            // Split filespec in path and mask
            // when path is empty then path is current directory
            // make sure that we only search in the given path
            LOCAL cPath AS STRING
            LOCAL cMask AS STRING
            cPath := Path.GetDirectoryName(filespec)
            cMask := Path.GetFilename(filespec)
            IF String.IsNullOrEmpty(cPath)
                cPath := System.Environment.CurrentDirectory
            ENDIF
            foundEntries:Clear()
            IF attributes == FA_VOLUME
                LOCAL allDrives := DriveInfo.GetDrives() AS DriveInfo[]
                FOREACH drive AS DriveInfo IN allDrives
                    foundEntries:Add(drive)
                NEXT
            ELSE
                LOCAL oDirInfo AS DirectoryInfo
                oDirInfo := DirectoryInfo{cPath}

                LOCAL files := oDirInfo:GetFiles(cMask) AS FileInfo[]
                VAR selectedFiles := FROM FileInfo IN files WHERE ( FileInfo:Attributes & (FileAttributes) (attributes + FA_NORMAL)) != 0 SELECT FileInfo
                FOREACH file AS FileInfo IN files
                    foundEntries:Add(file)
                NEXT

                IF (attributes & FA_DIRECTORY) == FA_DIRECTORY
                    LOCAL directories := oDirInfo:GetDirectories(cMask) AS FileSystemInfo[]
                    VAR selectedDirs := FROM DirectoryInfo IN directories WHERE (DirectoryInfo:Attributes & (FileAttributes) (attributes + FA_NORMAL) ) != 0 SELECT DirectoryInfo
                    FOREACH directory AS DirectoryInfo IN selectedDirs
                        foundEntries:Add(directory)
                    NEXT
                ENDIF
            ENDIF
            enumerator := foundEntries:GetEnumerator()
            enumerator:Reset()
            isAtEnd := !enumerator:MoveNext()
            IF  !isAtEnd
                currentItem := enumerator:Current
            ENDIF
            lRet := foundEntries:Count > 0

        CATCH oEx AS Exception

            XSharp.IO.File.setErrorState(oEx)
            lRet := FALSE

        END TRY

    RETURN lRet

    INTERNAL STATIC METHOD FindNext() AS LOGIC
        IF !isAtEnd
            isAtEnd := !enumerator:MoveNext()
            IF !isAtEnd
                currentItem := enumerator:Current
            ENDIF
        ENDIF
        RETURN isAtEnd

    INTERNAL STATIC METHOD FName() AS STRING
        LOCAL name := "" AS STRING
        IF !isAtEnd
            IF (currentItem IS DriveInfo)
                name := ((DriveInfo)currentItem):Name
            ELSEIF (currentItem IS FileInfo)
                name := ((FileInfo)currentItem):Name
            ELSEIF (currentItem IS DirectoryInfo)
                name := ((DirectoryInfo) currentItem):Name
            ENDIF
        ENDIF
        RETURN name

    INTERNAL STATIC METHOD FSize() AS DWORD
        LOCAL size := 0 AS INT
        IF !isAtEnd
            IF currentItem IS DriveInfo
                IF ((DriveInfo) currentItem):IsReady
                    size := (INT)((DriveInfo) currentItem):TotalSize
                ENDIF
            ELSEIF (currentItem IS FileInfo)
                size := (INT)((FileInfo)currentItem):Length
            ELSEIF currentItem IS DirectoryInfo
                size := (INT)((DirectoryInfo) currentItem):GetFileSystemInfos().LongLength
            ENDIF
        ENDIF
        RETURN (DWORD) size

    INTERNAL STATIC METHOD FTime() AS STRING
        LOCAL time := "00:00:00" AS STRING
        IF !isAtEnd
            IF (currentItem IS FileInfo)
                time := ((FileInfo)currentItem):LastWriteTime.ToString(timeFormat)
            ELSEIF currentItem IS DirectoryInfo
                time := ((DirectoryInfo) currentItem):LastWriteTime.ToString(timeFormat)
            ENDIF
        ENDIF
        RETURN  time

    INTERNAL STATIC METHOD FDate() AS DateTime
        LOCAL time := DateTime.MinValue AS DateTime
        IF !isAtEnd
            IF (currentItem IS FileInfo)
                time := ((FileInfo)currentItem):LastWriteTime
            ELSEIF currentItem IS DirectoryInfo
                time := ((DirectoryInfo) currentItem):LastWriteTime
            ENDIF
        ENDIF
        RETURN  time

    INTERNAL STATIC METHOD FAttrib() AS DWORD
        LOCAL attributes := 0x00000008 AS INT
        IF !isAtEnd
            IF (currentItem IS FileInfo)
                attributes := (INT)((FileInfo)currentItem):Attributes
            ELSEIF currentItem IS DirectoryInfo
                attributes := (INT)((DirectoryInfo) currentItem):Attributes
            ENDIF
        ENDIF
        RETURN  (DWORD)attributes

        END CLASS
/// <summary>
/// Return the number of files that match a given file specification and attribute.
/// </summary>
/// <param name="cFile"></param>
/// <param name="nAttr"></param>
/// <returns>The number of files that match a given file specification and attribute.
/// </returns>
FUNCTION FFCount(cFile AS STRING,nAttr AS DWORD) AS DWORD
    RETURN XSharp.FileSearch.FFCount(cFile,nAttr)

    /// <summary>
    /// Find the first file that matches a given file specification or attribute.
    /// </summary>
    /// <param name="cFile"></param>
    /// <param name="nAttr"></param>
    /// <returns>The first file that matches a given file specification or attribute.
    /// </returns>
FUNCTION FFirst(cFile AS STRING,nAttr AS DWORD) AS LOGIC
    RETURN XSharp.FileSearch.FindFirst(cFile,nAttr)
    /// <summary>
    /// Determine the attributes of the file found after FFCount(), FFirst(), or FNext().
    /// </summary>
    /// <returns>The attributes of the file found after FFCount(), FFirst(), or FNext().
    /// </returns>
FUNCTION FAttrib() AS DWORD
    RETURN XSharp.FileSearch.FAttrib()

    /// <summary>
    /// Return the Date stamp of the file found by FFCount(), FFirst(), or FNext().
    /// </summary>
    /// <returns>The Date stamp of the file found by FFCount(), FFirst(), or FNext().
    /// </returns>
FUNCTION FDate() AS DateTime
    RETURN XSharp.FileSearch.FDate()

    /// <summary>
    /// Return the name of the file found by FFCount(), FFirst(), or FNext().
    /// </summary>
    /// <returns>
    /// </returns>
FUNCTION FName() AS STRING
    RETURN XSharp.FileSearch.FName()

    /// <summary>
    /// Find the next file that matches the file previously found by FFirst().
    /// </summary>
    /// <returns>TRUE when a next file is found. Otherwise FALSE.
    /// </returns>
FUNCTION FNext() AS LOGIC
    RETURN XSharp.FileSearch.FindNext()

    /// <summary>
    /// Return the size of the file found by FFCount(), FFirst(), or FNext().
    /// </summary>
    /// <returns>The size of the file found by FFCount(), FFirst(), or FNext().
    /// </returns>
FUNCTION FSize() AS DWORD
    RETURN XSharp.FileSearch.FSize()
    /// <summary>
    /// Return the time stamp of the file found by FFCount(), FFirst(), or FNext().
    /// </summary>
    /// <returns>The time stamp of the file found by FFCount(), FFirst(), or FNext().
    /// </returns>
FUNCTION FTime() AS STRING
    RETURN XSharp.FileSearch.FTime()

    /// <summary>
    /// Determine if any file matches a given file specification.
    /// </summary>
    /// <param name="cFile">The name oif the file</param>
    /// <returns>
    /// True if the file exists, otherwise false
    /// </returns>
FUNCTION File(cFile AS STRING) AS LOGIC
    LOCAL lFound AS LOGIC
    LOCAL lHasWildCards AS LOGIC
    LOCAL aPaths AS STRING[]
    LOCAL cTemp AS STRING
    LOCAL lFirst AS LOGIC
    IF String.IsNullOrEmpty(cFile)
        RETURN FALSE
    ENDIF
    lHasWildCards := cFile:IndexOfAny( <CHAR>{ '*', '?' } ) > 0
    XSharp.IO.File.LastFound := ""
    IF ! lHasWildCards
        lFound := System.IO.File.Exists(cFile)
        IF lFound
            XSharp.IO.File.LastFound := Path.GetFullPath( cFile )
            RETURN TRUE
        ENDIF
        aPaths := __GetSearchPaths()
        lFirst := TRUE
        FOREACH cPath AS STRING IN aPaths
            cTemp := System.IO.Path.Combine(cPath, cFile)
            IF lFirst
                // store the first path that we looked in even when the file is not found
                // to be compatible with VO
                XSharp.IO.File.LastFound := cTemp
                lFirst := FALSE
            ENDIF
            lFound := System.IO.File.Exists(cTemp)
            IF lFound
                XSharp.IO.File.LastFound := cTemp
                RETURN TRUE
            ENDIF
        NEXT
    ELSE
        // wildcard, so use Directory.GetFiles()
        LOCAL files     AS STRING[]

        IF Path.IsPathRooted(cFile)
            files := Directory.GetFiles( Path.GetDirectoryName( cFile ), Path.GetFileName( cFile ) )
            IF files:Length > 0
                XSharp.IO.File.LastFound := files[1]
                RETURN TRUE
            ELSE
                // store the first path that we looked in even when the file is not found
                // to be compatible with VO
                XSharp.IO.File.LastFound := cFile
                RETURN FALSE
            ENDIF
        ELSE
            // Look in current directory first and if that fails through the whole normal search list
            IF __FileHelper(Environment.CurrentDirectory, cFile, FALSE )
                RETURN TRUE
            ENDIF
            aPaths := __GetSearchPaths()
            lFirst := TRUE
            FOREACH cPath AS STRING IN aPaths
                IF __FileHelper(cPath, cFile, lFirst )
                    RETURN TRUE
                ENDIF
                lFirst := FALSE
            NEXT
        ENDIF
    ENDIF
    RETURN FALSE
    /// <summary>
    /// Return the name and path of the file that was used by FXOpen() or File().
    /// </summary>
    /// <returns>
    /// </returns>
FUNCTION FPathName() AS STRING

    RETURN XSharp.IO.File.LastFound

INTERNAL FUNCTION __FileHelper(cPath AS STRING, cFileSpec AS STRING, lSavePath AS LOGIC) AS LOGIC
    LOCAL cTemp AS STRING
    LOCAL cFile AS STRING
    LOCAL files AS STRING[]
    IF ! System.IO.Directory.Exists(cPath)
        RETURN FALSE
    ENDIF
    cTemp := System.IO.Path.Combine(cPath, cFileSpec)
    cPath := System.IO.Path.GetDirectoryName(cTemp)
    cFile := System.IO.Path.GetFileName(cTemp)
    IF ! System.IO.Directory.Exists(cPath)
        RETURN FALSE
    ENDIF
    files := System.IO.Directory.GetFiles(cPath, cFile)
    IF files:Length > 0
        XSharp.IO.File.LastFound := files[0]
    ELSEIF lSavePath
        XSharp.IO.File.LastFound := cTemp
    ENDIF
    RETURN files:Length > 0

INTERNAL FUNCTION __GetSearchPaths() AS STRING[]
// Not found, now use the path settings from SetDefault and SetPath()
// if SetPath() is empty then we look through the Environment variable Path
LOCAL aDefault AS STRING[]
aDefault := SetPathArray()
IF aDefault != NULL
    RETURN aDefault
ENDIF

VAR aPaths := List<STRING>{}
VAR cPath  := SetDefault()
IF !String.IsNullOrEmpty(cPath)
    aPaths:Add(cPath)
ENDIF
cPath := SetPath()
IF String.IsNullOrEmpty(cPath)
    cPath := GetEnv("PATH")
ENDIF
IF !String.IsNullOrEmpty(cPath)
    VAR aElements := cPath:Split(<CHAR>{ ';' }, StringSplitOptions.RemoveEmptyEntries )
    aPaths:AddRange(aElements)
ENDIF
aDefault := aPaths:ToArray()
SetPathArray(aDefault)
RETURN aDefault

//
// Copyright (c) XSharp B.V.  All Rights Reserved.
// Licensed under the Apache License, Version 2.0.
// See License.txt in the project root for license information.
//

USING System.Collections.Generic
USING System.IO
USING System.Linq

INTERNAL STATIC CLASS XSharp.FileSearch
    STATIC PRIVATE foundEntries	:= List<OBJECT>{} AS List<OBJECT>
    STATIC PRIVATE enumerator   := NULL AS IEnumerator<OBJECT>
    STATIC PRIVATE currentItem	:= NULL AS OBJECT
    STATIC PRIVATE isAtEnd		:= TRUE AS LOGIC
    CONST timeFormat := "HH:MM:ss" AS STRING

    INTERNAL STATIC METHOD FFCount( filespec AS STRING , attributes AS DWORD ) AS DWORD
        FindFirst(filespec,attributes)
        RETURN (DWORD)foundEntries:Count

    INTERNAL STATIC METHOD FindFirst( filespec AS STRING , attributes AS DWORD ) AS LOGIC
        // Split filespec in path and mask
        // when path is empty then path is current directory
        // make sure that we only search in the given path
        LOCAL cPath AS STRING
        LOCAL cMask AS STRING
        cPath := Path.GetDirectoryName(filespec)
        cMask := Path.GetFilename(filespec)
        IF String.IsNullOrEmpty(cPath)
            cPath := System.Environment.CurrentDirectory
        ENDIF
        foundEntries:Clear()
        IF attributes == FA_VOLUME
            LOCAL allDrives := DriveInfo.GetDrives() AS DriveInfo[]
            FOREACH drive AS DriveInfo IN allDrives
                foundEntries:Add(drive)
            NEXT
        ELSE
            LOCAL oDirInfo AS DirectoryInfo
            oDirInfo := DirectoryInfo{cPath}
            IF (attributes & FA_DIRECTORY) == FA_DIRECTORY
                LOCAL directories := oDirInfo:GetDirectories(cMask) AS FileSystemInfo[]
                attributes -= (INT) FA_DIRECTORY
                attributes += (INT) FA_NORMAL
                VAR selectedDirs := FROM DirectoryInfo IN directories WHERE (DirectoryInfo:Attributes & (FileAttributes) attributes ) != 0 SELECT DirectoryInfo
                FOREACH directory AS DirectoryInfo IN selectedDirs
                    foundEntries:Add(directory)
                NEXT
            ELSE
                attributes += (INT) FA_NORMAL
                LOCAL files := oDirInfo:GetFiles(filespec) AS FileInfo[]
                VAR selectedFiles := FROM FileInfo IN files WHERE ( FileInfo:Attributes & (FileAttributes) attributes) != 0 SELECT FileInfo
                FOREACH file AS FileInfo IN files
                    foundEntries:Add(file)
                NEXT
            ENDIF
        ENDIF
        enumerator := foundEntries:GetEnumerator()
        enumerator:Reset()
        isAtEnd := !enumerator:MoveNext()
        IF  !isAtEnd
            currentItem := enumerator:Current
        ENDIF
        RETURN (foundEntries:Count > 0)

    INTERNAL STATIC METHOD FindNext() AS LOGIC
        IF !isAtEnd
            isAtEnd := enumerator:MoveNext()
            IF !isAtEnd
                currentItem := enumerator:Current
            ENDIF
        ENDIF
        RETURN isAtEnd

    INTERNAL STATIC METHOD FName() AS STRING
        LOCAL name := "" AS STRING
        IF !isAtEnd
            IF (currentItem IS DriveInfo)
                name := ((DriveInfo)currentItem):Name
            ELSEIF (currentItem IS FileInfo)
                name := ((FileInfo)currentItem):Name
            ELSEIF (currentItem IS DirectoryInfo)
                name := ((DirectoryInfo) currentItem):Name
            ENDIF
        ENDIF
        RETURN name

    INTERNAL STATIC METHOD FSize() AS DWORD
        LOCAL size := 0 AS INT
        IF !isAtEnd
            IF currentItem IS DriveInfo
                size := (INT)((DriveInfo) currentItem):TotalSize
            ELSEIF (currentItem IS FileInfo)
                size := (INT)((FileInfo)currentItem):Length
            ELSEIF currentItem IS DirectoryInfo
                size := (INT)((DirectoryInfo) currentItem):GetFileSystemInfos().LongLength
            ENDIF
        ENDIF
        RETURN (DWORD) size

    INTERNAL STATIC METHOD FTime() AS STRING
        LOCAL time := "00:00:00" AS STRING
        IF !isAtEnd
            IF (currentItem IS FileInfo)
                time := ((FileInfo)currentItem):LastWriteTime.ToString(timeFormat)
            ELSEIF currentItem IS DirectoryInfo
                time := ((DirectoryInfo) currentItem):LastWriteTime.ToString(timeFormat)
            ENDIF
        ENDIF
        RETURN  time

    INTERNAL STATIC METHOD FDate() AS DateTime
        LOCAL time := DateTime.MinValue AS DateTime
        IF !isAtEnd
            IF (currentItem IS FileInfo)
                time := ((FileInfo)currentItem):LastWriteTime
            ELSEIF currentItem IS DirectoryInfo
                time := ((DirectoryInfo) currentItem):LastWriteTime
            ENDIF
        ENDIF
        RETURN  time

    INTERNAL STATIC METHOD FAttrib() AS DWORD
        LOCAL attributes := 0x00000008 AS INT
        IF !isAtEnd
            IF (currentItem IS FileInfo)
                attributes := (INT)((FileInfo)currentItem):Attributes
            ELSEIF currentItem IS DirectoryInfo
                attributes := (INT)((DirectoryInfo) currentItem):Attributes
            ENDIF
        ENDIF
        RETURN  (DWORD)attributes

        END CLASS
/// <summary>
/// Return the number of files that match a given file specification and attribute.
/// </summary>
/// <param name="cFile"></param>
/// <param name="nAttr"></param>
/// <returns>The number of files that match a given file specification and attribute.
/// </returns>
FUNCTION FFCount(cFile AS STRING,nAttr AS DWORD) AS DWORD
    RETURN XSharp.FileSearch.FFCount(cFile,nAttr)

    /// <summary>
    /// Find the first file that matches a given file specification or attribute.
    /// </summary>
    /// <param name="cFile"></param>
    /// <param name="nAttr"></param>
    /// <returns>The first file that matches a given file specification or attribute.
    /// </returns>
FUNCTION FFirst(cFile AS STRING,nAttr AS DWORD) AS LOGIC
    RETURN XSharp.FileSearch.FindFirst(cFile,nAttr)
    /// <summary>
    /// Determine the attributes of the file found after FFCount(), FFirst(), or FNext().
    /// </summary>
    /// <returns>The attributes of the file found after FFCount(), FFirst(), or FNext().
    /// </returns>
FUNCTION FAttrib() AS DWORD
    RETURN XSharp.FileSearch.FAttrib()

    /// <summary>
    /// Return the Date stamp of the file found by FFCount(), FFirst(), or FNext().
    /// </summary>
    /// <returns>The Date stamp of the file found by FFCount(), FFirst(), or FNext().
    /// </returns>
FUNCTION FDate() AS DateTime
    RETURN XSharp.FileSearch.FDate()

    /// <summary>
    /// Return the name of the file found by FFCount(), FFirst(), or FNext().
    /// </summary>
    /// <returns>
    /// </returns>
FUNCTION FName() AS STRING
    RETURN XSharp.FileSearch.FName()

    /// <summary>
    /// Find the next file that matches the file previously found by FFirst().
    /// </summary>
    /// <returns>TRUE when a next file is found. Otherwise FALSE.
    /// </returns>
FUNCTION FNext() AS LOGIC
    RETURN XSharp.FileSearch.FindNext()

    /// <summary>
    /// Return the size of the file found by FFCount(), FFirst(), or FNext().
    /// </summary>
    /// <returns>The size of the file found by FFCount(), FFirst(), or FNext().
    /// </returns>
FUNCTION FSize() AS DWORD
    RETURN XSharp.FileSearch.FSize()
    /// <summary>
    /// Return the time stamp of the file found by FFCount(), FFirst(), or FNext().
    /// </summary>
    /// <returns>The time stamp of the file found by FFCount(), FFirst(), or FNext().
    /// </returns>
FUNCTION FTime() AS STRING
    RETURN XSharp.FileSearch.FTime()

    /// <summary>
    /// Determine if any file matches a given file specification.
    /// </summary>
    /// <param name="cFile">The name oif the file</param>
    /// <returns>
    /// True if the file exists, otherwise false
    /// </returns>
FUNCTION File(cFile AS STRING) AS LOGIC
    LOCAL lFound AS LOGIC
    LOCAL lHasWildCards AS LOGIC
    LOCAL aPaths AS STRING[]
    LOCAL cTemp AS STRING
    LOCAL lFirst AS LOGIC
    IF String.IsNullOrEmpty(cFile)
        RETURN FALSE
    ENDIF
    lHasWildCards := cFile:IndexOfAny( <CHAR>{ '*', '?' } ) > 0
    XSharp.IO.File.LastFound := ""
    IF ! lHasWildCards
        lFound := System.IO.File.Exists(cFile)
        IF lFound
            XSharp.IO.File.LastFound := Path.GetFullPath( cFile )
            RETURN TRUE
        ENDIF
        aPaths := __GetSearchPaths()
        lFirst := TRUE
        FOREACH cPath AS STRING IN aPaths
            cTemp := System.IO.Path.Combine(cPath, cFile)
            IF lFirst
                // store the first path that we looked in even when the file is not found
                // to be compatible with VO
                XSharp.IO.File.LastFound := cTemp
                lFirst := FALSE
            ENDIF
            lFound := System.IO.File.Exists(cTemp)
            IF lFound
                XSharp.IO.File.LastFound := cTemp
                RETURN TRUE
            ENDIF
        NEXT
    ELSE
        // wildcard, so use Directory.GetFiles()
        LOCAL files     AS STRING[]

        IF Path.IsPathRooted(cFile)
            files := Directory.GetFiles( Path.GetDirectoryName( cFile ), Path.GetFileName( cFile ) )
            IF files:Length > 0
                XSharp.IO.File.LastFound := files[1]
                RETURN TRUE
            ELSE
                // store the first path that we looked in even when the file is not found
                // to be compatible with VO
                XSharp.IO.File.LastFound := cFile
                RETURN FALSE
            ENDIF
        ELSE
            // Look in current directory first and if that fails through the whole normal search list
            IF __FileHelper(Environment.CurrentDirectory, cFile, FALSE )
                RETURN TRUE
            ENDIF
            aPaths := __GetSearchPaths()
            lFirst := TRUE
            FOREACH cPath AS STRING IN aPaths
                IF __FileHelper(cPath, cFile, lFirst )
                    RETURN TRUE
                ENDIF
                lFirst := FALSE
            NEXT
        ENDIF
    ENDIF
    RETURN FALSE
    /// <summary>
    /// Return the name and path of the file that was used by FXOpen() or File().
    /// </summary>
    /// <returns>
    /// </returns>
FUNCTION FPathName() AS STRING

    RETURN XSharp.IO.File.LastFound

INTERNAL FUNCTION __FileHelper(cPath AS STRING, cFileSpec AS STRING, lSavePath AS LOGIC) AS LOGIC
    LOCAL cTemp AS STRING
    LOCAL cFile AS STRING
    LOCAL files AS STRING[]
    IF ! System.IO.Directory.Exists(cPath)
        RETURN FALSE
    ENDIF
    cTemp := System.IO.Path.Combine(cPath, cFileSpec)
    cPath := System.IO.Path.GetDirectoryName(cTemp)
    cFile := System.IO.Path.GetFileName(cTemp)
    IF ! System.IO.Directory.Exists(cPath)
        RETURN FALSE
    ENDIF
    files := System.IO.Directory.GetFiles(cPath, cFile)
    IF files:Length > 0
        XSharp.IO.File.LastFound := files[0]
    ELSEIF lSavePath
        XSharp.IO.File.LastFound := cTemp
    ENDIF
    RETURN files:Length > 0

INTERNAL FUNCTION __GetSearchPaths() AS STRING[]
// Not found, now use the path settings from SetDefault and SetPath()
// if SetPath() is empty then we look through the Environment variable Path
LOCAL aDefault AS STRING[]
aDefault := SetPathArray()
IF aDefault != NULL
    RETURN aDefault
ENDIF

VAR aPaths := List<STRING>{}
VAR cPath  := SetDefault()
IF !String.IsNullOrEmpty(cPath)
    aPaths:Add(cPath)
ENDIF
cPath := SetPath()
IF String.IsNullOrEmpty(cPath)
    cPath := GetEnv("PATH")
ENDIF
IF !String.IsNullOrEmpty(cPath)
    VAR aElements := cPath:Split(<CHAR>{ ';' }, StringSplitOptions.RemoveEmptyEntries )
    aPaths:AddRange(aElements)
ENDIF
aDefault := aPaths:ToArray()
SetPathArray(aDefault)
RETURN aDefault


QtWebChannel: module updated

QtWebChannel: module updated

Modified:
source/QtWebChannel/QQmlWebChannel.prg

/*

  Qt5xHb - bibliotecas de ligao entre Harbour/xHarbour e Qt Framework 5

  Copyright (C) 2017 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com>

*/

#include "hbclass.ch"

#ifndef QT5XHB_NO_REQUESTS
REQUEST QQMLLISTPROPERTY<QOBJECT>
REQUEST QQMLWEBCHANNELATTACHED
#endif

CLASS QQmlWebChannel INHERIT QWebChannel

   METHOD new
   METHOD delete
   METHOD registerObjects
   METHOD registeredObjects
   METHOD transports
   METHOD qmlAttachedProperties
   METHOD connectTo
   METHOD disconnectFrom

   DESTRUCTOR destroyObject

END CLASS

PROCEDURE destroyObject () CLASS QQmlWebChannel
   IF ::self_destruction
      ::delete()
   ENDIF
RETURN

#pragma BEGINDUMP

#include <Qt>

#ifndef __XHARBOUR__
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
#include <QQmlWebChannel>
#endif
#endif

#include "qt5xhb_common.h"
#include "qt5xhb_macros.h"
#include "qt5xhb_utils.h"

#ifdef __XHARBOUR__
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
#include <QQmlWebChannel>
#endif
#endif

/*
explicit QQmlWebChannel(QObject *parent = 0)
*/
HB_FUNC_STATIC( QQMLWEBCHANNEL_NEW )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QQmlWebChannel * o = new QQmlWebChannel ( OPQOBJECT(1,0) );
  _qt5xhb_storePointerAndFlag( o, false );
#endif
}

HB_FUNC_STATIC( QQMLWEBCHANNEL_DELETE )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QQmlWebChannel * obj = (QQmlWebChannel *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    delete obj;
    obj = NULL;
    PHB_ITEM self = hb_stackSelfItem();
    PHB_ITEM ptr = hb_itemPutPtr( NULL, NULL );
    hb_objSendMsg( self, "_pointer", 1, ptr );
    hb_itemRelease( ptr );
  }
  hb_itemReturn( hb_stackSelfItem() );
#endif
}

/*
Q_INVOKABLE void registerObjects(const QVariantMap &objects)
*/
HB_FUNC_STATIC( QQMLWEBCHANNEL_REGISTEROBJECTS )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QQmlWebChannel * obj = (QQmlWebChannel *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->registerObjects ();
  }
  hb_itemReturn( hb_stackSelfItem() );
#endif
}

/*
QQmlListProperty<QObject> registeredObjects()
*/
HB_FUNC_STATIC( QQMLWEBCHANNEL_REGISTEREDOBJECTS )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QQmlWebChannel * obj = (QQmlWebChannel *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QQmlListProperty<QObject> * ptr = new QQmlListProperty<QObject>( obj->registeredObjects () );
    _qt5xhb_createReturnClass ( ptr, "QQMLLISTPROPERTY<QOBJECT>" );
  }
#endif
}

/*
QQmlListProperty<QObject> transports()
*/
HB_FUNC_STATIC( QQMLWEBCHANNEL_TRANSPORTS )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QQmlWebChannel * obj = (QQmlWebChannel *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QQmlListProperty<QObject> * ptr = new QQmlListProperty<QObject>( obj->transports () );
    _qt5xhb_createReturnClass ( ptr, "QQMLLISTPROPERTY<QOBJECT>" );
  }
#endif
}

/*
static QQmlWebChannelAttached *qmlAttachedProperties(QObject *obj)
*/
HB_FUNC_STATIC( QQMLWEBCHANNEL_QMLATTACHEDPROPERTIES )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QQmlWebChannelAttached * ptr = QQmlWebChannel::qmlAttachedProperties ( PQOBJECT(1) );
  _qt5xhb_createReturnClass ( ptr, "QQMLWEBCHANNELATTACHED" );
#endif
}

/*
Q_INVOKABLE void connectTo(QObject *transport)
*/
HB_FUNC_STATIC( QQMLWEBCHANNEL_CONNECTTO )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QQmlWebChannel * obj = (QQmlWebChannel *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->connectTo ( PQOBJECT(1) );
  }
  hb_itemReturn( hb_stackSelfItem() );
#endif
}

/*
Q_INVOKABLE void disconnectFrom(QObject *transport)
*/
HB_FUNC_STATIC( QQMLWEBCHANNEL_DISCONNECTFROM )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QQmlWebChannel * obj = (QQmlWebChannel *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->disconnectFrom ( PQOBJECT(1) );
  }
  hb_itemReturn( hb_stackSelfItem() );
#endif
}

#pragma ENDDUMP

/*

  Qt5xHb - bibliotecas de ligao entre Harbour/xHarbour e Qt Framework 5

  Copyright (C) 2017 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com>

*/

#include "hbclass.ch"

#ifndef QT5XHB_NO_REQUESTS
REQUEST QQMLLISTPROPERTY<QOBJECT>
REQUEST QQMLWEBCHANNELATTACHED
#endif

CLASS QQmlWebChannel INHERIT QWebChannel

   DATA self_destruction INIT .F.

   METHOD new
   METHOD delete
   METHOD registerObjects
   METHOD registeredObjects
   METHOD transports
   METHOD qmlAttachedProperties
   METHOD connectTo
   METHOD disconnectFrom

   DESTRUCTOR destroyObject

END CLASS

PROCEDURE destroyObject () CLASS QQmlWebChannel
   IF ::self_destruction
      ::delete()
   ENDIF
RETURN

#pragma BEGINDUMP

#include <Qt>

#ifndef __XHARBOUR__
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
#include <QQmlWebChannel>
#endif
#endif

#include "qt5xhb_common.h"
#include "qt5xhb_macros.h"
#include "qt5xhb_utils.h"

#ifdef __XHARBOUR__
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
#include <QQmlWebChannel>
#endif
#endif

/*
explicit QQmlWebChannel(QObject *parent = 0)
*/
HB_FUNC_STATIC( QQMLWEBCHANNEL_NEW )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QQmlWebChannel * o = new QQmlWebChannel ( OPQOBJECT(1,0) );
  _qt5xhb_storePointerAndFlag( o, false );
#endif
}

HB_FUNC_STATIC( QQMLWEBCHANNEL_DELETE )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QQmlWebChannel * obj = (QQmlWebChannel *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    delete obj;
    obj = NULL;
    PHB_ITEM self = hb_stackSelfItem();
    PHB_ITEM ptr = hb_itemPutPtr( NULL, NULL );
    hb_objSendMsg( self, "_pointer", 1, ptr );
    hb_itemRelease( ptr );
  }
  hb_itemReturn( hb_stackSelfItem() );
#endif
}

/*
Q_INVOKABLE void registerObjects(const QVariantMap &objects)
*/
HB_FUNC_STATIC( QQMLWEBCHANNEL_REGISTEROBJECTS )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QQmlWebChannel * obj = (QQmlWebChannel *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->registerObjects ();
  }
  hb_itemReturn( hb_stackSelfItem() );
#endif
}

/*
QQmlListProperty<QObject> registeredObjects()
*/
HB_FUNC_STATIC( QQMLWEBCHANNEL_REGISTEREDOBJECTS )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QQmlWebChannel * obj = (QQmlWebChannel *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QQmlListProperty<QObject> * ptr = new QQmlListProperty<QObject>( obj->registeredObjects () );
    _qt5xhb_createReturnClass ( ptr, "QQMLLISTPROPERTY<QOBJECT>" );
  }
#endif
}

/*
QQmlListProperty<QObject> transports()
*/
HB_FUNC_STATIC( QQMLWEBCHANNEL_TRANSPORTS )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QQmlWebChannel * obj = (QQmlWebChannel *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QQmlListProperty<QObject> * ptr = new QQmlListProperty<QObject>( obj->transports () );
    _qt5xhb_createReturnClass ( ptr, "QQMLLISTPROPERTY<QOBJECT>" );
  }
#endif
}

/*
static QQmlWebChannelAttached *qmlAttachedProperties(QObject *obj)
*/
HB_FUNC_STATIC( QQMLWEBCHANNEL_QMLATTACHEDPROPERTIES )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QQmlWebChannelAttached * ptr = QQmlWebChannel::qmlAttachedProperties ( PQOBJECT(1) );
  _qt5xhb_createReturnClass ( ptr, "QQMLWEBCHANNELATTACHED" );
#endif
}

/*
Q_INVOKABLE void connectTo(QObject *transport)
*/
HB_FUNC_STATIC( QQMLWEBCHANNEL_CONNECTTO )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QQmlWebChannel * obj = (QQmlWebChannel *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->connectTo ( PQOBJECT(1) );
  }
  hb_itemReturn( hb_stackSelfItem() );
#endif
}

/*
Q_INVOKABLE void disconnectFrom(QObject *transport)
*/
HB_FUNC_STATIC( QQMLWEBCHANNEL_DISCONNECTFROM )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QQmlWebChannel * obj = (QQmlWebChannel *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->disconnectFrom ( PQOBJECT(1) );
  }
  hb_itemReturn( hb_stackSelfItem() );
#endif
}

#pragma ENDDUMP