收藏订阅
Customizing Look and Feel
The toolkit provides several pre-built widget sets:
Each widget set contains from ten to a hundred widgets. Each widget is simply a drawing created with the Graphics Builder.
The component's drawing can be loaded into the Graphics Builder for browsing its resources or interactive editing. Since the component is a collection of graphical objects, it is extremely flexible. The control's appearance (colors, shapes and position of objects, etc.) can be changed interactively using the Builder's point and click interface, and a modified component can be saved for later use. More extensive customization, such as adding new labels, legends, and axes can also be performed.
Since the visual appearance is encapsulated in the drawing, the application does not have to be recompiled every time the drawing changes. This enables fast prototyping by eliminating time-consuming compile-link cycles.
All aspects of the component may be completely customized with the Builder, which eliminates the notion of a component's source code, since the drawing serves as a complete description of the object's appearance and behavior.
The Graphics Builder allows the developer to give custom names to a component's attributes. This provides an easy access to any component's attribute, which is not possible for code-based components, whereas only attributes that were handled in the code are accessible. Such named attributes become resources and can be accessed from the program at run-time to alter a component's appearance or to supply dynamic real-time data.
The Graphics Builder can also be used to create panels or dashboards containing multiple controls. Simply create a new canvas, drag-and-drop, position and resize controls using the mouse, name each control to access its resources and save the drawing. The control panel is now ready to be used in an application. It can also be prototyped with simulated data in the Builder.
Creating New Custom Components
New custom components can be created from scratch using the Professional or Enterprise Editions of the Graphics Builder. It is also possible to use an existing component as a template and modify it. For example, a second needle may be added to a dial by copying the dial's needle and pasting the copy into the dial. After the second instance of the needle is renamed, it is ready to be driven by program's data. Since the needle object encapsulates all its controlling parameters, no extra work is necessary. The needle's dynamics parameters will have been copied. The simulation panel shown on the right uses avionics gauges widget set and is a good example of a custom component.
Newly created custom components can be integrated into the Graphics Builder, in which case they will appear in the Builder's component palette.
Custom components are not limited to graphs, meters or dials. A custom component may be as complex as a dynamic process control drawing used to visualize the state of a chemical process. The parameters controlling a drawing's dynamics are exported as resources and may be used by the program to update the drawing with real-time data.
The Professional Edition of the Graphics Builder provides the functionality required to build such custom drawings from scratch. The Enterprise Edition of the Builder may be used to add custom events for handling elaborate user interaction, or to display object tooltips.
Programming API
GLG's easy-to-use Programming API is resource based. Instead of learning a separate method for each of the component's resources, a single SetResource method is used to set any of its resources, even custom attributes created by the user. All a programmer needs to know is the name of a given resource, either an intuitive default such as FillColor, or a custom name given to the resource by the developer.
The Toolkit can be deployed using a variety of programming environments, as well as the hardware and software platforms. GLG components may be deployed using either a cross-platform or a native platform-specific programming container. A cross-platform C/C++ API may be used in a platform-independent way on both Unix/Linux and Windows, enabling an application to be compiled and run on any platform without any changes to its source code.
An MFC class for Windows and a Motif, Gtk or Qt widget for Unix/Linux provide native deployment containers for the respective programming environments. A Java bean and Java class library for the Java development, and an ActiveX Control for the C# and VB.NET deployment are also provided.
The Programming API may be used to modify resources of components at run-time and animate the component with real-time data. It may also be used to handle user interaction.