toaruos/base/usr/include/toaru/decorations.h

69 lines
1.9 KiB
C
Raw Normal View History

2018-02-25 11:14:43 +03:00
/* vim: tabstop=4 shiftwidth=4 noexpandtab
*
* Decoration Library Headers
*
*/
#pragma once
2018-03-19 05:38:11 +03:00
#include <toaru/graphics.h>
#include <toaru/yutani.h>
2018-02-25 11:14:43 +03:00
/*
* Render decorations to a window. A buffer pointer is
* provided so that you may render in double-buffered mode.
*
* Run me at least once for each window, and any time you may need to
* redraw them.
*/
extern void render_decorations(yutani_window_t * window, gfx_context_t * ctx, char * title);
extern void render_decorations_inactive(yutani_window_t * window, gfx_context_t * ctx, char * title);
/**
* Decoration boundaries
*/
struct decor_bounds {
int top_height;
int bottom_height;
int left_width;
int right_width;
/* Convenience */
int width;
int height;
};
2018-02-25 11:14:43 +03:00
/*
* Used by decoration libraries to set callbacks
*/
extern void (*decor_render_decorations)(yutani_window_t *, gfx_context_t *, char *, int);
extern int (*decor_check_button_press)(yutani_window_t *, int x, int y);
extern int (*decor_get_bounds)(yutani_window_t *, struct decor_bounds *);
2018-02-25 11:14:43 +03:00
/*
* Run me once to set things up
*/
extern void init_decorations();
extern int decor_handle_event(yutani_t * yctx, yutani_msg_t * m);
/* Callbacks for handle_event */
extern void decor_set_close_callback(void (*callback)(yutani_window_t *));
extern void decor_set_resize_callback(void (*callback)(yutani_window_t *));
extern void decor_set_maximize_callback(void (*callback)(yutani_window_t *));
2018-04-27 16:14:08 +03:00
extern yutani_window_t * decor_show_default_menu(yutani_window_t * window, int y, int x);
2018-02-25 11:14:43 +03:00
/* Responses from handle_event */
2018-04-27 16:14:08 +03:00
#define DECOR_OTHER 1 /* Clicked on title bar but otherwise unimportant */
#define DECOR_CLOSE 2 /* Clicked on close button */
#define DECOR_RESIZE 3 /* Resize button */
#define DECOR_MAXIMIZE 4
2018-04-27 16:14:08 +03:00
#define DECOR_RIGHT 5
2018-02-25 11:14:43 +03:00
#define DECOR_ACTIVE 0
#define DECOR_INACTIVE 1
#define DECOR_FLAG_DECORATED (1 << 0)
#define DECOR_FLAG_NO_MAXIMIZE (1 << 1)
#define DECOR_FLAG_TILED (1 << 2)