#pragma once #include #include "constants.h" #include #ifndef NDEBUG #include #define UI_LOG(...) printf("[ui] " __VA_ARGS__ "\n") #else #define UI_LOG #endif /// Input handling of scrollbars. typedef struct uiScrollState { int scrollbar_handle_y_start; // y-coordinate of the scrollbar handle at the // start of the scroll. int table_offset_start; // Row offset of a table at the start of the scroll. bool scrolling; // Whether a scrollbar is being dragged. } uiScrollState; /// Input handling of mouse-down events. typedef struct uiMouseDownState { uiPtr widget; // The widget currently processing a mouse down event. uiPoint start_point; // Mouse position when the mouse went down. } uiMouseDownState; typedef struct uiLibrary { FontAtlas* font; uiScrollState scroll; uiMouseDownState mouse_down; uiMouseButtonState mouse_button_state[uiMouseButtonMax]; uiWidgetEvent widget_events[MaxWidgetEvents]; int num_widget_events; } uiLibrary; extern uiLibrary g_ui;