Changeset 50
- Timestamp:
- Sep 20, 2010, 8:07:01 AM (14 years ago)
- Location:
- DockManager/Lazarus
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
DockManager/Lazarus/Demo/Demo.lpi
r49 r50 40 40 <IsPartOfProject Value="True"/> 41 41 <UnitName Value="Demo"/> 42 <EditorIndex Value=" 5"/>42 <EditorIndex Value="3"/> 43 43 <WindowIndex Value="0"/> 44 44 <TopLine Value="1"/> 45 45 <CursorPos X="7" Y="3"/> 46 <UsageCount Value="3 8"/>46 <UsageCount Value="39"/> 47 47 <Loaded Value="True"/> 48 48 <DefaultSyntaxHighlighter Value="Delphi"/> … … 57 57 <WindowIndex Value="0"/> 58 58 <TopLine Value="1"/> 59 <CursorPos X=" 20" Y="5"/>60 <UsageCount Value="3 8"/>59 <CursorPos X="15" Y="21"/> 60 <UsageCount Value="39"/> 61 61 <Loaded Value="True"/> 62 62 <LoadedDesigner Value="True"/> … … 66 66 <Filename Value="E:\Programy\Lazarus\lcl\controls.pp"/> 67 67 <UnitName Value="Controls"/> 68 <EditorIndex Value="10"/> 69 <WindowIndex Value="0"/> 70 <TopLine Value="3840"/> 68 <WindowIndex Value="0"/> 69 <TopLine Value="3846"/> 71 70 <CursorPos X="1" Y="3853"/> 72 71 <UsageCount Value="19"/> 73 <Loaded Value="True"/>74 72 </Unit2> 75 73 <Unit3> … … 84 82 <Unit4> 85 83 <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"/> 89 86 <CursorPos X="1" Y="1048"/> 90 87 <UsageCount Value="18"/> 91 <Loaded Value="True"/>92 88 </Unit4> 93 89 <Unit5> 94 90 <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"/> 98 93 <CursorPos X="1" Y="7644"/> 99 94 <UsageCount Value="18"/> 100 <Loaded Value="True"/>101 95 </Unit5> 102 96 <Unit6> … … 174 168 <ResourceBaseClass Value="Form"/> 175 169 <UnitName Value="UDockForm"/> 176 <EditorIndex Value=" 15"/>170 <EditorIndex Value="6"/> 177 171 <WindowIndex Value="0"/> 178 172 <TopLine Value="1"/> 179 173 <CursorPos X="47" Y="8"/> 180 <UsageCount Value="3 7"/>174 <UsageCount Value="38"/> 181 175 <Loaded Value="True"/> 182 176 <LoadedDesigner Value="True"/> … … 202 196 <Filename Value="E:\Projekty jine\Lazarus\examples\anchordocking\anchordocking.pas"/> 203 197 <UnitName Value="AnchorDocking"/> 204 <EditorIndex Value=" 14"/>205 <WindowIndex Value="0"/> 206 <TopLine Value="475 4"/>198 <EditorIndex Value="5"/> 199 <WindowIndex Value="0"/> 200 <TopLine Value="4756"/> 207 201 <CursorPos X="5" Y="4763"/> 208 202 <UsageCount Value="18"/> … … 224 218 <EditorIndex Value="1"/> 225 219 <WindowIndex Value="0"/> 226 <TopLine Value=" 216"/>227 <CursorPos X="15" Y=" 218"/>220 <TopLine Value="770"/> 221 <CursorPos X="15" Y="791"/> 228 222 <UsageCount Value="32"/> 229 223 <Loaded Value="True"/> … … 233 227 <Filename Value="E:\Programy\Lazarus\lcl\extctrls.pp"/> 234 228 <UnitName Value="ExtCtrls"/> 235 <EditorIndex Value="3"/>236 229 <WindowIndex Value="0"/> 237 230 <TopLine Value="1183"/> 238 231 <CursorPos X="24" Y="1199"/> 239 232 <UsageCount Value="11"/> 240 <Loaded Value="True"/>241 233 </Unit21> 242 234 <Unit22> … … 250 242 <Unit23> 251 243 <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"/> 256 247 <UsageCount Value="14"/> 257 <Loaded Value="True"/>258 248 </Unit23> 259 249 <Unit24> … … 267 257 <Filename Value="E:\Programy\Lazarus\lcl\widgetset\wscontrols.pp"/> 268 258 <UnitName Value="WSControls"/> 269 <EditorIndex Value="12"/>270 259 <WindowIndex Value="0"/> 271 260 <TopLine Value="267"/> 272 261 <CursorPos X="1" Y="269"/> 273 262 <UsageCount Value="16"/> 274 <Loaded Value="True"/>275 263 </Unit25> 276 264 <Unit26> 277 265 <Filename Value="E:\Programy\Lazarus\lcl\comctrls.pp"/> 278 266 <UnitName Value="ComCtrls"/> 279 <EditorIndex Value="4"/> 280 <WindowIndex Value="0"/> 281 <TopLine Value="545"/> 267 <WindowIndex Value="0"/> 268 <TopLine Value="551"/> 282 269 <CursorPos X="3" Y="558"/> 283 270 <UsageCount Value="16"/> 284 <Loaded Value="True"/>285 271 </Unit26> 286 272 <Unit27> 287 273 <Filename Value="E:\Programy\Lazarus\lcl\forms.pp"/> 288 274 <UnitName Value="Forms"/> 289 <EditorIndex Value="9"/> 290 <WindowIndex Value="0"/> 291 <TopLine Value="687"/> 275 <WindowIndex Value="0"/> 276 <TopLine Value="693"/> 292 277 <CursorPos X="14" Y="700"/> 293 278 <UsageCount Value="15"/> 294 <Loaded Value="True"/>295 279 </Unit27> 296 280 <Unit28> 297 281 <Filename Value="E:\Programy\Lazarus\lcl\themes.pas"/> 298 282 <UnitName Value="Themes"/> 299 <EditorIndex Value=" 6"/>283 <EditorIndex Value="2"/> 300 284 <WindowIndex Value="0"/> 301 285 <TopLine Value="550"/> 302 <CursorPos X=" 31" Y="556"/>286 <CursorPos X="1" Y="556"/> 303 287 <UsageCount Value="12"/> 304 288 <Loaded Value="True"/> … … 315 299 <Filename Value="..\..\..\ExceptionLogger\UExceptionLogger.pas"/> 316 300 <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"/> 320 304 <CursorPos X="1" Y="56"/> 321 305 <UsageCount Value="11"/> … … 326 310 <Filename Value="E:\Programy\Lazarus\lcl\customtimer.pas"/> 327 311 <UnitName Value="CustomTimer"/> 328 <EditorIndex Value="2"/>329 312 <WindowIndex Value="0"/> 330 313 <TopLine Value="68"/> 331 314 <CursorPos X="3" Y="77"/> 332 315 <UsageCount Value="10"/> 333 <Loaded Value="True"/>334 316 </Unit31> 335 317 </Units> 336 <JumpHistory Count="30" HistoryIndex="2 8">318 <JumpHistory Count="30" HistoryIndex="29"> 337 319 <Position1> 338 320 <Filename Value="..\UCustomDockManager.pas"/> 339 <Caret Line=" 242" Column="20" TopLine="224"/>321 <Caret Line="499" Column="66" TopLine="486"/> 340 322 </Position1> 341 323 <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"/> 344 326 </Position2> 345 327 <Position3> 346 <Filename Value=" UMainForm.pas"/>347 <Caret Line="1 7" Column="18" TopLine="1"/>328 <Filename Value="..\UCustomDockManager.pas"/> 329 <Caret Line="108" Column="77" TopLine="88"/> 348 330 </Position3> 349 331 <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"/> 352 334 </Position4> 353 335 <Position5> 354 <Filename Value=" UMainForm.pas"/>355 <Caret Line="1 7" Column="20" TopLine="1"/>336 <Filename Value="..\UCustomDockManager.pas"/> 337 <Caret Line="108" Column="20" TopLine="94"/> 356 338 </Position5> 357 339 <Position6> 358 340 <Filename Value="..\UCustomDockManager.pas"/> 359 <Caret Line=" 167" Column="44" TopLine="157"/>341 <Caret Line="515" Column="11" TopLine="501"/> 360 342 </Position6> 361 343 <Position7> 362 344 <Filename Value="..\UCustomDockManager.pas"/> 363 <Caret Line=" 2" Column="52" TopLine="1"/>345 <Caret Line="112" Column="58" TopLine="91"/> 364 346 </Position7> 365 347 <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"/> 368 350 </Position8> 369 351 <Position9> 370 352 <Filename Value="..\UCustomDockManager.pas"/> 371 <Caret Line="1 06" Column="45" TopLine="90"/>353 <Caret Line="175" Column="24" TopLine="165"/> 372 354 </Position9> 373 355 <Position10> 374 356 <Filename Value="..\UCustomDockManager.pas"/> 375 <Caret Line=" 635" Column="1" TopLine="626"/>357 <Caret Line="229" Column="39" TopLine="216"/> 376 358 </Position10> 377 359 <Position11> 378 360 <Filename Value="..\UCustomDockManager.pas"/> 379 <Caret Line=" 100" Column="40" TopLine="97"/>361 <Caret Line="37" Column="24" TopLine="31"/> 380 362 </Position11> 381 363 <Position12> 382 364 <Filename Value="..\UCustomDockManager.pas"/> 383 <Caret Line=" 11" Column="72" TopLine="1"/>365 <Caret Line="48" Column="16" TopLine="42"/> 384 366 </Position12> 385 367 <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"/> 388 370 </Position13> 389 371 <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"/> 392 374 </Position14> 393 375 <Position15> 394 376 <Filename Value="..\UCustomDockManager.pas"/> 395 <Caret Line=" 22" Column="41" TopLine="13"/>377 <Caret Line="781" Column="23" TopLine="768"/> 396 378 </Position15> 397 379 <Position16> 398 380 <Filename Value="..\UCustomDockManager.pas"/> 399 <Caret Line=" 155" Column="47" TopLine="141"/>381 <Caret Line="808" Column="22" TopLine="786"/> 400 382 </Position16> 401 383 <Position17> 402 384 <Filename Value="..\UCustomDockManager.pas"/> 403 <Caret Line=" 158" Column="21" TopLine="145"/>385 <Caret Line="810" Column="3" TopLine="792"/> 404 386 </Position17> 405 387 <Position18> 406 388 <Filename Value="..\UCustomDockManager.pas"/> 407 <Caret Line=" 152" Column="30" TopLine="145"/>389 <Caret Line="67" Column="1" TopLine="54"/> 408 390 </Position18> 409 391 <Position19> 410 392 <Filename Value="..\UCustomDockManager.pas"/> 411 <Caret Line=" 72" Column="29" TopLine="60"/>393 <Caret Line="689" Column="14" TopLine="675"/> 412 394 </Position19> 413 395 <Position20> 414 396 <Filename Value="..\UCustomDockManager.pas"/> 415 <Caret Line=" 586" Column="3" TopLine="584"/>397 <Caret Line="801" Column="7" TopLine="795"/> 416 398 </Position20> 417 399 <Position21> 418 400 <Filename Value="..\UCustomDockManager.pas"/> 419 <Caret Line=" 499" Column="66" TopLine="486"/>401 <Caret Line="807" Column="8" TopLine="794"/> 420 402 </Position21> 421 403 <Position22> 422 404 <Filename Value="..\UCustomDockManager.pas"/> 423 <Caret Line=" 56" Column="65" TopLine="32"/>405 <Caret Line="635" Column="21" TopLine="628"/> 424 406 </Position22> 425 407 <Position23> 426 408 <Filename Value="..\UCustomDockManager.pas"/> 427 <Caret Line=" 108" Column="77" TopLine="88"/>409 <Caret Line="810" Column="7" TopLine="799"/> 428 410 </Position23> 429 411 <Position24> 430 412 <Filename Value="..\UCustomDockManager.pas"/> 431 <Caret Line=" 83" Column="44" TopLine="65"/>413 <Caret Line="790" Column="12" TopLine="770"/> 432 414 </Position24> 433 415 <Position25> 434 416 <Filename Value="..\UCustomDockManager.pas"/> 435 <Caret Line=" 108" Column="20" TopLine="94"/>417 <Caret Line="786" Column="1" TopLine="770"/> 436 418 </Position25> 437 419 <Position26> 438 420 <Filename Value="..\UCustomDockManager.pas"/> 439 <Caret Line=" 515" Column="11" TopLine="501"/>421 <Caret Line="787" Column="1" TopLine="770"/> 440 422 </Position26> 441 423 <Position27> 442 424 <Filename Value="..\UCustomDockManager.pas"/> 443 <Caret Line=" 112" Column="58" TopLine="91"/>425 <Caret Line="788" Column="1" TopLine="770"/> 444 426 </Position27> 445 427 <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"/> 448 430 </Position28> 449 431 <Position29> 450 432 <Filename Value="..\UCustomDockManager.pas"/> 451 <Caret Line=" 175" Column="24" TopLine="165"/>433 <Caret Line="790" Column="1" TopLine="770"/> 452 434 </Position29> 453 435 <Position30> 454 <Filename Value=" E:\Programy\Lazarus\lcl\customtimer.pas"/>455 <Caret Line="7 7" Column="3" TopLine="68"/>436 <Filename Value="..\UCustomDockManager.pas"/> 437 <Caret Line="791" Column="1" TopLine="770"/> 456 438 </Position30> 457 439 </JumpHistory> -
DockManager/Lazarus/Demo/UMainForm.lfm
r49 r50 27 27 Align = alBottom 28 28 Anchors = [akTop, akLeft, akRight, akBottom] 29 ClientHeight = 38730 ClientWidth = 57631 29 DockSite = True 32 30 TabOrder = 1 33 object TabControl1: TTabControl34 Left = 19135 Height = 15036 Top = 7537 Width = 20038 TabOrder = 039 TabPosition = tpLeft40 TabStop = False41 end42 31 end 43 32 object CustomDockMaster1: TCustomDockMaster -
DockManager/Lazarus/Demo/UMainForm.pas
r49 r50 17 17 CustomDockMaster1: TCustomDockMaster; 18 18 Panel1: TPanel; 19 TabControl1: TTabControl;20 19 procedure Button1Click(Sender: TObject); 21 20 procedure FormCreate(Sender: TObject); -
DockManager/Lazarus/UCustomDockManager.pas
r49 r50 19 19 20 20 TCustomDockManager = class; 21 TDockClientPanel = class; 21 22 22 23 { TConjoinDockForm } … … 28 29 29 30 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; 30 46 31 47 { TDockClientPanel } … … 40 56 procedure SetShowHeader(const AValue: Boolean); 41 57 public 58 Header: TDockHeader; 42 59 OwnerDockManager: TCustomDockManager; 43 CloseButton: TSpeedButton;44 60 Control: TControl; 45 61 Splitter: TSplitter; … … 50 66 procedure DockPanelMouseDown(Sender: TObject; Button: TMouseButton; 51 67 Shift: TShiftState; X, Y: Integer); 52 procedure DrawGrabber(Canvas: TCanvas; AControl: TControl);53 procedure CloseButtonClick(Sender: TObject);54 68 procedure ResizeExecute(Sender: TObject); 55 69 property ShowHeader: Boolean read FShowHeader write SetShowHeader; … … 83 97 procedure PopupMenuCloseClick(Sender: TObject); 84 98 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); 85 104 procedure Timer1Timer(Sender: TObject); 86 105 public 87 106 constructor Create(ADockSite: TWinControl); override; 88 107 destructor Destroy; override; 108 109 // Inherited from TDockManager 89 110 procedure BeginUpdate; override; 90 111 procedure EndUpdate; override; … … 141 162 SCloseForm = 'Close'; 142 163 SRenameForm = 'Rename'; 143 164 SPosition = 'Position'; 165 SPositionAuto = 'Auto'; 166 SPositionTop = 'Top'; 167 SPositionLeft = 'Left'; 168 SPositionRight = 'Right'; 169 SPositionBottom = 'Bottom'; 144 170 145 171 procedure Register; … … 189 215 NewMenuItem2.Caption := SDockTabs; 190 216 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; 191 246 NewMenuItem.Add(NewMenuItem2); 192 247 … … 580 635 end; 581 636 637 procedure TCustomDockManager.PopupMenuPositionAutoClick(Sender: TObject); 638 begin 639 TabsPos := hpAuto; 640 end; 641 642 procedure TCustomDockManager.PopupMenuPositionLeftClick(Sender: TObject); 643 begin 644 TabsPos := hpLeft; 645 end; 646 647 procedure TCustomDockManager.PopupMenuPositionRightClick(Sender: TObject); 648 begin 649 TabsPos := hpRight; 650 end; 651 652 procedure TCustomDockManager.PopupMenuPositionTopClick(Sender: TObject); 653 begin 654 TabsPos := hpTop; 655 end; 656 657 procedure TCustomDockManager.PopupMenuPositionBottomClick(Sender: TObject); 658 begin 659 TabsPos := hpBottom; 660 end; 661 582 662 procedure TCustomDockManager.Timer1Timer(Sender: TObject); 583 663 begin … … 614 694 begin 615 695 inherited; 616 CloseButton := TSpeedButton.Create(Self);617 with CloseButtondo begin696 Header := TDockHeader.Create(Self); 697 with Header do begin 618 698 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; 625 702 end; 626 703 ClientAreaPanel := TPanel.Create(Self); … … 630 707 DockSite := True; 631 708 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; 637 710 BevelInner := bvNone; 638 711 BevelOuter := bvNone; … … 658 731 end; 659 732 660 procedure TDockClientPanel.DrawGrabber(Canvas: TCanvas; AControl: TControl);661 begin662 with Canvas do begin663 Brush.Color := clBtnFace;664 Pen.Color := clBlack;665 FillRect(0, 0, AControl.Width, GrabberSize);666 667 if (AControl as TWinControl).Focused then668 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 begin680 Control.Hide;681 end;682 683 733 procedure TDockClientPanel.ResizeExecute(Sender: TObject); 684 734 begin … … 699 749 R := Control.ClientRect; 700 750 Canvas.FillRect(R); 701 CloseButton.Visible := ShowHeader;751 Header.Visible := ShowHeader; 702 752 if ShowHeader then begin 703 753 if ClientAreaPanel.DockClientCount = 0 then 704 DrawGrabber(Canvas, Control) else705 DrawGrabber(Canvas, ClientAreaPanel);754 Header.DrawGrabber(Canvas, Control) else 755 Header.DrawGrabber(Canvas, ClientAreaPanel); 706 756 end; 707 757 end; … … 731 781 UseDockManager := True; 732 782 Align := alClient; 783 BevelOuter := bvNone; 784 BevelInner := bvNone; 733 785 // Color := clYellow; 734 786 end; … … 781 833 end; 782 834 835 { TDockHeader } 836 837 constructor TDockHeader.Create(TheOwner: TComponent); 838 begin 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; 872 end; 873 874 destructor TDockHeader.Destroy; 875 begin 876 inherited Destroy; 877 end; 878 879 procedure TDockHeader.DrawGrabber(Canvas: TCanvas; AControl: TControl); 880 begin 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; 892 end; 893 894 procedure TDockHeader.CloseButtonClick(Sender: TObject); 895 begin 896 // Control.Hide; 897 end; 898 783 899 initialization 784 900 DefaultDockManagerClass := TCustomDockManager;
Note:
See TracChangeset
for help on using the changeset viewer.