Creating new Properties Editors

As programmer, you can creating. new properties editor that you put in the PropertiesEditors folder.
For standard Be classes, you just need this editor.
For costum classes for wich you want to write an properties editor, editor, you need to put an code-object file (PEF) that contain the definition of your class in the "lib" directory of BeConstruct as well to enable BeConstruct to instantiate your object.
You may want to make an archive file that contain an archived version (flattened BMessage) of your object in the "Archives" directory of BeConstruct. This enable your object to appear in the palette list.

Those exported symboles of properties editors add-ons are recognized and called by BeConstruct:

#pragma export on
void	InitEditor(entry_ref* ref);
	// init the add-on. ref point to the add-on file wich may contain resources
void	FreeEditor(entry_ref* ref);
	// close the add-on
BView* CreateEditor(BArchivable* trytarget);
int32 ClassLevel = 3;	// BArchivable -> BHandler -> BLooper -> BWindow
char EditorName[] = "BWindow editor";

bool	GetSubObjects(BArchivable* obj, BList* fill);
	// must fill BList* fill with all sub-objects of BArchivable* obj
bool	HasSubObject(BArchivable* parent, BArchivable* child, BArchivable** after);
	// must return true if *child is a sub-object of *parent
	// must fill **after with the previous sub-object of *child if any
bool	DropSubObject(BArchivable* under, BArchivable* obj, BArchivable* before);
	// an newly created object *obj is dropped to be added to *under before *before.
bool	RemoveSubObject(BArchivable* under, BArchivable* obj);
	// the sub-object *obj is to be removed (but not deleted !)
#pragma export reset
To make your properties editor you make a subclass of StandardClassPropEditor and at least implement and export the "CreateEditor" function which create and return the editor if the object is a kind of your class.
#ifndef STANDARD_CLASS_PROP_EDITOR_H
#define STANDARD_CLASS_PROP_EDITOR_H

#include "ImplemMessages.h"

class StandardClassPropEditor : public BView  {
public:
	StandardClassPropEditor(BRect frame, const char* name, BArchivable *settarget);
	virtual ~StandardClassPropEditor();
	virtual void		AttachedToWindow();
	virtual void		MessageReceived(BMessage *msg);
	virtual void		Draw(BRect updateRect);
	virtual bool		UpdateData();
	virtual void		SetUpData(BArchivable* changed);
	virtual void		WillRemoveObject(BArchivable* toremove);
	
			bool		LockMainEditor();
			void		UnlockMainEditor();
			
// call this function to update the object after a modification
			void		CommitChange();
// call this function to make BeConstruct select any existing object
			void		SelectObject(BView* v);
// call this function to make BeConstruct remove and delete any object
			void		RemoveObject(BArchivable* o);
// call this function to make BeConstruct open a properties editor for any object
			void		EditObject(BArchivable* o);
protected:
	BArchivable*	target;	// contain the target object of the editor
	float	normal_haut;
	BPictureButton* expandCtnl;
};
#endif

Documentation Table of Content