/* date = June 11th 2023 1:20 pm */

#ifndef VN_WORKSPACE_VIEW_H
#define VN_WORKSPACE_VIEW_H

////////////////////////////////
//~ sixten: Workspace View Types

struct workspace_view
{
    memory_arena *Arena;
    enum workspace_view_type Type;
    
    workspace_panel *Parent;
    workspace_view *Next;
    workspace_view *Prev;
    
    void *Data;
};

enum workspace_view_type
{
    W_View_Startup,
    W_View_Editor,
    W_View_CommandPalette,
    W_View_Settings,
    W_View_TextEditor,
    W_View_SceneView,
    W_View_CharacterEditor,
};

struct workspace_view_editor
{
    v2 Offset;
    r32 ZoomLevel;
    r32 Scale; // sixten(NOTE): Read-only, based on the zoom level
    workspace_editor_node *FirstNode;
    workspace_editor_node *LastNode;
    workspace_editor_node *FirstFreeNode;
    workspace_editor_node *LastFreeNode;
    
    workspace_editor_lister_dropdown ListerDropdown;
};

struct workspace_view_command_palette
{
    b32 ListerFieldSelected;
    u8 ListerInput[128];
    s32 ListerInputUsed;
    text_edit_state ListerInputEditState;
};

enum workspace_settings_category
{
    W_Settings_All,
    W_Settings_General,
    W_Settings_Theme,
    W_Settings_Developer,
};

struct workspace_view_settings
{
    workspace_settings_category Category;
    r32 GlobalScroll;
    
    // sixten: General
    b32 GeneralDropdownOpen;
    
    // sixten: Theme
    r32 ThemeScroll;
};

////////////////////////////////
//~ sixten: Workspace View Functions

//- sixten: Views
inline workspace_view *W_CreateNewView(workspace_view_type Type, workspace_panel *Parent);
inline void W_DestroyView(workspace_view *View);
inline b32 W_ViewIsCurrent(workspace_view *View);
inline string W_GetViewName(workspace_view *View);

//- sixten: Builder code
static void W_ViewListerInputCallback(render_group *Group, glyph_atlas *Atlas, ui_box *Box, void *Data);
static void W_BuildViewTypeLister(workspace_view *View);
static void W_BuildView(workspace_view *View);

#endif //VN_WORKSPACE_VIEW_H
