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

📄 dxribbongallery.pas

📁 胜天进销存源码,国产优秀的进销存
💻 PAS
📖 第 1 页 / 共 5 页
字号:
{*******************************************************************}
{                                                                   }
{       Developer Express Visual Component Library                  }
{       ExpressBars components                                      }
{                                                                   }
{       Copyright (c) 1998-2008 Developer Express Inc.              }
{       ALL RIGHTS RESERVED                                         }
{                                                                   }
{   The entire contents of this file is protected by U.S. and       }
{   International Copyright Laws. Unauthorized reproduction,        }     
{   reverse-engineering, and distribution of all or any portion of  }
{   the code contained in this file is strictly prohibited and may  }
{   result in severe civil and criminal penalties and will be       }
{   prosecuted to the maximum extent possible under the law.        }
{                                                                   }
{   RESTRICTIONS                                                    }
{                                                                   }
{   THIS SOURCE CODE AND ALL RESULTING INTERMEDIATE FILES           }
{   (DCU, OBJ, DLL, ETC.) ARE CONFIDENTIAL AND PROPRIETARY TRADE    }
{   SECRETS OF DEVELOPER EXPRESS INC. THE REGISTERED DEVELOPER IS   }
{   LICENSED TO DISTRIBUTE THE EXPRESSBARS AND ALL ACCOMPANYING VCL }
{   CONTROLS AS PART OF AN EXECUTABLE PROGRAM ONLY.                 }
{                                                                   }
{   THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED      }
{   FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE        }
{   COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE       }
{   AVAILABLE TO OTHER INDIVIDUALS WITHOUT EXPRESS WRITTEN CONSENT  }
{   AND PERMISSION FROM DEVELOPER EXPRESS INC.                      }
{                                                                   }
{   CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON       }
{   ADDITIONAL RESTRICTIONS.                                        }
{                                                                   }
{*******************************************************************}

unit dxRibbonGallery;

{$I cxVer.inc}

interface

uses
  Windows, Classes, Messages, SysUtils, Graphics, Controls, StdCtrls, Contnrs,
  ImgList, ActnList, cxClasses, cxGraphics, cxGeometry, cxScrollBar, dxBar,
  cxAccessibility, dxBarAccessibility, dxRibbon, cxControls,
  cxLookAndFeelPainters, dxRibbonSkins;

const
  dxRibbonGalleryDefaultColumnCount = 5;
  dxRibbonGalleryGroupItemIndent = 3;
  dxRibbonGalleryMinColumnCount = 2;

type
  TdxRibbonDropDownGallery = class;
  TdxRibbonDropDownGalleryControl = class;
  TdxRibbonGalleryControl = class;
  TdxRibbonGalleryControlViewInfo = class;
  TdxRibbonGalleryFilter = class;
  TdxRibbonGalleryFilterCategory = class;
  TdxRibbonGalleryFilterMenuControl = class;
  TdxRibbonGalleryGroup = class;
  TdxRibbonGalleryGroupItemActionLink = class;
  TdxRibbonGalleryGroupItemActionLinkClass = class of TdxRibbonGalleryGroupItemActionLink;
  TdxRibbonGalleryGroupItemViewInfo = class;
  TdxRibbonGalleryGroupOptions = class;
  TdxRibbonGalleryGroupViewInfo = class;
  TdxRibbonGalleryItem = class;
  TdxRibbonGalleryScrollBar = class;
  TdxRibbonOnSubMenuGalleryControlViewInfo = class;

  TdxRibbonDropDownGalleryNavigationDirection = (dgndNone, dgndUp, dgndDown);
  TdxRibbonGalleryGroupItemTextKind = (itkNone, itkCaption, itkCaptionAndDescription);
  TdxRibbonGalleryImagePosition = (gipLeft, gipRight, gipTop,
    gipBottom);
  TdxRibbonGalleryItemSelectionMode = (gsmNone, gsmSingle, gsmMultiple);
  TdxRibbonGallerySubMenuResizing = (gsrNone, gsrHeight, gsrWidthAndHeight);

  { TcxItemSize }

  TcxItemSize = class(TcxSize)
  private
    FAssigned: Boolean;
    FParent: TcxItemSize;
    procedure SetAssigned(const Value: Boolean);
  protected
    procedure DoChange; override;
    function GetValue(Index: Integer): Integer; override;
    function IsSizeStored(Index: Integer): Boolean; override;
    procedure SetSize(const Value: TSize); override;

    property Assigned: Boolean read FAssigned write SetAssigned;
    property Parent: TcxItemSize read FParent write FParent;
  end;

  { TdxRibbonGalleryItemPullHighlighting }

  TdxRibbonGalleryItemPullHighlightingDirection = (gphdStartToFinish, gphdFinishToStart);

  TdxRibbonGalleryItemPullHighlighting = class(TPersistent)
  private
    FActive: Boolean;
    FIsAssigned: Boolean;
    FDirection: TdxRibbonGalleryItemPullHighlightingDirection;
    FParent: TdxRibbonGalleryItemPullHighlighting;
    FOnChange: TNotifyEvent;
    function GetActive: Boolean;
    function GetDirection: TdxRibbonGalleryItemPullHighlightingDirection;
    procedure SetActive(Value: Boolean);
    procedure SetIsAssigned(Value: Boolean);
    procedure SetDirection(Value: TdxRibbonGalleryItemPullHighlightingDirection);
  protected
    procedure DoChange;
    function IsActiveStored: Boolean; virtual;
    function IsDirectionStored: Boolean; virtual;

    property IsAssigned: Boolean read FIsAssigned write SetIsAssigned;
    property Parent: TdxRibbonGalleryItemPullHighlighting read FParent write FParent;
  public
    procedure Assign(Source: TPersistent); override;
    property OnChange: TNotifyEvent read FOnChange write FOnChange;
  published
    property Active: Boolean read GetActive write SetActive stored IsActiveStored;
    property Direction: TdxRibbonGalleryItemPullHighlightingDirection read GetDirection
      write SetDirection stored IsDirectionStored;
  end;

  { TdxRibbonGalleryCustomOptions }

  TdxRibbonGalleryCustomOptions = class(TPersistent)
  private
    FImages: TCustomImageList;
    FImageChangeLink: TChangeLink;
    FItemImagePosition: TdxRibbonGalleryImagePosition;
    FItemImageSize: TcxItemSize;
    FItemSize: TcxItemSize;
    FItemTextKind: TdxRibbonGalleryGroupItemTextKind;
    FOwner: TdxRibbonGalleryItem;
    FItemPullHighlighting: TdxRibbonGalleryItemPullHighlighting;
    FSpaceAfterGroupHeader: Integer;
    FSpaceBetweenItemCaptionAndDescription: Integer;
    FSpaceBetweenItemImageAndText: Integer;
    FSpaceBetweenItemsHorizontally: Integer;
    FSpaceBetweenItemsVertically: Integer;
    procedure ReadSpaceBetweenItemsProperty(Reader: TReader);
    procedure SetItemImageSize(Value: TcxItemSize);
    procedure SetItemPullHighlighting(Value: TdxRibbonGalleryItemPullHighlighting);
    procedure SetItemSize(Value: TcxItemSize);
    procedure WriteSpaceBetweenItemsProperty(Writer: TWriter);
  protected
    procedure Changed; virtual;
    procedure CheckIntRange(var Value: Integer);
    procedure CheckItemsSpaceRange(var Value: Integer);
    procedure DefineProperties(Filer: TFiler); override;

    function GetItemImagePosition: TdxRibbonGalleryImagePosition; virtual;
    function GetItemTextKind: TdxRibbonGalleryGroupItemTextKind; virtual;
    function GetRemoveHorizontalItemPadding: Boolean; virtual;
    function GetRemoveVerticalItemPadding: Boolean; virtual;
    function GetSpaceAfterGroupHeader: Integer; virtual;
    function GetSpaceBetweenItemCaptionAndDescription: Integer; virtual;
    function GetSpaceBetweenItemImageAndText: Integer; virtual;
    function GetSpaceBetweenItems: Integer; virtual;
    function GetSpaceBetweenItemsHorizontally: Integer; virtual;
    function GetSpaceBetweenItemsVertically: Integer; virtual;

    function IsItemImagePositionStored: Boolean; virtual;
    function IsItemImageSizeStored: Boolean; virtual;
    function IsItemSizeStored: Boolean; virtual;
    function IsItemTextKindStored: Boolean; virtual;
    function IsItemPullHighlightingStored: Boolean; virtual;
    function IsSpaceAfterGroupHeaderStored: Boolean; virtual;
    function IsSpaceBetweenItemCaptionAndDescriptionStored: Boolean; virtual;
    function IsSpaceBetweenItemImageAndTextStored: Boolean; virtual;
    function IsSpaceBetweenItemsHorizontallyStored: Boolean; virtual;
    function IsSpaceBetweenItemsVerticallyStored: Boolean; virtual;
    procedure ItemImageSizeChange(Sender: TObject); virtual;
    procedure ItemPullHighlightingChange(Sender: TObject); virtual;
    procedure ItemSizeChange(Sender: TObject); virtual;

    procedure SetImages(Value: TCustomImageList); virtual;
    procedure SetItemImagePosition(Value: TdxRibbonGalleryImagePosition); virtual;
    procedure SetItemTextKind(Value: TdxRibbonGalleryGroupItemTextKind); virtual;
    procedure SetSpaceAfterGroupHeader(Value: Integer); virtual;
    procedure SetSpaceBetweenItemCaptionAndDescription(Value: Integer); virtual;
    procedure SetSpaceBetweenItemImageAndText(Value: Integer); virtual;
    procedure SetSpaceBetweenItems(Value: Integer); virtual;
    procedure SetSpaceBetweenItemsHorizontally(Value: Integer); virtual;
    procedure SetSpaceBetweenItemsVertically(Value: Integer); virtual;

    property ImageChangeLink: TChangeLink read FImageChangeLink;
    property Owner: TdxRibbonGalleryItem read FOwner;
    property RemoveHorizontalItemPadding: Boolean read GetRemoveHorizontalItemPadding;
    property RemoveVerticalItemPadding: Boolean read GetRemoveVerticalItemPadding;
  public
    constructor Create(AOwner: TdxRibbonGalleryItem);
    destructor Destroy; override;
    procedure Assign(Source: TPersistent); override;

    property Images: TCustomImageList read FImages write SetImages;
    property ItemImagePosition: TdxRibbonGalleryImagePosition
      read GetItemImagePosition write SetItemImagePosition stored IsItemImagePositionStored;
    property ItemImageSize: TcxItemSize
      read FItemImageSize write SetItemImageSize stored IsItemImageSizeStored;
    property ItemTextKind: TdxRibbonGalleryGroupItemTextKind
      read GetItemTextKind write SetItemTextKind stored IsItemTextKindStored;
    property ItemSize: TcxItemSize
      read FItemSize write SetItemSize stored IsItemSizeStored;
    property ItemPullHighlighting: TdxRibbonGalleryItemPullHighlighting read FItemPullHighlighting
      write SetItemPullHighlighting stored IsItemPullHighlightingStored;
    property SpaceAfterGroupHeader: Integer
      read GetSpaceAfterGroupHeader write SetSpaceAfterGroupHeader stored IsSpaceAfterGroupHeaderStored;
    property SpaceBetweenItemCaptionAndDescription: Integer
      read GetSpaceBetweenItemCaptionAndDescription write SetSpaceBetweenItemCaptionAndDescription stored IsSpaceBetweenItemCaptionAndDescriptionStored;
    property SpaceBetweenItemImageAndText: Integer
      read GetSpaceBetweenItemImageAndText write SetSpaceBetweenItemImageAndText stored IsSpaceBetweenItemImageAndTextStored;
    property SpaceBetweenItems: Integer read GetSpaceBetweenItems write SetSpaceBetweenItems;
    property SpaceBetweenItemsHorizontally: Integer
      read GetSpaceBetweenItemsHorizontally write SetSpaceBetweenItemsHorizontally stored IsSpaceBetweenItemsHorizontallyStored;
    property SpaceBetweenItemsVertically: Integer
      read GetSpaceBetweenItemsVertically write SetSpaceBetweenItemsVertically stored IsSpaceBetweenItemsVerticallyStored;
  end;

  { TdxRibbonGalleryGroupOptions }

  TdxRibbonGalleryGroupOptionsAssignedValue = (
    avItemImagePosition, avItemImageSize, avItemSize, avItemTextKind,
    avItemPullHighlighting, avSpaceAfterGroupHeader,
    avSpaceBetweenItemCaptionAndDescription, avSpaceBetweenItemImageAndText,
    avSpaceBetweenItems,
    avSpaceBetweenItemsHorizontally, avSpaceBetweenItemsVertically);
  TdxRibbonGalleryGroupOptionsAssignedValues = set of TdxRibbonGalleryGroupOptionsAssignedValue;

  TdxRibbonGalleryGroupOptions = class(TdxRibbonGalleryCustomOptions)
  private
    FAssignedValues: TdxRibbonGalleryGroupOptionsAssignedValues;
    FParentOptions: TdxRibbonGalleryCustomOptions;
    procedure SetAssignedValues(
      const Value: TdxRibbonGalleryGroupOptionsAssignedValues);
  protected
    function GetItemImagePosition: TdxRibbonGalleryImagePosition; override;
    function GetItemTextKind: TdxRibbonGalleryGroupItemTextKind; override;
    function GetSpaceAfterGroupHeader: Integer; override;
    function GetSpaceBetweenItemCaptionAndDescription: Integer; override;
    function GetSpaceBetweenItemImageAndText: Integer; override;
    function GetSpaceBetweenItemsHorizontally: Integer; override;
    function GetSpaceBetweenItemsVertically: Integer; override;

    function IsSpaceAfterGroupHeaderStored: Boolean; override;
    function IsSpaceBetweenItemCaptionAndDescriptionStored: Boolean; override;
    function IsSpaceBetweenItemImageAndTextStored: Boolean; override;
    function IsSpaceBetweenItemsHorizontallyStored: Boolean; override;
    function IsSpaceBetweenItemsVerticallyStored: Boolean; override;
    function IsItemImagePositionStored: Boolean; override;
    function IsItemImageSizeStored: Boolean; override;
    function IsItemTextKindStored: Boolean; override;
    function IsItemSizeStored: Boolean; override;
    function IsItemPullHighlightingStored: Boolean; override;
    procedure ItemImageSizeChange(Sender: TObject); override;
    procedure ItemSizeChange(Sender: TObject); override;
    procedure ItemPullHighlightingChange(Sender: TObject); override;

    procedure SetItemImagePosition(Value: TdxRibbonGalleryImagePosition); override;
    procedure SetItemTextKind(Value: TdxRibbonGalleryGroupItemTextKind); override;
    procedure SetSpaceAfterGroupHeader(Value: Integer); override;
    procedure SetSpaceBetweenItemCaptionAndDescription(Value: Integer); override;
    procedure SetSpaceBetweenItemImageAndText(Value: Integer); override;
    procedure SetSpaceBetweenItemsHorizontally(Value: Integer); override;
    procedure SetSpaceBetweenItemsVertically(Value: Integer); override;

    property ParentOptions: TdxRibbonGalleryCustomOptions read FParentOptions;
  public
    constructor Create(AOwner: TdxRibbonGalleryItem;
      AParentOptions: TdxRibbonGalleryCustomOptions; AGroup: TdxRibbonGalleryGroup);
  published
    property AssignedValues: TdxRibbonGalleryGroupOptionsAssignedValues
      read FAssignedValues write SetAssignedValues default [];
    property Images;
    property ItemImagePosition;

⌨️ 快捷键说明

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