Abstract:
A method for describing a panel to be displayed in a plurality of display contexts within a user interface including defining a panel description describing the functionality of the panel, a plurality of resource descriptions each describing the appearance of the panel and a mapping from each display context to one of the plurality of resource descriptions. The method includes associating the mapping and the panel description.

Description:
BACKGROUND OF THE INVENTION 
     The present invention relates generally to computer programs, and more specifically, to a method and apparatus for representing and rendering multiple instances of a panel. 
     Application programs typically include a user interface for displaying graphical elements and data produced during the execution of the program. Application programs often include one or more functional elements that are displayed to allow for selection or other user input in achieving a desired result. 
     Menus are used in computer programs to provide functionality. Types of menus that a user interface can include are dialog boxes, palettes, pull down menus, pop up hierarchial menus, hierarchial selection menus, textual menus, iconic menus and message boxes. 
     A menu&#39;s descriptive information is typically stored in a resource. Resources are defined by their type and either a resource identifier (i.d.) or name. Typically, each resource has a certain type and each type corresponds to a specific function. For example, the resource type “menu” can be used to describe menus used at the top of a screen. Resources of the same type residing in a program must have a unique resource i.d. For example, an application may have several resources of the type menu as long as each menu has a unique resource i.d. 
     A menu can include a panel. A panel is a stand alone functional operation or control without a defined appearance. A panel describes an operation and includes control specification as well as definition. Separate simple resources are defined for each panel. A simple resource is a resource that specifies the layout of the user interface elements for a particular instantiation of a panel. A simple resource lists what controls are to be included in a particular instantiation of a panel and where they should go. For example, one type of panel is a color picker, which includes controls allowing a user to choose a color. Typically, the functionality of a panel and appearance or layout at any given location in a user interface are described in one common body of code. 
     A computer programmer may desire to display a panel in several different formats and in several different places in a program. For example, a computer application may include a color picker that is displayed in a tabbed palette. In addition, a dialog box may include a color picker to allow a user to edit a color. When the color picker is displayed in a palette as shown in FIG. 1, the color picker may be drawn in a compact form. When the picker is displayed in a dialog box as shown in FIG. 2, the color picker can be drawn with a different appearance characterized by a different set of fonts and with controls positioned differently. Depending on where the color picker is used, some controls may be invisible. 
     A programmer typically writes special case codes to display a panel in more than one place, which adds to the time required to generate and debug a program. If multiple appearances are designed for a panel, such as to instantiate the panel in different types of menus in the user interface, the panel is typically written in multiple different ways, corresponding to each type of appearance. Each instance of the panel includes a unique resource and code that describes the functionality of the panel which is shared by all instances of the panel. Typically, there is a one-to-one relationship between a simple resource and the code that handles user interaction. 
     SUMMARY OF THE INVENTION 
     In one aspect, the invention provides a method for describing a panel to be displayed in a plurality of display contexts within a user interface and includes defining a panel description describing the functionality of the panel, a plurality of resource descriptions each describing the appearance of the panel and a mapping from each display context to one of the plurality of resource descriptions. The method includes associating the mapping and the panel description. 
     The invention includes numerous features. The step of defining a mapping can include building a table having an entry for each display context that includes a pointer to a resource description. The step of defining a mapping can include creating a resource including a table mapping each display context to a resource description. The method can further include separating functional and appearance aspects of the panel description. 
     In another aspect, the invention provides a resource for use in rendering a panel in a plurality of display contexts within a user interface and includes a panel description describing the functionality of the panel and a mapping associated with the panel description and defining a mapping between each display context and an associated resource description. The resource description describes an appearance of the panel in a particular display context. 
     In another aspect, the invention provides a method for rendering a panel in a display context within a user interface and includes providing a panel description describing the functionality of the panel and a mapping associated with the panel description and defining a mapping between display contexts and particular resource descriptions. Each resource description describes an appearance of the panel in a particular display context. The mapping is used to locate a particular resource description associated with the display context. The panel is rendered in accordance with the particular resource description and the panel description. 
     In anther aspect, the invention provides a method defining the appearance of a panel where the panel includes code defining functional aspects of the panel. The method includes defining bindings between simple resources and the code based on a context of use. 
     Advantages of the invention include one or more of the following. An a extra level of indirection between a panel description and its associated resources is provided. Rather than a one-to-one relationship between the resource and the panel description, there is a many-to-one relationship. Different resources can be specified to define different layouts in the same panel, but only a single block of code defined by a panel description is required to control the different instantiations of the panel. This code is shared among the resources thereby minimizing the amount of code required to be produced initially and maintained when supporting multiple instances of a panel. The use of common control code also facilitates consistency across the program. 
    
    
     BRIEF DESCRIPTION OF THE DRAWING 
     FIG. 1 is a user interface including a panel rendered in a palette. 
     FIG. 2 is a user interface including a panel rendered in a dialog box. 
     FIG. 3 is a flow diagram illustrating the steps for defining a panel and its appearance. 
     FIG. 4 is a menu identifier resource panel. 
     FIG. 5 is a flow chart illustrating the steps of rendering a panel in a menu. 
    
    
     DETAILED DESCRIPTION 
     Referring now to FIG. 3, a process  100  for generating a panel description and its appearance in a program includes writing a panel description ( 102 ). The panel description includes the functional description for all of the functional elements to be included in the panel. For example, a color picker may include sliders, edit boxes, static text labels and a color display switch. Associated with the functional description is underlying code that controls the operation of each of the functional elements included in a panel. For example, routines for controlling a slider or for manipulating a color display switch are required in order to control the functional element in a particular instantiation of the panel. This underlying code can be shared among the resources and is only required to be generated once, thereby minimizing the amount of code required to be initially produced and maintained when supporting multiple instances of a panel. The use of common code also facilitates consistency across the program. 
     The menus in which a panel will be rendered are identified ( 104 ). A menu identifier identifying each menu in which the panel will be used is created ( 106 ). The menu identifier uniquely identifies each location in the program where an instantiation of the panel is to be rendered. The menu identifier can be the resource name or identifier used in identifying the particular menu in the program. 
     The resources for rendering the panel in each menu are defined ( 108 ). The resources include descriptive information for the appearance of a particular instantiation of the panel. A resource, or resource description as it is often referred to, defines a panel&#39;s particular appearance and includes details of what controls are used and where the controls are positioned in the panel. If one panel has three different appearances then three different resource descriptions for that panel are required. Two distinct resource descriptions are required to develop the differing appearances for the color pickers shown in FIGS. 1 and 2. Resources can be defined by their type and either a resource identifier (i.d.) or name. 
     Resource identifiers are created identifying each resource for each rendered panel ( 110 ). Resources of the same type residing in a program must have a unique resource i.d. An application can have several resources of the same type as long as each has a unique resource i.d. 
     A table is created which includes a mapping for each menu identifier to a particular resource identifier ( 112 ). The particular resource identifier points to the resource used to generate the panel for a given menu. A table is used to identify all of the locations where the panel is to be used in a program. For each item in the table, a corresponding resource identifier indicates which resource description should be used in creating the panel. The table is a user editable resource for associating a particular resource description with a particular instantiation of the panel. The table structure includes a mapping of menu identifiers to an associated resource identifier. Resources may be redefined or otherwise modified without affecting the panel description. The resource mapping may be modified without affecting either the resource or the panel description. In addition, once generated, a single resource may be linked to a plurality of menus. An example of a table including mapping between menu identifiers and an associated resource identifier is shown in FIG.  4 . 
     Finally, the panel description is stored and associated with the table ( 114 ). The panel description, the table or a resource can be independently edited, as appropriate, to effectuate change in the functionality or the appearance of a panel in the program. 
     Referring now to FIG. 5, a process  200  of rendering a panel and displaying it in a menu includes locating the panel description for the panel being created ( 202 ). The table associated with the panel description that includes the menu identifiers and resource identifiers corresponding to the panel is located ( 204 ). The table is searched to locate the particular menu identifier for the menu being created ( 206 ). The resource identifier associated with the located menu identifier and corresponding to the resource to be used in generating the menu is determined ( 208 ). The particular panel is created and installed in the menu by executing the corresponding resource indicated by the resource identifier determined in step  208  ( 210 ). 
     In an alternative implementation, the panel description definition and resource description may be accomplished by separate entities for a given instantiation of a panel. For example, a third party vendor may make use of the panel description and table architecture described above to create a instantiation of a panel having a custom appearance. The definition of the custom appearance can be created by a resource description generated by the third party vendor. However, the code required to control the various functional elements within the custom panel may be provided (shared) with other resources supplied with the program. 
     The present invention has been described in terms of specific embodiments, which are illustrative of the invention and are not to be construed as limiting. Other embodiments of the invention are within the scope of the following claims.