You've already forked lazarus-ccr
tvplanit: A combined commit due to outage of sourceforge
- Increase version to 1.0.11 for new development version - Fix misalignment of listboxes in VpNavBar component editor form (issue #33698) - More flexible aligment of the listboxes in VpNavBar component editor (alLeft/alClient) - Add themed highlighting of VpNavBar items. - Extended VpNavBar demo with selection of item theme and text color. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6391 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,13 +1,13 @@
|
||||
object frmNavBarEd: TfrmNavBarEd
|
||||
Left = 374
|
||||
Height = 364
|
||||
Height = 370
|
||||
Top = 236
|
||||
Width = 543
|
||||
Width = 548
|
||||
HorzScrollBar.Page = 425
|
||||
VertScrollBar.Page = 322
|
||||
Caption = 'Nav Bar Layout Tool'
|
||||
ClientHeight = 364
|
||||
ClientWidth = 543
|
||||
Caption = 'NavBar Layout Tool'
|
||||
ClientHeight = 370
|
||||
ClientWidth = 548
|
||||
FormStyle = fsStayOnTop
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
@ -18,72 +18,48 @@ object frmNavBarEd: TfrmNavBarEd
|
||||
LCLVersion = '1.9.0.0'
|
||||
object pnlFoldersAndItems: TPanel
|
||||
Left = 0
|
||||
Height = 364
|
||||
Height = 370
|
||||
Top = 0
|
||||
Width = 543
|
||||
Width = 548
|
||||
Align = alClient
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 364
|
||||
ClientWidth = 543
|
||||
ClientHeight = 370
|
||||
ClientWidth = 548
|
||||
TabOrder = 0
|
||||
object pnlFolders: TPanel
|
||||
AnchorSideLeft.Control = pnlFoldersAndItems
|
||||
AnchorSideTop.Control = pnlFoldersAndItems
|
||||
AnchorSideRight.Control = Bevel1
|
||||
AnchorSideBottom.Control = pnlFoldersAndItems
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 364
|
||||
Height = 370
|
||||
Top = 0
|
||||
Width = 235
|
||||
Width = 232
|
||||
Align = alLeft
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Right = 4
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 364
|
||||
ClientWidth = 235
|
||||
ClientHeight = 370
|
||||
ClientWidth = 232
|
||||
TabOrder = 0
|
||||
object lbFolders: TListBox
|
||||
AnchorSideLeft.Control = pnlFolders
|
||||
AnchorSideTop.Control = Panel6
|
||||
AnchorSideTop.Control = lblFolders
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = pnlFolders
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = Panel5
|
||||
AnchorSideBottom.Control = pnlFolderBtns
|
||||
Left = 4
|
||||
Height = 308
|
||||
Height = 314
|
||||
Top = 23
|
||||
Width = 231
|
||||
Width = 228
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 4
|
||||
BorderSpacing.Top = 4
|
||||
ItemHeight = 0
|
||||
OnClick = lbFoldersClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object Panel6: TPanel
|
||||
Left = 0
|
||||
Height = 23
|
||||
Top = 0
|
||||
Width = 235
|
||||
Align = alTop
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 23
|
||||
ClientWidth = 235
|
||||
TabOrder = 0
|
||||
object Label1: TLabel
|
||||
Left = 4
|
||||
Height = 15
|
||||
Top = 4
|
||||
Width = 38
|
||||
Caption = '&Folders'
|
||||
FocusControl = lbFolders
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
object Panel5: TPanel
|
||||
object pnlFolderBtns: TPanel
|
||||
Left = 4
|
||||
Height = 25
|
||||
Top = 335
|
||||
Width = 231
|
||||
Top = 341
|
||||
Width = 228
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 4
|
||||
@ -91,11 +67,11 @@ object frmNavBarEd: TfrmNavBarEd
|
||||
BorderSpacing.Bottom = 4
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 25
|
||||
ClientWidth = 231
|
||||
TabOrder = 2
|
||||
ClientWidth = 228
|
||||
TabOrder = 1
|
||||
object btnFolderAdd: TSpeedButton
|
||||
AnchorSideLeft.Control = Panel5
|
||||
AnchorSideTop.Control = Panel5
|
||||
AnchorSideLeft.Control = pnlFolderBtns
|
||||
AnchorSideTop.Control = pnlFolderBtns
|
||||
Left = 0
|
||||
Height = 25
|
||||
Hint = 'Add folder'
|
||||
@ -120,7 +96,7 @@ object frmNavBarEd: TfrmNavBarEd
|
||||
object btnFolderDelete: TSpeedButton
|
||||
AnchorSideLeft.Control = btnFolderAdd
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Panel5
|
||||
AnchorSideTop.Control = pnlFolderBtns
|
||||
Left = 29
|
||||
Height = 25
|
||||
Hint = 'Remove folder'
|
||||
@ -146,7 +122,7 @@ object frmNavBarEd: TfrmNavBarEd
|
||||
object btnFolderUp: TSpeedButton
|
||||
AnchorSideLeft.Control = btnFolderDelete
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Panel5
|
||||
AnchorSideTop.Control = pnlFolderBtns
|
||||
Left = 58
|
||||
Height = 25
|
||||
Hint = 'Move folder up'
|
||||
@ -172,7 +148,7 @@ object frmNavBarEd: TfrmNavBarEd
|
||||
object btnFolderDown: TSpeedButton
|
||||
AnchorSideLeft.Control = btnFolderUp
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Panel5
|
||||
AnchorSideTop.Control = pnlFolderBtns
|
||||
Left = 83
|
||||
Height = 25
|
||||
Hint = 'Move folder down'
|
||||
@ -195,49 +171,55 @@ object frmNavBarEd: TfrmNavBarEd
|
||||
ParentShowHint = False
|
||||
end
|
||||
end
|
||||
object lblFolders: TLabel
|
||||
AnchorSideLeft.Control = pnlFolders
|
||||
AnchorSideTop.Control = pnlFolders
|
||||
Left = 4
|
||||
Height = 15
|
||||
Top = 4
|
||||
Width = 38
|
||||
BorderSpacing.Left = 4
|
||||
BorderSpacing.Top = 4
|
||||
Caption = 'Folders'
|
||||
FocusControl = lbFolders
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
object pnlItems: TPanel
|
||||
AnchorSideLeft.Control = pnlFolders
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = pnlFoldersAndItems
|
||||
AnchorSideRight.Control = pnlFoldersAndItems
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = pnlFoldersAndItems
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 239
|
||||
Height = 364
|
||||
Left = 237
|
||||
Height = 370
|
||||
Top = 0
|
||||
Width = 300
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Right = 4
|
||||
Width = 311
|
||||
Align = alClient
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 364
|
||||
ClientWidth = 300
|
||||
ClientHeight = 370
|
||||
ClientWidth = 311
|
||||
TabOrder = 1
|
||||
object lbItems: TListBox
|
||||
AnchorSideLeft.Control = pnlItems
|
||||
AnchorSideTop.Control = Panel4
|
||||
AnchorSideTop.Control = lblImages
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = btnUseImage
|
||||
AnchorSideBottom.Control = Panel1
|
||||
AnchorSideBottom.Control = pnlItemBtns
|
||||
Left = 0
|
||||
Height = 307
|
||||
Top = 24
|
||||
Width = 221
|
||||
Height = 314
|
||||
Top = 23
|
||||
Width = 228
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Right = 4
|
||||
ItemHeight = 13
|
||||
OnClick = lbItemsClick
|
||||
OnDrawItem = lbItemsDrawItem
|
||||
OnMeasureItem = lbItemsMeasureItem
|
||||
Style = lbOwnerDrawVariable
|
||||
TabOrder = 1
|
||||
TabOrder = 0
|
||||
end
|
||||
object Panel1: TPanel
|
||||
object pnlItemBtns: TPanel
|
||||
Left = 0
|
||||
Height = 25
|
||||
Top = 335
|
||||
Width = 296
|
||||
Top = 341
|
||||
Width = 307
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 4
|
||||
@ -245,11 +227,11 @@ object frmNavBarEd: TfrmNavBarEd
|
||||
BorderSpacing.Bottom = 4
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 25
|
||||
ClientWidth = 296
|
||||
TabOrder = 2
|
||||
ClientWidth = 307
|
||||
TabOrder = 1
|
||||
object btnItemAdd: TSpeedButton
|
||||
AnchorSideLeft.Control = Panel1
|
||||
AnchorSideTop.Control = Panel1
|
||||
AnchorSideLeft.Control = pnlItemBtns
|
||||
AnchorSideTop.Control = pnlItemBtns
|
||||
Left = 0
|
||||
Height = 25
|
||||
Hint = 'Add Item'
|
||||
@ -274,7 +256,7 @@ object frmNavBarEd: TfrmNavBarEd
|
||||
object btnItemDelete: TSpeedButton
|
||||
AnchorSideLeft.Control = btnItemAdd
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Panel1
|
||||
AnchorSideTop.Control = pnlItemBtns
|
||||
Left = 29
|
||||
Height = 25
|
||||
Hint = 'Remove item'
|
||||
@ -300,7 +282,7 @@ object frmNavBarEd: TfrmNavBarEd
|
||||
object btnItemUp: TSpeedButton
|
||||
AnchorSideLeft.Control = btnItemDelete
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Panel1
|
||||
AnchorSideTop.Control = pnlItemBtns
|
||||
Left = 58
|
||||
Height = 25
|
||||
Hint = 'Move item up'
|
||||
@ -326,7 +308,7 @@ object frmNavBarEd: TfrmNavBarEd
|
||||
object btnItemDown: TSpeedButton
|
||||
AnchorSideLeft.Control = btnItemUp
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Panel1
|
||||
AnchorSideTop.Control = pnlItemBtns
|
||||
Left = 87
|
||||
Height = 25
|
||||
Hint = 'Move item down'
|
||||
@ -350,76 +332,67 @@ object frmNavBarEd: TfrmNavBarEd
|
||||
ParentShowHint = False
|
||||
end
|
||||
end
|
||||
object Panel4: TPanel
|
||||
Left = 0
|
||||
Height = 24
|
||||
Top = 0
|
||||
Width = 300
|
||||
Align = alTop
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 24
|
||||
ClientWidth = 300
|
||||
TabOrder = 0
|
||||
object Label2: TLabel
|
||||
Left = 0
|
||||
Height = 15
|
||||
Top = 4
|
||||
Width = 62
|
||||
Caption = '&Items/Icons'
|
||||
FocusControl = lbItems
|
||||
ParentColor = False
|
||||
end
|
||||
object Label4: TLabel
|
||||
AnchorSideTop.Control = Label2
|
||||
AnchorSideRight.Control = Panel4
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 211
|
||||
Height = 15
|
||||
Top = 4
|
||||
Width = 89
|
||||
Anchors = [akTop, akRight]
|
||||
Caption = 'Available i&mages'
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
object lbImages: TListBox
|
||||
AnchorSideTop.Control = lbItems
|
||||
AnchorSideRight.Control = pnlItems
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = lbItems
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 252
|
||||
Height = 307
|
||||
Top = 24
|
||||
Left = 259
|
||||
Height = 314
|
||||
Top = 23
|
||||
Width = 48
|
||||
Anchors = [akTop, akRight, akBottom]
|
||||
BorderSpacing.Right = 4
|
||||
ItemHeight = 0
|
||||
OnDrawItem = lbImagesDrawItem
|
||||
Style = lbOwnerDrawFixed
|
||||
TabOrder = 3
|
||||
TabOrder = 2
|
||||
end
|
||||
object btnUseImage: TSpeedButton
|
||||
AnchorSideTop.Control = lbImages
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = lbImages
|
||||
Left = 225
|
||||
Left = 232
|
||||
Height = 22
|
||||
Hint = 'Use image in navigation bar'
|
||||
Top = 166
|
||||
Top = 169
|
||||
Width = 23
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 4
|
||||
OnClick = btnUseImageClick
|
||||
end
|
||||
object lblItems: TLabel
|
||||
AnchorSideLeft.Control = pnlItems
|
||||
AnchorSideTop.Control = pnlItems
|
||||
Left = 0
|
||||
Height = 15
|
||||
Top = 4
|
||||
Width = 62
|
||||
BorderSpacing.Top = 4
|
||||
Caption = 'Items/Icons'
|
||||
FocusControl = lbItems
|
||||
ParentColor = False
|
||||
end
|
||||
object lblImages: TLabel
|
||||
AnchorSideTop.Control = lblItems
|
||||
AnchorSideRight.Control = pnlItems
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 218
|
||||
Height = 15
|
||||
Top = 4
|
||||
Width = 89
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 4
|
||||
Caption = 'Available images'
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
object Bevel1: TBevel
|
||||
AnchorSideLeft.Control = pnlFoldersAndItems
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
Left = 239
|
||||
Height = 50
|
||||
object Splitter1: TSplitter
|
||||
Left = 232
|
||||
Height = 370
|
||||
Top = 0
|
||||
Width = 64
|
||||
Shape = bsSpacer
|
||||
Width = 5
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -53,29 +53,27 @@ type
|
||||
{ TfrmNavBarEd }
|
||||
|
||||
TfrmNavBarEd = class(TForm)
|
||||
Bevel1: TBevel;
|
||||
Label4: TLabel;
|
||||
lblImages: TLabel;
|
||||
lbImages: TListBox;
|
||||
pnlFoldersAndItems: TPanel;
|
||||
pnlItems: TPanel;
|
||||
pnlFolders: TPanel;
|
||||
lbItems: TListBox;
|
||||
lbFolders: TListBox;
|
||||
Panel1: TPanel;
|
||||
pnlItemBtns: TPanel;
|
||||
btnItemAdd: TSpeedButton;
|
||||
btnItemDelete: TSpeedButton;
|
||||
btnItemUp: TSpeedButton;
|
||||
btnItemDown: TSpeedButton;
|
||||
Panel4: TPanel;
|
||||
Label2: TLabel;
|
||||
Panel5: TPanel;
|
||||
lblItems: TLabel;
|
||||
pnlFolderBtns: TPanel;
|
||||
btnFolderAdd: TSpeedButton;
|
||||
btnFolderDelete: TSpeedButton;
|
||||
btnFolderUp: TSpeedButton;
|
||||
btnFolderDown: TSpeedButton;
|
||||
Panel6: TPanel;
|
||||
Label1: TLabel;
|
||||
lblFolders: TLabel;
|
||||
btnUseImage: TSpeedButton;
|
||||
Splitter1: TSplitter;
|
||||
|
||||
procedure btnFolderAddClick(Sender: TObject);
|
||||
procedure btnFolderDeleteClick(Sender: TObject);
|
||||
|
@ -52,6 +52,7 @@ type
|
||||
TVpBackgroundMethod = (bmNone, bmNormal, bmStretch, bmTile);
|
||||
TVpFolderDrawingStyle = (dsDefButton, dsEtchedButton, dsCoolTab, dsStandardTab);
|
||||
TVpFolderType = (ftDefault, ftContainer);
|
||||
TVpItemTheme = (itNoTheme, itPushButton, itToolbar);
|
||||
|
||||
TVpFolderContainer = class(TPanel)
|
||||
protected{Private}
|
||||
@ -210,6 +211,7 @@ type
|
||||
FLoadingFolder: Integer;
|
||||
FMouseDownPt: TPoint;
|
||||
FAllowInplaceEdit: Boolean;
|
||||
FItemTheme: TVpItemTheme;
|
||||
|
||||
{event variables}
|
||||
FOnArrange: TNotifyEvent;
|
||||
@ -351,6 +353,7 @@ type
|
||||
property ImagesWidth: Integer read FImagesWidth write SetImagesWidth;
|
||||
property ItemFont: TFont read FItemFont write SetItemFont;
|
||||
property ItemSpacing: Integer read FItemSpacing write SetItemSpacing stored IsStoredItemSpacing;
|
||||
property ItemTheme: TVpItemTheme read FItemTheme write FItemTheme default itNoTheme;
|
||||
property PlaySounds: Boolean read FPlaySounds write FPlaySounds default false;
|
||||
property ScrollDelta: Integer read FScrollDelta write SetScrollDelta default 2;
|
||||
property SelectedItem: Integer read FSelectedItem write FSelectedItem;
|
||||
@ -429,6 +432,7 @@ type
|
||||
{$ENDIF}{$ENDIF}
|
||||
property ItemFont;
|
||||
property ItemSpacing;
|
||||
property ItemTheme;
|
||||
property PlaySounds;
|
||||
property ScrollDelta;
|
||||
property SelectedItem;
|
||||
|
@ -515,28 +515,42 @@ end;
|
||||
|
||||
procedure TVpNavBarPainter.DrawItemHighlight(Canvas: TCanvas; R: TRect;
|
||||
Enable: Boolean);
|
||||
const
|
||||
PUSHBUTTON_DETAILS: array[boolean] of TThemedButton = (tbPushButtonHot, tbPushButtonPressed);
|
||||
TOOLBAR_DETAILS: array[boolean] of TThemedToolbar = (ttbButtonHot, ttbButtonPressed);
|
||||
var
|
||||
details: TThemedElementDetails;
|
||||
margin: integer;
|
||||
begin
|
||||
if Enable then begin
|
||||
if nabMouseDown then
|
||||
Canvas.Pen.Color := clBlack
|
||||
else
|
||||
Canvas.Pen.Color := clWhite;
|
||||
Canvas.MoveTo(R.Left-1, R.Bottom+1);
|
||||
Canvas.LineTo(R.Left-1, R.Top-1);
|
||||
Canvas.LineTo(R.Right+1, R.Top-1);
|
||||
if nabMouseDown then
|
||||
Canvas.Pen.Color := clWhite
|
||||
else
|
||||
Canvas.Pen.Color := clBlack;
|
||||
Canvas.LineTo(R.Right+1, R.Bottom+1);
|
||||
Canvas.LineTo(R.Left-1, R.Bottom+1);
|
||||
Canvas.Brush.Color := FBackgroundColor;
|
||||
(*
|
||||
end else begin
|
||||
Canvas.Pen.Color := FBackgroundColor;
|
||||
Canvas.Brush.Color := FBackgroundColor;
|
||||
Canvas.Rectangle(R.Left - 1, R.Top - 1, R.Right + 1, R.Bottom + 1);
|
||||
*)
|
||||
if ThemeServices.ThemesEnabled and (TVpNavBarOpener(FNavBar).ItemTheme <> itNoTheme) then
|
||||
begin
|
||||
margin := ScaleX(2, DesigntimeDPI);
|
||||
InflateRect(R, margin, margin);
|
||||
case TVpNavBarOpener(FNavBar).ItemTheme of
|
||||
itPushButton:
|
||||
details := ThemeServices.GetElementDetails(PUSHBUTTON_DETAILS[nabMousedown]);
|
||||
itToolbar:
|
||||
details := ThemeServices.GetElementDetails(TOOLBAR_DETAILS[nabMouseDown]);
|
||||
end;
|
||||
ThemeServices.DrawElement(Canvas.Handle, details, R);
|
||||
end else
|
||||
begin
|
||||
if nabMouseDown then
|
||||
Canvas.Pen.Color := clBlack
|
||||
else
|
||||
Canvas.Pen.Color := clWhite;
|
||||
Canvas.MoveTo(R.Left-1, R.Bottom+1);
|
||||
Canvas.LineTo(R.Left-1, R.Top-1);
|
||||
Canvas.LineTo(R.Right+1, R.Top-1);
|
||||
if nabMouseDown then
|
||||
Canvas.Pen.Color := clWhite
|
||||
else
|
||||
Canvas.Pen.Color := clBlack;
|
||||
Canvas.LineTo(R.Right+1, R.Bottom+1);
|
||||
Canvas.LineTo(R.Left-1, R.Bottom+1);
|
||||
Canvas.Brush.Color := FBackgroundColor;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Reference in New Issue
Block a user