From 67e3478bdbefb21e1efd9e5d65958b88401d3d64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Wed, 4 Sep 2013 10:00:30 +0000 Subject: [PATCH] [GB.FORM] * NEW: DateChooser[].Text is now taken into account. It is displayed as a tooltip when the mouse cursor hovers the associated date. git-svn-id: svn://localhost/gambas/trunk@5829 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- comp/src/gb.form/.lang/.pot | 4 --- comp/src/gb.form/.project | 4 +-- comp/src/gb.form/.src/Date/FCalendar.class | 23 ++++++++---- comp/src/gb.form/.src/Test/FMain.class | 4 ++- comp/src/gb.form/.src/Test/FMain.form | 19 +--------- comp/src/gb.form/.src/Test/Form4.class | 42 ---------------------- 6 files changed, 22 insertions(+), 74 deletions(-) diff --git a/comp/src/gb.form/.lang/.pot b/comp/src/gb.form/.lang/.pot index f1fa79fd1..ece647ffb 100644 --- a/comp/src/gb.form/.lang/.pot +++ b/comp/src/gb.form/.lang/.pot @@ -343,10 +343,6 @@ msgstr "" msgid "How quickly daft jumping zebras vex" msgstr "" -#: FMain.form:34 -msgid "ButtonBox1" -msgstr "" - #: FMessage.form:39 msgid "Do not display this message again" msgstr "" diff --git a/comp/src/gb.form/.project b/comp/src/gb.form/.project index 575aca33d..078d66254 100644 --- a/comp/src/gb.form/.project +++ b/comp/src/gb.form/.project @@ -1,7 +1,7 @@ # Gambas Project File 3.0 # Compiled with Gambas 3.4.90 Title=More controls for graphical components -Startup=Form4 +Startup=FMain Version=3.4.90 VersionFile=1 Component=gb.image @@ -9,7 +9,7 @@ Component=gb.gui Component=gb.form Component=gb.settings Authors="BenoƮt Minisini" -Environment="GB_GUI=gb.qt4" +Environment="GB_GUI=gb.gtk" TabSize=2 Translate=1 Language=en diff --git a/comp/src/gb.form/.src/Date/FCalendar.class b/comp/src/gb.form/.src/Date/FCalendar.class index 27601b5c8..56344c35f 100644 --- a/comp/src/gb.form/.src/Date/FCalendar.class +++ b/comp/src/gb.form/.src/Date/FCalendar.class @@ -165,6 +165,7 @@ Public Sub dwgMonth_Draw() Dim sKey As String Dim bToday As Boolean Dim hDate As _DateChooser_Date + Dim fSize As Float iForeground = dwgMonth.Foreground 'Draw.Foreground iBackground = dwgMonth.Background 'Draw.Background @@ -181,7 +182,8 @@ Public Sub dwgMonth_Draw() Draw.LineStyle = Line.None Draw.Font = dwgMonth.Font - Draw.Font.Size = Draw.Font.Size * H / Draw.Font.Height * 0.7 + fSize = Draw.Font.Size * H / Draw.Font.Height * 0.7 + Draw.Font.Size = fSize Draw.Font.Bold = True X = XD @@ -219,6 +221,7 @@ Public Sub dwgMonth_Draw() If iBackground = Color.Default Then iBackground = dwgMonth.Background Draw.Font = hDate.Font + Draw.Font.Size = fSize If CInt(dDate) = CInt($dDate) Then Draw.FillColor = If(dwgMonth.HasFocus, Color.SelectedBackground, Color.LightForeground) @@ -245,6 +248,7 @@ Public Sub dwgMonth_Draw() bToday = CInt(Date(Now)) = CInt(Date(dDate)) Draw.Font.Bold = bToday + Draw.Font.Underline = hDate.Text Draw.Text(Day(dDate), X, Y, W, H, Align.Center) @@ -348,8 +352,9 @@ Public Sub dwgMonth_KeyPress() End -Private Sub CalcCurrenDate() +Private Sub CalcCurrentDate() + Dim hDate As _DateChooser_Date Dim W, H As Integer Dim XD, YD As Integer @@ -367,12 +372,15 @@ Private Sub CalcCurrenDate() $dCurrentDate = $dStart + Min(6, Mouse.X \ W) + ((Mouse.Y - YD) \ H) * 7 + hDate = GetParent()[$dCurrentDate] + dwgMonth.Tooltip = hDate.Text + End Public Sub dwgMonth_MouseDown() - CalcCurrenDate + CalcCurrentDate If Not $dCurrentDate Then Return $dDate = $dCurrentDate @@ -536,7 +544,7 @@ Public Sub dwgTime_Draw() End -Private Sub CalcCurrenTime() +Private Sub CalcCurrentTime() Dim X, Y, DX, DY, DW, DH As Integer @@ -564,7 +572,7 @@ End Public Sub dwgTime_MouseDown() - CalcCurrenTime + CalcCurrentTime If $iCurrentTime >= 0 Then SetTime(Time($iCurrentTime \ 2, 30 * ($iCurrentTime Mod 2), 0)) Endif @@ -671,14 +679,14 @@ Public Sub dwgTime_MouseMove() Dim iLast As Integer = $iCurrentTime - CalcCurrenTime + CalcCurrentTime If $iCurrentTime <> iLast Then dwgTime.Refresh End Public Sub dwgMonth_MouseMove() - CalcCurrenDate + CalcCurrentDate dwgMonth.Refresh End @@ -686,6 +694,7 @@ End Public Sub dwgMonth_Leave() $dCurrentDate = Null + dwgMonth.Tooltip = "" dwgMonth.Refresh End diff --git a/comp/src/gb.form/.src/Test/FMain.class b/comp/src/gb.form/.src/Test/FMain.class index 6085fe3e7..4fc62484f 100644 --- a/comp/src/gb.form/.src/Test/FMain.class +++ b/comp/src/gb.form/.src/Test/FMain.class @@ -27,6 +27,8 @@ End Public Sub Form_Open() - + DateChooser1[Date(2013, 9, 4)].Text = "Aujourd'hui" + DateChooser1[Date(2013, 9, 6)].Text = "Mon anniversaire" + DateChooser1[Date(2013, 9, 28)].Text = "Papa" End diff --git a/comp/src/gb.form/.src/Test/FMain.form b/comp/src/gb.form/.src/Test/FMain.form index 6aab5c203..67063381e 100644 --- a/comp/src/gb.form/.src/Test/FMain.form +++ b/comp/src/gb.form/.src/Test/FMain.form @@ -3,30 +3,13 @@ { Form Form Move(0,0,476,336) #Scaled = False - Resizable = False + Arrangement = Arrange.Fill Spacing = True Margin = True - { Button1 Button - Move(175,21,112,28) - #Translate = False - Foreground = &HFF0000& - Text = "Button1" - } { DateChooser1 DateChooser Move(49,126,294,182) #Translate = False Foreground = &HFF0000& Border = False } - { Panel1 Panel - Move(28,63,154,28) - Border = Border.Plain - { ButtonBox1 ButtonBox - Move(0,0,154,28) - Text = ("ButtonBox1") - } - } - { DateBox1 DateBox - Move(224,70,168,28) - } } diff --git a/comp/src/gb.form/.src/Test/Form4.class b/comp/src/gb.form/.src/Test/Form4.class index fa057a9c6..0a5fa73ac 100644 --- a/comp/src/gb.form/.src/Test/Form4.class +++ b/comp/src/gb.form/.src/Test/Form4.class @@ -1,44 +1,2 @@ ' Gambas class file -Private Sub GetPicture() As Picture - - Select Case Int(Rnd(0, 6)) - - Case 0 - Return Picture["icon:/small/gambas"] - - Case 1 - Return Picture["icon:/small/gambas"] - - Case 2 - Return Picture["icon:/small/gambas"] - - Case 3 - Return Picture["icon:/small/gambas"] - - Case 4 - Return Picture["icon:/small/gambas"] - - Case 5 - Return Picture["icon:/small/gambas"] - - End Select - -End - -Public Sub Form_Open() - - Dim I As Integer - Dim sParent As String - Dim aList As String[] = ["gambas", "gnu", "people", "home", "internet", "language", "clock"] - - - For I = 1 To 20 - - 'If I > 1 Then sParent = Int(Rnd(1, Min(6, I))) - - TreeView1.Add(CStr(I), "Item " & CStr(I), Picture["icon:/small" &/ aList[Int(Rnd(0, aList.Count))]], sParent).Expanded = True - - Next - -End