+// A custom field type
+class wxRichTextFieldTypePropertiesTest: public wxRichTextFieldTypeStandard
+{
+public:
+ wxRichTextFieldTypePropertiesTest(const wxString& name, const wxString& label, int displayStyle = wxRICHTEXT_FIELD_STYLE_RECTANGLE):
+ wxRichTextFieldTypeStandard(name, label, displayStyle)
+ {
+ }
+ wxRichTextFieldTypePropertiesTest(const wxString& name, const wxBitmap& bitmap, int displayStyle = wxRICHTEXT_FIELD_STYLE_RECTANGLE):
+ wxRichTextFieldTypeStandard(name, bitmap, displayStyle)
+ {
+ }
+
+ virtual bool CanEditProperties(wxRichTextField* WXUNUSED(obj)) const { return true; }
+ virtual bool EditProperties(wxRichTextField* WXUNUSED(obj), wxWindow* WXUNUSED(parent), wxRichTextBuffer* WXUNUSED(buffer))
+ {
+ wxString label = GetLabel();
+ wxMessageBox(wxString::Format(wxT("Editing %s"), label.c_str()));
+ return true;
+ }
+
+ virtual wxString GetPropertiesMenuLabel(wxRichTextField* WXUNUSED(obj)) const
+ {
+ return GetLabel();
+ }
+};
+
+// A custom composite field type
+class wxRichTextFieldTypeCompositeTest: public wxRichTextFieldTypePropertiesTest
+{
+public:
+ wxRichTextFieldTypeCompositeTest(const wxString& name, const wxString& label):
+ wxRichTextFieldTypePropertiesTest(name, label, wxRICHTEXT_FIELD_STYLE_COMPOSITE)
+ {
+ }
+
+ virtual bool UpdateField(wxRichTextBuffer* buffer, wxRichTextField* obj)
+ {
+ if (buffer)
+ {
+ wxRichTextAttr attr(buffer->GetAttributes());
+ attr.GetTextBoxAttr().Reset();
+ attr.SetParagraphSpacingAfter(0);
+ attr.SetLineSpacing(10);
+ obj->SetAttributes(attr);
+ }
+ obj->GetChildren().Clear();
+ wxRichTextParagraph* para = new wxRichTextParagraph;
+ wxRichTextPlainText* text = new wxRichTextPlainText(GetLabel());
+ para->AppendChild(text);
+ obj->AppendChild(para);
+ return true;
+ }
+};
+