Changeset 137 for Include/Classes/System


Ignore:
Timestamp:
Mar 7, 2007, 5:36:31 PM (18 years ago)
Author:
イグトランス (egtra)
Message:

#55#73#75とりあえず完了

Location:
Include/Classes/System/Drawing
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Include/Classes/System/Drawing/Font.ab

    r104 r137  
    33
    44#require <GdiPlus.ab>
     5#require <Classes/System/Drawing/misc.ab>
    56#require <Classes/System/Drawing/Graphics.ab>
    67
     
    6465    End Sub
    6566
    66     Sub Font(/*IN const*/ familyName As *WCHAR, /*IN*/ emSize As Single)
    67         Font(familyName, emSize, FontStyleRegular, UnitPoint, ByVal 0)
    68     End Sub
    69 
    70     Sub Font(/*IN const*/ familyName As *WCHAR, /*IN*/ emSize As Single,
     67    Sub Font(/*IN const*/ familyName As PCWSTR, /*IN*/ emSize As Single)
     68        Font(familyName, emSize, FontStyleRegular, Unit.Point, ByVal 0)
     69    End Sub
     70
     71    Sub Font(/*IN const*/ familyName As String, /*IN*/ emSize As Single)
     72        Font(familyName, emSize, FontStyleRegular, Unit.Point, ByVal 0)
     73    End Sub
     74
     75    Sub Font(/*IN const*/ familyName As PCWSTR, /*IN*/ emSize As Single,
    7176         /*IN*/ style As Long)
    72         Font(familyName, emSize, style, UnitPoint, ByVal 0)
    73     End Sub
    74 
    75     Sub Font(/*IN const*/ familyName As *WCHAR, /*IN*/ emSize As Single,
     77        Font(familyName, emSize, style, Unit.Point, ByVal 0)
     78    End Sub
     79
     80    Sub Font(/*IN const*/ familyName As String, /*IN*/ emSize As Single,
     81         /*IN*/ style As Long)
     82        Font(familyName, emSize, style, Unit.Point, ByVal 0)
     83    End Sub
     84
     85    Sub Font(/*IN const*/ familyName As PCWSTR, /*IN*/ emSize As Single,
    7686         /*IN*/ style As Long, /*IN*/ unit As GraphicsUnit)
    7787        Font(familyName, emSize, style, unit, ByVal 0)
    7888    End Sub
    7989
    80     Sub Font(/*IN const*/ familyName As *WCHAR, /*IN*/ emSize As Single,
     90    Sub Font(/*IN const*/ familyName As String, /*IN*/ emSize As Single,
     91         /*IN*/ style As Long, /*IN*/ unit As GraphicsUnit)
     92        Font(familyName, emSize, style, unit, ByVal 0)
     93    End Sub
     94
     95    Sub Font(/*IN const*/ familyName As PCWSTR, /*IN*/ emSize As Single,
    8196        /*IN*/ style As Long, /*IN*/ unit As GraphicsUnit,
    8297        /*IN const*/ ByRef fontCollection As FontCollection)
     
    112127    End Sub
    113128
     129    Sub Font(/*IN const*/ familyName As String, /*IN*/ emSize As Single,
     130        /*IN*/ style As Long, /*IN*/ unit As GraphicsUnit,
     131        /*IN const*/ ByRef fontCollection As FontCollection)
     132#ifdef __STRING_IS_NOT_UNICODE
     133        Dim name = _System_MultiByteToWideChar(familyName)
     134        Font(name, emSize, style, unit, fontCollection)
     135        _System_free(name)
     136#else
     137        Font(familyName.Chars, emSize, style, unit, fontCollection)
     138#endif
     139    End Sub
     140
    114141    Const Function GetLogFontA(/*IN const*/ ByRef g As Graphics, /*OUT*/ ByRef lf As LOGFONTA) As Status
    115142        Dim nativeGraphics As *GpGraphics
     
    128155    End Function
    129156
     157    Const Function GetLogFont(/*IN const*/ ByRef g As Graphics, /*OUT*/ ByRef lf As LOGFONTA) As Status
     158        Dim nativeGraphics As *GpGraphics
     159        If VarPtr(g) <> 0 Then
     160            nativeGraphics = g.nativeGraphics
     161        End If
     162#ifdef UNICODE
     163        Return SetStatus(GdipGetLogFontW(nativeFont, nativeGraphics, lf))
     164#else
     165        Return SetStatus(GdipGetLogFontA(nativeFont, nativeGraphics, lf))
     166#endif
     167    End Function
     168
    130169    Const Function Clone() As *Font
    131170        Dim cloneFont = 0 As *GpFont
     
    138177    End Sub
    139178
    140     Const Function IsAvailable() As BOOL
     179    Const Function IsAvailable() As Boolean
    141180        Return nativeFont <> 0
    142181    End Function
     
    150189    End Function
    151190
     191    Const Function SizeInPoints() As Single
     192
    152193    Const Function Unit() As GraphicsUnit
    153194        SetStatus(GdipGetFontUnit(nativeFont, Unit))
     
    158199    End Function
    159200
    160     Const Function Height() As Single
    161         Return GetHeight()
     201    Const Function Height() As Long
     202        Return GetHeight() As Long
    162203    End Function
    163204
     
    187228'   End Function
    188229
     230    Const Function Bold() As Boolean
     231        Dim lf As LOGFONT
     232        GetLogFont(0, lf)
     233        Return lf.lfWeight > FW_BOLD
     234    End Function
     235
     236    Const Function GdiCharSet() As Byte
     237        Dim lf As LOGFONT
     238        GetLogFont(0, lf)
     239        Return lf.lfCharSet
     240    End Function
     241
     242    'Const Function GdiVerticalFont() As Boolean
     243
    189244    Const Function NativeFont() As *GpFont
    190245        Return nativeFont
    191246    End Function
     247
     248    'Const Function IsSystemFont() As Boolean
     249
     250    Const Function Italic() As Boolean
     251        Dim lf As LOGFONT
     252        GetLogFont(0, lf)
     253        Return lf.lfItalic <> FALSE
     254    End Function
     255
     256    Const Function Name() As String
     257#ifdef __STRING_IS_NOT_UNICODE
     258        Dim lf As LOGFONTA
     259        GetLogFontA(0, lf)
     260#else
     261        Dim lf As LOGFONTW
     262        GetLogFontW(0, lf)
     263#endif
     264        Return lf.lfFaceName
     265    End Function
     266
     267    'Const Function SizeInPoint() As Boolean
     268
     269    Const Function NativeFont() As *GpFont
     270        Return nativeFont
     271    End Function
     272
     273    Const Function StrikeOut() As Boolean
     274        Dim lf As LOGFONT
     275        GetLogFont(0, lf)
     276        Return lf.fdwStrikeOut <> FALSE
     277    End Function
     278
     279    Const Function Style() As FontStyle
     280        Dim lf As LOGFONT
     281        GetLogFont(0, lf)
     282        Return (((lf.lfWeight > FW_BOLD) And FontStyle.Bold) Or _
     283            ((lf.lfItatlic <> FALSE) And FontStyle.Italic) Or _
     284            ((lf.fdwStrikeOut <> FALSE) And FontStyle.Strickeout) Or _
     285            ((lf.fdwUnderline <> FALSE) And FontStyle.Underline)) As FontStyle
     286    End Function
     287       
     288    'Const Function SystemFontName() As String
     289
     290    Const Function Underline() As Boolean
     291        Dim lf As LOGFONT
     292        GetLogFont(0, lf)
     293        Return lf.fdwUnderline <> FALSE
     294    End Function
     295
     296    Override Function ToString() As String
     297        Return Name
     298    End Function
     299
     300    Const Function ToHfont() As HFONT
     301        Dim lf As LOGFONT
     302        GetLogFont(ByVal 0, lf)
     303        Return CreateFontIndirect(lf)
     304    End Function
     305
     306    Const Sub ToLogFont(ByRef lf As LOGFONT)
     307        GetLogFont(ByVal 0, lf)
     308    End Sub
     309
     310    Const Sub ToLogFont(ByRef lf As LOGFONT, ByRef g As Graphics)
     311        GetLogFont(g, lf)
     312    End Sub
     313
    192314
    193315Private
  • Include/Classes/System/Drawing/misc.ab

    r104 r137  
    3636End Enum
    3737
     38Enum FontStyle
     39    Regular = 0
     40    Bold = 1
     41    Italic = 2
     42    Strikeout = 4
     43    Underline  = 8
     44End Enum
     45
     46
    3847#endif '__SYSTEM_DRAWING_MISC_AB__
Note: See TracChangeset for help on using the changeset viewer.