📄 fcpropedt.pas
字号:
unit fcPropEdt;
{
//
// Components : TfcPropEdt
//
// Copyright (c) 1999 by Woll2Woll Software
//
// Changes:
// 4/14/99 - PYW - Causes controls in OutlookBar not to be painted when a button is selected.
// 12/7/99 - Better palette support for loading image button images.
}
interface
{$i fcIfDef.pas}
uses Windows, Messages, Classes, SysUtils, Graphics,
{$ifdef fcdelphi6up}
designintf, designeditors,
vcleditors,
{$else}
dsgnintf,
{$endif}
typinfo,
ColnEdit,
fcPicEdt, fcButton, fcImgBtn,
fcShapeBtn, fcLabel, fcLinesEditor, fcButtonGroup, fcCollectionEditor,
fcTreeView_ItemsEditor, fcTreeCombo, fcStatusBar, fcImager, Controls,
fcCommon, Dialogs, fcOutlookBar, fcImageForm, fcBitmap, fcOutlookList,
fcTreeView, fcColorCombo,stdctrls, fcCollection, forms, clipbrd,
fcTreeHeader;
{$i fcIfDef.pas}
const
FC_BTN_SETSHADECOLORS = 0;
FC_BTN_RESIZE = 1;
FC_IMGBTN_SPLIT = 2;
FC_CG_COUNT = 1;
FC_CG_NEWBUTTON = 0;
FC_OTLKPNL_ADDOUTLOOKLIST = 0;
FC_OTLKPNL_PASTE = 1;
type
{$ifdef fcDelphi6Up}
TFormDesigner = IDesigner;
{$else}
TFormDesigner = IFormDesigner;
{$endif}
TfcComponentEditor = class(TDefaultEditor)
private
procedure ShowAboutBox;
public
function GetVerbCount: Integer; override;
function GetVerb(Index: Integer): string; override;
procedure ExecuteVerb(Index: Integer); override;
end;
TfcCustomOutlookListEditor = class(TfcComponentEditor)
public
procedure Edit; override;
end;
TfcControllerProperty = class(TComponentProperty)
procedure GetValues(Proc : TGetStrProc); override;
procedure fcGetStrProc(const s: string);
end;
TfcLabelCaptionEditor = class(TPropertyEditor)
public
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
procedure SetValue(const Value: string); override;
procedure Edit; override;
end;
TfcButtonCaptionEditor = class(TPropertyEditor)
public
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
procedure SetValue(const Value: string); override;
procedure Edit; override;
end;
TfcCustomBtnEditor = class(TfcComponentEditor)
public
constructor Create(AComponent: TComponent; ADesigner: TFormDesigner); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
procedure ExecuteVerb(Index: Integer); override;
end;
TfcImgBtnEditor = class(TfcCustomBtnEditor)
protected
ClickedPoint: TPoint;
public
constructor Create(AComponent: TComponent; ADesigner: TFormDesigner); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
procedure Edit; override;
procedure ExecuteVerb(Index: Integer); override;
end;
TfcImageBtnImageEditor = class(TPropertyEditor)
public
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
procedure Edit; override;
end;
TfcButtonGroupEditor = class(TfcComponentEditor)
protected
{$ifdef fcDelphi6Up}
Editor: IComponentEditor;
{$else}
Editor: TComponentEditor;
{$endif}
ExecutionPoint: TPoint;
public
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
procedure GetObscuredEditor;
procedure Edit; override;
procedure ExecuteVerb(Index: Integer); override;
end;
TfcButtonGroupItemsEditor = class(TPropertyEditor)
public
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
procedure Edit; override;
end;
TfcButtonGroupControlClassEditor = class(TPropertyEditor)
public
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
procedure GetValues(Proc: TGetStrProc); override;
procedure SetValue(const Value: string); override;
end;
TfcTreeComboEditor = class(TfcComponentEditor)
public
procedure Edit; override;
end;
TfcTreeComboItemsProperty = class(TPropertyEditor)
public
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
end;
TfcStatusBarEditor = class(TfcComponentEditor)
public
procedure Edit; override;
end;
TfcHeaderEditor = class(TfcComponentEditor)
public
procedure Edit; override;
{ public
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
}
end;
TfcStatusBarPanelsEditor = class(TPropertyEditor)
public
procedure Edit; override;
function GetValue: string; override;
function GetAttributes: TPropertyAttributes; override;
end;
TfcImagerEditor = class(TfcComponentEditor)
procedure Edit; override;
end;
TfcOutlookPanelEditor = class(TfcComponentEditor)
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
procedure ExecuteVerb(Index: Integer); override;
end;
TfcImageFormEditor = class(TfcComponentEditor)
procedure Edit; override;
end;
TfcBitmapEditor = class(TPropertyEditor)
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
end;
TfcButtonGroupSelectedEditor = class(TPropertyEditor)
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
procedure SetValue(const Value: string); override;
procedure GetValues(Proc: TGetStrProc); override;
end;
TfcTreeViewItemsProperty = class(TPropertyEditor)
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
end;
TfcTreeViewEditor = class(TfcComponentEditor)
public
procedure Edit; override;
end;
TfcColorComboSelectedColorEditor = class(TPropertyEditor)
public
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
procedure Edit; override;
procedure SetValue(const Value: string); override;
procedure GetValues(Proc: TGetStrProc); override;
end;
{$ifdef fcDelphi6Up}
TfcImageBtnTranColorEditor = class(TColorProperty, ICustomPropertyListDrawing)
{$else}
TfcImageBtnTranColorEditor = class(TColorProperty)
{$endif}
public
{$ifdef fcDelphi5}
procedure ListDrawValue(const Value: string; ACanvas: TCanvas;
const ARect: TRect; ASelected: Boolean); override;
{$endif}
{$ifdef fcDelphi6Up}
{ ICustomPropertyListDrawing }
procedure ListMeasureHeight(const Value: string; ACanvas: TCanvas;
var AHeight: Integer);
procedure ListMeasureWidth(const Value: string; ACanvas: TCanvas;
var AWidth: Integer);
procedure ListDrawValue(const Value: string; ACanvas: TCanvas;
const ARect: TRect; ASelected: Boolean);
{$endif}
function GetValue: string; override;
procedure SetValue(const Value: string); override;
procedure GetValues(Proc: TGetStrProc); override;
end;
TfcComponentProperty = class(TComponentProperty)
private
FStrings: TStringList;
protected
function ValidComponent(AComponent: TComponent): Boolean; virtual;
procedure GetBaseValues(const s: string); virtual;
public
function GetAttributes: TPropertyAttributes; override;
procedure SetValue(const Value: string); override;
procedure GetValues(Proc: TGetStrProc); override;
end;
TfcImageBtnExtImageEditor = class(TfcComponentProperty)
protected
function ValidComponent(AComponent: TComponent): Boolean; override;
end;
TfcOutlookBarActivePageEditor = class(TfcComponentProperty)
protected
function ValidComponent(AComponent: TComponent): Boolean; override;
public
function GetAttributes: TPropertyAttributes; override;
end;
TfcCollectionEditor = class(TPropertyEditor)
public
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
procedure Edit; override;
end;
implementation
uses fcabout, registry;
var MyProc: TGetStrProc;
constructor TfcCustomBtnEditor.Create(AComponent: TComponent; ADesigner: TFormDesigner);
begin
inherited;
// if Selections.Equals(Selection) then
// if GetKeyState(VK_RBUTTON) >= 0 then
with Component as TfcCustomBitBtn do
if (Parent <> nil) and (Parent is TfcCustomButtonGroup) then
begin
if Parent is TfcCustomOutlookBar then
with Parent as TfcCustomButtonGroup do
Selected := ButtonItems.FindButton(Component as TfcCustomBitBtn);
//4/14/99 - PYW - Causes controls in OutlookBar not to be painted when a button is selected.
//Parent.Invalidate;
end;
end;
function TfcCustomBtnEditor.GetVerb(Index: Integer): string;
begin
case Index of
FC_BTN_SETSHADECOLORS: result := '&Set Shade Colors';
FC_BTN_RESIZE: result := '&Size to Default';
else
result := inherited GetVerb(Index);
end;
end;
function TfcCustomBtnEditor.GetVerbCount: Integer;
begin
result := inherited GetVerbCount + 2;
end;
procedure TfcCustomBtnEditor.ExecuteVerb(Index: Integer);
begin
case Index of
FC_BTN_SETSHADECOLORS: begin
(Component as TfcCustomBitBtn).UpdateShadeColors((Component as TfcCustomBitBtn).Color);
Designer.Modified;
end;
FC_BTN_RESIZE: begin
(Component as TfcCustomBitBtn).SizeToDefault;
Designer.Modified;
end;
else
inherited;
end;
end;
// TfcImgBtnEditor - ComponentEditor for TfcImageBtn
constructor TfcImgBtnEditor.Create(AComponent: TComponent; ADesigner: TFormDesigner);
begin
inherited;
with AComponent as TfcCustomImageBtn do
if (Parent <> nil) and (Parent is TfcCustomButtonGroup) and
(Parent as TfcCustomButtonGroup).Transparent then
(Parent as TfcCustomButtonGroup).LastButtonRect := BoundsRect;
end;
procedure TfcImgBtnEditor.Edit;
begin
if (Component is TfcCustomImageBtn) and not (Component is TfcCustomShapeBtn) and (Component as TfcCustomImageBtn).Image.Empty then
begin
fcExecutePictureEditor((Component as TfcCustomImageBtn).Image, (Component as TfcCustomImageBtn).Image);
Designer.Modified;
end else inherited;
end;
function TfcImgBtnEditor.GetVerb(Index: Integer): string;
begin
ClickedPoint := (Component as TfcCustomImageBtn).ScreenToClient(fcGetCursorPos);
{ case Index of
FC_IMGBTN_SPLIT: result := '&Split Highlighted Image';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -