[GB.REPORT]

* NEW: Now all the filling properties are replaced with
  special function that return a CReportBrush class to the 
  Object Brush Property


git-svn-id: svn://localhost/gambas/trunk@2694 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Fabien Bodard 2010-02-12 12:35:01 +00:00
parent 9b48791621
commit 8804d44fca
5 changed files with 96 additions and 83 deletions

View file

@ -57,6 +57,18 @@ Clear
m
Image
m
CReportBrush
(Value)s(X)s(Y)s
Gradient
m
CReportBrush
(Colors)Integer[];(Positions)float[];
Color
m
CReportBrush
(iColor)i
#ReportBorder
C
@ -311,22 +323,10 @@ f
#ReportFrame
ReportControl
C
Color
p
i
Image
p
Image
BorderColor
p
i
BackGround
p
i
Style
p
i
@ -339,9 +339,9 @@ Border
p
i
Gradient
Brush
p
Integer[]
CReportBrush
_DrawBefore
m

View file

@ -0,0 +1,11 @@
' Gambas class file
Public Type As Integer
Public X As TSizeParse
Public Y As TSizeParse
Public X2 As TSizeParse
Public Y2 As TSizeParse
Public radius As TSizeParse
Public {Image} As Image
Public Color As Integer[]
Public Pos As Float[]
Public iValue As Integer

View file

@ -251,3 +251,38 @@ End
' frmPreview.Run(Me)
'
' End
Public Function Image(Value As String, X As String, Y As String) As CReportBrush
Dim hBrush As New CReportBrush
hBrush.Type = 1
hBrush.X = MRTools.ScanValue(X)
hBrush.Y = MRTools.ScanValue(Y)
hBrush.Image = Image.Load(Value)
Return hBrush
End
Public Function Gradient(Colors As Integer[], Positions As float[]) As CReportBrush
Dim hBrush As New CReportBrush
hBrush.Type = 2
'hBrush.X = MRTools.ScanValue(X)
'hBrush.Y = MRTools.ScanValue(Y)
hBrush.Color = Colors
hBrush.Pos = Positions
Return hBrush
End
Public Sub {Color}(iColor As Integer) As CReportBrush
Dim hBrush As New CReportBrush
hBrush.Type = 0
hBrush.iValue = iColor
Return hBrush
End

View file

@ -3,23 +3,23 @@
Export
Inherits ReportControl
Private $iBorderColor As Integer = Color.Black
Private $iBackGround As Integer = Color.White
Private $iColor As Integer = Color.Black
'Private $iBackGround As Integer = Color.White
'Private $iColor As Integer = Color.Black
Private $iStyle As Integer = ReportStyle.None
Private $fBorderWidth As Float = 1.0
Private $iBorder As Integer = ReportBorder.None
Private $hImage As Image
Private $sGradient As String
Private $aGradient As New Integer[]
'Private $hImage As Image
Private $hBrush As CReportBrush
Property BorderColor As Integer
Property BackGround As Integer
Property Color As Integer
'Property BackGround As Integer
'Property Color As Integer
Property Style As Integer
Property BorderWidth As Float
Property Border As Integer
Property {Image} As Image
Property Gradient As Integer[]
Property Brush As CReportBrush
@ -35,29 +35,6 @@ Private Sub BorderColor_Write(Value As Integer)
End
Private Function BackGround_Read() As Integer
Return $iBackGround
End
Private Sub BackGround_Write(Value As Integer)
$iBackGround = Value
End
Private Function Color_Read() As Integer
Return $iColor
End
Private Sub Color_Write(Value As Integer)
$iColor = Value
End
Private Function Style_Read() As Integer
@ -115,18 +92,18 @@ Public Sub _DrawBefore(Page As Integer, X As Integer, Y As Integer, hControl As
Else
'si pas de fond alors on ne le dessine pas !
Select Case Me.Style
Case ReportStyle.None
Return
Case ReportStyle.Solid
Paint.Brush = Paint.Color($iColor)
If Me.Brush = Null Then Return
Select Case Me.Brush.Type
Case 0
Paint.Brush = Paint.Color(Me.Brush.iValue)
Case 1
Paint.Brush = paint.Image(Me.Brush.Image, X1, Y1)
Case ReportStyle.Gradient
Paint.Brush = paint.LinearGradient(X1, Y1, X1, Y2, Me.Gradient, [0.0, 1])
Case ReportStyle.Image
Case 2
Paint.Brush = paint.LinearGradient(X1, Y1, X1, Y2, Me.Brush.Color, Me.Brush.Pos)
Case 3
Paint.Brush = paint.Image($hImage, X1, Y1)
'Paint.Brush = paint.Image($hImage, X1, Y1)
End Select
@ -176,27 +153,16 @@ Dim X1, Y1, X2, Y2 As Integer
End
Private Function Image_Read() As Image
Return $hImage
Private Function Brush_Read() As CReportBrush
Return $hBrush
End
Private Sub Image_Write(Value As Image)
Private Sub Brush_Write(Value As CReportBrush)
$hImage = Value
End
Private Function Gradient_Read() As Integer[]
Return $aGradient
End
Private Sub Gradient_Write(Value As Integer[])
$aGradient = Value
$hBrush = Value
End

View file

@ -39,7 +39,7 @@ Public Sub Test1()
lblcoucou = New ReportLabel(hHBox)
lblcoucou.Text = "coucou"
lblcoucou.Color = Color.Yellow
lblcoucou.Brush = report.Color(Color.Yellow)
lblcoucou.BorderColor = Color.Red
lblcoucou.Style = ReportStyle.Solid
lblcoucou.Font.Size = 15
@ -86,7 +86,8 @@ hLab.Text = "MY FRIENDS FIRST NAME" 'Set the text
hLab.Font = Font["Arial,+8,"] 'Set The Font
hLab.Alignment = Align.Center 'Set The aligment
hLab.Border = ReportBorder.Solid
hLab.Color = Color.LightGray
'hLab.Color = Color.LightGray
hlab.Brush = report.Color(Color.Gray)
hLab.Style = ReportStyle.Solid
'* Add a Cloner to list what i want
@ -231,7 +232,7 @@ Public Sub Test4()
hCont = New ReportHBox(Report)
hCont.Height = "3 cm"
img = New ReportFrame(hCont)
img.Image = Image.Load("new-logo.png")
img.Brush = report.Image("new-logo.png", "1", "1")
img.Width = "3 cm"
img.Style = ReportStyle.Image
'img.Height = "3 cm"
@ -307,12 +308,12 @@ Public Sub Test4()
txt.Alignment = Align.Center
txt.Font.Italic = True
txt.Style = ReportStyle.Gradient
txt.Gradient = [Color.Black, Color.Yellow]
txt.Brush = report.Gradient([Color.Black, Color.Yellow], [0.0, 1.0])
'txt.Width = 2
txt.Border = ReportBorder.Solid
txt.Color = Color.LightGray
'txt.Brush = Report.Color(Color.LightGray)
'txt.FillStyle = fill.Solid
vRef = New ReportVBox(vCont)
@ -335,7 +336,7 @@ Public Sub Test4()
txt.Alignment = Align.Center
txt.Font.Italic = True
txt.Border = ReportBorder.Solid
txt.Color = Color.LightGray
txt.Brush = report.Color(Color.LightGray)
txt.Style = ReportStyle.Solid
vDes = New ReportVBox(vCont)
@ -355,7 +356,7 @@ Public Sub Test4()
txt.Font.Italic = True
'txt.Width = "3,5 cm"
txt.Border = ReportBorder.Solid
txt.Color = Color.LightGray
txt.Brush = report.Color(Color.Gray)
txt.Style = ReportStyle.Solid
vQt = New ReportVBox(vCont)
@ -374,7 +375,7 @@ Public Sub Test4()
txt.Font.Italic = True
'txt.Width = "3,5 cm"
txt.Border = ReportBorder.Solid
txt.Color = Color.LightGray
txt.Brush = report.Color(Color.Gray)
txt.Style = ReportStyle.Solid
vPU = New ReportVBox(vCont)
@ -393,7 +394,7 @@ Public Sub Test4()
txt.Font.Italic = True
'txt.Width = "3,5 cm"
txt.Border = ReportBorder.Solid
txt.Color = Color.LightGray
txt.Brush = report.Color(Color.LightGray)
txt.Style = ReportStyle.Solid
vTot = New ReportVBox(vCont)
@ -405,7 +406,7 @@ Public Sub Test4()
hCont = New ReportHBox(Report)
hCont.Height = "1 cm"
hCont.Color = Color.LightGray
hCont.Brush = report.Color(Color.LightGray)
hCont.Border = ReportBorder.Solid
hCont.Tag = "Container de total"
@ -440,4 +441,4 @@ Public Sub Test4()
Next
End
End