ContentsWhat is fGUI ?
fGUI basics The classesfApplicationfClassInfo fColor fGroup fObject fPoint |
The factory
Note: The factory is unfinished as of yet. The text below describes the concept and what the benefits of using the factory are, once it is finished. The factory ideaAs already said in What is fGUI ? the user will be able to change certain aspects of the GUI, it will for example be possible to have a Be-Style or a Windows-Style. To achieve that the programmer cannot use something like new fBeButton(...) since that would hardcode the Be-Style in the application. Instead fGUI requires every (concrete) class to register with the factory. This can be the global factory for classes without a Style or for classes with no corresponding equivalent in other Styles (a Style here is the set of all classes that implement a certain Look&Feel). Classes which implement a certain Style have to register with the corresponding factoey, e.g. fBeButton will register with the Be-Factory, fWindowsCheckBox with the Windows-Factory.This allows the user to change the GUI using a fGUI preferences program and allows the use of a still to come fBuilder who creates a GUI from a textfile freeing the programmer from actually having to write all the code to initialize the GUI. The fFactory classThe fFactory keeps a list of all classes that register with it. In that both the global factory and the Style-specific factories behave similar. Whenever the programmer, either directly or with help from fBuilder ask the global factory for an instance of a class the request is always to the base class, i.e. you ask the factory for an instance of "fButton". Depending on the users preferences the factory asks one of the Style-factories to deliver an instance of its button class. If the users wants the Be-Style the global factory would ask the Be-Style-factory to deliver an instance of "fButton" and since the only fButton the Be-Style-factory knows are fBeButtons an instance of that is returned.Using this schema the programmer is independant from the actual Look&Feel of the objects he uses to create the GUI.
The flexible GUI, in HTML for the BeOS Release 3. Copyright © 1997-1998 Stegemann & Co. All rights reserved. Last modified May 19, 1998. |