Changeset 50 for DockManager/Lazarus


Ignore:
Timestamp:
Sep 20, 2010, 8:07:01 AM (14 years ago)
Author:
george
Message:
  • Upraveno: Titulková lišta ukotvených oken přepracována s využitím klasických prvků jako TPanel, TShape, TLabel a TSpeedButton. Zjednodušení kódu díky automatické obsluze velikosti a rozmístění.
Location:
DockManager/Lazarus
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • DockManager/Lazarus/Demo/Demo.lpi

    r49 r50  
    4040        <IsPartOfProject Value="True"/>
    4141        <UnitName Value="Demo"/>
    42         <EditorIndex Value="5"/>
     42        <EditorIndex Value="3"/>
    4343        <WindowIndex Value="0"/>
    4444        <TopLine Value="1"/>
    4545        <CursorPos X="7" Y="3"/>
    46         <UsageCount Value="38"/>
     46        <UsageCount Value="39"/>
    4747        <Loaded Value="True"/>
    4848        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    5757        <WindowIndex Value="0"/>
    5858        <TopLine Value="1"/>
    59         <CursorPos X="20" Y="5"/>
    60         <UsageCount Value="38"/>
     59        <CursorPos X="15" Y="21"/>
     60        <UsageCount Value="39"/>
    6161        <Loaded Value="True"/>
    6262        <LoadedDesigner Value="True"/>
     
    6666        <Filename Value="E:\Programy\Lazarus\lcl\controls.pp"/>
    6767        <UnitName Value="Controls"/>
    68         <EditorIndex Value="10"/>
    69         <WindowIndex Value="0"/>
    70         <TopLine Value="3840"/>
     68        <WindowIndex Value="0"/>
     69        <TopLine Value="3846"/>
    7170        <CursorPos X="1" Y="3853"/>
    7271        <UsageCount Value="19"/>
    73         <Loaded Value="True"/>
    7472      </Unit2>
    7573      <Unit3>
     
    8482      <Unit4>
    8583        <Filename Value="E:\Programy\Lazarus\lcl\include\control.inc"/>
    86         <EditorIndex Value="13"/>
    87         <WindowIndex Value="0"/>
    88         <TopLine Value="1035"/>
     84        <WindowIndex Value="0"/>
     85        <TopLine Value="1041"/>
    8986        <CursorPos X="1" Y="1048"/>
    9087        <UsageCount Value="18"/>
    91         <Loaded Value="True"/>
    9288      </Unit4>
    9389      <Unit5>
    9490        <Filename Value="E:\Programy\Lazarus\lcl\include\wincontrol.inc"/>
    95         <EditorIndex Value="11"/>
    96         <WindowIndex Value="0"/>
    97         <TopLine Value="7631"/>
     91        <WindowIndex Value="0"/>
     92        <TopLine Value="7637"/>
    9893        <CursorPos X="1" Y="7644"/>
    9994        <UsageCount Value="18"/>
    100         <Loaded Value="True"/>
    10195      </Unit5>
    10296      <Unit6>
     
    174168        <ResourceBaseClass Value="Form"/>
    175169        <UnitName Value="UDockForm"/>
    176         <EditorIndex Value="15"/>
     170        <EditorIndex Value="6"/>
    177171        <WindowIndex Value="0"/>
    178172        <TopLine Value="1"/>
    179173        <CursorPos X="47" Y="8"/>
    180         <UsageCount Value="37"/>
     174        <UsageCount Value="38"/>
    181175        <Loaded Value="True"/>
    182176        <LoadedDesigner Value="True"/>
     
    202196        <Filename Value="E:\Projekty jine\Lazarus\examples\anchordocking\anchordocking.pas"/>
    203197        <UnitName Value="AnchorDocking"/>
    204         <EditorIndex Value="14"/>
    205         <WindowIndex Value="0"/>
    206         <TopLine Value="4754"/>
     198        <EditorIndex Value="5"/>
     199        <WindowIndex Value="0"/>
     200        <TopLine Value="4756"/>
    207201        <CursorPos X="5" Y="4763"/>
    208202        <UsageCount Value="18"/>
     
    224218        <EditorIndex Value="1"/>
    225219        <WindowIndex Value="0"/>
    226         <TopLine Value="216"/>
    227         <CursorPos X="15" Y="218"/>
     220        <TopLine Value="770"/>
     221        <CursorPos X="15" Y="791"/>
    228222        <UsageCount Value="32"/>
    229223        <Loaded Value="True"/>
     
    233227        <Filename Value="E:\Programy\Lazarus\lcl\extctrls.pp"/>
    234228        <UnitName Value="ExtCtrls"/>
    235         <EditorIndex Value="3"/>
    236229        <WindowIndex Value="0"/>
    237230        <TopLine Value="1183"/>
    238231        <CursorPos X="24" Y="1199"/>
    239232        <UsageCount Value="11"/>
    240         <Loaded Value="True"/>
    241233      </Unit21>
    242234      <Unit22>
     
    250242      <Unit23>
    251243        <Filename Value="E:\Programy\Lazarus\lcl\include\dragmanager.inc"/>
    252         <EditorIndex Value="8"/>
    253         <WindowIndex Value="0"/>
    254         <TopLine Value="553"/>
    255         <CursorPos X="18" Y="574"/>
     244        <WindowIndex Value="0"/>
     245        <TopLine Value="538"/>
     246        <CursorPos X="20" Y="567"/>
    256247        <UsageCount Value="14"/>
    257         <Loaded Value="True"/>
    258248      </Unit23>
    259249      <Unit24>
     
    267257        <Filename Value="E:\Programy\Lazarus\lcl\widgetset\wscontrols.pp"/>
    268258        <UnitName Value="WSControls"/>
    269         <EditorIndex Value="12"/>
    270259        <WindowIndex Value="0"/>
    271260        <TopLine Value="267"/>
    272261        <CursorPos X="1" Y="269"/>
    273262        <UsageCount Value="16"/>
    274         <Loaded Value="True"/>
    275263      </Unit25>
    276264      <Unit26>
    277265        <Filename Value="E:\Programy\Lazarus\lcl\comctrls.pp"/>
    278266        <UnitName Value="ComCtrls"/>
    279         <EditorIndex Value="4"/>
    280         <WindowIndex Value="0"/>
    281         <TopLine Value="545"/>
     267        <WindowIndex Value="0"/>
     268        <TopLine Value="551"/>
    282269        <CursorPos X="3" Y="558"/>
    283270        <UsageCount Value="16"/>
    284         <Loaded Value="True"/>
    285271      </Unit26>
    286272      <Unit27>
    287273        <Filename Value="E:\Programy\Lazarus\lcl\forms.pp"/>
    288274        <UnitName Value="Forms"/>
    289         <EditorIndex Value="9"/>
    290         <WindowIndex Value="0"/>
    291         <TopLine Value="687"/>
     275        <WindowIndex Value="0"/>
     276        <TopLine Value="693"/>
    292277        <CursorPos X="14" Y="700"/>
    293278        <UsageCount Value="15"/>
    294         <Loaded Value="True"/>
    295279      </Unit27>
    296280      <Unit28>
    297281        <Filename Value="E:\Programy\Lazarus\lcl\themes.pas"/>
    298282        <UnitName Value="Themes"/>
    299         <EditorIndex Value="6"/>
     283        <EditorIndex Value="2"/>
    300284        <WindowIndex Value="0"/>
    301285        <TopLine Value="550"/>
    302         <CursorPos X="31" Y="556"/>
     286        <CursorPos X="1" Y="556"/>
    303287        <UsageCount Value="12"/>
    304288        <Loaded Value="True"/>
     
    315299        <Filename Value="..\..\..\ExceptionLogger\UExceptionLogger.pas"/>
    316300        <UnitName Value="UExceptionLogger"/>
    317         <EditorIndex Value="7"/>
    318         <WindowIndex Value="0"/>
    319         <TopLine Value="34"/>
     301        <EditorIndex Value="4"/>
     302        <WindowIndex Value="0"/>
     303        <TopLine Value="49"/>
    320304        <CursorPos X="1" Y="56"/>
    321305        <UsageCount Value="11"/>
     
    326310        <Filename Value="E:\Programy\Lazarus\lcl\customtimer.pas"/>
    327311        <UnitName Value="CustomTimer"/>
    328         <EditorIndex Value="2"/>
    329312        <WindowIndex Value="0"/>
    330313        <TopLine Value="68"/>
    331314        <CursorPos X="3" Y="77"/>
    332315        <UsageCount Value="10"/>
    333         <Loaded Value="True"/>
    334316      </Unit31>
    335317    </Units>
    336     <JumpHistory Count="30" HistoryIndex="28">
     318    <JumpHistory Count="30" HistoryIndex="29">
    337319      <Position1>
    338320        <Filename Value="..\UCustomDockManager.pas"/>
    339         <Caret Line="242" Column="20" TopLine="224"/>
     321        <Caret Line="499" Column="66" TopLine="486"/>
    340322      </Position1>
    341323      <Position2>
    342         <Filename Value="UMainForm.pas"/>
    343         <Caret Line="61" Column="26" TopLine="47"/>
     324        <Filename Value="..\UCustomDockManager.pas"/>
     325        <Caret Line="56" Column="65" TopLine="32"/>
    344326      </Position2>
    345327      <Position3>
    346         <Filename Value="UMainForm.pas"/>
    347         <Caret Line="17" Column="18" TopLine="1"/>
     328        <Filename Value="..\UCustomDockManager.pas"/>
     329        <Caret Line="108" Column="77" TopLine="88"/>
    348330      </Position3>
    349331      <Position4>
    350         <Filename Value="UMainForm.pas"/>
    351         <Caret Line="18" Column="23" TopLine="1"/>
     332        <Filename Value="..\UCustomDockManager.pas"/>
     333        <Caret Line="83" Column="44" TopLine="65"/>
    352334      </Position4>
    353335      <Position5>
    354         <Filename Value="UMainForm.pas"/>
    355         <Caret Line="17" Column="20" TopLine="1"/>
     336        <Filename Value="..\UCustomDockManager.pas"/>
     337        <Caret Line="108" Column="20" TopLine="94"/>
    356338      </Position5>
    357339      <Position6>
    358340        <Filename Value="..\UCustomDockManager.pas"/>
    359         <Caret Line="167" Column="44" TopLine="157"/>
     341        <Caret Line="515" Column="11" TopLine="501"/>
    360342      </Position6>
    361343      <Position7>
    362344        <Filename Value="..\UCustomDockManager.pas"/>
    363         <Caret Line="2" Column="52" TopLine="1"/>
     345        <Caret Line="112" Column="58" TopLine="91"/>
    364346      </Position7>
    365347      <Position8>
    366         <Filename Value="..\UCustomDockManager.pas"/>
    367         <Caret Line="108" Column="5" TopLine="83"/>
     348        <Filename Value="UMainForm.pas"/>
     349        <Caret Line="5" Column="20" TopLine="1"/>
    368350      </Position8>
    369351      <Position9>
    370352        <Filename Value="..\UCustomDockManager.pas"/>
    371         <Caret Line="106" Column="45" TopLine="90"/>
     353        <Caret Line="175" Column="24" TopLine="165"/>
    372354      </Position9>
    373355      <Position10>
    374356        <Filename Value="..\UCustomDockManager.pas"/>
    375         <Caret Line="635" Column="1" TopLine="626"/>
     357        <Caret Line="229" Column="39" TopLine="216"/>
    376358      </Position10>
    377359      <Position11>
    378360        <Filename Value="..\UCustomDockManager.pas"/>
    379         <Caret Line="100" Column="40" TopLine="97"/>
     361        <Caret Line="37" Column="24" TopLine="31"/>
    380362      </Position11>
    381363      <Position12>
    382364        <Filename Value="..\UCustomDockManager.pas"/>
    383         <Caret Line="11" Column="72" TopLine="1"/>
     365        <Caret Line="48" Column="16" TopLine="42"/>
    384366      </Position12>
    385367      <Position13>
    386         <Filename Value="UMainForm.pas"/>
    387         <Caret Line="17" Column="20" TopLine="1"/>
     368        <Filename Value="..\UCustomDockManager.pas"/>
     369        <Caret Line="801" Column="34" TopLine="780"/>
    388370      </Position13>
    389371      <Position14>
    390         <Filename Value="UMainForm.pas"/>
    391         <Caret Line="5" Column="20" TopLine="1"/>
     372        <Filename Value="..\UCustomDockManager.pas"/>
     373        <Caret Line="686" Column="11" TopLine="673"/>
    392374      </Position14>
    393375      <Position15>
    394376        <Filename Value="..\UCustomDockManager.pas"/>
    395         <Caret Line="22" Column="41" TopLine="13"/>
     377        <Caret Line="781" Column="23" TopLine="768"/>
    396378      </Position15>
    397379      <Position16>
    398380        <Filename Value="..\UCustomDockManager.pas"/>
    399         <Caret Line="155" Column="47" TopLine="141"/>
     381        <Caret Line="808" Column="22" TopLine="786"/>
    400382      </Position16>
    401383      <Position17>
    402384        <Filename Value="..\UCustomDockManager.pas"/>
    403         <Caret Line="158" Column="21" TopLine="145"/>
     385        <Caret Line="810" Column="3" TopLine="792"/>
    404386      </Position17>
    405387      <Position18>
    406388        <Filename Value="..\UCustomDockManager.pas"/>
    407         <Caret Line="152" Column="30" TopLine="145"/>
     389        <Caret Line="67" Column="1" TopLine="54"/>
    408390      </Position18>
    409391      <Position19>
    410392        <Filename Value="..\UCustomDockManager.pas"/>
    411         <Caret Line="72" Column="29" TopLine="60"/>
     393        <Caret Line="689" Column="14" TopLine="675"/>
    412394      </Position19>
    413395      <Position20>
    414396        <Filename Value="..\UCustomDockManager.pas"/>
    415         <Caret Line="586" Column="3" TopLine="584"/>
     397        <Caret Line="801" Column="7" TopLine="795"/>
    416398      </Position20>
    417399      <Position21>
    418400        <Filename Value="..\UCustomDockManager.pas"/>
    419         <Caret Line="499" Column="66" TopLine="486"/>
     401        <Caret Line="807" Column="8" TopLine="794"/>
    420402      </Position21>
    421403      <Position22>
    422404        <Filename Value="..\UCustomDockManager.pas"/>
    423         <Caret Line="56" Column="65" TopLine="32"/>
     405        <Caret Line="635" Column="21" TopLine="628"/>
    424406      </Position22>
    425407      <Position23>
    426408        <Filename Value="..\UCustomDockManager.pas"/>
    427         <Caret Line="108" Column="77" TopLine="88"/>
     409        <Caret Line="810" Column="7" TopLine="799"/>
    428410      </Position23>
    429411      <Position24>
    430412        <Filename Value="..\UCustomDockManager.pas"/>
    431         <Caret Line="83" Column="44" TopLine="65"/>
     413        <Caret Line="790" Column="12" TopLine="770"/>
    432414      </Position24>
    433415      <Position25>
    434416        <Filename Value="..\UCustomDockManager.pas"/>
    435         <Caret Line="108" Column="20" TopLine="94"/>
     417        <Caret Line="786" Column="1" TopLine="770"/>
    436418      </Position25>
    437419      <Position26>
    438420        <Filename Value="..\UCustomDockManager.pas"/>
    439         <Caret Line="515" Column="11" TopLine="501"/>
     421        <Caret Line="787" Column="1" TopLine="770"/>
    440422      </Position26>
    441423      <Position27>
    442424        <Filename Value="..\UCustomDockManager.pas"/>
    443         <Caret Line="112" Column="58" TopLine="91"/>
     425        <Caret Line="788" Column="1" TopLine="770"/>
    444426      </Position27>
    445427      <Position28>
    446         <Filename Value="UMainForm.pas"/>
    447         <Caret Line="5" Column="20" TopLine="1"/>
     428        <Filename Value="..\UCustomDockManager.pas"/>
     429        <Caret Line="789" Column="1" TopLine="770"/>
    448430      </Position28>
    449431      <Position29>
    450432        <Filename Value="..\UCustomDockManager.pas"/>
    451         <Caret Line="175" Column="24" TopLine="165"/>
     433        <Caret Line="790" Column="1" TopLine="770"/>
    452434      </Position29>
    453435      <Position30>
    454         <Filename Value="E:\Programy\Lazarus\lcl\customtimer.pas"/>
    455         <Caret Line="77" Column="3" TopLine="68"/>
     436        <Filename Value="..\UCustomDockManager.pas"/>
     437        <Caret Line="791" Column="1" TopLine="770"/>
    456438      </Position30>
    457439    </JumpHistory>
  • DockManager/Lazarus/Demo/UMainForm.lfm

    r49 r50  
    2727    Align = alBottom
    2828    Anchors = [akTop, akLeft, akRight, akBottom]
    29     ClientHeight = 387
    30     ClientWidth = 576
    3129    DockSite = True
    3230    TabOrder = 1
    33     object TabControl1: TTabControl
    34       Left = 191
    35       Height = 150
    36       Top = 75
    37       Width = 200
    38       TabOrder = 0
    39       TabPosition = tpLeft
    40       TabStop = False
    41     end
    4231  end
    4332  object CustomDockMaster1: TCustomDockMaster
  • DockManager/Lazarus/Demo/UMainForm.pas

    r49 r50  
    1717    CustomDockMaster1: TCustomDockMaster;
    1818    Panel1: TPanel;
    19     TabControl1: TTabControl;
    2019    procedure Button1Click(Sender: TObject);
    2120    procedure FormCreate(Sender: TObject);
  • DockManager/Lazarus/UCustomDockManager.pas

    r49 r50  
    1919
    2020  TCustomDockManager = class;
     21  TDockClientPanel = class;
    2122
    2223  { TConjoinDockForm }
     
    2829
    2930  TDockStyle = (dsList, dsTabs);
     31
     32  { TDockHeader }
     33
     34  TDockHeader = class(TPanel)
     35    CloseButton: TSpeedButton;
     36    Title: TLabel;
     37    Icon: TIcon;
     38    ParentClientPanel: TDockClientPanel;
     39    Shape: TShape;
     40    constructor Create(TheOwner: TComponent); override;
     41    destructor Destroy; override;
     42  private
     43    procedure CloseButtonClick(Sender: TObject);
     44    procedure DrawGrabber(Canvas: TCanvas; AControl: TControl);
     45  end;
    3046
    3147  { TDockClientPanel }
     
    4056    procedure SetShowHeader(const AValue: Boolean);
    4157  public
     58    Header: TDockHeader;
    4259    OwnerDockManager: TCustomDockManager;
    43     CloseButton: TSpeedButton;
    4460    Control: TControl;
    4561    Splitter: TSplitter;
     
    5066    procedure DockPanelMouseDown(Sender: TObject; Button: TMouseButton;
    5167      Shift: TShiftState; X, Y: Integer);
    52     procedure DrawGrabber(Canvas: TCanvas; AControl: TControl);
    53     procedure CloseButtonClick(Sender: TObject);
    5468    procedure ResizeExecute(Sender: TObject);
    5569    property ShowHeader: Boolean read FShowHeader write SetShowHeader;
     
    8397    procedure PopupMenuCloseClick(Sender: TObject);
    8498    procedure PopupMenuRenameClick(Sender: TObject);
     99    procedure PopupMenuPositionAutoClick(Sender: TObject);
     100    procedure PopupMenuPositionLeftClick(Sender: TObject);
     101    procedure PopupMenuPositionRightClick(Sender: TObject);
     102    procedure PopupMenuPositionTopClick(Sender: TObject);
     103    procedure PopupMenuPositionBottomClick(Sender: TObject);
    85104    procedure Timer1Timer(Sender: TObject);
    86105  public
    87106    constructor Create(ADockSite: TWinControl); override;
    88107    destructor Destroy; override;
     108
     109    // Inherited from TDockManager
    89110    procedure BeginUpdate; override;
    90111    procedure EndUpdate; override;
     
    141162  SCloseForm = 'Close';
    142163  SRenameForm = 'Rename';
    143 
     164  SPosition = 'Position';
     165  SPositionAuto = 'Auto';
     166  SPositionTop = 'Top';
     167  SPositionLeft = 'Left';
     168  SPositionRight = 'Right';
     169  SPositionBottom = 'Bottom';
    144170
    145171procedure Register;
     
    189215  NewMenuItem2.Caption := SDockTabs;
    190216  NewMenuItem2.OnClick := PopupMenuTabsClick;
     217  NewMenuItem.Add(NewMenuItem2);
     218
     219  NewMenuItem := TMenuItem.Create(PopupMenu1);
     220  NewMenuItem.Caption := SPosition;
     221  PopupMenu1.Items.Add(NewMenuItem);
     222
     223  NewMenuItem2 := TMenuItem.Create(NewMenuItem);
     224  NewMenuItem2.Caption := SPositionAuto;
     225  NewMenuItem2.OnClick := PopupMenuPositionAutoClick;
     226  NewMenuItem.Add(NewMenuItem2);
     227
     228  NewMenuItem2 := TMenuItem.Create(NewMenuItem);
     229  NewMenuItem2.Caption := SPositionTop;
     230  NewMenuItem2.OnClick := PopupMenuPositionTopClick;
     231  NewMenuItem.Add(NewMenuItem2);
     232
     233  NewMenuItem2 := TMenuItem.Create(NewMenuItem);
     234  NewMenuItem2.Caption := SPositionLeft;
     235  NewMenuItem2.OnClick := PopupMenuPositionLeftClick;
     236  NewMenuItem.Add(NewMenuItem2);
     237
     238  NewMenuItem2 := TMenuItem.Create(NewMenuItem);
     239  NewMenuItem2.Caption := SPositionBottom;
     240  NewMenuItem2.OnClick := PopupMenuPositionBottomClick;
     241  NewMenuItem.Add(NewMenuItem2);
     242
     243  NewMenuItem2 := TMenuItem.Create(NewMenuItem);
     244  NewMenuItem2.Caption := SPositionRight;
     245  NewMenuItem2.OnClick := PopupMenuPositionRightClick;
    191246  NewMenuItem.Add(NewMenuItem2);
    192247
     
    580635end;
    581636
     637procedure TCustomDockManager.PopupMenuPositionAutoClick(Sender: TObject);
     638begin
     639  TabsPos := hpAuto;
     640end;
     641
     642procedure TCustomDockManager.PopupMenuPositionLeftClick(Sender: TObject);
     643begin
     644  TabsPos := hpLeft;
     645end;
     646
     647procedure TCustomDockManager.PopupMenuPositionRightClick(Sender: TObject);
     648begin
     649  TabsPos := hpRight;
     650end;
     651
     652procedure TCustomDockManager.PopupMenuPositionTopClick(Sender: TObject);
     653begin
     654  TabsPos := hpTop;
     655end;
     656
     657procedure TCustomDockManager.PopupMenuPositionBottomClick(Sender: TObject);
     658begin
     659  TabsPos := hpBottom;
     660end;
     661
    582662procedure TCustomDockManager.Timer1Timer(Sender: TObject);
    583663begin
     
    614694begin
    615695  inherited;
    616   CloseButton := TSpeedButton.Create(Self);
    617   with CloseButton do begin
     696  Header := TDockHeader.Create(Self);
     697  with Header do begin
    618698    Parent := Self;
    619     Caption := 'X';
    620     Font.Size := 6;
    621     Width := GrabberSize - 4;
    622     Height := GrabberSize - 4;
    623     Visible := False;
    624     OnClick := CloseButtonClick;
     699    Visible := ShowHeader;
     700    Align := alTop;
     701    Height := GrabberSize;
    625702  end;
    626703  ClientAreaPanel := TPanel.Create(Self);
     
    630707    DockSite := True;
    631708    UseDockManager := True;
    632     Left := 0;
    633     Top := GrabberSize;
    634     Width := Self.Width;
    635     Height := Self.Height - GrabberSize;
    636     Anchors := [akTop, akBottom, akLeft, akRight];
     709    Align := alClient;
    637710    BevelInner := bvNone;
    638711    BevelOuter := bvNone;
     
    658731end;
    659732
    660 procedure TDockClientPanel.DrawGrabber(Canvas: TCanvas; AControl: TControl);
    661 begin
    662   with Canvas do begin
    663     Brush.Color := clBtnFace;
    664     Pen.Color := clBlack;
    665     FillRect(0, 0, AControl.Width, GrabberSize);
    666 
    667     if (AControl as TWinControl).Focused then
    668       Font.Style := Font.Style + [fsBold]
    669       else Font.Style := Font.Style - [fsBold];
    670     Rectangle(1, 1, AControl.Width - 1, GrabberSize - 1);
    671     TextOut(6, 4, AControl.Caption);
    672 
    673     CloseButton.Left := AControl.Width - CloseButton.Width - 2;
    674     CloseButton.Top := 2;
    675   end;
    676 end;
    677 
    678 procedure TDockClientPanel.CloseButtonClick(Sender: TObject);
    679 begin
    680   Control.Hide;
    681 end;
    682 
    683733procedure TDockClientPanel.ResizeExecute(Sender: TObject);
    684734begin
     
    699749    R := Control.ClientRect;
    700750    Canvas.FillRect(R);
    701     CloseButton.Visible := ShowHeader;
     751    Header.Visible := ShowHeader;
    702752    if ShowHeader then begin
    703753      if ClientAreaPanel.DockClientCount = 0 then
    704         DrawGrabber(Canvas, Control) else
    705       DrawGrabber(Canvas, ClientAreaPanel);
     754        Header.DrawGrabber(Canvas, Control) else
     755      Header.DrawGrabber(Canvas, ClientAreaPanel);
    706756    end;
    707757  end;
     
    731781    UseDockManager := True;
    732782    Align := alClient;
     783    BevelOuter := bvNone;
     784    BevelInner := bvNone;
    733785  //  Color := clYellow;
    734786  end;
     
    781833end;
    782834
     835{ TDockHeader }
     836
     837constructor TDockHeader.Create(TheOwner: TComponent);
     838begin
     839  inherited Create(TheOwner);
     840  Shape := TShape.Create(Self);
     841  with Shape do begin
     842    Parent := Self;
     843    Anchors := [akRight, akBottom, akLeft, akTop];
     844    Left := 1;
     845    Top := 1;
     846    Width := Self.Width - 2;
     847    Height := Self.Height - 2;
     848    Brush.Style := bsClear;
     849  end;
     850  CloseButton := TSpeedButton.Create(Self);
     851  with CloseButton do begin
     852    Parent := Self;
     853    Caption := 'X';
     854    Font.Size := 6;
     855    Width := GrabberSize - 8;
     856    Height := GrabberSize - 8;
     857    Anchors := [akRight, akTop];
     858    Left := Self.Width - Width - 4;
     859    Top := 4;
     860    Visible := True;
     861    OnClick := CloseButtonClick;
     862  end;
     863  Title := TLabel.Create(Self);
     864  with Title do begin
     865    Parent := Self;
     866    Visible := True;
     867    Top := 4;
     868    Left := 6;
     869    BevelInner := bvNone;
     870    BevelOuter := bvNone;
     871  end;
     872end;
     873
     874destructor TDockHeader.Destroy;
     875begin
     876  inherited Destroy;
     877end;
     878
     879procedure TDockHeader.DrawGrabber(Canvas: TCanvas; AControl: TControl);
     880begin
     881  with Canvas do begin
     882    Brush.Color := clBtnFace;
     883    Pen.Color := clBlack;
     884    //FillRect(0, 0, AControl.Width, GrabberSize);
     885
     886    if (AControl as TWinControl).Focused then
     887      Title.Font.Style := Font.Style + [fsBold]
     888      else Title.Font.Style := Font.Style - [fsBold];
     889    Rectangle(1, 1, AControl.Width - 1, GrabberSize - 1);
     890    Title.Caption := AControl.Caption;
     891  end;
     892end;
     893
     894procedure TDockHeader.CloseButtonClick(Sender: TObject);
     895begin
     896//  Control.Hide;
     897end;
     898
    783899initialization
    784900  DefaultDockManagerClass := TCustomDockManager;
Note: See TracChangeset for help on using the changeset viewer.