📄 jvqnavigationpane.pas
字号:
Result := inherited ShowPage(Page, PageIndex);
if Result <> nil then
UpdatePositions;
end;
procedure TJvCustomNavigationPane.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
if Operation = opRemove then
begin
if AComponent = LargeImages then
LargeImages := nil;
if AComponent = SmallImages then
SmallImages := nil;
if AComponent = StyleManager then
StyleManager := nil;
end;
end;
procedure TJvCustomNavigationPane.SetDropDownMenu(const Value: TPopupMenu);
begin
if FIconPanel <> nil then
FIconPanel.DropDownMenu := Value;
end;
procedure TJvCustomNavigationPane.SetLargeImages(const Value: TCustomImageList);
begin
if FLargeImages <> Value then
begin
FLargeImages := Value;
UpdatePages;
end;
end;
procedure TJvCustomNavigationPane.SetSmallImages(const Value: TCustomImageList);
begin
if FSmallImages <> Value then
begin
FSmallImages := Value;
UpdatePages;
end;
end;
procedure TJvCustomNavigationPane.HidePanel(Index: Integer);
begin
if (Index >= 0) and (Index < PageCount) then // don't hide the first panel
NavPages[Index].Iconic := True;
end;
procedure TJvCustomNavigationPane.ShowPanel(Index: Integer);
begin
if (Index >= 0) and (Index < PageCount) then
NavPages[Index].Iconic := False;
end;
procedure TJvCustomNavigationPane.SetMaximizedCount(Value: Integer);
var
I, ACount: Integer;
begin
ACount := MaximizedCount;
if Value < 0 then
Value := 0;
if Value > PageCount then
Value := PageCount;
if Value = MaximizedCount then
Exit;
while ACount > Value do
begin
HidePanel(ACount - 1);
Dec(ACount);
end;
if Value > ACount then
for I := Value downto ACount do
ShowPanel(I - 1);
UpdatePositions;
end;
procedure TJvCustomNavigationPane.UpdatePositions;
var
I, X, Y: Integer;
begin
if (csDestroying in ComponentState) or (FIconPanel = nil) then
Exit;
DisableAlign;
FIconPanel.DisableAlign;
try
Y := 0;
X := 0;
FSplitter.Top := Y;
FIconPanel.FDropButton.Left := Width;
FIconPanel.Top := Height - FIconPanel.Height;
Inc(Y, FSplitter.Height);
for I := 0 to PageCount - 1 do
begin
if (NavPages[I].NavPanel = nil) or (NavPages[I].IconButton = nil) then
Exit;
NavPages[I].IconButton.Left := X;
Inc(X, NavPages[I].IconButton.Width);
NavPages[I].NavPanel.Top := Y;
Inc(Y, NavPages[I].NavPanel.Height);
NavPages[I].Invalidate;
end;
finally
EnableAlign;
FIconPanel.EnableAlign;
end;
Invalidate;
end;
procedure TJvCustomNavigationPane.SetColors(const Value: TJvNavPanelColors);
begin
FColors.Assign(Value);
end;
procedure TJvCustomNavigationPane.DoColorsChange(Sender: TObject);
begin
if FIconPanel <> nil then
TJvIconPanel(FIconPanel).Colors := Colors;
UpdatePages;
FSplitter.ColorFrom := Colors.SplitterColorFrom;
FSplitter.ColorTo := Colors.SplitterColorTo;
Invalidate;
end;
procedure TJvCustomNavigationPane.Loaded;
begin
inherited Loaded;
UpdatePositions;
end;
procedure TJvCustomNavigationPane.SetResizable(const Value: Boolean);
begin
if FResizable <> Value then
begin
FResizable := Value;
FSplitter.Enabled := FResizable;
end;
end;
function TJvCustomNavigationPane.InternalGetPageClass: TJvCustomPageClass;
begin
Result := TJvNavPanelPage;
end;
function TJvCustomNavigationPane.GetNavPage(Index: Integer): TJvNavPanelPage;
begin
Result := TJvNavPanelPage(Pages[Index]);
end;
procedure TJvCustomNavigationPane.InsertPage(APage: TJvCustomPage);
begin
inherited InsertPage(APage);
if APage <> nil then
begin
TJvNavPanelPage(APage).Top := FIconPanel.Top;
if (ActivePage = nil) and not (csLoading in ComponentState) then
ActivePage := APage;
end;
UpdatePositions;
end;
procedure TJvCustomNavigationPane.SetActivePage(Page: TJvCustomPage);
begin
inherited SetActivePage(Page);
if ActivePage <> nil then
begin
TJvNavPanelPage(ActivePage).NavPanel.Down := True;
TJvNavPanelPage(ActivePage).IconButton.Down := True;
TJvNavPanelPage(ActivePage).NavPanel.Invalidate;
TJvNavPanelPage(ActivePage).IconButton.Invalidate;
ActivePage.Invalidate;
end;
end;
function TJvCustomNavigationPane.WidgetFlags: Integer;
begin
Result := inherited WidgetFlags or Integer(WidgetFlags_WRepaintNoErase);
end;
procedure TJvCustomNavigationPane.Paint;
begin
// inherited;
if ActivePage = nil then
begin
Canvas.Brush.Color := Color;
Canvas.FillRect(ClientRect);
FBackground.DrawImage(Canvas, ClientRect);
end;
end;
procedure TJvCustomNavigationPane.SetBackground(const Value: TJvNavPaneBackgroundImage);
begin
FBackground.Assign(Value);
end;
procedure TJvCustomNavigationPane.SetNavPanelFont(const Value: TFont);
begin
FNavPanelFont.Assign(Value);
end;
procedure TJvCustomNavigationPane.SetNavPanelHotTrackFont(const Value: TFont);
begin
FNavPanelHotTrackFont.Assign(Value);
end;
procedure TJvCustomNavigationPane.SetNavPanelHotTrackFontOptions(const Value: TJvTrackFontOptions);
begin
if FNavPanelHotTrackFontOptions <> Value then
begin
FNavPanelHotTrackFontOptions := Value;
UpdatePages;
end;
end;
function TJvCustomNavigationPane.IsNavPanelFontStored: Boolean;
var
F: TFont;
begin
F := Application.Font;
with FNavPanelFont do
Result := ((StyleManager = nil) or (StyleManager.Theme = nptCustom)) and ((Name <> F.Name) or (Size <> F.Size) or (Style <> [fsBold]) or
(Color <> F.Color) or (Pitch <> F.Pitch) or (Charset <> F.Charset));
end;
function TJvCustomNavigationPane.IsNavPanelFontHotTrackStored: Boolean;
begin
Result := IsNavPanelHotTrackFontOptionsStored or IsNavPanelFontStored;
end;
function TJvCustomNavigationPane.IsNavPanelHotTrackFontOptionsStored: Boolean;
begin
Result := not (hoFollowFont in NavPanelHotTrackFontOptions);
end;
procedure TJvCustomNavigationPane.DoNavPanelFontChange(Sender: TObject);
begin
UpdatePages;
end;
procedure TJvCustomNavigationPane.RemovePage(APage: TJvCustomPage);
begin
inherited RemovePage(APage);
Invalidate;
end;
procedure TJvCustomNavigationPane.SetButtonHeight(const Value: Integer);
begin
if FButtonHeight <> Value then
begin
FButtonHeight := Value;
UpdatePages;
FIconPanel.Height := FButtonHeight;
end;
end;
procedure TJvCustomNavigationPane.SetButtonWidth(const Value: Integer);
begin
if FButtonWidth <> Value then
begin
FButtonWidth := Value;
UpdatePages;
FIconPanel.FDropButton.Width := FButtonWidth;
end;
end;
procedure TJvCustomNavigationPane.SetSplitterHeight(const Value: Integer);
begin
if FSplitter.Height <> Value then
FSplitter.Height := Value;
end;
function TJvCustomNavigationPane.GetSplitterHeight: Integer;
begin
Result := FSplitter.Height;
end;
procedure TJvCustomNavigationPane.SetStyleManager(const Value: TJvNavPaneStyleManager);
begin
if FStyleManager <> Value then
begin
ParentStyleManager := False;
if FStyleManager <> nil then
FStyleManager.UnregisterChanges(FStyleLink);
FStyleManager := Value;
if FStyleManager <> nil then
begin
FStyleManager.RegisterChanges(FStyleLink);
FStyleManager.FreeNotification(Self);
Colors := FStyleManager.Colors;
end;
// FSplitter.StyleManager := Value;
InternalStyleManagerChanged(Self, Value);
end;
end;
procedure TJvCustomNavigationPane.DoStyleChange(Sender: TObject);
begin
Colors := (Sender as TJvNavPaneStyleManager).Colors;
NavPanelFont := (Sender as TJvNavPaneStyleManager).Fonts.NavPanelFont;
NavPanelHotTrackFont := (Sender as TJvNavPaneStyleManager).Fonts.NavPanelHotTrackFont;
NavPanelHotTrackFontOptions := (Sender as TJvNavPaneStyleManager).Fonts.NavPanelHotTrackFontOptions;
end;
procedure TJvCustomNavigationPane.SetAutoHeaders(const Value: Boolean);
begin
if FAutoHeaders <> Value then
begin
FAutoHeaders := Value;
UpdatePages;
end;
end;
procedure TJvCustomNavigationPane.SetAlignment(const Value: TAlignment);
begin
if FAlignment <> Value then
begin
FAlignment := Value;
UpdatePages;
end;
end;
procedure TJvCustomNavigationPane.SetWordWrap(const Value: Boolean);
begin
if FWordWrap <> Value then
begin
FWordWrap := Value;
UpdatePages;
end;
end;
procedure TJvCustomNavigationPane.UpdatePages;
var
I: Integer;
begin
for I := 0 to PageCount - 1 do
begin
NavPages[I].AutoHeader := AutoHeaders;
NavPages[I].NavPanel.Height := ButtonHeight;
NavPages[I].IconButton.Width := ButtonWidth;
NavPages[I].NavPanel.Colors := Colors;
NavPages[I].IconButton.Colors := Colors;
NavPages[I].NavPanel.HotTrackFontOptions := NavPanelH
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -