Gin
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
ComponentViewer Class Reference

A debugging tool that displays component hierarchy and properties. More...

#include <gin_componentviewer.h>

Inherits juce::DocumentWindow, and juce::ComponentListener.

Public Member Functions

 ComponentViewer (Component *toTrack=nullptr, juce::PropertiesFile *settings=nullptr, bool alwaysOnTop=true)
 Creates a ComponentViewer window.
 
 ~ComponentViewer () override
 Destructor.
 

Public Attributes

std::function< void()> onClose
 Callback invoked when the user requests to close the window.
 

Detailed Description

A debugging tool that displays component hierarchy and properties.

ComponentViewer is a window that shows information about the component under the mouse cursor, including its position, size, class name, and component hierarchy. This is extremely useful for debugging UI layouts and understanding component structures during development.

Features:

Example usage:

auto* viewer = new ComponentViewer (mainComponent, nullptr, true);
viewer->setVisible (true);
// ComponentViewer will delete itself when closed or when mainComponent is deleted
A debugging tool that displays component hierarchy and properties.
Definition gin_componentviewer.h:42
A lightweight 2D point class for projects that don't use juce_graphics.
Definition gin_point.h:25
See also
onClose

Constructor & Destructor Documentation

◆ ComponentViewer()

ComponentViewer::ComponentViewer ( Component *  toTrack = nullptr,
juce::PropertiesFile *  settings = nullptr,
bool  alwaysOnTop = true 
)

Creates a ComponentViewer window.

Parameters
toTrackOptional component to track - when this component is deleted, the ComponentViewer will automatically be deleted as well. Pass nullptr to disable this feature.
settingsOptional PropertiesFile for storing window position. Pass nullptr to use a default settings file.
alwaysOnTopIf true, the window will stay on top of other windows

◆ ~ComponentViewer()

ComponentViewer::~ComponentViewer ( )
override

Destructor.

Member Data Documentation

◆ onClose

std::function<void ()> ComponentViewer::onClose

Callback invoked when the user requests to close the window.

By default, the ComponentViewer deletes itself when closed. You can override this behavior by setting this callback to perform custom cleanup.


The documentation for this class was generated from the following file: