There are two add-ons included with the application which can help you to design the user interface of your program and create C++ classes, thus saving lots of time. You can modify the window/view resources in the resource file even after compilation; you do not have to recompile your code, your application will still work after adding or removing any menu items or views. Whats more the classes that you have to include when compiling are only some kilobytes, so there will be very small impact on the code size. How this all works and what is generated is explained here.
IEResourceHandler
is created and initialized when the application starts
in the constructor of IEApplication
, so you have to do nothing special about it.
This class is used by IEWindow
and IEApplication
classes, you do not have to
override it.
By default it assumes that the window/menu and other resource are attached to the
application image, but if there are other resource files as well, you can add it to
IEResourceHandler
by calling its AddResourceFile(record_ref rsrcfile)
method. After the call you are ready to instantiate windows from the resource file
specified by the argument. It's so simple.
One thing you should know about IEResourceHandler
:
there is a global IEResourceHandler *resourcehandler
variable
which all the windows and application uses. But again, you have to access it very rarely if at all.
IEApplication
is a generic simple application class.
Currently it's only task is to create and initialize the resource handler.
In the near future several new features will be added.
When you create an application called e.g. 'test app' the following classes are derived from IEApplication -> IETestApp (generated, don't modify) -> TestApp (skeleton generated, modify)IEApplication
:
IETestApp
is the class what Interface Elements maintains, it will be recreated at the next 'Generate Source'
so you should not modify it. However you can (and have to) modify the class that inherits from it, called TestApp
.
The skeleton of TestApp
is created for your convenience with the possible methods you should implement.
TestApp
will never be overwritten by subsequent regenerations.
IEWindow
is a generic window class. It can instantiate itself and its views from the window data in the resource file.
It knows how to set and read the view variables or update the views. It provides you an ExitHook, and dependant window handling.
In the following release this will be better documented.
When you create a window called e.g. 'my window' the following classes are derived from IEWindow -> IEMyWindow (generated, don't modify) -> MyWindow (skeleton generated, modify)IEWindow
:
IEMyWindow
is the class what Interface Elements maintains, it will be recreated at the next 'Generate Source'
so you should not modify it. However you can (and have to) modify the class that inherits from it, called MyWindow
.
The skeleton of MyWindow
is created for your convenience with the possible methods you should implement.
MyWindow
will never be overwritten by subsequent regenerations.
You can specify the name of your application, the main menu (by dropping a previously created main menu), an about box (by dropping a previously created window), and some windows to open when the application starts up. The resource created is a flattened BMessage of type 'IApp'.
You can design the layout of your window and its views interactively here. You have to specify
Editing your window
You can drag the GUI elements (which should be in /boot/add-ons/InterfaceElements) to your window, and edit, move, center, stretch, duplicate or delete them.
There are keyboard shortcuts you can use:
By selecting 'Center Horizontally', 'Center Vertically' or 'Center All (H+V)' from the popup, the view will be centered in its parent.
By selecting 'Stretch Horizontally', 'Stretch Vertically' or 'Stretch All (H+V)' from the popup, the view will be stretched to fit its parent.