From 154cfbab515c7410edbb97403fb8a166dee4c16c Mon Sep 17 00:00:00 2001 From: giuliano Date: Sun, 19 Nov 2017 21:24:58 +0000 Subject: [PATCH] Fix issue #32711 TWinControl.flipchildren does not flip anchored controls git-svn-id: trunk@56437 - --- examples/bidi/project1.lpi | 2 +- examples/bidi/unit1.lfm | 363 ++++++++++++++++++++++++++----------- examples/bidi/unit1.pas | 20 ++ lcl/controls.pp | 33 +++- lcl/include/wincontrol.inc | 8 +- 5 files changed, 316 insertions(+), 110 deletions(-) diff --git a/examples/bidi/project1.lpi b/examples/bidi/project1.lpi index b9f4276c95..5891610977 100644 --- a/examples/bidi/project1.lpi +++ b/examples/bidi/project1.lpi @@ -46,7 +46,7 @@ - + diff --git a/examples/bidi/unit1.lfm b/examples/bidi/unit1.lfm index 4f81bac616..b055df4946 100644 --- a/examples/bidi/unit1.lfm +++ b/examples/bidi/unit1.lfm @@ -4,14 +4,14 @@ object Form1: TForm1 Top = 131 Width = 687 Caption = 'Form1' - ClientHeight = 353 + ClientHeight = 350 ClientWidth = 687 Menu = MainMenu1 OnCreate = FormCreate - LCLVersion = '0.9.29' + LCLVersion = '1.9.0.0' object PageControl1: TPageControl Left = 8 - Height = 309 + Height = 306 Top = 40 Width = 672 ActivePage = TabSheet1 @@ -20,7 +20,7 @@ object Form1: TForm1 TabOrder = 0 object TabSheet1: TTabSheet Caption = 'Standard' - ClientHeight = 283 + ClientHeight = 274 ClientWidth = 664 object Label1: TLabel Left = 13 @@ -39,7 +39,6 @@ object Form1: TForm1 Top = 5 Width = 88 Caption = 'Notify Me!' - Color = clBtnFace Glyph.Data = { 36040000424D3604000000000000360000002800000010000000100000000100 2000000000000004000064000000640000000000000000000000FF00F7FFFF00 @@ -76,21 +75,20 @@ object Form1: TForm1 F7FFFF00F7FFFF00F7FFFF00F7FFFF00F7FFFF00F7FFFF00F7FFFF00F7FFFF00 F7FFFF00F7FFFF00F7FFFF00F7FFFF00F7FFFF00F7FFFF00F7FF } - NumGlyphs = 0 OnClick = SpeedButton1Click end object Label2: TLabel - Left = 540 - Height = 14 + Left = 494 + Height = 17 Top = 5 - Width = 116 + Width = 162 Anchors = [akTop, akRight] Caption = 'Label Anchored to Right' ParentColor = False end object Edit1: TEdit Left = 128 - Height = 21 + Height = 27 Top = 161 Width = 150 TabOrder = 0 @@ -116,15 +114,15 @@ object Form1: TForm1 'Item2!' 'Item3?' ) - ItemHeight = 13 + ItemHeight = 17 TabOrder = 2 end object ComboBox1: TComboBox Left = 284 - Height = 21 + Height = 27 Top = 161 Width = 167 - ItemHeight = 13 + ItemHeight = 17 Items.Strings = ( 'Item1.' 'Item2!' @@ -155,25 +153,25 @@ object Form1: TForm1 end object CheckBox1: TCheckBox Left = 16 - Height = 17 + Height = 23 Top = 88 - Width = 60 + Width = 88 Caption = 'Check it!' TabOrder = 6 end object RadioButton1: TRadioButton Left = 16 - Height = 17 + Height = 21 Top = 111 - Width = 63 + Width = 87 Caption = 'This one?' TabOrder = 7 end object RadioButton2: TRadioButton Left = 16 - Height = 17 + Height = 21 Top = 134 - Width = 55 + Width = 77 Caption = 'Or this?' TabOrder = 8 end @@ -241,14 +239,14 @@ object Form1: TForm1 Top = 26 Width = 185 Caption = 'GroupBox1' - ClientHeight = 48 - ClientWidth = 181 + ClientHeight = 40 + ClientWidth = 175 TabOrder = 11 object CheckBox2: TCheckBox Left = 15 - Height = 17 + Height = 23 Top = 8 - Width = 60 + Width = 88 Caption = 'Check it!' TabOrder = 0 end @@ -264,9 +262,9 @@ object Form1: TForm1 end object RadioGroup1: TRadioGroup Left = 460 - Height = 69 + Height = 185 Top = 106 - Width = 185 + Width = 69 AutoFill = True Caption = 'RadioGroup1' ChildSizing.LeftRightSpacing = 6 @@ -277,8 +275,8 @@ object Form1: TForm1 ChildSizing.ShrinkVertical = crsScaleChilds ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.ControlsPerLine = 2 - ClientHeight = 51 - ClientWidth = 181 + ClientHeight = 163 + ClientWidth = 59 Columns = 2 Items.Strings = ( 'One!' @@ -290,13 +288,13 @@ object Form1: TForm1 end object TabSheet2: TTabSheet Caption = 'Owner Draw' - ClientHeight = 283 + ClientHeight = 274 ClientWidth = 664 object Label3: TLabel Left = 16 - Height = 14 + Height = 17 Top = 10 - Width = 61 + Width = 83 Caption = 'Owner Draw' ParentColor = False end @@ -310,7 +308,7 @@ object Form1: TForm1 end object ColorBox1: TColorBox Left = 212 - Height = 22 + Height = 27 Top = 9 Width = 127 ItemHeight = 16 @@ -326,7 +324,7 @@ object Form1: TForm1 'Check2' 'Check3' ) - ItemHeight = 15 + ItemHeight = 23 TabOrder = 2 Data = { 03000000000000 @@ -348,7 +346,7 @@ object Form1: TForm1 end object ComboBox2: TComboBox Left = 12 - Height = 19 + Height = 27 Top = 77 Width = 167 ItemHeight = 13 @@ -358,7 +356,6 @@ object Form1: TForm1 'Item2!' 'Item3?' ) - ReadOnly = True Style = csOwnerDrawFixed TabOrder = 4 Text = 'Item1.' @@ -366,7 +363,7 @@ object Form1: TForm1 end object TabSheet3: TTabSheet Caption = 'Grids' - ClientHeight = 283 + ClientHeight = 274 ClientWidth = 664 object Shape2: TShape Left = 0 @@ -439,27 +436,134 @@ object Form1: TForm1 Height = 157 Top = 3 Width = 211 + Color = clWindow Columns = < item + Title.Caption = 'Title' end item + Title.Caption = 'Title' end> TabOrder = 3 end end + object TabSheet4: TTabSheet + Caption = 'Anchored' + ClientHeight = 274 + ClientWidth = 664 + object Button7: TButton + AnchorSideLeft.Control = TabSheet4 + Left = 6 + Height = 26 + Top = 23 + Width = 194 + AutoSize = True + BorderSpacing.Left = 6 + Caption = 'Left anchored to TabSheet' + TabOrder = 0 + end + object Label4: TLabel + AnchorSideLeft.Control = Button7 + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Button7 + AnchorSideTop.Side = asrCenter + Left = 206 + Height = 17 + Top = 28 + Width = 168 + BorderSpacing.Left = 6 + Caption = 'Letf anchored to button ' + Color = clWhite + ParentColor = False + Transparent = False + end + object Label5: TLabel + AnchorSideLeft.Control = Label4 + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Label4 + AnchorSideTop.Side = asrCenter + Left = 380 + Height = 17 + Top = 28 + Width = 154 + BorderSpacing.Left = 6 + Caption = 'Left anchored to Label' + Color = clLime + ParentColor = False + Transparent = False + end + object Button9: TButton + AnchorSideLeft.Control = TabSheet4 + AnchorSideLeft.Side = asrCenter + AnchorSideTop.Control = TabSheet4 + AnchorSideTop.Side = asrCenter + Left = 226 + Height = 26 + Top = 124 + Width = 213 + AutoSize = True + Caption = 'Center anchored to TabSheet' + TabOrder = 1 + end + object Button8: TButton + AnchorSideRight.Control = TabSheet4 + AnchorSideRight.Side = asrBottom + Left = 457 + Height = 26 + Top = 80 + Width = 201 + Anchors = [akTop, akRight] + AutoSize = True + BorderSpacing.Right = 6 + Caption = 'Right anchored to TabSheet' + TabOrder = 2 + end + object Label7: TLabel + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Label6 + AnchorSideTop.Side = asrCenter + AnchorSideRight.Control = Label6 + Left = 109 + Height = 17 + Top = 85 + Width = 161 + Anchors = [akTop, akRight] + BorderSpacing.Right = 6 + Caption = 'Right anchored to Label' + Color = clLime + ParentColor = False + Transparent = False + end + object Label6: TLabel + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Button8 + AnchorSideTop.Side = asrCenter + AnchorSideRight.Control = Button8 + Left = 276 + Height = 17 + Top = 85 + Width = 175 + Anchors = [akTop, akRight] + BorderSpacing.Right = 6 + Caption = 'Right anchored to button ' + Color = clWhite + ParentColor = False + Transparent = False + end + end end object Button5: TButton Left = 11 Height = 25 Top = 8 - Width = 173 + Width = 212 BorderSpacing.InnerBorder = 4 Caption = 'Switch Application.BidiMode ' OnClick = Button5Click TabOrder = 1 end object Button3: TButton - Left = 184 + Left = 224 Height = 25 Top = 8 Width = 173 @@ -469,15 +573,31 @@ object Form1: TForm1 TabOrder = 2 end object Button2: TButton - Left = 357 + Left = 400 Height = 25 Top = 8 - Width = 75 + Width = 103 BorderSpacing.InnerBorder = 4 Caption = 'Flip Controls' OnClick = Button2Click TabOrder = 3 end + object FlipLabel: TLabel + Left = 624 + Height = 17 + Top = 12 + Width = 45 + Caption = 'Native' + ParentColor = False + end + object Label8: TLabel + Left = 536 + Height = 17 + Top = 12 + Width = 76 + Caption = 'Flip Status:' + ParentColor = False + end object MainMenu1: TMainMenu Images = ImageList1 left = 222 @@ -502,32 +622,40 @@ object Form1: TForm1 Caption = 'Undo' Checked = True Bitmap.Data = { - 36030000424D3603000000000000360000002800000010000000100000000100 - 18000000000000030000C40E0000C40E00000000000000000000FF00FFFF00FF - FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00 - FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF - 00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF - FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00 - FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF - 00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF - 0000000000000000000000000000000000000000000000000000000000000000 - 00FF00FFFF00FFFF00FFFF00FFFF00FF0065639CFFFF00CFFF00CFFF00CFFF00 - CFFF009ACE00CFFF009ACE009ACE000000FF00FFFF00FFFF00FFFF00FFFF00FF - 0065639CFFFF9CFFFF00CFFF00CFFF00CFFF00CFFF009ACE00CFFF009ACE0000 - 00FF00FFFF00FFFF00FFFF00FFFF00FF0065639CFFFF00CFFF9CFFFF00CFFF00 - CFFF00CFFF00CFFF009ACE009ACE000000FF00FFFF00FFFF00FFFF00FFFF00FF - 0065639CFFFFFFFFFF00CFFF9CFFFF00CFFF00CFFF00CFFF00CFFF009ACE0000 - 00FF00FFFF00FFFF00FFFF00FFFF00FF0065639CFFFF00CFFFFFFFFF00CFFF9C - FFFF00CFFF00CFFF00CFFF009ACE000000FF00FFFF00FFFF00FFFF00FFFF00FF - 0065639CFFFF9CFFFF9CFFFF9CFFFF9CFFFF9CFFFF9CFFFF9CFFFF9CFFFF0000 - 00FF00FFFF00FFFF00FFFF00FFFF00FF0065639CFFFF9CFFFF9CFFFF9CCFCE00 - 6563006563006563006563006563FF00FFFF00FFFF00FFFF00FFFF00FFFF00FF - FF00FF006563006563006563006563FF00FFFF00FFFF00FFFF00FFFF00FFFF00 - FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF - 00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF - FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00 - FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF - 00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000 + 00FF000000FF000000FF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00006563FF9CFFFFFF00CFFFFF00CFFFFF00CFFFFF00CFFFFF009ACEFF00CF + FFFF009ACEFF009ACEFF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00006563FF9CFFFFFF9CFFFFFF00CFFFFF00CFFFFF00CFFFFF00CFFFFF009A + CEFF00CFFFFF009ACEFF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00006563FF9CFFFFFF00CFFFFF9CFFFFFF00CFFFFF00CFFFFF00CFFFFF00CF + FFFF009ACEFF009ACEFF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00006563FF9CFFFFFFFFFFFFFF00CFFFFF9CFFFFFF00CFFFFF00CFFFFF00CF + FFFF00CFFFFF009ACEFF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00006563FF9CFFFFFF00CFFFFFFFFFFFFF00CFFFFF9CFFFFFF00CFFFFF00CF + FFFF00CFFFFF009ACEFF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00006563FF9CFFFFFF9CFFFFFF9CFFFFFF9CFFFFFF9CFFFFFF9CFFFFFF9CFF + FFFF9CFFFFFF9CFFFFFF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00006563FF9CFFFFFF9CFFFFFF9CFFFFFF9CCFCEFF006563FF006563FF0065 + 63FF006563FF006563FFFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00006563FF006563FF006563FF006563FFFF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 } ImageIndex = 1 end @@ -543,24 +671,40 @@ object Form1: TForm1 object MenuItem6: TMenuItem Caption = 'Copy' Bitmap.Data = { - 2E020000424D2E0200000000000036000000280000000B0000000E0000000100 - 180000000000F801000000000000000000000000000000000000FF00FFFF00FF - FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF000000FF00 - FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF00 - 0000FF00FFFF00FFFF00FF000000000000000000000000000000FF00FFFF00FF - FF00FF000000FF00FFFF00FF0000003434CB3434CB3434CB3434CB3434CB0000 - 00FF00FFFF00FF000000FF00FF0000005C5CD63434CB3434CB3434CB3434CB34 - 34CB3434CB000000FF00FF000000FF00FF0000005C5CD65C5CD63434CB3434CB - 3434CB3434CB3434CB000000FF00FF000000FF00FF0000007474DC5C5CD65C5C - D63434CB3434CB3434CB3434CB000000FF00FF000000FF00FF0000007474DC74 - 74DC5C5CD63434CB3434CB3434CB3434CB000000FF00FF000000FF00FF000000 - 7474DC7474DC7474DC5C5CD63434CB3434CB3434CB000000FF00FF000000FF00 - FFFF00FF0000007474DC7474DC7474DC5C5CD65C5CD6000000FF00FFFF00FF00 - 0000FF00FFFF00FFFF00FF000000000000000000000000000000FF00FFFF00FF - FF00FF000000FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00 - FFFF00FFFF00FF000000FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF - 00FFFF00FFFF00FFFF00FF000000FF00FFFF00FFFF00FFFF00FFFF00FFFF00FF - FF00FFFF00FFFF00FFFF00FFFF00FF000000 + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00000000FF000000FF000000FF000000FF0000 + 00FFFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00000000FF3434CBFF3434CBFF3434CBFF3434CBFF3434 + CBFF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00000000FF5C5CD6FF3434CBFF3434CBFF3434CBFF3434CBFF3434 + CBFF3434CBFF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00000000FF5C5CD6FF5C5CD6FF3434CBFF3434CBFF3434CBFF3434 + CBFF3434CBFF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00000000FF7474DCFF5C5CD6FF5C5CD6FF3434CBFF3434CBFF3434 + CBFF3434CBFF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00000000FF7474DCFF7474DCFF5C5CD6FF3434CBFF3434CBFF3434 + CBFF3434CBFF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00000000FF7474DCFF7474DCFF7474DCFF5C5CD6FF3434CBFF3434 + CBFF3434CBFF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00000000FF7474DCFF7474DCFF7474DCFF5C5CD6FF5C5C + D6FF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00000000FF000000FF000000FF000000FF0000 + 00FFFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 } ImageIndex = 2 end @@ -582,25 +726,40 @@ object Form1: TForm1 object MenuItem22: TMenuItem Caption = 'Contents' Bitmap.Data = { - 42020000424D4202000000000000420000002800000010000000100000000100 - 1000030000000002000000000000000000000000000000000000007C0000E003 - 00001F0000001F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C - 1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C - 1F7C1F7C1F7C1F7C1F7C1F7C0000000000000000000000000000000000000000 - 00001F7C1F7C1F7C1F7C1F7C1042FF7FFF7F9C739C739C733967396739673967 - 00001F7C1F7C1F7C1F7C1F7C1042FF7F9C73FF7FFF7F9C73FF7F9C735A6B3967 - 00001F7C1F7C1F7C1F7C1F7C1042FF7FFF7FFF7FFF7FFF7F9C73FF7F9C733967 - 00001F7C1F7C1F7C1F7C1F7C1042FF7FFF7FFF7F9C73FF7FFF7F9C73FF7F9C73 - 00001F7C1F7C1F7C1F7C1F7C1042FF7FFF7FFF7FFF7FFF7FFF7FFF7F9C739C73 - 00001F7C1F7C1F7C1F7C1F7C1042FF7FFF7FFF7FFF7FFF7F9C73FF7FFF7F9C73 - 00001F7C1F7C1F7C1F7C1F7C1042FF7FFF7FFF7FFF7FFF7FFF7F9C739C735A6B - 00001F7C1F7C1F7C1F7C1F7C1042FF7FFF7FFF7FFF7FFF7F0000000000000000 - 00001F7C1F7C1F7C1F7C1F7C1042FF7FFF7FFF7FFF7FFF7F1042FF7FFF7F0000 - 1F7C1F7C1F7C1F7C1F7C1F7C1042FF7FFF7FFF7FFF7FFF7F1042FF7F00001F7C - 1F7C1F7C1F7C1F7C1F7C1F7C1042FF7FFF7FFF7FFF7FFF7F104200001F7C1F7C - 1F7C1F7C1F7C1F7C1F7C1F7C10421042104210421042104200001F7C1F7C1F7C - 1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C1F7C - 1F7C1F7C1F7C + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FF00F700FF00 + F700FF00F700FF00F700FF00F700FF00F700FF00F700FF00F700FF00F700FF00 + F700FF00F700FF00F700FF00F700FF00F700FF00F700FF00F700FF00F700FF00 + F700FF00F700FF00F700FF00F700FF00F700FF00F700FF00F700FF00F700FF00 + F700FF00F700FF00F700FF00F700FF00F700FF00F700FF00F700FF00F700FF00 + F700FF00F700000000FF000000FF000000FF000000FF000000FF000000FF0000 + 00FF000000FF000000FF000000FF000000FFFF00F700FF00F700FF00F700FF00 + F700FF00F70084868CFFFFFFFFFFFFFFFFFFE7E7EFFFE7E7EFFFE7E7EFFFCECF + CEFFCECFCEFFCECFCEFFCECFCEFF000000FFFF00F700FF00F700FF00F700FF00 + F700FF00F70084868CFFFFFFFFFFE7E7EFFFFFFFFFFFFFFFFFFFE7E7EFFFFFFF + FFFFE7E7EFFFD6D7DEFFCECFCEFF000000FFFF00F700FF00F700FF00F700FF00 + F700FF00F70084868CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE7E7 + EFFFFFFFFFFFE7E7EFFFCECFCEFF000000FFFF00F700FF00F700FF00F700FF00 + F700FF00F70084868CFFFFFFFFFFFFFFFFFFFFFFFFFFE7E7EFFFFFFFFFFFFFFF + FFFFE7E7EFFFFFFFFFFFE7E7EFFF000000FFFF00F700FF00F700FF00F700FF00 + F700FF00F70084868CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFE7E7EFFFE7E7EFFF000000FFFF00F700FF00F700FF00F700FF00 + F700FF00F70084868CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE7E7 + EFFFFFFFFFFFFFFFFFFFE7E7EFFF000000FFFF00F700FF00F700FF00F700FF00 + F700FF00F70084868CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFE7E7EFFFE7E7EFFFD6D7DEFF000000FFFF00F700FF00F700FF00F700FF00 + F700FF00F70084868CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000 + 00FF000000FF000000FF000000FF000000FFFF00F700FF00F700FF00F700FF00 + F700FF00F70084868CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8486 + 8CFFFFFFFFFFFFFFFFFF000000FFFF00F700FF00F700FF00F700FF00F700FF00 + F700FF00F70084868CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8486 + 8CFFFFFFFFFF000000FFFF00F700FF00F700FF00F700FF00F700FF00F700FF00 + F700FF00F70084868CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8486 + 8CFF000000FFFF00F700FF00F700FF00F700FF00F700FF00F700FF00F700FF00 + F700FF00F70084868CFF84868CFF84868CFF84868CFF84868CFF84868CFF0000 + 00FFFF00F700FF00F700FF00F700FF00F700FF00F700FF00F700FF00F700FF00 + F700FF00F700FF00F700FF00F700FF00F700FF00F700FF00F700FF00F700FF00 + F700FF00F700FF00F700FF00F700FF00F700FF00F700FF00F700 } ImageIndex = 0 end diff --git a/examples/bidi/unit1.pas b/examples/bidi/unit1.pas index eaa7eb2ff9..aa7107b7fc 100644 --- a/examples/bidi/unit1.pas +++ b/examples/bidi/unit1.pas @@ -23,6 +23,9 @@ type Button4: TButton; Button5: TButton; Button6: TButton; + Button7: TButton; + Button8: TButton; + Button9: TButton; CheckBox1: TCheckBox; CheckBox2: TCheckBox; CheckListBox1: TCheckListBox; @@ -37,6 +40,12 @@ type Label1: TLabel; Label2: TLabel; Label3: TLabel; + Label4: TLabel; + Label5: TLabel; + Label6: TLabel; + Label7: TLabel; + FlipLabel: TLabel; + Label8: TLabel; ListBox1: TListBox; ListBox2: TListBox; MainMenu1: TMainMenu; @@ -82,6 +91,7 @@ type TabSheet1: TTabSheet; TabSheet2: TTabSheet; TabSheet3: TTabSheet; + TabSheet4: TTabSheet; TrayIcon1: TTrayIcon; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); @@ -146,6 +156,16 @@ end; procedure TForm1.Button2Click(Sender: TObject); begin FlipChildren(True); + if IsFlipped then + begin + FlipLabel.Caption := 'Flipped'; + FlipLabel.Color := clRed; + end + else + begin + FlipLabel.Caption := 'Native'; + FlipLabel.Color := clNone; + end; end; procedure TForm1.FormCreate(Sender: TObject); diff --git a/lcl/controls.pp b/lcl/controls.pp index aed7bafb27..cf47dd327f 100644 --- a/lcl/controls.pp +++ b/lcl/controls.pp @@ -1948,6 +1948,7 @@ type FClientWidth: Integer; FClientHeight: Integer; FDockManager: TDockManager; + FFlipped: boolean; // true if flipped - false if native FOnAlignInsertBefore: TAlignInsertBeforeEvent; FOnAlignPosition: TAlignPositionEvent; FOnDockDrop: TDockDropEvent; @@ -2186,6 +2187,7 @@ type property DockSite: Boolean read FDockSite write SetDockSite default False; property DoubleBuffered: Boolean read FDoubleBuffered write FDoubleBuffered default False; property Handle: HWND read GetHandle write SetHandle; + property IsFlipped: Boolean read FFlipped; property IsResizing: Boolean read GetIsResizing; property TabOrder: TTabOrder read GetTabOrder write SetTabOrder default -1; property TabStop: Boolean read FTabStop write SetTabStop default false; @@ -2823,16 +2825,35 @@ begin end; function BidiFlipAnchors(Control: TControl; Flip: Boolean): TAnchors; +var + LeftControl,RightControl : TControl; + LeftSide,RightSide: TAnchorSideReference; + NewAnchors: TAnchors; begin Result := Control.Anchors; if Flip then begin - if (akLeft in Result) and (Control.AnchorSide[akLeft].Control=nil) - and not (akRight in Result) then - Result := Result - [akLeft] + [akRight] - else if (akRight in Result) and (Control.AnchorSide[akRight].Control=nil) - and not (akLeft in Result) then - Result := Result - [akRight] + [akLeft]; + LeftControl := Control.AnchorSide[akLeft].Control; + LeftSide := Control.AnchorSide[akLeft].Side; + if LeftSide = asrTop then LeftSide := asrBottom + else if LeftSide = asrBottom then LeftSide := asrTop; + + RightControl := Control.AnchorSide[akRight].Control; + RightSide := Control.AnchorSide[akRight].Side; + if RightSide = asrTop then RightSide := asrBottom + else if RightSide = asrBottom then RightSide := asrTop; + + Control.AnchorSide[akLeft].Control := RightControl; + Control.AnchorSide[akLeft].Side := RightSide; + Control.AnchorSide[akRight].Control := LeftControl; + Control.AnchorSide[akRight].Side := LeftSide; + + NewAnchors := []; + if (akTop in Result) then NewAnchors := NewAnchors + [akTop]; + if (akBottom in Result) then NewAnchors := NewAnchors + [akBottom]; + if (akLeft in Result) then NewAnchors := NewAnchors + [akRight]; + if (akRight in Result) then NewAnchors := NewAnchors + [akLeft]; + Result := NewAnchors; end; end; diff --git a/lcl/include/wincontrol.inc b/lcl/include/wincontrol.inc index c0c8f18e99..8934bfadd1 100644 --- a/lcl/include/wincontrol.inc +++ b/lcl/include/wincontrol.inc @@ -4513,7 +4513,7 @@ begin FlipControls.Free; EnableAlign; end; - + FFlipped := not FFlipped; // toggle FFlipped status // flip recursively if AllLevels then begin for i := 0 to ControlCount - 1 do begin @@ -6659,11 +6659,17 @@ var i: Integer; CurControl: TControl; AWidth: Integer; + SaveLeft: Integer; begin AWidth:=GetLogicalClientRect.Right; DisableAlign; for i:=0 to ControlCount-1 do begin CurControl:=Controls[i]; + // flip BorderSpacing + SaveLeft := CurControl.BorderSpacing.Left; + CurControl.BorderSpacing.Left := CurControl.BorderSpacing.Right; + CurControl.BorderSpacing.Right := SaveLeft; + // flip control and anchors CurControl.Left:=AWidth-CurControl.Left-CurControl.Width; CurControl.Anchors := BidiFlipAnchors(CurControl, True); end;