C++ Class Explorer Window

From RAD Studio
Jump to: navigation, search

Go Up to View Menu

View > C++ Class Explorer

Allows you to:

  • Examine the class structure of your project
  • Examine the declaration in the source for a selected element
  • Create new fields, methods, and properties in managed units in your project

Three Panes in the C++ Class Explorer

The C++ Class Explorer window is separated into three panes (you can see a screenshot showing the Graph pane in C++ Class Explorer Overview):

Pane Location Description

Type List

Left-hand pane in the C++ Class Explorer window

Shows a tree structure of types, classes, interfaces, and namespaces declared directly in your project.

Look further in this help topic for Type List Tree Structure and Type List Context Menu.

Member View

Top right-hand pane

Displays the members (fields, properties, and methods) of the type or types currently selected in the Type List.

In the Member View, the icons for class members can have additional "decorators," as follows:

  • Lock.png - Private class member icons have a "lock" decorator (such as MemberPrivate.png for a private method).
  • Key.png - Protected class member icons have a "key" decorator (such as MemberProtected.png for a protected method).

Source/References/Graph Window

Lower right-hand pane

The three tabs display different information, as follows:

  • Source tab displays the source code, and focuses on the declaration of the item most recently selected in the Type List.
  • References tab lists the references to the symbols currently selected in the Type List. For each symbol:
    • ClExplGoToDecl.png - Indicates the declaration of the symbol (typically the first entry).
    • ClExplGoToDef.png - Indicates the definition, typically the second entry (if the compiler encountered a definition).
    • ClExplReference.png - Indicates references to the symbol, given by file name and source line number.
Double-clicking an entry in the References tab opens the Code Editor window and navigates to the reference.
  • Graph tab displays graphical information about the items currently selected in the Type List. For example, if you select a few classes in the Type List, the Graph tab displays the hierarchy of the selected symbols. See the illustration of the Graph pane in C++ Class Explorer Overview.

Type List Tree Structure

The Type List dislays all the types, classes, interfaces, and namespaces declared in units directly used in your project. By default, the nodes (units, classes, interfaces, types) in the tree are displayed in alphabetical order.

To expand or collapse nodes in the Type List, click the tree nodes:

  • NodePlus.png indicates a collapsed node. (Clicking opens the node.)
  • NodeMinus.png indicates an expanded node. (Clicking closes the node.)

If no icon is displayed before a node, the node is a terminal node (that is, it does not have subnodes that can be expanded or collapsed).

Clicking a node (or moving from node to node using the arrow keys) loads the corresponding source file into the read-only Source Window and focuses the window on the declaration of the selected item.

Icons Used in the Type List and Member View

The following icons are used in both the Type List and Member View:

Icon Description Icon Description

Plus icon

Collapsed node

Minus icon

Expanded node

Source File

Source file

Namespace icon

Namespace

Class icon

Class

Interface icon

Interface1

Method or Operation icon

Method or Operation2

Field or Variable icon

Field or Variable3

Property icon

Property

Event icon

Event

Typedef icon

Typedef4

Union icon

Union

Enum icon

Enumeration4

Enumeration member icon

Member of enumeration

Structure icon

Structure

Group icon

Group (default group or custom group)

Icon decorator for private member

Private class member

Icon decorator for protected member

Protected class member

Notes: 1 By default, an interface is defined as a class/struct that contains no data and only pure virtual methods. You can modify the definition of an interface for viewing purposes by setting options on the Tools > Options > C++ Options > Class Explorer

dialog box. (The option "Interfaces must derive from IUnknown" determines whether ActiveX/COM types are displayed as interfaces, and you can disable "Show pure abstract classes as Interfaces.") 2 The same icon is used for method, operation, procedure, or function. You can add methods (using the ClExplAddMethod.png button) only to a managed unit. 3 You can add fields (using the ClExplAddField.png button) only to a managed unit. 4 You can control the display of typedefs and enumerations using the ClExplTypedef.png and ClExplEnum.png buttons and the Properties dialog box.

Type List Search Field ClExplSearchWGlyph.png

At the top of the Type List is an incremental search field, indicated by a magnifying glass icon Search Glass.

As you enter a string in the search field, the Type List adjusts to display only elements that contain that string. The search matches the names of any contained elements (such as members of a class), even if the class name itself does not contain the string. But the search field has a dropdown menu that enables you to control some crucial aspects of the search. Click the search icon to display the following menu:

Item Description

All

Matches any element that contains the search string, even if the string occurs in a parameter or an ancestor. Default is On.

Name Only

Matches only types whose names contain the search string. Default is Off.

Case insensitive

Requires that elements must match the search string in case. Default is On (case insensitive).

Toolbar Icons

The following icons appear on the toolbar buttons of the Class Explorer:

Icon Description

Sort by Types

Sort by types, either forward or reverse. ClExplSortType.png sorts the various types in the following order:

  • Classes
  • Interfaces
  • Structs
  • Enumerations
  • Typedefs
  • Methods
  • Variables

The reverse button ClExplSortByTypes.png sorts individual types in the reverse order. In either case, the Type List displays the types in alphabetical order (the default view).

Alpha Sort

Sort alphabetically by name, forward (A-Z). The reverse button ClExplSortAlph.png sorts backward (Z-A).

Do Not Group Types

Do not group types. Types are shown in a flat display, as root nodes, instead of being associated with parent nodes (namespace, file, or Custom File Group nodes).

Group Types by Iheritance Hierarchy

Group types by inheritance hierarchy. Types are shown under their base type nodes; or flat, if there's no base type.

Group by Namespace

Group types by their namespaces. Each node is represented by a namespace icon GroupTypesByNamespace.png, and the types in the namespace are listed under that icon.

Group Types by Files

Group types by their files. Displays a file icon (ClExplFile.png) for each file (.cpp, .h, or .hpp file), and lists the elements defined in each file.

Custom file groups

Group types using custom file groups. Uses the default display groups, as well as any custom groups that you have created.

Refresh Types

Refresh list of types. Parse modified source files and update type list.

Cancel icon

Cancel active browser compilations.

Clear Info

Clear all browser information

Add method icon

Add a new method to this class. Opens the Add Method (C++) dialog box. Enabled only for managed units.

Add field icon

Add a new field to this class. Opens the Add Field (C++) dialog box. Enabled only for managed units.

Add property icon

Add a new property to this class. Opens the Add Property (C++) dialog box. Enabled only for managed units.

Filter Types

Configure custom file groups. Opens the Explorer File Groups dialog box, enabling you to:

  • Create your own file groups in the Type List
  • Enable/disable the display of specific groups
  • Establish the display order of the groups in the Type List

Show typedefs

Show top-level typedefs in the type list. Default is Off.

Show enums

Show top-level enumerations in the type list. Default is On (shown).

Show Functions in Type List

Show top-level functions in the type list. Default is Off.

Show Variables in Type List

Show top-level (global) variables in the type list. Default is Off.

Show inherited members

Include inherited members. By default, the Member View includes inherited class members by displaying the members of the ancestor type below the members of the selected type. For example, TForm3 is followed by its ancestor type, TForm. When this button is not pressed, only locally defined members are displayed. Default is On.

Go to declaration

Go to the declaration of the selected node. Opens the source in the Code Editor, and highlights the declaration of the selected item.

Go to definition

Go to the definition of this declaration. Opens the source in the Code Editor, and highlights the definition of the selected item. The C++ compiler maintains information such as when each symbol is first defined and when it is subsequently used. This information is used to perform the Go to definition command.

Type List Context Menu

Right-clicking an element in the Type List displays the following context menu commands.

Note: The context menu commands are enabled only for elements that are declared in a managed unit; that is, the .CPP and .H file must belong to the project that you are exploring with the C++ Class Explorer. For example, you cannot add fields, methods, or properties to VCL or FireMonkey elements using the C++ Class Explorer.

Name Description

Go to Declaration

Opens the Code Editor window and focuses on the declaration of the selected element. Enabled only when an element is selected that is declared in a managed unit.

Go to Definition

Opens the Code Editor window and focuses on the definition of the selected element. Enabled only when an element is selected that is defined in a managed unit.

Collapse All

Closes all the nodes, folders, or groups that are open in the Type List.

Group

Specifies the grouping to be used in the Class Explorer. Select from the following:

  • File (unit file, .cpp file)
  • Namespace
  • Custom groups (VCL, FireMonkey, RTL, <yourProject>, and so forth)
  • None (Do not group)

Show

Specifies that certain elements are displayed in or omitted from the top level of the Class Explorer view. Select either:

  • Typedefs
  • Enumerations

Including either or both of these elements in the view or eliminating them from the view can enable you to see more detail about the specific elements you want to view.

Note: When either of these elements is Off, you will still see elements of the excluded type inside the class structure. This is because only top-level elements are affected by the Show command.

Sort

Specifies the sorting to be used in the Class Explorer. You can sort all elements alphabetically or sort according to types. Select either:

  • Alphabetically
  • Type

Add Field

Opens the Add Field dialog box, which enables you to add a new field to the selected element. Enabled only when an element is selected that is declared in a managed unit, and you have write access to the source.

Add Method

Opens the Add Method dialog box, which enables you to add a new method to the selected element. Enabled only when an element is selected that is declared in a managed unit, and you have write access to the source.

Add Property

Opens the Add Property dialog box, which enables you to add a new property to the selected element. Enabled only when an element is selected that is declared in a managed unit, and you have write access to the source.

Properties

Opens the Properties dialog box (the same dialog as the Tools > Options > Environment Options > C++ Options > Class Explorer dialog box). You can set three types of options:

  • Browser Compiler options:
    • Enable precompiled headers
    • Display compiler messages in the 'Messages View'
  • Custom command-line options for the C++ compiler
  • Types Shown options
    • Display as an Interface only those classes that have only pure virtual functions
    • And display only classes that inherit from IUnknown)
  • Search options
    • Enable case insensitivity
    • Allow wildcards

See Also