/*
 * DWN - Desktop Window Manager
 * retoor <retoor@molodetz.nl>
 * Window decorations (title bars, borders, buttons)
 */

#ifndef DWN_DECORATIONS_H
#define DWN_DECORATIONS_H

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

typedef enum {
    BUTTON_CLOSE,
    BUTTON_MAXIMIZE,
    BUTTON_MINIMIZE,
    BUTTON_COUNT
} ButtonType;

typedef struct {
    int x, y;
    int width, height;
} ButtonArea;

void decorations_init(void);
void decorations_cleanup(void);

void decorations_render(Client *client, bool focused);
void decorations_render_title_bar(Client *client, bool focused);
void decorations_render_buttons(Client *client, bool focused);
void decorations_render_border(Client *client, bool focused);

ButtonType decorations_hit_test_button(Client *client, int x, int y);
bool decorations_hit_test_title_bar(Client *client, int x, int y);
bool decorations_hit_test_resize_area(Client *client, int x, int y, int *direction);

void decorations_button_press(Client *client, ButtonType button);

void decorations_draw_text(Window window, GC gc, int x, int y,
                           const char *text, unsigned long color);

#endif
