]> O.S.I.I.S - jp/crow.git/commitdiff
test stretched text, debug
authorjpbruyere <jp.bruyere@hotmail.com>
Tue, 2 Feb 2016 10:14:33 +0000 (11:14 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Tue, 2 Feb 2016 10:14:33 +0000 (11:14 +0100)
Tests/Interfaces/testTextBox.crow
src/GraphicObjects/Label.cs

index 9e6280998164fb840295a54fb3d99b4024807471..9623284f38878d46fa2494ac69889e312ed7c941 100755 (executable)
@@ -1,5 +1,25 @@
 <?xml version="1.0"?>
-<VerticalStack Background="Red" Width="-1" Height="-1">        
+<VerticalStack Background="SteelBlue" Fit="true">
+       <HorizontalStack Fit="true">
+               <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="TopLeft"/>
+               <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="TopCenter"/>
+               <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="TopRight"/>
+               <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="LeftCenter"/>
+               <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="Center"/>
+               <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="RightCenter"/>
+               <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="BottomLeft"/>
+               <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="BottomCenter"/>
+               <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="BottomRight"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="true">
+               <TextBox Background="DarkGray" Height="30" Width="70" TextAlignment="TopStretch" Text="TopStretch"/>
+               <TextBox Background="DarkGray" Height="30" Width="60" TextAlignment="HorizontalStretch" Text="HorizontalStretch" />
+               <TextBox Background="DarkGray" Height="30" Width="60" TextAlignment="BottomStretch" Text="BottomStretch"/>
+               <TextBox Background="DarkGray" Height="10" Width="70" TextAlignment="LeftStretch" Text="LeftStretch"/>
+               <TextBox Background="DarkGray" Height="10" Width="70" TextAlignment="VerticalStretch" Text="VerticalStretch"/>
+               <TextBox Background="DarkGray" Height="10" Width="70" TextAlignment="RightStretch" Text="RightStretch"/>
+               <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="Fit" Text="Fit"/>
+       </HorizontalStack>      
        <TextBox Name="tb" Multiline="true" Font="droid,16" Margin="5" Text="A\nBB\nCCC\nDDDD"/>
        <TextBox Multiline="true" Font="droid,16" Name="tb5" Margin="5" Text="{../tb.SelectedText}"/>
 <!--   <TextBox Font="droid,10" Name="tb1" Margin="5" Text="this is a test of a text box"/>
index 68cd50b61328002544742fd3c9853d35928898fd..1af9e04b1cc53ed459b132a03ce170dffe317c5b 100644 (file)
@@ -379,8 +379,8 @@ namespace Crow
                                case Alignment.RightStretch://ok\r
                                        heightRatio = widthRatio = (float)cb.Height / rText.Height;\r
                                        rText.Height = cb.Height;\r
-                                       rText.Width = (int)(widthRatio * cb.Width);\r
-                                       rText.X = cb.X;\r
+                                       rText.Width = (int)(widthRatio * rText.Width);\r
+                                       rText.X = cb.Right - rText.Width;\r
                                        rText.Y = cb.Y;\r
                                        break;\r
                                case Alignment.BottomCenter://ok\r
@@ -429,7 +429,9 @@ namespace Crow
                                        break;\r
                                }\r
                        }\r
-                       OpenTKGameWindow.currentWindow.CursorVisible = true;\r
+\r
+                       gr.FontMatrix = new Matrix(widthRatio * Font.Size, 0, 0, heightRatio * Font.Size, 0, 0);\r
+                       fe = gr.FontExtents;\r
 \r
                        #region draw text cursor\r
                        if (mouseLocalPos >= 0)\r
@@ -487,8 +489,7 @@ namespace Crow
                                gr.LineTo(new PointD(textCursorPos + rText.X, rText.Y + (CurrentLine + 1) * fe.Height));\r
                                gr.Stroke();\r
                        }\r
-                       gr.FontMatrix = new Matrix(widthRatio * Font.Size, 0, 0, heightRatio * Font.Size, 0, 0);\r
-                       OpenTKGameWindow.currentWindow.CursorVisible = true;\r
+\r
                        for (int i = 0; i < lines.Count; i++) {                         \r
                                string l = lines [i].Replace ("\t", new String (' ', Interface.TabSize));\r
                                int lineLength = (int)gr.TextExtents (l).XAdvance;\r