2009-12-16 17:16:54 +00:00
|
|
|
|
unit uNavPaneUtils;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Forms, ImgList, ActnList, JvPageList, JvNavigationPane, Menus,
|
|
|
|
|
|
Controls;
|
|
|
|
|
|
|
|
|
|
|
|
procedure PopulateNavPagePane(AParentControl : TWinControl;
|
|
|
|
|
|
AMenuItem: TMenuItem; AImageList : TCustomImageList;
|
|
|
|
|
|
AStyleManager : TJvNavPaneStyleManager); overload;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
2010-01-22 09:52:58 +00:00
|
|
|
|
ComCtrls, Classes, Math, SpTBXDkPanels, StrUtils, SysUtils,
|
2010-01-22 18:23:50 +00:00
|
|
|
|
ExtCtrls, Graphics, Dialogs, JvLinkLabel, JvLabel, StdCtrls;
|
2009-12-16 17:16:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure PopulateNavPagePane(AParentControl : TWinControl;
|
|
|
|
|
|
AMenuItem: TMenuItem; AImageList : TCustomImageList;
|
|
|
|
|
|
AStyleManager : TJvNavPaneStyleManager);
|
|
|
|
|
|
var
|
|
|
|
|
|
ItemIndex : Integer;
|
|
|
|
|
|
AHeight : Integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
AHeight := 0;
|
|
|
|
|
|
for ItemIndex := 0 to (AMenuItem.Count - 1) do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if ((not AMenuItem[ItemIndex].IsLine) // que no sea una l<>nea separadora
|
2010-01-22 18:23:50 +00:00
|
|
|
|
and (AMenuItem[ItemIndex].Count = 0) // que no sea el padre de un submen<65>
|
|
|
|
|
|
and (AMenuItem[ItemIndex].Visible)) // y que sea visible
|
2009-12-16 17:16:54 +00:00
|
|
|
|
then
|
2010-01-22 18:23:50 +00:00
|
|
|
|
with TJvLabel.Create(AParentControl) do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Parent := AParentControl;//APanel;
|
|
|
|
|
|
ParentFont := True;
|
|
|
|
|
|
Align := alTop;
|
|
|
|
|
|
Tag := AMenuItem[ItemIndex].Tag;
|
|
|
|
|
|
Caption := AMenuItem[ItemIndex].Caption;
|
|
|
|
|
|
Action := AMenuItem[ItemIndex].Action;
|
|
|
|
|
|
|
|
|
|
|
|
HotTrack := True;
|
|
|
|
|
|
HotTrackFont.Style := [fsUnderline];
|
|
|
|
|
|
|
|
|
|
|
|
Images := AImageList;
|
|
|
|
|
|
ImageIndex := AMenuItem[ItemIndex].ImageIndex;
|
|
|
|
|
|
|
|
|
|
|
|
Height := AImageList.Height;
|
|
|
|
|
|
|
|
|
|
|
|
Margins.Top := 0;
|
|
|
|
|
|
Margins.Bottom := 6;
|
|
|
|
|
|
Margins.Left := 10;
|
|
|
|
|
|
Margins.Right := 10;
|
|
|
|
|
|
AlignWithMargins := True;
|
|
|
|
|
|
|
|
|
|
|
|
AutoSize := True;
|
|
|
|
|
|
Layout := tlCenter;
|
|
|
|
|
|
Transparent := True;
|
|
|
|
|
|
|
|
|
|
|
|
AHeight := AHeight + Margins.Top + Margins.Bottom + Height;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
{ with TSpTBXLabel.Create(Application) do
|
2009-12-16 17:16:54 +00:00
|
|
|
|
begin
|
|
|
|
|
|
Parent := AParentControl;//APanel;
|
|
|
|
|
|
Align := alTop;
|
|
|
|
|
|
ParentFont := True;
|
|
|
|
|
|
Tag := AMenuItem[ItemIndex].Tag;
|
|
|
|
|
|
Caption := AMenuItem[ItemIndex].Caption;
|
|
|
|
|
|
Action := AMenuItem[ItemIndex].Action;
|
2010-01-22 18:23:50 +00:00
|
|
|
|
|
2009-12-16 17:16:54 +00:00
|
|
|
|
Images := AImageList;
|
|
|
|
|
|
ImageIndex := AMenuItem[ItemIndex].ImageIndex;
|
|
|
|
|
|
if ItemIndex = 0 then
|
|
|
|
|
|
Margins.Top := 15
|
|
|
|
|
|
else
|
|
|
|
|
|
Margins.Top := 6;
|
|
|
|
|
|
Margins.Bottom := 6;
|
|
|
|
|
|
Margins.Left := 10;
|
|
|
|
|
|
Margins.Right := 10;
|
2010-01-22 18:23:50 +00:00
|
|
|
|
AlignWithMargins := True;
|
2009-12-16 17:16:54 +00:00
|
|
|
|
Height := 18;
|
2010-01-22 18:23:50 +00:00
|
|
|
|
Color := clRed;
|
2009-12-16 17:16:54 +00:00
|
|
|
|
Invalidate;
|
2010-01-22 18:23:50 +00:00
|
|
|
|
AHeight := AHeight + Margins.Top + Margins.Bottom + Height;
|
|
|
|
|
|
end;}
|
2009-12-16 17:16:54 +00:00
|
|
|
|
end;
|
|
|
|
|
|
AParentControl.Height := AHeight;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|