digitalmars.com                      
Last update Sun Mar 4 12:07:01 2018

20. Hierarchy Editor Reference

This chapter describes menu operations and mouse functions available in the Hierarchy Editor. For an introduction to this tool, see Chapter 5, "Defining Classes and Their Hierarchies."

The Hierarchy Editor Window

To open a Hierarchy Editor window you have several choices: Multiple instances of the Hierarchy Editor may be open at the same time. These windows share data among themselves and with Class Editor windows, so changes made in one window are transmitted instantly to the others.

Edit menu commands

Commands in the Edit menu (Figure 20-1) let you undo Hierarchy Editor operations and print the graphical display.

Figure 20-1 Edit menu commands
Figure 20-1 Edit menu commands

Global Undo

Cancels the last operation performed in the Hierarchy Editor (such as Add Class or Add Member). The text of this menu item changes to reflect the previous operation performed in the Hierarchy Editor.

Print

Opens the Print dialog box. See Chapter 21, "Text Editor Reference."

Macro menu commands

The commands in the Macro menu (Figure 20-2) are identical to Macro menu commands in Source windows. For a description, see Chapter 21, "Text Editor Reference."

Figure 20-2 Macro menu commands
Figure 20-2 Macro menu commands

New! command

Opens another Hierarchy Editor window.

Pop-up menu commands

Contains commands to add and modify classes and inheritance relationships, and to access Hierarchy Editor options.

Figure 20-3 Hierarchy Editor pop-up menu commands
Figure 20-3 Hierarchy Editor pop-up menu commands

Add Derived

Opens a dialog box (Figure 20-4) that lets you add a new class to the hierarchy. The new class is a derived class of the currently selected class, whose name is shown in the dialog box's title.

Figure 20-4 Create Derived Class dialog box
Figure 20-4 Create Derived Class dialog box

Class name
Specifies a name for the new class.
Header file
Contains the name of the header file into which the class declaration is placed. By default, the first eight characters of the class name (with .h appended) are used as the header file name. You may type an alternative filename into the textbox, or click on Browse to select a filename from the Class Header File dialog box.

Add Top

Adds a top-level (baseless) class. The dialog box that opens as a result of selecting this command is identical in function to the one that opens when you choose the Add Derived command.

Add Sibling

Adds a class that is a sibling of (derived from the same base classes as) the currently selected class. The dialog box that opens as a result of selecting this command is identical in function to the one that opens when you choose the Add Derived command.

Show Header

Opens a new Source window to edit the header file containing the declaration of the currently selected class.

Connect Base

Opens the Add Base dialog box (Figure 20-5), with which you can add a base class to the selected class.

Figure 20-5 Add Base dialog box
Figure 20-5 Add Base dialog box

Access
These options indicate the base class access specifier:
Public:
Public members of the base class are public members of the derived class, and protected members of the base class are protected members of the derived class.
Protected:
Public and protected members of the base class are protected members of the derived class.
Private:
Public and protected members of the base class are private members of the derived class.
Virtual
Specifies the base class to be virtual.
Base class
Specifies the class that is made a base of the selected class. You can select more than one class to make a base class by holding down the Control key while clicking on the class name.

Edit Base Attributes

Opens the Edit Base Attributes dialog box (Figure 20-6), with which you can change the attributes of the selected connection between a derived class and its base class.

Figure 20-6 Edit Base Attributes dialog box
Figure 20-6 Edit Base Attributes dialog box

Access
These options indicate the base class access specifier:
Public:
Public members of the base class are public members of the derived class, and protected members of the base class are protected members of the derived class.
Protected:
Public and protected members of the base class are protected members of the derived class.
Private:
Public and protected members of the base class are private members of the derived class.
Don't change:
Appears only if you are editing the attributes of more than one connection and the base class access specifiers are not all identical. It means that the base class access specifiers are not altered. It lets you change the Virtual specifier of all connections without affecting their individual access specifiers.
Virtual
If selected, this option specifies the base class to be virtual. If grayed, the virtual setting is left unchanged.

Delete Base Connection

Deletes the selected connection between a derived class and its base class.

You are prompted to confirm this if the Confirm Inheritance Changes option on the General page of the Editing/Browsing Settings dialog box is selected.

Settings

Opens the Editing/Browsing Settings dialog box, in which you set global Hierarchy Editor and text editor options. Details of this dialog box are discussed in "Hierarchy Editor Settings," later in this chapter.

Mouse functions

The right mouse button opens the pop-up menu.

A class is selected by clicking on it. Additional classes may be selected by clicking while holding down Control. Members of the class last selected appear in the Members child window.

Double-clicking on a class opens a Class Editor window. A connection is selected by clicking on it. Additional connections may be selected by clicking while holding down Control.

A new derived class is added by clicking on the base class and dragging the cursor to an empty area of the display.

A new base-to-derived connection is made by clicking on the base class and dragging the cursor to the derived class.

A derived class's connection to a base may be moved to a different base by clicking the connection, then dragging the connection's handle to the new base class. (This is a shortcut for deleting one connection, then establishing a new one.)

Toolbar commands

The Hierarchy Editor toolbar (Figure 20-7) offers quick access to several menu choices.

Figure 20-7 Hierarchy Editor toolbar
Figure 20-7 Hierarchy Editor toolbar

The following options are the same as those on other menus:

Add top:
Same as choosing Add Top from the pop-up menu.
Add derived:
Same as choosing Add Derived from the pop-up menu.
Connect base:
Same as choosing Connect Base from the pop-up menu.
Print:
Same as choosing Print from the Edit menu.
Play macro:
Same as choosing Play from the Macro menu.

Members Child Window

The Hierarchy Editor's Members child window is enabled by setting the Members option on the Hierarchy page of the Editing/Browsing Settings dialog box. You can open this dialog box by choosing Settings from the Hierarchy Editor's pop-up menu.

Member menu commands

The Member menu (Figure 20-8) contains commands to add, delete, and modify class members, and to access Hierarchy Editor options.

Figure 20-8 Member menu commands
Figure 20-8 Member menu commands

Add

Opens the Add Member dialog box (Figure 20-9). The new member is added to the class whose members currently are displayed in the Members child window.

Figure 20-9 Add Member dialog box
Figure 20-9 Add Member dialog box

Access
These options specify the member access control:
Public:
Members are accessible from outside the member's class.
Protected:
Members are accessible only within the member's class, derived classes, and their friends.
Private:
Members are accessible only within the member's class and its friends.
Storage
These options specify the member storage class:
Normal:
The member has no storage modifiers.
Static:
Only one copy of the member exists; it is shared by all objects of the member's class.
Virtual (functions only):
The function may be overridden in derived classes.
Pure virtual (functions only):
The function must be overridden in derived classes; the class is abstract.
Friend (functions only):
The named function is allowed access to the class's private members.
Inline
Requests inline implementation of a function.
Declaration
Contains the member declaration. For data items, enter the type and member name (for example, int nCats). For functions, enter the return type, function name, and argument types (for example, void AddCats(int)). Do not precede the declaration with storage specifiers; use the option buttons above. Trailing semicolons are optional.
Source file
Contains the name of the source file into which the member definition is placed. By default, the first eight characters of the class name (with .cpp appended) are used as the source filename. You can type an alternative filename into the textbox, or click on Browse to select an alternative filename from the Member Source File dialog box.

The member declaration is placed in the class declaration. If the specified source file does not already exist, it is created and added to the project. By default, empty definitions of inline functions are placed in the header file. Empty definitions of normal, static, and virtual functions, as well as static data members, are placed in the source file.

Delete

Deletes the currently selected member. If the Confirm Member Delete option on the General page of the Editing/Browsing Settings dialog box is selected, you are asked to confirm the deletion. The member's declaration and definition (if applicable) are removed from the header and source files.

Edit Attributes

This command opens the Change Member Attributes dialog box (Figure 20-10), which you can use to edit access and storage specifiers of the selected member.

Figure 20-10 Change Member Attributes dialog box
Figure 20-10 Change Member Attributes dialog box

Access
These options specify the member access control:
Public:
Members are accessible from outside the member's class.
Protected:
Members are accessible only within the member's class, derived classes, and their friends.
Private:
Members are accessible only within the member's class and its friends.
Don't change:
Appears only if you are editing the attributes of more than one member and their access controls are not all identical. It means that the access control is not altered. It lets you change other member attributes without also affecting their individual access controls.
Storage
These options specify the member storage class:
Normal:
The member has no storage modifiers.
Static:
Only one copy of the member exists; it is shared by all objects of the member's class.
Virtual (functions only):
The function may be overridden in derived classes.
Pure virtual (functions only):
The function must be overridden; the class is abstract.
Friend (functions only):
The named function is allowed access to the class's protected and private members.
Don't change:
Appears only if you are editing the attributes of more than one member and their storage classes are not all identical. It means that the storage class is not altered. It lets you change other member attributes without affecting their individual storage classes.
Inline
Requests inline implementation of a function. If grayed, the current setting is left unchanged.
Source file
If applicable, this option contains the name of the source file holding the member definition. You may change the filename in the textbox, or click on Browse to select an alternative filename from the Member Source File dialog box. If you change the source file, the member definition moves.

Show Source

Opens a new Source window to show the source file containing the definition of the currently selected member.

If you add new functions or static data definitions to the source file, or alter function argument or return types, you must update the class header to reflect the changes.

Settings

Opens the Editing/Browsing Settings dialog box, in which you set global Hierarchy Editor and text editor options. Details of this dialog box are discussed in "Hierarchy Editor Settings," later in this chapter.

Pop-up menu commands

The Members child window pop-up menu is identical to the Member menu.

Mouse functions

The right mouse button opens the pop-up menu.

Select a member by clicking on it. Additional members may be selected by clicking on them while holding down Control.

Double-clicking on a member causes its definition (if appropriate) or declaration to be displayed in the Source child window.

You may drag and drop a member into the Source child window; the member declaration is inserted into the buffer.

Source Child Window

The Hierarchy Editor's Source child window is enabled by setting the Source option on the Hierarchy page of the Editing/Browsing Settings dialog box. You can open this dialog box by choosing Settings from the Hierarchy Editor's pop-up menu.

Edit menu commands

Commands in the Edit menu (Figure 20-11) are used to perform text editing operations, and are identical to the corresponding Edit menu commands in Source windows. For a description, see Chapter 21, "Text Editor Reference."

Figure 20-11 Edit menu commands
Figure 20-11 Edit menu commands

Goto menu commands

The commands in the Goto menu (Figure 20-12) are used to move around within the Source child window and are identical to the corresponding Goto menu commands in Source windows. For a description, see Chapter 21, "Text Editor Reference."

Figure 20-12 Goto menu commands
Figure 20-12 Goto menu commands

Pop-up menu commands

With one exception, commands in the Source child window pop-up menu (Figure 20-13) are identical to the corresponding commands in Source windows. For a description, see Chapter 21, "Text Editor Reference."

Figure 20-13 Pop-up menu commands
Figure 20-13 Pop-up menu commands

Save

Saves the program code shown in the Source child window and places it in the appropriate source or header file.

Changes to static data and to function argument and return types made in the source code are updated automatically in the class declaration and Members child window.

Mouse functions

The right mouse button opens the pop-up menu.

The Source child window supports typical source window mouse and cursor operations, as described in Chapter 21, "Text Editor Reference."

Hierarchy Editor Settings

You can access Hierarchy Editor settings by choosing Settings from the Hierarchy Editor pop-up menu, Settings from the Members child window Member or pop-up menus, or Text Settings from the Source child window Edit menu. These commands open the Editing/Browsing Settings dialog box, a workspace with tabs along the top margin.

The tabs are used to switch between several sets of options. The Hierarchy, Member, and General options are discussed in this section; the remaining options pertain to text editing and are discussed in Chapter 21, "Text Editor Reference."

General options

The General options set (Figure 20-14) contains options for undo levels and confirmations, as well as options related to the text editor.

Figure 20-14 General options
Figure 20-14 General options

Browser operations

Specifies the number of operations that can be undone in the Class and Hierarchy Editors.

Text edits, per buffer

Specifies the number of edit operations that can be undone per buffer.

Confirmations

These options enable confirmation requests for various operations in the Class and Hierarchy Editors. You can enable confirmations of:

Open output window on message

Lets the IDDE open an error window whenever there is an error of any kind (during compilation, during parsing, and so on.)

Keyboard emulation file

Specifies the key bindings set to be used by the text editor.

Multiple selections

Enables multiple selections in lists in the Class and Hierarchy editors.
Yes:
Multiple selections are allowed.
No:
Multiple selections are not allowed.
Confirm:
Multiple selections are allowed, but a confirmation request is displayed each time an operation is performed on multiple classes or members.

Hierarchy options

The Hierarchy options set (Figure 20-15) lets you enable the Members and Source child windows and specify the font used in the graphical display.

Figure 20-15 Hierarchy options
Figure 20-15 Hierarchy options

Pop-up windows

These options enable the Hierarchy Editor child windows:
Members:
Enables the Members child window.
Source:
Enables the Source child window.

Font

Specifies the font used to display class names. You can select a predefined font from the drop-down list, or you can click on Custom and select any installed font from a Windows Font dialog box.

Apply here only

Indicates that the specified settings should be applied only to the current Hierarchy Editor window.

Member options

Lets you specify the display parameters of class members in the Members child window.

Figure 20-16 Member options
Figure 20-16 Member options

Grouping

Indicates how class members are grouped. Any or all of the following options may be checked:
By access:
Members are grouped into public, protected, and private. If By Access is not selected, each member is preceded by a colored diamond indicating its access specifier (green for public, yellow for protected, red for private).
By file:
Members are grouped by the source file containing their definitions. When this option is selected, only functions and static data are shown.
By kind:
Members are grouped into Data, Functions, and Typedefs.
If more than one Grouping option is selected, members are grouped by kind within files and by files within access category.

Sorting

Indicates how members are arranged within each group.
Order defined:
Members are arranged in the order in which they are declared in the class header.
Alphabetical:
Members are arranged alphabetically.

Show full method names

Specifies that member names are displayed with their type specifiers and (if a method) their parameter type list (for example, int Multiply(int, int, int)). If this option is not selected, only the identifier name is displayed (for example, Multiply).

Font

Specifies the font used to display member names in the Members child window. You can select a predefined font from the combobox, or you can click on Custom and select any installed font from a Windows Font dialog box.

Apply here only

Indicates that the specified settings should be applied only to the current Hierarchy Editor window. Otherwise, the settings are applied to all Hierarchy and Class Editor windows.
Home | Compiler & Tools | Runtime Library | STL | Search | Download | Forums | Prev | Next