📄 editors.h
字号:
//---------------------------------------------------------------------------
#ifndef EditorsH
#define EditorsH
#include <vcl.h>
#include "VirtualTrees.hpp"
namespace WZZ_Editors_namespace
{
//---------------------------------------------------------------------------
typedef enum {
vtNone,
vtString,
vtPickString,
vtNumber,
vtPickNumber,
vtMemo,
vtDate
}TValueType;
//----------------------------------------------------------------------------------------------------------------------
typedef struct __tagPropertyData
{
TValueType ValueType;
WideString Value; // This value can actually be a date or a number too.
bool Changed;
}TPropertyData ,*PPropertyData;
// Our own edit link to implement several different node editors.
class TPropertyEditLink :public IVTEditLink
{
private:
ULONG FRefCount; // used by our own implementation of the interface
TWinControl *FEdit; // One of the property editor classes.
TVirtualStringTree *FTree; // A back reference to the tree calling.
PVirtualNode FNode; // The node being edited.
int FColumn; // The column of the node being edited.
protected:
void __fastcall EditKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
public:
__fastcall TPropertyEditLink();
virtual __fastcall ~TPropertyEditLink(void);
// IUnknown members
virtual ULONG __stdcall AddRef();
virtual ULONG __stdcall Release();
virtual HResult __stdcall QueryInterface(const GUID& IID, void** ppv);
virtual bool __stdcall BeginEdit(void);
virtual bool __stdcall CancelEdit(void);
virtual bool __stdcall EndEdit(void);
virtual bool __stdcall PrepareEdit(TBaseVirtualTree* Tree, PVirtualNode Node, TColumnIndex Column);
virtual Types::TRect __stdcall GetBounds(void);
virtual void __stdcall ProcessMessage(Messages::TMessage &Message);
virtual void __stdcall SetBounds(const Types::TRect R);
};
//----------------------------------------------------------------------------------------------------------------------
typedef enum{
ptkText,
ptkHint
}TPropertyTextKind ;
// The following constants provide the property tree with default data.
const
// Types of editors to use for a certain node in VST3.
TValueType ValueTypes[2][13]= {
{
vtString, // Title
vtString, // Theme
vtPickString, // Category
vtMemo, // Keywords
vtNone, // Template
vtNone, // Page count
vtNone, // Word count
vtNone, // Character count
vtNone, // Lines
vtNone, // Paragraphs
vtNone, // Scaled
vtNone, // Links to update
vtMemo}, // Comments
{
vtString, // Author
vtNone, // Most recently saved by
vtNumber, // Revision number
vtPickString, // Primary application
vtString, // Company name
vtNone, // Creation date
vtDate, // Most recently saved at
vtNone, // Last print
vtNone,
vtNone,
vtNone,
vtNone,
vtNone}
};
// types of editors to use for a certain node in VST3
AnsiString DefaultValue[2][13] = {
{
"Virtual Treeview", // Title
"native Delphi controls", // Theme
"Virtual Controls", // Category
"virtual, treeview, VCL", // Keywords
"no template used", // Template
"> 900", // Page count
"?", // Word count
"~ 1.000.000", // Character count
"~ 28.000", // Lines
"", // Paragraphs
"False", // Scaled
"www.delphi-gems.com", // Links to update
"Virtual Treeview is much more than a simple treeview."}, // Comments
{
"Dipl. Ing. Mike Lischke", // Author
"Mike Lischke", // Most recently saved by
"3.0", // Revision number
"Delphi", // Primary application
"", // Company name
"July 1999", // Creation date
"January 2002", // Most recently saved at
"", // Last print
"",
"",
"",
"",
""}
};
// Fixed strings for property tree (VST3).
AnsiString PropertyTexts[2][13][2] = {
{// first {upper} subtree
{"Title", "Title of the file or document"},
{"Theme", "Theme of the file or document"},
{"Category", "Category of theme"},
{"Keywords", "List of keywords which describe the content of the file"},
{"Template", "Name of the template which was used to create the document"},
{"Page count", "Number of pages in the document"},
{"Word count", "Number of words in the document"},
{"Character count", "Number of characters in the document"},
{"Lines", "Number of lines in the document"},
{"Paragraphs", "Number of paragraphs in the document"},
{"Scaled", "Scaling of the document for output"},
{"Links to update", "Links which must be updated"},
{"Comments", "Description or comments for the file"}
},
{// second {lower} subtree
{"Author", "name of the author of the file or document"},
{"Most recently saved by", "Name of the person who has saved the document last"},
{"Revision number", "Revision number of the file or document"},
{"Primary application", "Name of the application which is primarily used to create this kind of file"},
{"Company name", "Name of the company or institution"},
{"Creation date", "Date when the file or document was created"},
{"Most recently saved at", "Date when the file or document was saved the last time"},
{"Last print", "Date when the file or document was printed the last time"},
{"", ""}, // the remaining 5 entries are not used
{"", ""},
{"", ""},
{"", ""},
{"", ""}
}
};
//----------------------------------------------------------------------------------------------------------------------
/*
typedef struct __tagGridData{
TValueType ValueType[4]; // one for each column
Variant Value[4];
bool Changed;
}TGridData,*PGridData;
// Our own edit link to implement several different node editors.
class TGridEditLink :public(TPropertyEditLink, IVTEditLink)
{
public:
virtual bool __stdcall EndEdit(void);
virtual bool __stdcall PrepareEdit(TBaseVirtualTree* Tree, PVirtualNode Node, TColumnIndex Column);
};
*/
//----------------------------------------------------------------------------------------------------------------------
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -