NOTE: using variables is depreciated and thus not recommended nor supported! This kind of functionality would be useful if it was supported at a lower level, by all BeOS classes. Since variable handling is only provided by IE add-ons, this has created some confusion among developers.
Each application (or add-on) should have a global resource handler object which is used to access the resources:
IEResourceHandler *resourcehandler;IMPORTANT: you have to insert the above line into your application otherwise you will get link errors!
The second task of the resource handler is to maintain an application-wide window list
of open windows. The IEWindow objects are automatically register themselves in the constructor and remove themselves in the Quit method from this window list.
When the last window is closed, B_QUIT_REQUESTED
is sent to the application.
IEWindow(char *windowname);Calls the BWindow constructor with the window archive. The constructor calls FindWindowResource to find the window by name in the resources.
virtual ~IEWindow(void);Deletes the window dependancy list.
void AddDependantWindow(BWindow *window);
You can add a window to the dependancy list. The window will be closed when this window is closed in the Quit method.
BMessage *FindWindowResource(char *windowname);
FindWindowResource tries to locate a resource called windowname of type B_ARCHIVED_OBJECT
in the resources.
If the window is not found, FindWindowResource will return a default window archive
with the error in the window title. (This method cannot return NULL
because the BWindow constructor is called with the return value.)
Such an error can happen only during application development.
virtual void Quit(void);
Closes the windows in the dependancy list. The list items are BMessengers, whose validity is checked before locking and quitting the child windows.
virtual bool QuitRequested(void);
The default QuitRequested calls UpdateAllVariables and returns true
.
virtual void SetViewVariable(char *viewname, void *variable, const char *variabletype=NULL);
SetViewVariable locates the view by name (viewname) and calls the IEEditableView method SetVariable to assign a variable address and type to the view.
If variabletype is NULL
, the existing type will not be changed.
virtual void Show(void);
The default Show calls UpdateAllViews to update the views before displaying the window.
virtual void UpdateAllVariables(BView *parentview=NULL);
Calls UpdateVariable for all children of parentview or for the whole window if parentview is NULL
.
virtual void UpdateAllViews(BView *parentview=NULL);
Calls UpdateView for all children of parentview or for the whole window if parentview is NULL
.
virtual void UpdateVariable(char *viewname);
UpdateVariable locates the view by name (viewname) and calls the IEEditableView method UpdateVariable to convert the view state to the variable.
virtual void UpdateView(char *viewname);
UpdateView locates the view by name (viewname) and calls the IEEditableView method UpdateView to initialize the view based on the variable contents.