⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dxbarextitems.pas

📁 胜天进销存源码,国产优秀的进销存
💻 PAS
📖 第 1 页 / 共 5 页
字号:
  ReleaseDC(0, DC);
  Result := C;
  FreeMem(C);
end;

function sdxBarDatePopupToday: string;
begin
  Result := cxGetResourceString(@dxSBAR_DATETODAY);
end;

function sdxBarDatePopupClear: string;
begin
  Result := cxGetResourceString(@dxSBAR_DATECLEAR);
end;

{ TdxBarStatic }

constructor TdxBarStatic.Create(AOwner: TComponent);
begin
  inherited;
  FAlignment := taCenter;
  FShowCaption := True;
end;

procedure TdxBarStatic.SetAlignment(Value: TAlignment);
begin
  if FAlignment <> Value then
  begin
    FAlignment := Value;
    if not IsLoading then Update;
  end;
end;

procedure TdxBarStatic.SetBorderStyle(Value: TdxBarStaticBorderStyle);
begin
  if FBorderStyle <> Value then
  begin
    FBorderStyle := Value;
    if not IsLoading then
      if (Width = 0) or (Height = 0) then
        UpdateEx
      else
        Update;
  end;
end;

procedure TdxBarStatic.SetSizeValue(Index: Integer; Value: Integer);
var
  PrevValue: Integer;
begin
  if Value < 0 then Value := 0;
  case Index of
    1: PrevValue := FLeftIndent;
    2: PrevValue := FRightIndent;
    3: PrevValue := FWidth;
    4: PrevValue := FHeight;
  else
    PrevValue := 0;
  end;
  if PrevValue <> Value then
  begin
    case Index of
      1: FLeftIndent := Value;
      2: FRightIndent := Value;
      3: FWidth := Value;
      4: FHeight := Value;
    end;
    if not IsLoading then UpdateEx;
  end;
end;

function TdxBarStatic.CanClicked: Boolean;
begin
  Result := FAllowClick;
end;

function TdxBarStatic.HasAccel(AItemLink: TdxBarItemLink): Boolean;
begin
  Result := False;
end;

function TdxBarStatic.IsStyleColorSupported: Boolean;
begin
  Result := True;
end;

{ TdxBarStaticControl }

function TdxBarStaticControl.GetBorderStyle: TdxBarStaticBorderStyle;
begin
  Result := Item.BorderStyle;
end;

function TdxBarStaticControl.GetBorderOffsets: TRect;
begin
  Result := Painter.StaticControlGetBorderOffsets(Parent, BorderStyle);
end;

function TdxBarStaticControl.GetItem: TdxBarStatic;
begin
  Result := TdxBarStatic(ItemLink.Item);
end;

function TdxBarStaticControl.GetSizeValue(Index: Integer): Integer;
begin
  case Index of
    1: Result := Item.LeftIndent;
    2: Result := Item.RightIndent;
    3: Result := Item.Width;
    4: Result := Item.Height;
  else
    Result := 0;
  end;
end;

function TdxBarStaticControl.CanHaveZeroSize: Boolean;
begin
  Result := False;
end;

procedure TdxBarStaticControl.CalcDrawParams(AFull: Boolean = True);
begin
  inherited;
  if AFull then
  begin
    DrawParams.Alignment := Alignment;
    DrawParams.AllowCenter := True;
    DrawParams.BorderOffsets := BorderOffsets;
    DrawParams.BorderStyle := BorderStyle;
  end;
end;

function TdxBarStaticControl.CanClicked: Boolean;
begin
  Result := Item.AllowClick;
end;

function TdxBarStaticControl.CanMouseSelect: Boolean;
begin
  Result := not IsSelectionForbidden;
end;

procedure TdxBarStaticControl.CaptionChanged;
begin
  if Width = 0 then
    inherited
  else
    Repaint;
end;

procedure TdxBarStaticControl.DoPaint(ARect: TRect; PaintType: TdxBarPaintType);
begin
  Painter.DrawStaticLikeControl(DrawParams, ARect, cxRect(LeftIndent, LeftIndent, RightIndent, RightIndent));
end;

procedure TdxBarStaticControl.DrawInterior(ARect: TRect);
begin
  Painter.DrawStaticGlyphAndCaption(DrawParams, ARect);
end;

function TdxBarStaticControl.GetAlignment: TAlignment;
begin
  Result := Item.Alignment;
end;

function TdxBarStaticControl.GetAutoHeight(ADefaultButtonSize: Integer): Integer;
begin
  if Parent.Kind = bkSubMenu then
    Result := GetTextSize
  else
  begin
    if cpText in DrawParams.ViewStructure then
    begin
      if cpIcon in DrawParams.ViewStructure then
        Result := Max(ADefaultButtonSize, GetTextSize - 3)
      else
        Result := GetTextSize - 3;
    end
    else
    begin
      if (cpIcon in DrawParams.ViewStructure) or not CanHaveZeroSize then
        Result := ADefaultButtonSize
      else
        Result := GetTextSize - 3;
    end;
  end;
  Inc(Result, BorderOffsets.Top);
  Inc(Result, BorderOffsets.Bottom);
end;

function TdxBarStaticControl.GetAutoWidth(ADefaultButtonSize: Integer): Integer;
begin
  if cpText in DrawParams.ViewStructure then
  begin
    if (cpIcon in DrawParams.ViewStructure) then
      if DrawParams.PaintType <> ptMenu then
        Result := ADefaultButtonSize + 4 + GetCaptionWidth
      else
        Result := Painter.SubMenuControlGetItemTextIndent(DrawParams) + GetCaptionWidth + 4
    else
      Result := GetCaptionWidth + Parent.TextSize div 2;
  end
  else
  begin
    if (cpIcon in DrawParams.ViewStructure) or not CanHaveZeroSize then
      Result := ADefaultButtonSize
    else
      Result := 0;
  end;

  Inc(Result, LeftIndent + RightIndent + BorderOffsets.Left + BorderOffsets.Right);
end;

function TdxBarStaticControl.GetDefaultHeight: Integer;
begin
  if IsRotated then
    Result := InternalGetDefaultWidth
  else
    Result := InternalGetDefaultHeight;
end;

function TdxBarStaticControl.GetDefaultWidth: Integer;
begin
  if IsRotated then
    Result := InternalGetDefaultHeight
  else
    Result := InternalGetDefaultWidth;
end;

function TdxBarStaticControl.InternalGetDefaultHeight: Integer;
begin
  if Height = 0 then
    Result := GetAutoHeight(GetRotationDependentHeight(DrawParams.DefaultButtonSize))
  else
    Result := Height;
end;

function TdxBarStaticControl.InternalGetDefaultWidth: Integer;
begin
  if Width = 0 then
    Result := GetAutoWidth(GetRotationDependentWidth(DrawParams.DefaultButtonSize))
  else
    Result := Width;
end;

function TdxBarStaticControl.IsDestroyOnClick: Boolean;
begin
  Result := Item.AllowClick;
end;

{ TdxBarLargeButton }

constructor TdxBarLargeButton.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FAutoGrayScale := True;
  FHotGlyph := TBitmap.Create;
  FHotGlyph.OnChange := OnHotGlyphChanged;
  FHotImageIndex := -1;
  FShowCaption := True;
  FSyncImageIndex := True;
end;

destructor TdxBarLargeButton.Destroy;
begin
  FreeAndNil(FHotGlyph);
  inherited;
end;

function TdxBarLargeButton.IsImageIndexStored: Boolean;
begin
  Result := not SyncImageIndex;
end;

function TdxBarLargeButton.IsLargeImageIndexStored: Boolean;
begin
  Result := (ActionLink = nil) or
    not TdxBarItemActionLinkAccess(ActionLink).IsImageIndexLinked;
end;

procedure TdxBarLargeButton.SetAutoGrayScale(Value: Boolean);
begin
  if FAutoGrayScale <> Value then
  begin
    FAutoGrayScale := Value;
    Update;
  end;
end;

procedure TdxBarLargeButton.SetHeight(Value: Integer);
begin
  if FHeight <> Value then
  begin
    if Value < 0 then Exit;
    FHeight := Value;
    UpdateEx;
  end;
end;

procedure TdxBarLargeButton.SetHotGlyph(Value: TBitmap);
begin
  FHotGlyph.Assign(Value);
end;

procedure TdxBarLargeButton.SetHotImageIndex(Value: Integer);
begin
  if FHotImageIndex <> Value then
  begin
    FHotImageIndex := Value;
    HotGlyphChanged;
  end;
end;

procedure TdxBarLargeButton.SetSyncImageIndex(Value: Boolean);
begin
  if IsLoading and not FInSyncImageIndex then
    FSetSyncImageIndex := True;
  if FSyncImageIndex <> Value then
  begin
    FSyncImageIndex := Value;
    if FSyncImageIndex then
      LargeGlyphChanged;
  end;
end;

procedure TdxBarLargeButton.OnHotGlyphChanged(Sender: TObject);
begin
  HotGlyphChanged;
end;

procedure TdxBarLargeButton.DefineProperties(Filer: TFiler);
begin
  inherited;
  Filer.DefineProperty('ImageIndex', ReadImageIndex, WriteImageIndex, IsImageIndexStored);
end;

procedure TdxBarLargeButton.Loaded;
begin
  inherited Loaded;
  FSetImageIndex := False;
  FSetLargeImageIndex := False;
  FSetSyncImageIndex := False;
end;

procedure TdxBarLargeButton.ReadImageIndex(Reader: TReader);
begin
  ImageIndex := Reader.ReadInteger;
end;

procedure TdxBarLargeButton.WriteImageIndex(Writer: TWriter);
begin
  Writer.WriteInteger(ImageIndex);
end;

function TdxBarLargeButton.GetActionImageIndex: Integer;
begin
  Result := LargeImageIndex;
end;

procedure TdxBarLargeButton.SetActionImageIndex(Value: Integer);
begin
  LargeImageIndex := Value;
end;

function TdxBarLargeButton.HasAccel(AItemLink: TdxBarItemLink): Boolean;
begin
  Result := inherited HasAccel(AItemLink) and
    (not (AItemLink.Owner.Owner is TdxBar) or FShowCaption);
end;

procedure TdxBarLargeButton.HotGlyphChanged;
var
  I: Integer;
{var
  AItemLink: TdxBarItemLink;}
begin
{  AItemLink := CurItemLink;
  if (AItemLink <> nil) and (AItemLink.Control <> nil) then

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -