[GB.REPORT]
* NEW: ReportTextLabel have now a Data event and a Data Property * BUG: ReportTextLabel now use RichTextExtend * OPT: I've removed the wordwrap property * NEW: Begin To implement ReportDrawingArea widget It's a simple widget with a draw event. git-svn-id: svn://localhost/gambas/trunk@4272 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
d28e770be9
commit
f173a43bba
10 changed files with 133 additions and 32 deletions
|
@ -532,7 +532,7 @@ b
|
|||
_Properties
|
||||
C
|
||||
s
|
||||
Left{ReportCoord},Top{ReportCoord},Width{ReportCoord},Height{ReportCoord},Brush{ReportBrush},Visible=True,Fixed,Font,Padding,Ignore,Expand,AutoResize,Tag
|
||||
Left{ReportCoord},Top{ReportCoord},Width{ReportCoord},Height{ReportCoord},Brush{ReportBrush},Visible=True,Fixed,Font,Padding,Ignore,Expand,AutoResize,Tag,Range
|
||||
_Family
|
||||
C
|
||||
s
|
||||
|
@ -629,6 +629,10 @@ _RelativePadding
|
|||
r
|
||||
b
|
||||
|
||||
Range
|
||||
p
|
||||
s
|
||||
|
||||
Left
|
||||
p
|
||||
s
|
||||
|
@ -729,6 +733,29 @@ _GetActualBrush
|
|||
m
|
||||
PaintBrush
|
||||
(X1)i(Y1)i(X2)i(Y2)i
|
||||
#ReportDrawingArea
|
||||
ReportFrame
|
||||
C
|
||||
:Draw
|
||||
:
|
||||
|
||||
|
||||
_Properties
|
||||
C
|
||||
s
|
||||
*
|
||||
_Similar
|
||||
C
|
||||
s
|
||||
ReportImage
|
||||
_DefaultEvent
|
||||
C
|
||||
s
|
||||
Draw
|
||||
_Paint
|
||||
m
|
||||
|
||||
(Page)i(X)f(Y)f(hControl)TControl;(VirtualId)i
|
||||
#ReportFrame
|
||||
ReportControl
|
||||
|
||||
|
@ -1047,6 +1074,10 @@ _Similar
|
|||
C
|
||||
s
|
||||
ReportControl
|
||||
_DefaultEvent
|
||||
C
|
||||
s
|
||||
Data
|
||||
Text
|
||||
p
|
||||
s
|
||||
|
@ -1055,9 +1086,13 @@ Alignment
|
|||
p
|
||||
i
|
||||
|
||||
WordWrap
|
||||
p
|
||||
b
|
||||
Data
|
||||
v
|
||||
s
|
||||
|
||||
:Data
|
||||
:
|
||||
|
||||
|
||||
_GetSizeHints
|
||||
m
|
||||
|
|
|
@ -7,6 +7,7 @@ ReportBorder
|
|||
ReportBrush
|
||||
ReportContainer
|
||||
ReportControl
|
||||
ReportDrawingArea
|
||||
ReportFrame
|
||||
ReportHBox
|
||||
ReportImage
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Gambas Project File 3.0
|
||||
# Compiled with Gambas 2.99.6
|
||||
Title=Report designer
|
||||
Startup=Report11
|
||||
Startup=Report6
|
||||
Icon=printer1.png
|
||||
Version=2.99.6
|
||||
VersionProgram=gbx3 -V
|
||||
|
|
|
@ -280,7 +280,7 @@ Public Sub _GetSizeHints(AvailableW As Float, AvailableH As Float, TotalWidth As
|
|||
Return GetHSizeInt(AvailableW, AvailableH, TotalWidth, TotalHeight)
|
||||
|
||||
Case Arrange.Fill, Arrange.None
|
||||
hMyHints.Width = Super._GetSizeHints(AvailableW, AvailableH, TotalWidth, TotalHeight)
|
||||
Return Super._GetSizeHints(AvailableW, AvailableH, TotalWidth, TotalHeight)
|
||||
'hMyHints.Height = AvailableH
|
||||
'Me._SizeInt.StoreSize = True
|
||||
'Me._SizeInt = hMyHints
|
||||
|
|
|
@ -4,7 +4,7 @@ Export
|
|||
Create Private
|
||||
|
||||
Public Const _IsControl As Boolean = True
|
||||
Public Const _Properties As String = "Left{ReportCoord},Top{ReportCoord},Width{ReportCoord},Height{ReportCoord},Brush{ReportBrush},Visible=True,Fixed,Font,Padding,Ignore,Expand,AutoResize,Tag"
|
||||
Public Const _Properties As String = "Left{ReportCoord},Top{ReportCoord},Width{ReportCoord},Height{ReportCoord},Brush{ReportBrush},Visible=True,Fixed,Font,Padding,Ignore,Expand,AutoResize,Tag,Range"
|
||||
Public Const _Family As String = "Report"
|
||||
Public _SizeInt As TSizeHint
|
||||
Public _Count As Integer = 1
|
||||
|
@ -49,7 +49,7 @@ Private $bRelativeWidth As Boolean
|
|||
Private $bRelativeHeight As Boolean
|
||||
Private $bRelativePadding As Boolean
|
||||
Private $bIgnore As Boolean = False
|
||||
|
||||
Private $sRange As String
|
||||
Property Read Id As Integer
|
||||
Property Read Parent As ReportContainer
|
||||
Property Tag As Variant
|
||||
|
@ -68,7 +68,7 @@ Property Read _RelativeTop As Boolean ''Use percentage for Top Pos?
|
|||
Property Read _RelativeWidth As Boolean ''Use percentage for width?
|
||||
Property Read _RelativeHeight As Boolean ''Use percentage for height ?
|
||||
Property Read _RelativePadding As Boolean ''Use percentage for padding ?
|
||||
|
||||
Property Range As String
|
||||
Property Left As String
|
||||
Property Top As String
|
||||
Property X As String
|
||||
|
@ -524,3 +524,15 @@ Private Function DataIndex_Read() As Integer
|
|||
Return Me.Parent._GetIndex()
|
||||
|
||||
End
|
||||
|
||||
Private Function Range_Read() As String
|
||||
|
||||
Return $sRange
|
||||
|
||||
End
|
||||
|
||||
Private Sub Range_Write(Value As String)
|
||||
|
||||
$sRange = Value
|
||||
|
||||
End
|
||||
|
|
30
comp/src/gb.report/.src/ReportDrawingArea.class
Normal file
30
comp/src/gb.report/.src/ReportDrawingArea.class
Normal file
|
@ -0,0 +1,30 @@
|
|||
' Gambas class file
|
||||
|
||||
Export
|
||||
Inherits ReportFrame
|
||||
|
||||
Event Draw
|
||||
Public Const _Properties As String = "*"
|
||||
Public Const _Similar As String = "ReportImage"
|
||||
Public Const _DefaultEvent As String = "Draw"
|
||||
|
||||
Public Sub _Paint(Page As Integer, X As Float, Y As Float, hControl As TControl, VirtualId As Integer)
|
||||
|
||||
Dim hRect As Rect
|
||||
Dim iX, iY, iW, iH As Integer
|
||||
|
||||
iX = (x + hControl.RealLeft + MTools.UnitsToPixels(Me.Padding._Left + Me.Border._Left))
|
||||
iY = (y + hControl.RealTop + MTools.UnitsToPixels(Me.Padding._Top + Me.Border._Top))
|
||||
iW = (hControl.RealWidth - MTools.UnitsToPixels(Me.Padding._Left + Me.Padding._Right + Me.Border._Left + Me.Border._Right))
|
||||
iH = (hControl.RealHeight - MTools.UnitsToPixels(Me.Padding._Top + Me.Padding._Bottom + Me.Border._Top + Me.Border._Bottom))
|
||||
|
||||
hRect = New Rect(iX, iY, iW, iH)
|
||||
|
||||
Paint.ClipRect = hRect
|
||||
'Paint.
|
||||
Paint.Translate(iX, iY)
|
||||
Raise Draw
|
||||
Paint.Translate(- iX, - iY)
|
||||
Paint.ResetClip
|
||||
|
||||
End
|
|
@ -266,6 +266,6 @@ Public Sub RoundRect(x As Integer, y As Integer, w As Integer, h As Integer, Rad
|
|||
c2 = ARC_TO_BEZIER * radius_y[0]
|
||||
paint.relcurveto(0.0, - c2, radius_x[0] - c1, - radius_y[0], radius_x[0], - radius_y[0])
|
||||
|
||||
paint.closepath()
|
||||
'paint.closepath()
|
||||
|
||||
End
|
|
@ -5,26 +5,16 @@ Inherits ReportFrame
|
|||
|
||||
Public Const _Properties As String = "*,Text,Alignment{Align.*}"
|
||||
Public Const _Similar As String = "ReportControl"
|
||||
Public Const _DefaultEvent As String = "Data"
|
||||
Property Text As String
|
||||
Property Alignment As Integer
|
||||
Property WordWrap As Boolean
|
||||
|
||||
Private $bWordWrap As Boolean
|
||||
Private $sText As String
|
||||
Private $iAlignment As Integer = Align.TopNormal
|
||||
Private $fZoom As Float
|
||||
|
||||
Private Function WordWrap_Read() As Boolean
|
||||
|
||||
Return $bWordWrap
|
||||
|
||||
End
|
||||
|
||||
Private Sub WordWrap_Write(Value As Boolean)
|
||||
|
||||
$bWordWrap = Value
|
||||
|
||||
End
|
||||
Public Data As String
|
||||
Event Data()
|
||||
|
||||
Private Function Text_Read() As String
|
||||
|
||||
|
@ -54,15 +44,21 @@ Public Sub _GetSizeHints(AvailableW As Float, AvailableH As Float, TotalWidth As
|
|||
|
||||
Dim hMyHints As New TSizeHint
|
||||
Dim fTextHeight As Float
|
||||
Dim sTmp As String
|
||||
|
||||
hMyHints = Super._GetSizeHints(AvailableW, AvailableH, TotalWidth, TotalWidth)
|
||||
|
||||
If Me.Autoresize Then
|
||||
|
||||
If Not $sText Then
|
||||
Raise Data
|
||||
sTmp = Data
|
||||
Else
|
||||
sTmp = $sText
|
||||
Endif
|
||||
'La largeur est fixée par l'utilisateur
|
||||
'Calcule de la hauteur
|
||||
If Not IsNull(Me.Font) Then Paint.Font = Me.Font
|
||||
fTextHeight = MTools.PixelsToUnits(Paint.RichTextHeight($sText, MTools.UnitsToPixels(hMyHints.Width)))
|
||||
fTextHeight = MTools.PixelsToUnits(Paint.RichTextExtents(sTmp, MTools.UnitsToPixels(hMyHints.Width)).Height)
|
||||
hMyHints.Height = Max(hMyHints.Height, Me.Border._Top + Me.Padding._Top + fTextHeight + Me.Padding._Bottom + Me.Border._Bottom)
|
||||
Endif
|
||||
|
||||
|
@ -73,9 +69,16 @@ End
|
|||
Public Sub _Paint(Page As Integer, X As Float, Y As Float, hControl As TControl, VirtualId As Integer)
|
||||
|
||||
Dim iX, iY, iW, iH As Integer
|
||||
Dim sTmp As String
|
||||
|
||||
Paint.Brush = Paint.Color(Me.BorderColor)
|
||||
If Me.Tag = "*" Then Stop
|
||||
Paint.Brush = Me._GetActualBrush(iX, iY, iX + hControl.RealWidth, iY + hControl.RealHeight)
|
||||
|
||||
If Not $sText Then
|
||||
Raise Data
|
||||
sTmp = Data
|
||||
Else
|
||||
sTmp = $sText
|
||||
Endif
|
||||
|
||||
'Set the Font if it is initialized
|
||||
If Not IsNull(Me.Font) Then Paint.Font = Me.Font
|
||||
|
@ -85,6 +88,10 @@ Public Sub _Paint(Page As Integer, X As Float, Y As Float, hControl As TControl,
|
|||
iW = (hControl.RealWidth - MTools.UnitsToPixels(Me.Padding._Left + Me.Padding._Right + Me.Border._Left + Me.Border._Right))
|
||||
iH = (hControl.RealHeight - MTools.UnitsToPixels(Me.Padding._Top + Me.Padding._Bottom + Me.Border._Top + Me.Border._Bottom))
|
||||
|
||||
Paint.RichText($sText, iX, iY, iW, iH, $iAlignment)
|
||||
Paint.Rectangle(iX, iY, iW, iH)
|
||||
Paint.Clip
|
||||
Paint.RichText(sTmp, iX, iY, iW, iH, $iAlignment)
|
||||
Paint.Fill
|
||||
Paint.ResetClip
|
||||
|
||||
End
|
||||
|
|
|
@ -3,3 +3,11 @@
|
|||
Public Sub ReportLabel1_Data()
|
||||
|
||||
End
|
||||
|
||||
Public Sub ReportDrawingArea1_Draw()
|
||||
|
||||
Paint.MoveTo(0, 0)
|
||||
Paint.LineTo(Paint.Width, Paint.Height)
|
||||
Paint.Stroke
|
||||
|
||||
End
|
||||
|
|
|
@ -4,10 +4,18 @@
|
|||
#MoveScaled(0,0,64,64)
|
||||
Index = 0
|
||||
Text = ("")
|
||||
{ ReportLabel1 ReportLabel
|
||||
#MoveScaled(12,6,32,5)
|
||||
AutoResize = True
|
||||
Text = ("Test")
|
||||
{ ReportPanel1 ReportPanel
|
||||
#MoveScaled(-2,1,71,57)
|
||||
Expand = True
|
||||
Arrangement = Arrange.None
|
||||
{ ReportDrawingArea1 ReportDrawingArea
|
||||
#MoveScaled(7,6,55,33)
|
||||
Left = "5cm"
|
||||
Top = "3cm"
|
||||
Width = "3cm"
|
||||
Height = "12cm"
|
||||
Border = ReportBorder["Top:1mm #000000;Bottom:1mm #000000;Left:1mm #000000;Right:1mm #000000"]
|
||||
}
|
||||
}
|
||||
Index = 0
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue