Skip to main content

src/WhiskerToolbox/EditorState/ZoneTypes.hpp

src/WhiskerToolbox/EditorState/ZoneTypes.hpp

Shared Zone enum for UI widget placement. More…

Types

Name
enum class Zone { Left, Center, Right, Bottom}
Standard UI zones for widget placement.

Functions

Name
Zone zoneFromString(QString const & zone_str)
Converts zone string to Zone enum.
QString zoneToString(Zone zone)
Converts Zone enum to string.

Detailed Description

Shared Zone enum for UI widget placement.

This header defines the Zone enum used throughout the EditorState and UI layout systems. It’s a shared dependency to avoid circular includes between EditorRegistry and ZoneManager.

Types Documentation

enum Zone

Enumerator Value Description
Left Left panel - outliner, data tree, group management.
Center Center - primary editing/visualization area.
Right Right panel - properties, context-sensitive controls.
Bottom Bottom - timeline, terminal, output.

Standard UI zones for widget placement.

Zone represents the logical areas in the application’s docking layout:

┌──────────────────────────────────────────────────────────────────┐
│  Menu Bar                                                        │
├────────────────┬─────────────────────────────┬───────────────────┤
│                │                             │                   │
│   Left         │     Center                  │   Right           │
│                │                             │                   │
│   - Data       │     Media_Widget            │   - Properties    │
│     Manager    │     DataViewer_Widget       │   - Data          │
│   - Group      │     Analysis plots          │     Transforms    │
│     Manager    │     etc.                    │                   │
│                │                             │                   │
├────────────────┴─────────────────────────────┴───────────────────┤
│  Bottom (Timeline, Terminal)                                     │
└──────────────────────────────────────────────────────────────────┘

Functions Documentation

function zoneFromString

inline Zone zoneFromString(
    QString const & zone_str
)

Converts zone string to Zone enum.

Parameters:

  • zone_str String representation (“left”, “center”, “right”, “bottom”, “main”)

Return: Corresponding Zone enum, defaults to Center for unknown strings

function zoneToString

inline QString zoneToString(
    Zone zone
)

Converts Zone enum to string.

Parameters:

  • zone Zone enum value

Return: String representation

Source code

#ifndef ZONE_TYPES_HPP
#define ZONE_TYPES_HPP


#include <QString>

enum class Zone {
    Left,      
    Center,    
    Right,     
    Bottom     
};

inline Zone zoneFromString(QString const & zone_str) {
    QString const lower = zone_str.toLower();
    if (lower == QStringLiteral("left")) return Zone::Left;
    if (lower == QStringLiteral("right")) return Zone::Right;
    if (lower == QStringLiteral("bottom")) return Zone::Bottom;
    // "center", "main", or unknown defaults to Center
    return Zone::Center;
}

inline QString zoneToString(Zone zone) {
    switch (zone) {
    case Zone::Left:   return QStringLiteral("left");
    case Zone::Center: return QStringLiteral("center");
    case Zone::Right:  return QStringLiteral("right");
    case Zone::Bottom: return QStringLiteral("bottom");
    }
    return QStringLiteral("center");  // Default
}

#endif  // ZONE_TYPES_HPP

Updated on 2026-11-13 at 20:25:45 +0000