/*
 * DWN - Desktop Window Manager
 * retoor <retoor@molodetz.nl>
 * Panel system (top and bottom panels with widgets)
 */

#ifndef DWN_PANEL_H
#define DWN_PANEL_H

#include "dwn.h"
#include <stdbool.h>

typedef enum {
    PANEL_TOP,
    PANEL_BOTTOM
} PanelPosition;

struct Panel {
    Window window;
    PanelPosition position;
    int x, y;
    int width, height;
    bool visible;
    Pixmap buffer;
    bool dirty;
};

Panel *panel_create(PanelPosition position);
void panel_destroy(Panel *panel);
void panels_init(void);
void panels_cleanup(void);

void panel_render(Panel *panel);
void panel_render_all(void);
void panel_invalidate(void);
void panel_invalidate_taskbar(void);
void panel_invalidate_news(void);
void panel_set_news_region(int x, int width);
void panel_render_news_only(void);
bool panel_needs_render(void);
bool panel_news_needs_render(void);
void panel_render_workspaces(Panel *panel, int x, int *width);
void panel_render_taskbar(Panel *panel, int x, int *width);
void panel_render_clock(Panel *panel, int x, int *width);
void panel_render_systray(Panel *panel, int x, int *width);
void panel_render_layout_indicator(Panel *panel, int x, int *width);
void panel_render_ai_status(Panel *panel, int x, int *width);

void panel_handle_click(Panel *panel, int x, int y, int button);
int panel_hit_test_workspace(Panel *panel, int x, int y);
Client *panel_hit_test_taskbar(Panel *panel, int x, int y);

void panel_show(Panel *panel);
void panel_hide(Panel *panel);
void panel_toggle(Panel *panel);
void panel_raise_all(void);

void panel_update_clock(void);

void panel_update_system_stats(void);

void panel_init_systray(void);
void panel_add_systray_icon(Window icon);
void panel_remove_systray_icon(Window icon);

#endif
