The IE library


Library: /IE library/IE.a



Overview

The purpose of this library to instantiate windows which may contain views that are the representation of a variable. The window methods (SetViewVariable, UpdateView, UpdateVariable, UpdateAllViews, UpdateAllVariables) will help you accessing the variable. The library consists of three classes: IEApplication, IEResourceHandler and IEWindow, of which only IEWindow is documented in detail. You can better understand these classes by studying their sources.

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.


IEApplication

IEApplication has only one functionality: to initialize the resource handler object in its constructor and delete it in the destructor. IEApplication quits itself if there is something wrong with the resource handler object creation. This may happen only during application development.

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!


IEResourceHandler

The resource handler has a list of BResources, and is able to find any resources from this list.

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

IEWindow can instantiate windows from the resources with the help of the resource handler.
It also has methods which access the variables of (IEEditableView derived) dynamically loaded view add-ons which have variable support. Using these add-ons has a big advantage, that you don't have to bother with variable conversion, you just tell the view the address and type of the variable and the rest is handled by the view.
IEWindow also handles a window list of child windows, which it closes in the Quit method.



Constructor and Destructor


IEWindow()

   IEWindow(char *windowname);
Calls the BWindow constructor with the window archive. The constructor calls FindWindowResource to find the window by name in the resources.



~IEWindow()

    virtual ~IEWindow(void);
Deletes the window dependancy list.



Member Functions


AddDependantWindow()

      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.


FindWindowResource()

      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.


Quit()

      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.


QuitRequested()

      virtual	bool QuitRequested(void);

The default QuitRequested calls UpdateAllVariables and returns true.


SetViewVariable()

      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.


Show()

      virtual void Show(void);

The default Show calls UpdateAllViews to update the views before displaying the window.


UpdateAllVariables()

      virtual void UpdateAllVariables(BView *parentview=NULL);

Calls UpdateVariable for all children of parentview or for the whole window if parentview is NULL.


UpdateAllViews()

      virtual void UpdateAllViews(BView *parentview=NULL);

Calls UpdateView for all children of parentview or for the whole window if parentview is NULL.


UpdateVariable()

      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.


UpdateView()

      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.