diff --git a/components/rx/Demos/RxMDI/project1.ico b/components/rx/Demos/RxMDI/project1.ico new file mode 100644 index 000000000..0341321b5 Binary files /dev/null and b/components/rx/Demos/RxMDI/project1.ico differ diff --git a/components/rx/Demos/RxMDI/project1.lpi b/components/rx/Demos/RxMDI/project1.lpi new file mode 100644 index 000000000..a8da1eca8 --- /dev/null +++ b/components/rx/Demos/RxMDI/project1.lpi @@ -0,0 +1,113 @@ + + + + + + + + + + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + <Icon Value="0"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + </local> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="rxnew"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="5"> + <Unit0> + <Filename Value="project1.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="project1"/> + </Unit0> + <Unit1> + <Filename Value="unit1.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="Unit1"/> + </Unit1> + <Unit2> + <Filename Value="unit2.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form2"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="Unit2"/> + </Unit2> + <Unit3> + <Filename Value="unit3.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form3"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="Unit3"/> + </Unit3> + <Unit4> + <Filename Value="unit4.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form4"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="Unit4"/> + </Unit4> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="project1"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CompilerMessages> + <MsgFileName Value=""/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/components/rx/Demos/RxMDI/project1.lpr b/components/rx/Demos/RxMDI/project1.lpr new file mode 100644 index 000000000..fd216e9ac --- /dev/null +++ b/components/rx/Demos/RxMDI/project1.lpr @@ -0,0 +1,20 @@ +program project1; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, Unit1, rxnew, Unit2, Unit3, Unit4; + +{$R *.res} + +begin + RequireDerivedFormResource := True; + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + diff --git a/components/rx/Demos/RxMDI/project1.lps b/components/rx/Demos/RxMDI/project1.lps new file mode 100644 index 000000000..8fa8a3e41 --- /dev/null +++ b/components/rx/Demos/RxMDI/project1.lps @@ -0,0 +1,208 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectSession> + <Version Value="9"/> + <BuildModes Active="Default"/> + <Units Count="6"> + <Unit0> + <Filename Value="project1.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="project1"/> + <UsageCount Value="20"/> + </Unit0> + <Unit1> + <Filename Value="unit1.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="Unit1"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="0"/> + <WindowIndex Value="0"/> + <TopLine Value="45"/> + <CursorPos X="26" Y="75"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + </Unit1> + <Unit2> + <Filename Value="unit2.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form2"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="Unit2"/> + <EditorIndex Value="3"/> + <WindowIndex Value="0"/> + <TopLine Value="7"/> + <CursorPos X="6" Y="10"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + </Unit2> + <Unit3> + <Filename Value="../../rxmdi.pas"/> + <UnitName Value="RxMDI"/> + <EditorIndex Value="1"/> + <WindowIndex Value="0"/> + <TopLine Value="294"/> + <CursorPos X="3" Y="298"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit3> + <Unit4> + <Filename Value="unit3.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form3"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="Unit3"/> + <EditorIndex Value="2"/> + <WindowIndex Value="0"/> + <TopLine Value="9"/> + <CursorPos X="14" Y="37"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + </Unit4> + <Unit5> + <Filename Value="unit4.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form4"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="Unit4"/> + <EditorIndex Value="4"/> + <WindowIndex Value="0"/> + <TopLine Value="12"/> + <CursorPos X="26" Y="41"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + </Unit5> + </Units> + <General> + <ActiveWindowIndexAtStart Value="0"/> + </General> + <JumpHistory Count="30" HistoryIndex="29"> + <Position1> + <Filename Value="unit1.pas"/> + <Caret Line="18" Column="27" TopLine="1"/> + </Position1> + <Position2> + <Filename Value="unit1.pas"/> + <Caret Line="20" Column="27" TopLine="1"/> + </Position2> + <Position3> + <Filename Value="unit1.pas"/> + <Caret Line="21" Column="27" TopLine="1"/> + </Position3> + <Position4> + <Filename Value="unit1.pas"/> + <Caret Line="22" Column="27" TopLine="1"/> + </Position4> + <Position5> + <Filename Value="unit1.pas"/> + <Caret Line="23" Column="27" TopLine="1"/> + </Position5> + <Position6> + <Filename Value="unit1.pas"/> + <Caret Line="24" Column="27" TopLine="1"/> + </Position6> + <Position7> + <Filename Value="unit1.pas"/> + <Caret Line="25" Column="27" TopLine="1"/> + </Position7> + <Position8> + <Filename Value="unit1.pas"/> + <Caret Line="27" Column="27" TopLine="1"/> + </Position8> + <Position9> + <Filename Value="unit1.pas"/> + <Caret Line="42" Column="9" TopLine="15"/> + </Position9> + <Position10> + <Filename Value="unit1.pas"/> + <Caret Line="43" Column="9" TopLine="15"/> + </Position10> + <Position11> + <Filename Value="unit2.pas"/> + <Caret Line="24" Column="22" TopLine="1"/> + </Position11> + <Position12> + <Filename Value="unit1.pas"/> + <Caret Line="44" Column="9" TopLine="15"/> + </Position12> + <Position13> + <Filename Value="unit1.pas"/> + <Caret Line="46" Column="9" TopLine="15"/> + </Position13> + <Position14> + <Filename Value="unit1.pas"/> + <Caret Line="53" Column="47" TopLine="24"/> + </Position14> + <Position15> + <Filename Value="unit1.pas"/> + <Caret Line="54" Column="47" TopLine="25"/> + </Position15> + <Position16> + <Filename Value="unit1.pas"/> + <Caret Line="55" Column="47" TopLine="26"/> + </Position16> + <Position17> + <Filename Value="unit1.pas"/> + <Caret Line="55" Column="1" TopLine="28"/> + </Position17> + <Position18> + <Filename Value="unit1.pas"/> + <Caret Line="55" Column="1" TopLine="28"/> + </Position18> + <Position19> + <Filename Value="unit3.pas"/> + <Caret Line="19" Column="22" TopLine="1"/> + </Position19> + <Position20> + <Filename Value="unit3.pas"/> + <Caret Line="23" Column="22" TopLine="1"/> + </Position20> + <Position21> + <Filename Value="unit3.pas"/> + <Caret Line="26" Column="22" TopLine="1"/> + </Position21> + <Position22> + <Filename Value="unit1.pas"/> + <Caret Line="55" Column="1" TopLine="28"/> + </Position22> + <Position23> + <Filename Value="unit1.pas"/> + <Caret Line="57" Column="1" TopLine="29"/> + </Position23> + <Position24> + <Filename Value="unit1.pas"/> + <Caret Line="62" Column="47" TopLine="35"/> + </Position24> + <Position25> + <Filename Value="unit4.pas"/> + <Caret Line="1" Column="1" TopLine="1"/> + </Position25> + <Position26> + <Filename Value="unit1.pas"/> + <Caret Line="63" Column="47" TopLine="36"/> + </Position26> + <Position27> + <Filename Value="unit1.pas"/> + <Caret Line="65" Column="26" TopLine="43"/> + </Position27> + <Position28> + <Filename Value="unit4.pas"/> + <Caret Line="22" Column="21" TopLine="4"/> + </Position28> + <Position29> + <Filename Value="unit1.pas"/> + <Caret Line="73" Column="26" TopLine="43"/> + </Position29> + <Position30> + <Filename Value="unit1.pas"/> + <Caret Line="74" Column="26" TopLine="44"/> + </Position30> + </JumpHistory> + </ProjectSession> + <EditorMacros Count="0"/> +</CONFIG> diff --git a/components/rx/Demos/RxMDI/project1.res b/components/rx/Demos/RxMDI/project1.res new file mode 100644 index 000000000..7c6cf3e4b Binary files /dev/null and b/components/rx/Demos/RxMDI/project1.res differ diff --git a/components/rx/Demos/RxMDI/unit1.lfm b/components/rx/Demos/RxMDI/unit1.lfm new file mode 100644 index 000000000..eaef5b4fb --- /dev/null +++ b/components/rx/Demos/RxMDI/unit1.lfm @@ -0,0 +1,129 @@ +object Form1: TForm1 + Left = 527 + Height = 423 + Top = 222 + Width = 581 + Caption = 'MainForm' + ClientHeight = 400 + ClientWidth = 581 + Menu = MainMenu1 + Position = poScreenCenter + LCLVersion = '1.1' + WindowState = wsMaximized + object ToolPanel1: TToolPanel + Left = 0 + Height = 31 + Top = 0 + Width = 581 + Items = <> + Options = [] + Align = alTop + BorderWidth = 4 + ClientHeight = 31 + ClientWidth = 581 + TabOrder = 0 + object RxMDICloseButton1: TRxMDICloseButton + AnchorSideTop.Control = ToolPanel1 + AnchorSideTop.Side = asrCenter + AnchorSideRight.Control = ToolPanel1 + AnchorSideRight.Side = asrBottom + Left = 553 + Height = 22 + Top = 4 + Width = 23 + Anchors = [akTop, akRight] + Glyph.Data = { + 1A020000424D1A0200000000000036000000280000000B0000000B0000000100 + 200000000000E401000064000000640000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000FF0000 + 00FF00000000000000000000000000000000000000FF000000FF000000000000 + 00000000000000000000000000FF000000FF0000000000000000000000FF0000 + 00FF000000000000000000000000000000000000000000000000000000FF0000 + 00FF000000FF000000FF00000000000000000000000000000000000000000000 + 00000000000000000000000000FF000000FF0000000000000000000000000000 + 000000000000000000000000000000000000000000FF000000FF000000FF0000 + 00FF000000000000000000000000000000000000000000000000000000FF0000 + 00FF0000000000000000000000FF000000FF0000000000000000000000000000 + 0000000000FF000000FF00000000000000000000000000000000000000FF0000 + 00FF000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000 + } + end + end + object RxMDITasks1: TRxMDITasks + Left = 0 + Height = 25 + Top = 356 + Width = 581 + Align = alBottom + end + object StatusBar1: TStatusBar + Left = 0 + Height = 19 + Top = 381 + Width = 581 + Panels = <> + end + object RxMDIPanel1: TRxMDIPanel + Left = 0 + Height = 325 + Top = 31 + Width = 581 + CloseButton = RxMDICloseButton1 + TaskPanel = RxMDITasks1 + Align = alClient + BevelOuter = bvLowered + end + object ActionList1: TActionList + left = 440 + top = 72 + object sysClose: TAction + Category = 'System' + Caption = 'Close' + OnExecute = sysCloseExecute + end + object Action1: TAction + Category = 'MDI forms' + Caption = 'Form # 1' + OnExecute = Action1Execute + end + object Action2: TAction + Category = 'MDI forms' + Caption = 'Form # 2' + OnExecute = Action2Execute + end + object Action3: TAction + Category = 'MDI forms' + Caption = 'New single MDI form' + OnExecute = Action3Execute + end + end + object MainMenu1: TMainMenu + left = 408 + top = 72 + object MenuItem1: TMenuItem + Caption = 'System' + object MenuItem2: TMenuItem + Action = sysClose + end + end + object MenuItem3: TMenuItem + Caption = 'MDI forms' + object MenuItem4: TMenuItem + Action = Action1 + end + object MenuItem5: TMenuItem + Action = Action2 + end + object MenuItem7: TMenuItem + Caption = '-' + end + object MenuItem6: TMenuItem + Action = Action3 + end + end + end +end diff --git a/components/rx/Demos/RxMDI/unit1.pas b/components/rx/Demos/RxMDI/unit1.pas new file mode 100644 index 000000000..c2d9191ba --- /dev/null +++ b/components/rx/Demos/RxMDI/unit1.pas @@ -0,0 +1,79 @@ +unit Unit1; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, rxtoolbar, RxMDI, Forms, Controls, Graphics, + Dialogs, ActnList, Menus, ComCtrls; + +type + + { TForm1 } + + TForm1 = class(TForm) + Action1: TAction; + Action2: TAction; + Action3: TAction; + MenuItem1: TMenuItem; + MenuItem2: TMenuItem; + MenuItem3: TMenuItem; + MenuItem4: TMenuItem; + MenuItem5: TMenuItem; + MenuItem6: TMenuItem; + MenuItem7: TMenuItem; + sysClose: TAction; + ActionList1: TActionList; + MainMenu1: TMainMenu; + RxMDICloseButton1: TRxMDICloseButton; + RxMDIPanel1: TRxMDIPanel; + RxMDITasks1: TRxMDITasks; + StatusBar1: TStatusBar; + ToolPanel1: TToolPanel; + procedure Action1Execute(Sender: TObject); + procedure Action2Execute(Sender: TObject); + procedure Action3Execute(Sender: TObject); + procedure sysCloseExecute(Sender: TObject); + private + { private declarations } + public + { public declarations } + end; + +var + Form1: TForm1; + +implementation + +uses Unit2, Unit3, Unit4; + +{$R *.lfm} + +{ TForm1 } + +procedure TForm1.sysCloseExecute(Sender: TObject); +begin + Close; +end; + +procedure TForm1.Action1Execute(Sender: TObject); +begin + RxMDIPanel1.ChildWindowsCreate(Form2, TForm2); +end; + +procedure TForm1.Action2Execute(Sender: TObject); +begin + RxMDIPanel1.ChildWindowsCreate(Form3, TForm3); +end; + +procedure TForm1.Action3Execute(Sender: TObject); +var + Form4: TForm4; +begin + Form4:=TForm4.Create(Application); + RxMDIPanel1.ChildWindowsAdd(Form4); +end; + +end. + diff --git a/components/rx/Demos/RxMDI/unit2.lfm b/components/rx/Demos/RxMDI/unit2.lfm new file mode 100644 index 000000000..f131d402e --- /dev/null +++ b/components/rx/Demos/RxMDI/unit2.lfm @@ -0,0 +1,59 @@ +object Form2: TForm2 + Left = 502 + Height = 240 + Top = 245 + Width = 320 + Caption = 'MDI form 1' + ClientHeight = 240 + ClientWidth = 320 + Icon.Data = { + 7E04000000000100010010100000010020006804000016000000280000001000 + 0000200000000100200000000000000400006400000064000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000BE7A45FFBE7A + 45FFBE7A45FF0000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000BE7A45FFBE7A45FF78553958BE7A45FFE3CD + BCFFBE7A45FF78553958BE7A45FFBE7A45FF0000000000000000000000000000 + 00000000000000000000BE7A45FFE3CDBCFFD2A786FFBE7A45FFC79064FFDAB8 + 9DFFC79064FFBE7A45FFD2A786FFE3CDBCFFBE7A45FF00000000000000000000 + 00000000000000000000BE7A45FFD2A786FFDAB89DFFDAB89DFFDAB89DFFDAB8 + 9DFFDAB89DFFDAB89DFFDAB89DFFD2A786FFBE7A45FF00000000000000000000 + 0000000000000000000078553958BE7A45FFE3CDBCFFCFA17CFFBD7F4CF8C386 + 56FFBA7A46F4D5AE8FFFDAB89DFFBE7A45FF7855395800000000000000000000 + 000000000000BE7A45FFBE7A45FFC79064FFDAB89DFFBD7F4CF8B78256CD7855 + 3959A56F43C0BA7A46F4DAB89DFFC79064FFBE7A45FFBE7A45FF000000000000 + 000000000000BE7A45FFE3CDBCFFDAB89DFFDAB89DFFC38656FF785539590000 + 000078553959C38656FFDAB89DFFDAB89DFFE3CDBCFFBE7A45FF000000000000 + 000000000000BE7A45FFBE7A45FFC79064FFDAB89DFFBA7A46F49C6B42AE7855 + 39598F633F97BA7C49EEDAB89DFFC79064FFBE7A45FFBE7A45FF000000000000 + 0000000000000000000078553958BE7A45FFDAB89DFFCFA17CFFBA7A46F4C386 + 56FFBA7A46F4D1A582FFDAB89DFFBE7A45FF7855395800000000000000000000 + 00000000000000000000BE7A45FFD2A786FFDAB89DFFDAB89DFFDAB89DFFDAB8 + 9DFFDAB89DFFDAB89DFFDAB89DFFD2A786FFBE7A45FF00000000000000000000 + 00000000000000000000BE7A45FFE3CDBCFFD2A786FFBE7A45FFC79064FFDAB8 + 9DFFC79064FFBE7A45FFD2A786FFE3CDBCFFBE7A45FF00000000000000000000 + 0000000000000000000078553958BE7A45FFBE7A45FF78553958BE7A45FFE3CD + BCFFBE7A45FF78553958BE7A45FFBE7A45FF0000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000BE7A45FFBE7A + 45FFBE7A45FF0000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000 + } + OnClose = FormClose + LCLVersion = '1.1' + object Panel1: TPanel + Left = 0 + Height = 50 + Top = 0 + Width = 320 + Align = alTop + Caption = 'MDI form # 1' + TabOrder = 0 + end +end diff --git a/components/rx/Demos/RxMDI/unit2.pas b/components/rx/Demos/RxMDI/unit2.pas new file mode 100644 index 000000000..7b3daa92b --- /dev/null +++ b/components/rx/Demos/RxMDI/unit2.pas @@ -0,0 +1,39 @@ +unit Unit2; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls; + +type + + { TForm2 } + + TForm2 = class(TForm) + Panel1: TPanel; + procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); + private + { private declarations } + public + { public declarations } + end; + +var + Form2: TForm2 = nil; + +implementation + +{$R *.lfm} + +{ TForm2 } + +procedure TForm2.FormClose(Sender: TObject; var CloseAction: TCloseAction); +begin + CloseAction:=caFree; + Form2:=nil; +end; + +end. + diff --git a/components/rx/Demos/RxMDI/unit3.lfm b/components/rx/Demos/RxMDI/unit3.lfm new file mode 100644 index 000000000..f46270b90 --- /dev/null +++ b/components/rx/Demos/RxMDI/unit3.lfm @@ -0,0 +1,70 @@ +object Form3: TForm3 + Left = 604 + Height = 442 + Top = 239 + Width = 640 + Caption = 'MDI form # 2' + ClientHeight = 442 + ClientWidth = 640 + Icon.Data = { + 7E04000000000100010010100000010020006804000016000000280000001000 + 0000200000000100200000000000000400006400000064000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000E2C0AAFFE2C0AAFF000000000000 + 00000000000000000000E2C0AAFFE2C0AAFF0000000000000000000000000000 + 0000000000000000000000000000C8865BFFBE713FFFC58053FF000000000000 + 00000000000000000000CE946EFFBE703EFFC17746FF00000000000000000000 + 0000000000000000000000000000BD6E3BFFBD6E3BFFE2C0AAFF000000000000 + 0000000000000000000000000000BD6E3BFFBD6E3BFFE2C0AAFF000000000000 + 0000000000000000000000000000BD6E3BFFBD6E3BFFE2C0AAFF000000000000 + 0000000000000000000000000000BD6E3BFFBD6E3BFFE2C0AAFF000000000000 + 0000000000000000000000000000BD6E3BFFBD6E3BFFE2C0AAFF000000000000 + 0000000000000000000000000000BD6E3BFFBD6E3BFFE2C0AAFF000000000000 + 00000000000000000000D6A586FFC2794AFFCA8A61FF00000000000000000000 + 0000000000000000000000000000D39E7CFFC2794AFFCC9068FF000000000000 + 00000000000000000000C9885EFFC07443FFC27849FF00000000000000000000 + 0000000000000000000000000000C9885EFFC2794AFFC9885EFF000000000000 + 0000000000000000000000000000BD6E3BFFBD6E3BFFE2C0AAFF000000000000 + 0000000000000000000000000000BD6E3BFFBD6E3BFFE2C0AAFF000000000000 + 0000000000000000000000000000BD6E3BFFBD6E3BFFE2C0AAFF000000000000 + 0000000000000000000000000000BD6E3BFFBD6E3BFFE2C0AAFF000000000000 + 0000000000000000000000000000BD6E3BFFBD6E3BFFE2C0AAFF000000000000 + 0000000000000000000000000000BD6E3BFFBD6E3BFFE2C0AAFF000000000000 + 0000000000000000000000000000D4A17FFFBD6F3CFFBE703DFF000000000000 + 00000000000000000000C68155FFBF7241FFCC8D66FF00000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000 + } + OnClose = FormClose + LCLVersion = '1.1' + object Panel1: TPanel + Left = 0 + Height = 50 + Top = 0 + Width = 640 + Align = alTop + Caption = 'MDI form # 2' + TabOrder = 0 + end + object Memo1: TMemo + Left = 0 + Height = 392 + Top = 50 + Width = 640 + Align = alClient + Lines.Strings = ( + 'Memo1' + ) + TabOrder = 1 + end +end diff --git a/components/rx/Demos/RxMDI/unit3.pas b/components/rx/Demos/RxMDI/unit3.pas new file mode 100644 index 000000000..2214c5c02 --- /dev/null +++ b/components/rx/Demos/RxMDI/unit3.pas @@ -0,0 +1,41 @@ +unit Unit3; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, + StdCtrls; + +type + + { TForm3 } + + TForm3 = class(TForm) + Memo1: TMemo; + Panel1: TPanel; + procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); + private + { private declarations } + public + { public declarations } + end; + +var + Form3: TForm3 = nil; + +implementation + +{$R *.lfm} + +{ TForm3 } + +procedure TForm3.FormClose(Sender: TObject; var CloseAction: TCloseAction); +begin + CloseAction:=caFree; + Form3:=nil; +end; + +end. + diff --git a/components/rx/Demos/RxMDI/unit4.lfm b/components/rx/Demos/RxMDI/unit4.lfm new file mode 100644 index 000000000..b70a3d815 --- /dev/null +++ b/components/rx/Demos/RxMDI/unit4.lfm @@ -0,0 +1,60 @@ +object Form4: TForm4 + Left = 477 + Height = 446 + Top = 196 + Width = 620 + Caption = 'Form4' + ClientHeight = 446 + ClientWidth = 620 + Icon.Data = { + 7E04000000000100010010100000010020006804000016000000280000001000 + 0000200000000100200000000000000400006400000064000000000000000000 + 0000874A2056874A20FF874A20FF874A20FF874A204400000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000874A20FFBEA592FFB89C86FFB89C86FF874A20FF874A2044000000000000 + 0000000000000000000000000000858A8881858A88D3858A8881000000000000 + 0000874A20FFCCBBADFFA7917DFFB5957AFFAE8B72FF874A20FF874A20440000 + 00000000000000000000858A884C858A88FF9EA1A0FF858A88FF000000000000 + 0000874A20FFCCBBADFFA48D78FFA28A74FFB4957AFFB3937CFF874A20FF0000 + 000000000000858A884C858A88FFD2D3D4FFC2C3C4FF858A88FF000000000000 + 0000874A2030874A20FFD4C8BDFFA48D78FFA48D78FFBEA592FF874A20FF0000 + 0000858A884C858A88FFE2E3E4FFC2C4C6FF858A88FF858A8881000000000000 + 000000000000874A2019874A20FFCCBBADFFCCBBADFFB3937CFF874A20FF858A + 8881858A88FFD3D3D4FFBDBEBFFF858A88FF858A884C00000002000000000000 + 00000000000000000000874A2019874A20FF874A20FF874A20FF85837DFFAAAD + ADFFC8C9CAFFBDBEBFFF858A88FF858A884C0000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000B5B7B8FF858A + 88FFB7B8B9FF858A88FF858A884C000000020000000000000000000000000000 + 000000000000858A884C858A88FF858A88FF858A88FF858A88FFD0D1D2FFA3A4 + A4FF858A88FF858A888100000000000000000000000000000000000000000000 + 0000858A884C858A88FFF3F3F3FEEFF0F0FFEDEEEEFEEAECECFEB6B9BAFF858A + 88FF858A884C858A88FF858A884C000000000000000000000000000000000000 + 0000858A88FFF5F6F6FEA9ACABFF858A88FFF7F7F7FFE2E3E5FFAAADADFFECEE + EE8100000000858A884C858A88FF858A884C0000000000000000000000000000 + 0000858A884C858A88FF00000000858A884C858A88FFFAFAFAFF858A88FF0000 + 00000000000000000000858A884C858A88FF878C8AFF0000004C000000000000 + 000000000000000000000000000000000000858A88FFEEF0F0FF858A88FF0000 + 0000000000000000000000000000858A88FFF0F0F0FF858A88FF0000004C0000 + 0000000000000000000000000000858A88FFE9EBECFF858A88FF858A884C0000 + 00000000000000000000000000000000004C858A88FFEEEFEFFC858A88FF0000 + 0000000000000000000000000000858A884C858A88FF858A884C000000000000 + 0000000000000000000000000000000000000000004C858A88FF858A884C0000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000 + } + OnClose = FormClose + OnCreate = FormCreate + LCLVersion = '1.1' + object Panel1: TPanel + Left = 0 + Height = 50 + Top = 0 + Width = 620 + Align = alTop + Caption = 'MDI form # ...' + TabOrder = 0 + end +end diff --git a/components/rx/Demos/RxMDI/unit4.pas b/components/rx/Demos/RxMDI/unit4.pas new file mode 100644 index 000000000..b91cb54e2 --- /dev/null +++ b/components/rx/Demos/RxMDI/unit4.pas @@ -0,0 +1,45 @@ +unit Unit4; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls; + +type + + { TForm4 } + + TForm4 = class(TForm) + Panel1: TPanel; + procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); + procedure FormCreate(Sender: TObject); + private + { private declarations } + public + { public declarations } + end; + +var + CntMM:integer = 0; +implementation + +{$R *.lfm} + +{ TForm4 } + +procedure TForm4.FormClose(Sender: TObject; var CloseAction: TCloseAction); +begin + CloseAction:=caFree; +end; + +procedure TForm4.FormCreate(Sender: TObject); +begin + Inc(CntMM); + Panel1.Caption:=Panel1.Caption + IntToStr(CntMM); + Caption:=Panel1.Caption; +end; + +end. + diff --git a/components/rx/RxMDICloseIcon.lrs b/components/rx/RxMDICloseIcon.lrs new file mode 100644 index 000000000..2370b4d98 --- /dev/null +++ b/components/rx/RxMDICloseIcon.lrs @@ -0,0 +1,7 @@ +LazarusResources.Add('RxMDICloseIcon','PNG',[ + #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#11#0#0#0#11#1#3#0#0#0#147'b'#229'e' + +#0#0#0#3'sBIT'#8#8#8#219#225'O'#224#0#0#0#6'PLTE'#0#0#0#0#0#0#165'g'#185#207 + +#0#0#0#1'tRNS'#0'@'#230#216'f'#0#0#0#9'pHYs'#0#0#14#196#0#0#14#196#1#149'+' + +#14#27#0#0#0' IDAT'#8#153'c`'#16'g'#0#2#131#3#12#146#13#12#252'l'#12'l'#12#12 + +#252#12' 6P'#4#12#0'7r'#3'T'#179'3'#141'G'#0#0#0#0'IEND'#174'B`'#130 +]); diff --git a/components/rx/images/RxMDICloseIcon.png b/components/rx/images/RxMDICloseIcon.png new file mode 100644 index 000000000..e3df635b6 Binary files /dev/null and b/components/rx/images/RxMDICloseIcon.png differ diff --git a/components/rx/languages/rxconst.es.po b/components/rx/languages/rxconst.es.po index 69596aa06..631a5f2b7 100644 --- a/components/rx/languages/rxconst.es.po +++ b/components/rx/languages/rxconst.es.po @@ -41,10 +41,22 @@ msgstr "Derecho" msgid "Carbon widget set" msgstr "" +#: rxconst.scloseallexceptthis +msgid "Close all except this" +msgstr "" + +#: rxconst.scloseallwindows +msgid "Close all windows" +msgstr "" + #: rxconst.sclosevaliderror msgid "Error. Expected vailes..." msgstr "" +#: rxconst.sclosewindows +msgid "Close window" +msgstr "" + #: rxconst.sdatedlgtitle msgid "Select a Date" msgstr "Seleccionar Fecha" diff --git a/components/rx/languages/rxconst.po b/components/rx/languages/rxconst.po index cc471fde2..34483f959 100644 --- a/components/rx/languages/rxconst.po +++ b/components/rx/languages/rxconst.po @@ -41,10 +41,22 @@ msgstr "" msgid "Carbon widget set" msgstr "" +#: rxconst.scloseallexceptthis +msgid "Close all except this" +msgstr "" + +#: rxconst.scloseallwindows +msgid "Close all windows" +msgstr "" + #: rxconst.sclosevaliderror msgid "Error. Expected vailes..." msgstr "" +#: rxconst.sclosewindows +msgid "Close window" +msgstr "" + #: rxconst.sdatedlgtitle msgid "Select a Date" msgstr "" diff --git a/components/rx/languages/rxconst.ru.po b/components/rx/languages/rxconst.ru.po index a6398e39e..e6cd60a7c 100644 --- a/components/rx/languages/rxconst.ru.po +++ b/components/rx/languages/rxconst.ru.po @@ -41,10 +41,22 @@ msgstr "Вправо" msgid "Carbon widget set" msgstr "Графический интерфейс Carbon" +#: rxconst.scloseallexceptthis +msgid "Close all except this" +msgstr "" + +#: rxconst.scloseallwindows +msgid "Close all windows" +msgstr "" + #: rxconst.sclosevaliderror msgid "Error. Expected vailes..." msgstr "Ошибка. Ожидается значение..." +#: rxconst.sclosewindows +msgid "Close window" +msgstr "" + #: rxconst.sdatedlgtitle msgid "Select a Date" msgstr "Выберите дату" diff --git a/components/rx/registerrx.pas b/components/rx/registerrx.pas index fe85925b8..ad65aa9b3 100644 --- a/components/rx/registerrx.pas +++ b/components/rx/registerrx.pas @@ -47,7 +47,7 @@ uses Dialogs, ComponentEditors, DBPropEdits, DB, rxctrls, RxCustomChartPanel, AutoPanel, pickdate, rxconst, tooledit, rxclock, rxceEditLookupFields, rxpopupunit, rxspin, RxTimeEdit, - RxAboutDialog, RxViewsPanel; + RxAboutDialog, RxViewsPanel, RxMDI; type @@ -211,6 +211,11 @@ begin RegisterComponents('RX',[TRxViewsPanel]); end; +procedure RegisterRxMDI; +begin + RegisterComponents('RX',[TRxMDICloseButton, TRxMDIPanel, TRxMDITasks]); +end; + procedure RegisterRxHistoryNavigator; begin RegisterComponents('RX Tools',[TRxHistoryNavigator]); @@ -243,6 +248,8 @@ begin RegisterUnit('RxAboutDialog', @RegisterRxAboutDialog); RegisterUnit('RxViewsPanel', @RegisterRxViewsPanel); RegisterUnit('RxHistoryNavigator', @RegisterRxHistoryNavigator); + RegisterUnit('RxMDI', @RegisterRxMDI); + // diff --git a/components/rx/rxconst.pas b/components/rx/rxconst.pas index 5deddd575..dec6c5ec7 100644 --- a/components/rx/rxconst.pas +++ b/components/rx/rxconst.pas @@ -123,6 +123,11 @@ resourcestring sReqValue = 'Error. Expected value for filed %s.'; sExptControlNotFound = 'Control not found in validate %s.'; + { RxMDI } + sCloseWindows = 'Close window'; + sCloseAllExceptThis = 'Close all except this'; + sCloseAllWindows = 'Close all windows'; + implementation end. diff --git a/components/rx/rxmdi.pas b/components/rx/rxmdi.pas new file mode 100644 index 000000000..52c9384e9 --- /dev/null +++ b/components/rx/rxmdi.pas @@ -0,0 +1,712 @@ +{ Free DB Manager + + Copyright (C) 2005-2012 Lagunov Aleksey alexs75 at hotbox.ru + + This source is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) + any later version. + + This code is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + A copy of the GNU General Public License is available on the World Wide Web + at <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by writing + to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. +} +unit RxMDI; + +{$I rx.inc} + +interface + +uses + Classes, SysUtils, Forms, Buttons, Menus, ExtCtrls, Graphics, Controls; + +type + TRxMDIPanel = class; + TRxMDITasks = class; + + { TRxMDIButton } + + TRxMDIButton = class(TSpeedButton) + private + FNavForm: TForm; + FNavPanel:TRxMDITasks; + FSaveClose:TCloseEvent; + procedure SeTRxMDIForm(AValue: TForm); + procedure DoCreateMenuItems; + + procedure DoCloseMenu(Sender: TObject); + procedure DoCloseAllMenu(Sender: TObject); + procedure DoCloseAllExcepThisMenu(Sender: TObject); + procedure DoActivateMenu(Sender: TObject); + procedure DoCreateButtonImage; + private + FMenu:TPopupMenu; + procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); + public + constructor CreateButton(AOwner:TRxMDITasks; AForm:TForm); + procedure Click; override; // make Click public + procedure UpdateCaption; + property NavForm:TForm read FNavForm write SeTRxMDIForm; + end; + + { TRxMDITasks } + + TRxMDITasks = class(TCustomPanel) + private + FBtnScrollLeft:TSpeedButton; + FBtnScrollRigth:TSpeedButton; + FMainPanel: TRxMDIPanel; + procedure UpdateScrollBtnStatus; + procedure ScrollLeftExecute(Sender: TObject); + procedure ScrollRigthExecute(Sender: TObject); + procedure ShowHiddenBtnOnResize; + procedure ChildWindowsShowLast; + protected + procedure Paint; override; + procedure Resize; override; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + public + constructor Create(TheOwner: TComponent); override; + destructor Destroy; override; + procedure AddButton(Btn:TRxMDIButton); + procedure ShowWindow(F:TForm); + property MainPanel:TRxMDIPanel read FMainPanel write FMainPanel; + published + property Align; + end; + + { TRxMDICloseButton } + + TRxMDICloseButton = class(TCustomSpeedButton) + private + FInfoLabel:TBoundLabel; + FLabelSpacing:integer; + FMDIPanel:TRxMDIPanel; + protected + procedure SetParent(AParent: TWinControl); override; + procedure Loaded; override; + procedure DoPositionLabel; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + procedure CreateInternalLabel; + public + constructor Create(AOwner: TComponent); override; + published + property Align; + property Anchors; + property Glyph; + property Flat; + end; + + { TRxMDIPanel } + + TRxMDIPanel = class(TCustomPanel) + private + FCurrentChildWindow: TForm; + FCloseButton: TRxMDICloseButton; + FTaskPanel: TRxMDITasks; + procedure SetCurrentChildWindow(AValue: TForm); + procedure navCloseButtonClick(Sender: TObject); + procedure SetRxMDICloseButton(AValue: TRxMDICloseButton); + procedure SetTaskPanel(AValue: TRxMDITasks); + protected + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + public + constructor Create(TheOwner: TComponent); override; + procedure ShowWindow(F:TForm); + + procedure ChildWindowsAdd(F:TForm); + procedure ChildWindowsCreate(var AForm; FC:TFormClass); + procedure ChildWindowsUpdateCaption(F:TForm); + + property CurrentChildWindow:TForm read FCurrentChildWindow write SetCurrentChildWindow; + published + property CloseButton:TRxMDICloseButton read FCloseButton write SetRxMDICloseButton; + property TaskPanel:TRxMDITasks read FTaskPanel write SetTaskPanel; + + property Align; + property BevelInner; + property BevelOuter; + end; + +implementation +uses LResources, vclutils, rxconst; + + +{ TRxMDICloseButton } + +procedure TRxMDICloseButton.SetParent(AParent: TWinControl); +begin + inherited SetParent(AParent); + DoPositionLabel; +end; + +procedure TRxMDICloseButton.Loaded; +begin + inherited Loaded; + DoPositionLabel; +end; + +procedure TRxMDICloseButton.DoPositionLabel; +begin + if FInfoLabel = nil then exit; + if Parent<>nil then + Parent.DisableAlign; + //DebugLn(['TCustomLabeledEdit.DoPositionLabel ']); + FInfoLabel.Parent := Parent; + FInfoLabel.Visible := Visible; +{ case FLabelPosition of + lpAbove: + begin + FInfoLabel.AnchorParallel(akLeft,0,Self); + FInfoLabel.AnchorToCompanion(akBottom,FLabelSpacing,Self); + end; + lpBelow: + begin + FInfoLabel.AnchorParallel(akLeft,0,Self); + FInfoLabel.AnchorToCompanion(akTop,FLabelSpacing,Self); + end; + lpLeft : + begin} + FInfoLabel.AnchorToCompanion(akRight,FLabelSpacing,Self); + FInfoLabel.AnchorVerticalCenterTo(Self); +{ end; + lpRight: + begin + FInfoLabel.AnchorToCompanion(akLeft,FLabelSpacing,Self); + FInfoLabel.AnchorVerticalCenterTo(Self); + end; + end;} + if Parent<>nil then + Parent.EnableAlign; +end; + +procedure TRxMDICloseButton.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited Notification(AComponent, Operation); + if (AComponent = FInfoLabel) and (Operation = opRemove) then + FInfoLabel := nil + else + if (AComponent = FMDIPanel) and (Operation = opRemove) then + begin + FMDIPanel:=nil; + OnClick:=nil; + end; +end; + +procedure TRxMDICloseButton.CreateInternalLabel; +begin + if FInfoLabel<>nil then exit; + FInfoLabel := TBoundLabel.Create(Self); + FInfoLabel.ControlStyle := FInfoLabel.ControlStyle + [csNoDesignSelectable]; + //FInfoLabel.FocusControl := Self; +end; + +constructor TRxMDICloseButton.Create(AOwner: TComponent); +begin + inherited Create(AOwner); +// FLabelPosition := lpAbove; + FLabelSpacing := 3; + CreateInternalLabel; + Glyph:=LoadLazResBitmapImage('RxMDICloseIcon'); +end; + +{ TRxMDIPanel } + +procedure TRxMDIPanel.SetCurrentChildWindow(AValue: TForm); +begin + FCurrentChildWindow:=AValue; + if Assigned(FCloseButton) then + begin + FCloseButton.Enabled:=Assigned(FCurrentChildWindow); + if FCloseButton.Enabled then + FCloseButton.FInfoLabel.Caption:=FCurrentChildWindow.Caption + else + FCloseButton.FInfoLabel.Caption:=''; + end; + + if Assigned(TaskPanel) then + TaskPanel.Visible:=Assigned(FCurrentChildWindow); +end; + +procedure TRxMDIPanel.navCloseButtonClick(Sender: TObject); +begin + if Assigned(FCurrentChildWindow) then + FCurrentChildWindow.Close; +end; + +procedure TRxMDIPanel.SeTRxMDICloseButton(AValue: TRxMDICloseButton); +begin + if FCloseButton=AValue then Exit; + if Assigned(FCloseButton) then + begin + FCloseButton.OnClick:=nil; + FCloseButton.FMDIPanel:=nil; + end; + + FCloseButton:=AValue; + + if Assigned(FCloseButton) then + begin + FCloseButton.OnClick:=@navCloseButtonClick; + FCloseButton.FMDIPanel:=Self; + end; +end; + +procedure TRxMDIPanel.SetTaskPanel(AValue: TRxMDITasks); +begin + if FTaskPanel=AValue then Exit; + FTaskPanel:=AValue; + if Assigned(FTaskPanel) then + FTaskPanel.FMainPanel:=Self; +end; + +procedure TRxMDIPanel.Notification(AComponent: TComponent; Operation: TOperation + ); +begin + inherited Notification(AComponent, Operation); + if (AComponent = FCloseButton) and (Operation = opRemove) then + FCloseButton := nil + else + if (AComponent = FTaskPanel) and (Operation = opRemove) then + FTaskPanel:=nil; +end; + +constructor TRxMDIPanel.Create(TheOwner: TComponent); +begin + inherited Create(TheOwner); + Caption:=''; + Align:=alClient; + BevelOuter:=bvLowered; +end; + +procedure TRxMDIPanel.ShowWindow(F: TForm); +begin + TaskPanel.ShowWindow(F); +end; + +procedure TRxMDIPanel.ChildWindowsAdd(F: TForm); +var + B:TRxMDIButton; +begin + F.BorderStyle:=bsNone; + F.Align:=alClient; + F.Parent:=Self; + F.Visible:=true; + F.BringToFront; + Application.MainForm.ActiveControl:=F; + + B:=TRxMDIButton.CreateButton(TaskPanel, F); +end; + +procedure TRxMDIPanel.ChildWindowsCreate(var AForm; FC: TFormClass); +var + FForm:TForm absolute AForm; +begin + if not Assigned(FForm) then + begin + FForm:=FC.Create(Self); + ChildWindowsAdd(FForm); + end + else + ShowWindow(FForm) +end; + +procedure TRxMDIPanel.ChildWindowsUpdateCaption(F: TForm); +var + i:integer; + B:TRxMDIButton; +begin + for i:=0 to TaskPanel.ComponentCount -1 do + begin + if TRxMDIButton(TaskPanel.Components[i]).NavForm = F then + begin + TRxMDIButton(TaskPanel.Components[i]).UpdateCaption; + exit; + end; + end; +end; + + +{ TRxMDITasks } + +procedure TRxMDITasks.UpdateScrollBtnStatus; +var + i, W:Integer; + B:TRxMDIButton; +begin + W:=FBtnScrollLeft.Width + FBtnScrollRigth.Width; + FBtnScrollLeft.Enabled:=false; + for i:=0 to ComponentCount-1 do + begin + B:=TRxMDIButton(Components[i]); + if not B.Visible then + FBtnScrollLeft.Enabled:=true + else + W:=W+B.Width + 2; + end; + + FBtnScrollRigth.Enabled:=W > Width; +end; + +procedure TRxMDITasks.ScrollLeftExecute(Sender: TObject); +var + i:Integer; + B:TRxMDIButton; +begin + for i:=0 to ComponentCount-1 do + begin + if (Components[i] is TRxMDIButton) then + begin + B:=TRxMDIButton(Components[i]); + if not B.Visible then + begin + B.Visible:=true; + B.Left:=FBtnScrollLeft.Width; + break; + end; + end; + end; + + UpdateScrollBtnStatus; + Invalidate; +end; + +procedure TRxMDITasks.ScrollRigthExecute(Sender: TObject); +var + i:Integer; + B:TRxMDIButton; +begin + for i:=0 to ComponentCount - 1 do + begin + if (Components[i] is TRxMDIButton) then + begin + B:=TRxMDIButton(Components[i]); + if B.Visible then + begin + B.Visible:=false; + break; + end; + end; + end; + + UpdateScrollBtnStatus; + Invalidate; +end; + +procedure TRxMDITasks.ShowHiddenBtnOnResize; +begin + +end; + +procedure TRxMDITasks.ChildWindowsShowLast; +var + CC:TControl; +begin + if (FMainPanel.ControlCount>1) then + begin + CC:=FMainPanel.Controls[FMainPanel.ControlCount-2]; + if Assigned(CC) then + ShowWindow(CC as TForm) + end + else + FMainPanel.CurrentChildWindow:=nil; + Invalidate; +end; + +procedure TRxMDITasks.Paint; +var + i:integer; + H:integer; + B:TRxMDIButton; +begin + inherited Paint; + Canvas.Pen.Color:=clBlack; + H:=Height - 2; + for i:=0 to ComponentCount - 1 do + begin + if (Components[i] is TRxMDIButton) then + begin + B:=TRxMDIButton(Components[i]); + if (B.Visible) and (B.Left > B.Width) then + begin + Canvas.Pen.Color:=clBtnShadow; + Canvas.Line(B.Left - 2, 2, B.Left - 2, H); + Canvas.Pen.Color:=clWindow; + Canvas.Line(B.Left - 1, 2, B.Left - 1, H); + end; + end; + end; +end; + +procedure TRxMDITasks.Resize; +begin + inherited Resize; + if Assigned(FBtnScrollLeft) and Assigned(FBtnScrollRigth) then + UpdateScrollBtnStatus; +end; + +procedure TRxMDITasks.Notification(AComponent: TComponent; Operation: TOperation + ); +begin + inherited Notification(AComponent, Operation); + if (AComponent = FMainPanel) and (Operation = opRemove) then + FMainPanel := nil +end; + +constructor TRxMDITasks.Create(TheOwner: TComponent); +begin + inherited Create(TheOwner); + Caption:=''; + + FBtnScrollLeft:=TSpeedButton.Create(Self); + FBtnScrollLeft.Parent:=Self; + FBtnScrollLeft.Align:=alLeft; + FBtnScrollLeft.AnchorSide[akLeft].Control:=Self; + FBtnScrollLeft.Anchors:=[akLeft, akTop, akBottom]; + FBtnScrollLeft.OnClick:=@ScrollLeftExecute; + FBtnScrollLeft.Caption:='<'; + FBtnScrollLeft.ShowCaption:=true; + FBtnScrollLeft.AutoSize:=true; + FBtnScrollLeft.Flat:=true; + FBtnScrollLeft.Transparent:=false; + + FBtnScrollRigth:=TSpeedButton.Create(Self); + FBtnScrollRigth.Parent:=Self; + FBtnScrollRigth.Align:=alRight; + FBtnScrollRigth.Anchors:=[akRight, akTop, akBottom]; + FBtnScrollRigth.AnchorSide[akRight].Control:=Self; + FBtnScrollRigth.OnClick:=@ScrollRigthExecute; + FBtnScrollRigth.Caption:='>'; + FBtnScrollRigth.ShowCaption:=true; + FBtnScrollRigth.AutoSize:=true; + FBtnScrollRigth.Flat:=true; + FBtnScrollRigth.Transparent:=false; + + Align:=alBottom; + Height:=25; +end; + +destructor TRxMDITasks.Destroy; +begin + FBtnScrollRigth:=nil; + FBtnScrollLeft:=nil; + inherited Destroy; +end; + +procedure TRxMDITasks.AddButton(Btn: TRxMDIButton); +begin + Btn.Parent:=Self; + Btn.Left:=Width-1; + Btn.Down:=true; + Btn.BorderSpacing.Left:=3; + Btn.BorderSpacing.Right:=3; + + FBtnScrollRigth.BringToFront; + FBtnScrollLeft.BringToFront; + + UpdateScrollBtnStatus; +end; + +procedure TRxMDITasks.ShowWindow(F: TForm); +var + i:integer; +begin + for i:=0 to ComponentCount -1 do + begin + if (Components[i] is TRxMDIButton) and (TRxMDIButton(Components[i]).NavForm = F) then + begin + TRxMDIButton(Components[i]).Click; + TRxMDIButton(Components[i]).Visible:=true; + exit; + end; + end; +end; + + +{ TRxMDIButton } + +procedure TRxMDIButton.SeTRxMDIForm(AValue: TForm); +var + FImageIndex:integer; + B:TBitmap; +begin + if FNavForm=AValue then Exit; + FNavForm:=AValue; + if Assigned(FNavForm) then + begin + FSaveClose:=FNavForm.OnClose; + FNavForm.OnClose:=@FormClose; + Caption:=' '+FNavForm.Caption+' '; + DoCreateButtonImage; + + + FNavPanel.FMainPanel.CurrentChildWindow:=NavForm; + end; + +{ if NavForm is TfbmDBObjectEditorForm then + begin + B:=TBitmap.Create; + try + B.Width:=fbManagerMainForm.ImageList2.Width; + B.Height:=fbManagerMainForm.ImageList2.Height; + B.Canvas.Brush.Color:=Color; + B.Canvas.FillRect(0,0, B.Width, B.Height); + FImageIndex:=ord(TfbmDBObjectEditorForm(NavForm).DBObject.DBObjectKind) + 2; + fbManagerMainForm.ImageList2.Draw(B.Canvas, 0,0,FImageIndex); + Glyph.Assign(B); + finally + B.Free; + end; + end;} +end; + +procedure TRxMDIButton.DoCreateMenuItems; +var + Item: TMenuItem; +begin + Item:=TMenuItem.Create(Self); + Item.Caption:=Caption; + Item.OnClick:=@DoActivateMenu; + FMenu.Items.Add(Item); + + Item:=TMenuItem.Create(Self); + Item.Caption:='-'; + FMenu.Items.Add(Item); + + Item:=TMenuItem.Create(Self); + Item.Caption:=sCloseWindows; + Item.OnClick:=@DoCloseMenu; + FMenu.Items.Add(Item); + + Item:=TMenuItem.Create(Self); + Item.Caption:='-'; + FMenu.Items.Add(Item); + + + Item:=TMenuItem.Create(Self); + Item.Caption:=sCloseAllExceptThis; + Item.OnClick:=@DoCloseAllExcepThisMenu; + FMenu.Items.Add(Item); + + Item:=TMenuItem.Create(Self); + Item.Caption:=sCloseAllWindows; + Item.OnClick:=@DoCloseAllMenu; + FMenu.Items.Add(Item); +end; + +procedure TRxMDIButton.DoCloseMenu(Sender: TObject); +begin + if Assigned(FNavForm) then + FNavForm.Close; +end; + +procedure TRxMDIButton.DoCloseAllMenu(Sender: TObject); +begin +{ if Assigned(WindowTabs) then + CloseAllWindowTabs;} +end; + +procedure TRxMDIButton.DoCloseAllExcepThisMenu(Sender: TObject); +var + i:integer; + F:TForm; +begin +{ if Assigned(WindowTabs) then + begin + for i:=WindowTabs.WindowCount-1 downto 0 do + begin + F:=WindowTabs.Item[i]; + if F<>FNavForm then + F.Close; + end; + end;} +end; + +procedure TRxMDIButton.DoActivateMenu(Sender: TObject); +begin + Click; +end; + +procedure TRxMDIButton.DoCreateButtonImage; +var + FImageIndex:integer; + B:TBitmap; +begin + if Assigned(NavForm.Icon) and (NavForm.Icon.Count>0) then + begin + B:=TBitmap.Create; + try + B.Width:=NavForm.Icon.Width; + B.Height:=NavForm.Icon.Height; + + B.Canvas.Brush.Color:=Color; + B.Canvas.FillRect(0,0, B.Width, B.Height); + B.Canvas.Draw(0, 0, NavForm.Icon); + + Glyph.Assign(B); + finally + B.Free; + end; + end; +end; + +procedure TRxMDIButton.FormClose(Sender: TObject; var CloseAction: TCloseAction); +begin + if Assigned(FSaveClose) then + FSaveClose(Sender, CloseAction); + Free; + + FNavPanel.ChildWindowsShowLast; + FNavPanel.ShowHiddenBtnOnResize; +end; + +constructor TRxMDIButton.CreateButton(AOwner: TRxMDITasks; AForm: TForm); +begin + inherited Create(AOwner); + FNavPanel:=AOwner; + Align:=alLeft; + NavForm:=AForm; + AutoSize:=true; + Flat:=true; + GroupIndex:=1; + + FMenu:=TPopupMenu.Create(Self); + FMenu.Parent:=Self; + PopupMenu:=FMenu; + DoCreateMenuItems; + + AOwner.AddButton(Self); +end; + +procedure TRxMDIButton.Click; +begin + inherited Click; + if Assigned(FNavForm) then + begin + FNavForm.BringToFront; + FNavPanel.FMainPanel.CurrentChildWindow:=NavForm; + Application.MainForm.ActiveControl:=NavForm.ActiveControl; + end; + Down:=true; +end; + +procedure TRxMDIButton.UpdateCaption; +begin + if Assigned(FNavForm) then + Caption:=' '+FNavForm.Caption+' ' + else + Caption:='---'; + AdjustSize; +end; + +initialization + {$I RxMDICloseIcon.lrs} +end. + diff --git a/components/rx/rxnew.lpk b/components/rx/rxnew.lpk index 33a0ecceb..c33171aeb 100644 --- a/components/rx/rxnew.lpk +++ b/components/rx/rxnew.lpk @@ -26,8 +26,8 @@ Copyright (c) 1998 Master-Bank translate to Lazarus by alexs in 2005 - 2012 "/> <License Value="LGPL"/> - <Version Major="2" Minor="3" Release="1" Build="116"/> - <Files Count="66"> + <Version Major="2" Minor="4" Release="1" Build="118"/> + <Files Count="67"> <Item1> <Filename Value="autopanel.pas"/> <UnitName Value="AutoPanel"/> @@ -295,6 +295,10 @@ translate to Lazarus by alexs in 2005 - 2012 <Filename Value="rxsortby.pas"/> <UnitName Value="rxsortby"/> </Item66> + <Item67> + <Filename Value="rxmdi.pas"/> + <UnitName Value="RxMDI"/> + </Item67> </Files> <LazDoc Paths="docs;\usr\local\share\lazarus\components\rxnew\docs"/> <i18n> diff --git a/components/rx/rxnew.pas b/components/rx/rxnew.pas index dedb26152..913713db2 100644 --- a/components/rx/rxnew.pas +++ b/components/rx/rxnew.pas @@ -18,7 +18,7 @@ uses RxSystemServices, rxtbrsetup, RxTimeEdit, rxtoolbar, RxVersInfo, RxViewsPanel, rxxpman, seldsfrm, tooledit, vclutils, RxCloseFormValidator, RxHistoryNavigator, ex_rx_bin_datapacket, ex_rx_datapacket, - ex_rx_xml_datapacket, rxsortby, LazarusPackageIntf; + ex_rx_xml_datapacket, rxsortby, RxMDI, LazarusPackageIntf; implementation