' Classes/System/Drawing/StringFormat.ab

Namespace System
Namespace Drawing

Function GetNativeStringFormat(sf As StringFormat) As *GpStringFormat
	If ActiveBasic.IsNothing(sf) Then
		GetNativeStringFormat = 0
	Else
		GetNativeStringFormat = sf.NativeFormat
	End If
End Function

Class StringFormat
	Implements IDisposable, ICloneable
Public
	Sub StringFormat(native As *GpStringFormat)
		nativeFormat = native
	End Sub

	Sub StringFormat() 'Žb’è
		SetStatus(GdipCreateStringFormat(0, LANG_NEUTRAL, nativeFormat))
	End Sub

	Sub StringFormat(formatFlags /*= 0*/ As StringFormatFlags, language = LANG_NEUTRAL As LANGID)
		SetStatus(GdipCreateStringFormat(formatFlags, language, nativeFormat))
	End Sub

	Sub StringFormat(format As StringFormat)
		SetStatus(GdipCloneStringFormat(GetNativeStringFormat(format), nativeFormat))
	End Sub

	Static Function GenericDefault() As StringFormat
		Dim native As *GpStringFormat
		SetStatus(GdipStringFormatGetGenericTypographic(native))
		GenericDefault = New StringFormat(native)
	End Function

	Static Function GenericTypographic() As StringFormat
		Dim native As *GpStringFormat
		SetStatus(GdipStringFormatGetGenericTypographic(native))
		GenericTypographic = New StringFormat(native)
	End Function

	Function Clone() As StringFormat
		Dim clonedStringFormat As *GpStringFormat
		SetStatus(GdipCloneStringFormat(nativeFormat, clonedStringFormat))
		Clone = New StringFormat(clonedStringFormat)
	End Function

	Sub Dispose()
		GdipDeleteStringFormat(nativeFormat)
		nativeFormat = 0
	End Sub

	Sub ~StringFormat()
		Dispose()
	End Sub

	Sub FormatFlags(align As StringFormatFlags)
		SetStatus(GdipSetStringFormatFlags(nativeFormat, align))
	End Sub
/*
	Function FormatFlags() As StringFormatFlags
		Dim flags As Long
		SetStatus(GdipGetStringFormatFlags(nativeFormat, flags))
		FormatFlags = flags As StringFormatFlags
	End Function
*/
	Sub Alignment(align As StringAlignment)
		SetStatus(GdipSetStringFormatAlign(nativeFormat, align))
	End Sub
/*
	Function Alignment() As StringAlignment
		SetStatus(GdipGetStringFormatAlign(nativeFormat, Alignment))
	End Function
*/
	Sub LineAlignment(align As StringAlignment)
		SetStatus(GdipSetStringFormatLineAlign(nativeFormat, align))
	End Sub
/*
	Function LineAlignment() As StringAlignment
		SetStatus(GdipGetStringFormatLineAlign(nativeFormat, LineAlignment))
	End Function
*/
	Sub SetHotkeyPrefix(hotkeyPrefix As Text.HotkeyPrefix)
		SetStatus(GdipSetStringFormatHotkeyPrefix(nativeFormat, hotkeyPrefix As Long))
	End Sub
/*
	Function HotkeyPrefix() As Text.HotkeyPrefix
		SetStatus(GdipGetStringFormatHotkeyPrefix(nativeFormat, ByVal hotkeyPrefix As *Long))
	End Function
*/
	'SetTabStops - GdipSetStringFormatTabStops
	'GetTabStops - GdipGetStringFormatTabStops/GetTabStopCount

	Sub SetDigitSubstitution(language As LANGID, substitute As StringDigitSubstitute)
		SetStatus(GdipSetStringFormatDigitSubstitution(nativeFormat, language, substitute))
	End Sub

	Function DigitSubstitutionLanguage() As LANGID
		SetStatus(GdipGetStringFormatDigitSubstitution(nativeFormat, DigitSubstitutionLanguage, ByVal NULL))
	End Function
/*
	Function DigitSubstitutionMethod() As StringDigitSubstitute
		SetStatus(GdipGetStringFormatDigitSubstitution(nativeFormat, NULL, DigitSubstitutionMethod))
	End Function
*/
	Sub Trimming(trimming As StringTrimming)
		SetStatus(GdipSetStringFormatTrimming(nativeFormat, trimming))
	End Sub
/*
	Function Trimming() As StringTrimming
		SetStatus(GdipGetStringFormatTrimming(nativeFormat, StringTrimming))
	End Function
*/
	' SetMeasurableCharacterRanges - GdipSetStringFormatMeasurableCharacterRanges

	Function NativeFormat() As *GpStringFormat
		NativeFormat = nativeFormat
	End Function

Private
	nativeFormat As *GpStringFormat
End Class

End Namespace
End Namespace
