📄 dxribbongallery.pas
字号:
procedure RemoveGroupItem(AItem: TdxRibbonGalleryGroupItem);
procedure SetDownedGroupItem(const Value: TdxRibbonGalleryGroupItem);
procedure SetGroupItemStoredSize(const Value: TSize; AGroupIndex: Integer);
procedure SetHotGroupItem(Value: TdxRibbonGalleryGroupItem);
procedure ShowGroupItem(AGroupItem: TdxRibbonGalleryGroupItem); virtual;
property DontDisplayHotTrackedGroupItem: Integer read FDontDisplayHotTrackedGroupItem write FDontDisplayHotTrackedGroupItem;
property DontDisplayGroupHeaderWhenHotTrackingGroupItem: Integer read FDontDisplayGroupHeaderWhenHotTrackingGroupItem write FDontDisplayGroupHeaderWhenHotTrackingGroupItem;
property DownedGroupItem: TdxRibbonGalleryGroupItem read FDownedGroupItem;
property GalleryBounds: TRect read GetGalleryBounds;
property GalleryItem: TdxRibbonGalleryItem read GetGalleryItem;
property GalleryOptions: TdxRibbonGalleryOptions read GetGalleryOptions;
property GallerySize: TSize read GetGallerySize;
property GlobalItemSize: TSize read FGlobalItemSize;
property HotGroupItem: TdxRibbonGalleryGroupItem read FHotGroupItem write SetHotGroupItem;
property LayoutOffset: Integer read FLayoutOffset;
property Painter: TdxBarSkinnedPainter read GetPainter;
property ScrollBarWidth: Integer read GetScrollBarWidth;
public
constructor Create(AControl: TdxBarItemControl); override;
destructor Destroy; override;
procedure Calculate(ALayoutOffset: Integer; AScrollCode: TScrollCode); virtual;
function IsCollapsed: Boolean; virtual; abstract;
procedure Paint;
property Control: TdxRibbonGalleryControl read GetControl;
property GroupCount: Integer read GetGroupCount;
property Groups[Index: Integer]: TdxRibbonGalleryGroupViewInfo read GetGroups;
property ScrollBarBounds: TRect read GetScrollBarBounds;
end;
{ TdxInRibbonGalleryControlViewInfo }
TdxInRibbonGalleryControlViewInfo = class(TdxRibbonGalleryControlViewInfo,
IdxBarMultiColumnItemControlViewInfo)
private
FCollapsed: Boolean;
FColumnCount: Integer;
FControlHeight: Integer;
FIsScrolling: Boolean;
FRowCount: Integer;
FScrollingBreak: Boolean;
FScrollingRowCounter: Integer;
FTopVisibleRow: Integer;
FWidthForColumnCountInfos: array of TdxBarItemCachedWidthInfo;
procedure FillGroupItemList(AFirstVisibleRow, ALastVisibleRow, AColumnCount: Integer; AList: TObjectList);
function GetControlHeight: Integer;
function GetVisibleRowCount: Integer;
// IdxBarMultiColumnItemControlViewInfo
function CanCollapse: Boolean;
function GetCollapsed: Boolean;
function GetColumnCount: Integer;
function GetMaxColumnCount: Integer;
function GetRowIndex(AGroupItemIndex, AColumnCount: Integer): Integer;
function GetMinColumnCount: Integer;
function GetSpaceBetweenItems(IsAflat: Boolean): Integer;
function GetWidthForColumnCount(AColumnCount: Integer): Integer;
function IsScrollingPossible(ARowDelta: Integer): Boolean;
procedure ScrollingRowCounterRelease;
procedure SetCollapsed(Value: Boolean);
procedure SetColumnCount(Value: Integer);
procedure SetScrollingRowCounter(Value: Integer);
protected
procedure BoundsCalculated; override;
procedure CalculateLayout(ALayoutOffset, AColumnCount: Integer; AGroupItemsList: TObjectList);
function CorrectGroupItemSize(const AGroupItemSize: TSize): TSize;
procedure DoScrolling(ARowDelta: Integer);
procedure DrawBackground(const R: TRect); override;
function GetControlMargins: TRect; virtual;
function GetGalleryMargins: TRect; override;
function GetLayoutWidth(AColumnCount: Integer; out AGroupItemWidthIsNull: Boolean): Integer; override;
function GetMaxGroupItemSize: TSize; override;
function GetBottomLayoutIndent: Integer;
function GetLeftLayoutIndent: Integer; override;
function GetRightLayoutIndent: Integer; override;
function GetTopLayoutIndent: Integer;
function InternalGetScrollBarWidth: Integer; override;
function IsInRibbon: Boolean; override;
procedure ShowGroupItem(AGroupItem: TdxRibbonGalleryGroupItem); override;
property ControlHeight: Integer read GetControlHeight;
public
procedure Calculate(ALayoutOffset: Integer; AScrollCode: TScrollCode); override;
function IsCollapsed: Boolean; override;
procedure ResetCachedValues; override;
end;
{ TdxRibbonOnSubMenuGalleryControlViewInfo }
TdxRibbonOnSubMenuGalleryControlViewInfo = class(TdxRibbonGalleryControlViewInfo)
private
FFilterBandContentRect: TRect;
FFilterBandHotTrack: Boolean;
FFilterBandRect: TRect;
procedure CalculateFilterBand;
procedure DrawFilterBand;
procedure DrawFilterCaption;
function GetBottomSeparatorHeight: Integer;
function GetFilterBandHeight: Integer;
function GetHeightByRowCount(AWidth: Integer): Integer;
function GetSpaceBetweenItems(AGroupIndex: Integer; IsAflat: Boolean): Integer;
function NeedsDrawBottomSeparator: Boolean;
protected
procedure DisplayGroupItem(AGroupItem: TdxRibbonGalleryGroupItem); override;
procedure DrawBackground(const R: TRect); override;
function GetControlBounds: TRect; override;
function GetGalleryHeight(AWidth: Integer): Integer; override;
function GetGalleryMargins: TRect; override;
function GetHeight(AWidth: Integer): Integer; override;
function GetLayoutWidth(AColumnCount: Integer; out AGroupItemWidthIsNull: Boolean): Integer; override;
procedure GroupItemYRange(const AGroupItem: TdxRibbonGalleryGroupItem;
var ATop, ABottom: Integer);
function GetMinSize: TSize; override;
function InternalGetScrollBarWidth: Integer; override;
public
procedure Calculate(ALayoutOffset: Integer; AScrollCode: TScrollCode); override;
procedure GetFilterMenuShowingParams(out APosition: TPoint;
out AOwnerHeight: Integer);
function IsCollapsed: Boolean; override;
function IsPtInFilterBandHotTrackArea(const P: TPoint): Boolean;
procedure RepaintFilterBand;
procedure SetFilterBandHotTrack(AValue: Boolean);
end;
{ TdxRibbonGalleryControlAccessibilityHelper }
TdxRibbonGalleryControlAccessibilityHelper = class(TdxBarSubItemControlAccessibilityHelper)
private
function GetControl: TdxRibbonGalleryControl;
function GetOnSubMenuController: TdxRibbonOnSubMenuGalleryController;
protected
// IdxBarAccessibilityHelper
function HandleNavigationKey(var AKey: Word): Boolean; override;
function IsNavigationKey(AKey: Word): Boolean; override;
procedure GetKeyTipData(AKeyTipsData: TList); override;
procedure GetKeyTipInfo(out AKeyTipInfo: TdxBarKeyTipInfo); override;
procedure OnSubMenuHotTrack(
ANavigationDirection: TdxRibbonDropDownGalleryNavigationDirection);
function ShowDropDownWindow: Boolean; override;
property Control: TdxRibbonGalleryControl read GetControl;
property OnSubMenuController: TdxRibbonOnSubMenuGalleryController
read GetOnSubMenuController;
end;
{ TdxRibbonDropDownGalleryControlAccessibilityHelper }
TdxRibbonDropDownGalleryControlAccessibilityHelper = class(TdxBarSubMenuControlAccessibilityHelper)
private
function GetBarControl: TdxRibbonDropDownGalleryControl;
function GetInternalGalleryItemControlAccessibilityHelper: TdxRibbonGalleryControlAccessibilityHelper;
protected
// IdxBarAccessibilityHelper
function HandleNavigationKey(var AKey: Word): Boolean; override;
function IsNavigationKey(AKey: Word): Boolean; override;
procedure HandleVertNavigationKey(AUpKey, AFocusItemControl: Boolean); override;
property BarControl: TdxRibbonDropDownGalleryControl read GetBarControl;
property InternalGalleryItemControlAccessibilityHelper: TdxRibbonGalleryControlAccessibilityHelper
read GetInternalGalleryItemControlAccessibilityHelper;
end;
{ TdxRibbonGalleryScrollBarViewInfo }
TdxRibbonGalleryScrollBarViewInfo = class(TcxScrollBarViewInfo)
private
FDropDownButtonRect: TRect;
protected
procedure CalculateRects; override;
public
property DropDownButtonRect: TRect read FDropDownButtonRect;
end;
{ TdxRibbonGalleryScrollBar }
TdxRibbonGalleryScrollBar = class(TcxScrollBar)
private
FGalleryControl: TdxRibbonGalleryControl;
FIsDropDownButtonPressed: Boolean;
FOnDropDown: TNotifyEvent;
procedure DoDropDown;
function GetButtonSkinState(AState: TcxButtonState): Integer;
function GetPainter: TdxBarSkinnedPainter;
function GetViewInfo: TdxRibbonGalleryScrollBarViewInfo;
function IsButtonEnabled(AButtonKind: TdxInRibbonGalleryScrollBarButtonKind): Boolean;
function IsDropDownButtonUnderMouse: Boolean;
procedure WMCaptureChanged(var Message: TMessage); message WM_CAPTURECHANGED;
procedure WMNCDestroy(var Message: TWMNCDestroy); message WM_NCDESTROY;
protected
procedure DoPaint(ACanvas: TcxCanvas); override;
procedure DrawScrollBarPart(ACanvas: TcxCanvas; const R: TRect;
APart: TcxScrollBarPart; AState: TcxButtonState); override;
function GetViewInfoClass: TcxScrollBarViewInfoClass; override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
property GalleryControl: TdxRibbonGalleryControl read FGalleryControl;
property Painter: TdxBarSkinnedPainter read GetPainter;
property ViewInfo: TdxRibbonGalleryScrollBarViewInfo read GetViewInfo;
public
constructor Create(AGalleryControl: TdxRibbonGalleryControl); reintroduce;
function IsDropDownStyle: Boolean;
property IsDropDownButtonPressed: Boolean read FIsDropDownButtonPressed;
property OnDropDown: TNotifyEvent read FOnDropDown write FOnDropDown;
end;
{ TdxRibbonDropDownGallery }
TdxRibbonDropDownGallery = class(TdxRibbonPopupMenu)
private
FGalleryItem: TdxRibbonGalleryItem;
procedure SetGalleryItem(Value: TdxRibbonGalleryItem);
protected
function CreateBarControl: TCustomdxBarControl; override;
function GetControlClass: TCustomdxBarControlClass; override;
function HasValidGalleryItem: Boolean;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
public
destructor Destroy; override;
published
property GalleryItem: TdxRibbonGalleryItem read FGalleryItem
write SetGalleryItem;
end;
{ TdxRibbonDropDownGalleryGalleryItemItemLinks }
TdxRibbonDropDownGalleryGalleryItemItemLinks = class(TdxBarSubMenuControlItemLinks)
public
function CanContainItem(AItem: TdxBarItem; out AErrorText: string): Boolean; override;
end;
{ TdxRibbonDropDownGalleryControlPainter }
TdxRibbonDropDownGalleryControlPainter = class(TdxRibbonBarPainter)
protected
function HasSizingBand(AGalleryControl: TdxRibbonDropDownGalleryControl): Boolean;
public
function GetSizingBandHeight(
AGalleryControl: TdxRibbonDropDownGalleryControl): Integer; virtual;
function PtInSizingArea(AGalleryControl: TdxRibbonDropDownGalleryControl;
const P: TPoint): Boolean; virtual;
procedure SubMenuControlDrawBorder(ABarSubMenuControl: TdxBarSubMenuControl;
DC: HDC; R: TRect); override;
end;
{ TdxRibbonDropDownGalleryControl }
TdxRibbonDropDownGalleryControl = class(TdxRibbonPopupMenuControl)
private
FGalleryItem: TdxRibbonGalleryItem;
FGalleryItemItemLinks: TdxRibbonDropDownGalleryGalleryItemItemLinks;
FHeight: Integer;
FInternalPainter: TdxRibbonDropDownGalleryControlPainter;
FIsResizingAssigned: Boolean;
FMouseWheelStep: Integer;
FResizing: TdxRibbonGallerySubMenuResizing;
FUseInternalSizeValue: Boolean;
function GetInternalGalleryItemControl: TdxRibbonGalleryControl;
function GetInternalPainter: TdxRibbonDropDownGalleryControlPainter;
function GetMouseWheelStep: Integer;
function GetResizing: TdxRibbonGallerySubMenuResizing;
procedure SetResizing(Value: TdxRibbonGallerySubMenuResizing);
procedure WMGetMinMaxInfo(var Message: TWMGetMinMaxInfo); message WM_GETMINMAXINFO;
procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;
procedure WMNCLButtonDown(var Message: TWMLButtonDown); message WM_NCLBUTTONDOWN;
protected
procedure CalcColumnItemRects(ATopIndex: Integer;
out ALastItemBottom: Integer); override;
function ChangeSizeByChildItemControl(out ASize: TSize): Boolean; override;
procedure CreateWnd; override;
function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
procedure DoNCPaint(DC: HDC; const ARect: TRect); override;
function DoFindLinkWithAccel(AKey
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -