#ifndef BW_WINDOW_H
#define BW_WINDOW_H
#ifdef __cplusplus
extern "C" {
#endif
#include "application.h"
#include "common.h"
#include "string.h"
#ifndef BW_BINDGEN
#if defined(BW_WIN32)
#include "win32/window.h"
#elif defined(BW_GTK)
#include "window/gtk.h"
#elif defined(BW_CEF_WINDOW)
#include "window/cef.h"
#else
#error Unsupported window API implementation
#endif
#else
typedef struct {} bw_WindowImpl;
#endif
#include <stdbool.h>
#include <stdint.h>
typedef struct bw_Window bw_Window;
typedef struct bw_WindowCallbacks {
void (*do_cleanup)( bw_Window* );
void (*on_close)( const bw_Window* );
void (*on_loaded)( const bw_Window* );
void (*on_resize)( const bw_Window*, unsigned int width, unsigned int height );
} bw_WindowCallbacks;
typedef struct bw_WindowOptions {
bool borders;
bool minimizable;
bool resizable;
} bw_WindowOptions;
typedef void (*bw_WindowDispatchFn)( bw_Window* window, void* data );
typedef struct bw_WindowDispatchData bw_WindowDispatchData;
struct bw_Window {
bw_Application* app; const bw_Window* parent; bool closed; bool dropped; bw_WindowCallbacks callbacks;
void* user_data;
bw_WindowImpl impl; };
void bw_Window_destroy( bw_Window* window );
void bw_Window_drop( bw_Window* window );
bw_Dims2D bw_Window_getContentDimensions( bw_Window* window );
uint8_t bw_Window_getOpacity( bw_Window* window );
bw_Pos2D bw_Window_getPosition( bw_Window* window );
size_t bw_Window_getTitle( bw_Window* window, bw_StrSlice title );
bw_Dims2D bw_Window_getWindowDimensions( bw_Window* window );
void bw_Window_hide( bw_Window* window );
bool bw_Window_isVisible( const bw_Window* window );
bw_Window* bw_Window_new(
bw_Application* app,
const bw_Window* parent,
bw_CStrSlice _title,
int width, int height,
const bw_WindowOptions* options,
void* user_data
);
void bw_Window_setContentDimensions( bw_Window* window, bw_Dims2D dimensions );
void bw_Window_setOpacity( bw_Window* window, uint8_t opacity );
void bw_Window_setPosition( bw_Window* window, bw_Pos2D position );
void bw_Window_setTitle( bw_Window* window, bw_CStrSlice title );
void bw_Window_setWindowDimensions( bw_Window* window, bw_Dims2D dimensions );
void bw_Window_show( bw_Window* window );
void bw_Window_triggerClose( bw_Window* window );
void _bw_Window_onResize( const bw_Window* window, unsigned int width, unsigned int height );
#ifdef __cplusplus
} #endif
#endif