📄 dxbarextitems.pas
字号:
TdxBarLargeButtonControl(AItemLink.Control).HotGlyphChanged;}
for I := 0 to LinkCount - 1 do
if Links[I].Control <> nil then
TdxBarLargeButtonControl(Links[I].Control).HotGlyphChanged;
end;
function TdxBarLargeButton.IsHotImageLinked: Boolean;
begin
Result := IsImageIndexLinked(BarManager.HotImages, FHotImageIndex);
end;
function TdxBarLargeButton.IsLargeImageLinked: Boolean;
begin
Result := IsImageIndexLinked(BarManager.LargeImages, LargeImageIndex);
end;
procedure TdxBarLargeButton.LargeGlyphChanged;
begin
if not FInSyncImageIndex and SyncImageIndex then
begin
if IsLoading and FSetImageIndex then
SyncImageIndex := LargeImageIndex = ImageIndex
else
begin
FInSyncImageIndex := True;
try
ImageIndex := LargeImageIndex;
finally
FInSyncImageIndex := False;
end;
end;
end;
inherited;
end;
procedure TdxBarLargeButton.SetImageIndex(Value: Integer);
begin
if IsLoading and not FInSyncImageIndex then
FSetImageIndex := True;
inherited SetImageIndex(Value);
if not FInSyncImageIndex then
begin
if IsLoading and (LargeImageIndex = -1) and (SyncImageIndex or not FSetSyncImageIndex) then
begin
FInSyncImageIndex := True;
try
LargeImageIndex := ImageIndex;
finally
FInSyncImageIndex := False;
end;
end
else
// if not FInSyncImageIndex then
if not FSetSyncImageIndex then
SyncImageIndex := False;
end;
end;
procedure TdxBarLargeButton.SetLargeImageIndex(Value: Integer);
begin
if IsLoading and not FInSyncImageIndex then
FSetLargeImageIndex := True;
inherited;
end;
function TdxBarLargeButton.UseHotImages: Boolean;
begin
Result := HotImageIndex > -1;
end;
function TdxBarLargeButton.UseLargeImages: Boolean;
begin
Result := LargeImageIndex > -1;
end;
procedure TdxBarLargeButton.WidthChanged;
begin
UpdateEx;
end;
function TdxBarLargeButton.GetSupportedActions: TdxBarCustomizationActions;
begin
Result := inherited GetSupportedActions - [caChangeButtonPaintStyle];
end;
{ TdxBarLargeButtonControl }
function TdxBarLargeButtonControl.GetHotGlyph: TBitmap;
begin
Result := Item.HotGlyph;
end;
function TdxBarLargeButtonControl.GetItem: TdxBarLargeButton;
begin
Result := TdxBarLargeButton(ItemLink.Item);
end;
function TdxBarLargeButtonControl.IsInheritedBehaviour: Boolean;
begin
Result := GetPaintType = ptMenu;
end;
function TdxBarLargeButtonControl.IsSizeAssigned: Boolean;
begin
with Item do
Result := (Width <> 0) and (Height <> 0);
end;
function TdxBarLargeButtonControl.ArrowWidth: Integer;
begin
if Parent is TdxBarControl then
Result := Painter.RealLargeButtonArrowWidth(BarManager)
else
Result := inherited ArrowWidth;
end;
procedure TdxBarLargeButtonControl.HotGlyphChanged;
begin
LargeGlyphChanged;
end;
procedure TdxBarLargeButtonControl.LargeGlyphChanged;
begin
if DrawParams.ViewSize = cvsLarge then
if IsSizeAssigned or (DrawParams.PaintType = ptMenu) then
Repaint
else
Parent.RepaintBar;
end;
function TdxBarLargeButtonControl.GetCurrentImage(AViewSize: TdxBarItemControlViewSize; ASelected: Boolean;
out ACurrentGlyph: TBitmap; out ACurrentImages: TCustomImageList; out ACurrentImageIndex: Integer): Boolean;
function CheckHotGlyph: Boolean;
begin
Result := True;
if not HotGlyph.Empty then
ACurrentGlyph := HotGlyph
else
if Item.IsHotImageLinked then
begin
ACurrentImages := HotImages;
ACurrentImageIndex := Item.HotImageIndex;
end
else
Result := False;
end;
function CheckLargeGlyph: Boolean;
begin
Result := True;
if not LargeGlyph.Empty then
ACurrentGlyph := LargeGlyph
else
if Item.IsLargeImageLinked then
begin
ACurrentImages := LargeImages;
ACurrentImageIndex := LargeImageIndex;
end
else
Result := False;
end;
function GetCurrentImages: TCustomImageList;
begin
if LargeImages <> nil then
Result := LargeImages
else
Result := HotImages;
end;
begin
if DrawParams.ViewSize = cvsLarge then
begin
ACurrentGlyph := nil;
ACurrentImages := nil;
ACurrentImageIndex := -1;
if ASelected then
Result := CheckHotGlyph or CheckLargeGlyph
else
Result := CheckLargeGlyph or CheckHotGlyph;
if not Result then
ACurrentImages := GetCurrentImages;
end
else
Result := inherited GetCurrentImage(AViewSize, ASelected, ACurrentGlyph, ACurrentImages, ACurrentImageIndex);
end;
function TdxBarLargeButtonControl.GetDefaultViewStructure: TdxBarItemControlViewStructure;
begin
if IsInheritedBehaviour then
Result := inherited GetDefaultViewStructure
else
begin
Result := [cpIcon];
if Item.ShowCaption then
Include(Result, cpText);
end;
end;
function TdxBarLargeButtonControl.GetDefaultViewSize: TdxBarItemControlViewSize;
begin
if IsInheritedBehaviour then
Result := inherited GetDefaultViewSize
else
Result := cvsLarge;
end;
function TdxBarLargeButtonControl.GetPossibleViewLevels: TdxBarItemViewLevels;
begin
Result := inherited GetPossibleViewLevels;
Include(Result, ivlLargeIconWithText);
end;
function TdxBarLargeButtonControl.GrayScale: Boolean;
begin
Result := not DrawSelected and Enabled and Item.AutoGrayScale;
end;
function TdxBarLargeButtonControl.InternalGetDefaultHeight: Integer;
begin
if Item.Height = 0 then
Result := inherited InternalGetDefaultHeight
else
Result := Item.Height;
end;
function TdxBarLargeButtonControl.InternalGetDefaultWidth: Integer;
begin
if Item.Width = 0 then
Result := inherited InternalGetDefaultWidth
else
Result := Item.Width;
end;
function TdxBarLargeButtonControl.IsRotated: Boolean;
begin
Result := inherited IsRotated and Item.ShowCaption;
end;
procedure TdxBarLargeButtonControl.PreparePaintStyleOnBar(var APaintStyle: TdxBarPaintStyle);
begin
APaintStyle := psCaption;
end;
{ TdxBarColorCombo }
constructor TdxBarColorCombo.Create(AOwner: TComponent);
begin
inherited;
FAutoColor := clWindowText;
FAutoColorText := cxGetResourceString(@dxSBAR_COLORAUTOTEXT);
FCustomColorText := cxGetResourceString(@dxSBAR_COLORCUSTOMTEXT);
DropDownCount := 16;
Glyph.LoadFromResourceName(HInstance, 'DXBARCOLORCOMBO');
CreateItemsList;
ItemIndex := 0;
ShowEditor := False;
end;
function TdxBarColorCombo.GetCurColor: TColor;
begin
Result := GetColorByIndex(CurItemIndex);
end;
procedure TdxBarColorCombo.SetAutoColor(Value: TColor);
begin
if FAutoColor <> Value then
begin
FAutoColor := Value;
if FShowAutoColor then
begin
FSettingColor := True;
try
ItemIndex := GetIndexOfColor(FColor);
finally
FSettingColor := False;
Update;
end;
end;
end;
end;
procedure TdxBarColorCombo.SetAutoColorText(Value: string);
begin
if FAutoColorText <> Value then
begin
FAutoColorText := Value;
if FShowAutoColor then
begin
Items[0] := Value;
Update;
end;
end;
end;
procedure TdxBarColorCombo.SetColor(Value: TColor);
var
AIndex: Integer;
begin
if FColor <> Value then
begin
FColor := Value;
FSettingColor := True;
try
AIndex := GetIndexOfColor(FColor);
if ItemIndex = AIndex then
begin
Update;
Change;
end
else ItemIndex := AIndex;
finally
FSettingColor := False;
end;
end;
end;
procedure TdxBarColorCombo.SetCurColor(Value: TColor);
begin
if CurColor <> Value then
CurItemIndex := GetIndexOfColor(Value);
end;
procedure TdxBarColorCombo.SetCustomColorText(Value: string);
begin
if FCustomColorText <> Value then
begin
FCustomColorText := Value;
Update;
end;
end;
procedure TdxBarColorCombo.SetShowAutoColor(Value: Boolean);
begin
if FShowAutoColor <> Value then
begin
FShowAutoColor := Value;
FSettingColor := True;
try
if Value then Items.Insert(0, FAutoColorText)
else Items.Delete(0);
if DropDownCount = Byte(not Value) + 16 then
DropDownCount := Byte(Value) + 16;
ItemIndex := GetIndexOfColor(FColor);
finally
FSettingColor := False;
Update;
end;
end;
end;
procedure TdxBarColorCombo.SetShowCustomColorButton(Value: Boolean);
begin
if FShowCustomColorButton <> Value then
begin
FShowCustomColorButton := Value;
Recalculate;
end;
end;
procedure TdxBarColorCombo.CreateItemsList;
begin
with Items do
begin
Clear;
if FShowAutoColor then Add(FAutoColorText);
Add(cxGetResourceString(@dxSBAR_COLOR_STR_0));
Add(cxGetResourceString(@dxSBAR_COLOR_STR_1));
Add(cxGetResourceString(@dxSBAR_COLOR_STR_2));
Add(cxGetResourceString(@dxSBAR_COLOR_STR_3));
Add(cxGetResourceString(@dxSBAR_COLOR_STR_4));
Add(cxGetResourceString(@dxSBAR_COLOR_STR_5));
Add(cxGetResourceString(@dxSBAR_COLOR_STR_6));
Add(cxGetResourceString(@dxSBAR_COLOR_STR_7));
Add(cxGetResourceString(@dxSBAR_COLOR_STR_8));
Add(cxGetResourceString(@dx
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -