Files
kryon/include/ui_scroll.h
T

96 lines
2.4 KiB
C

#ifndef UI_SCROLL_H
#define UI_SCROLL_H
#include "kryon_compat.generated.h"
typedef struct {
Rectangle bounds;
int content_height;
int content_x;
int content_width;
int *scroll_offset;
int wheel_step;
int scrollbar_x;
} UIScrollArea;
typedef struct {
int content_x;
int content_y;
int content_w;
int viewport_h;
int content_h;
int max_scroll;
} UIScrollView;
typedef int (*UIScrollPageHeightFn)(int content_width, void *user_data);
typedef struct {
int y;
int height;
int max_content_width;
int min_content_width;
int side_padding;
int *scroll_offset;
int wheel_step;
int scrollbar_x;
int measure_passes;
UIScrollPageHeightFn content_height;
void *user_data;
} UIScrollPageSpec;
typedef struct {
UIScrollArea area;
UIScrollView view;
int content_x;
int content_y;
int content_w;
int content_h;
} UIScrollPage;
typedef int (*UIScreenScaffoldTitleFn)(const char *title, int height,
void *user_data);
typedef struct {
const char *title;
int title_height;
int top_gap;
int bottom_reserved;
int max_content_width;
int min_content_width;
int side_padding;
int *scroll_offset;
int wheel_step;
int scrollbar_x;
int measure_passes;
UIScrollPageHeightFn content_height;
void *user_data;
UIScreenScaffoldTitleFn draw_title;
void *title_user_data;
} UIScreenScaffoldSpec;
typedef struct {
int closed;
int title_height;
int content_y;
int content_h;
UIScrollPage page;
int content_x;
int content_w;
int y;
} UIScreenScaffold;
int GetUIScrollbarReservedWidth(int max_scroll);
int GetUIScrollbarContentWidth(int content_width, int max_scroll);
int GetUIScrollbarSafeContentWidth(int content_x, int content_width,
int scrollbar_x, int max_scroll);
UIScrollView MeasureUIScrollContainer(UIScrollArea area);
UIScrollView BeginUIScrollContainer(UIScrollArea area);
void EndUIScrollContainer(UIScrollArea area, UIScrollView view);
void EnsureUIScrollRectVisible(UIScrollArea area, Rectangle rect, int margin);
UIScrollPage BeginUIScrollPage(UIScrollPageSpec spec);
void EndUIScrollPage(UIScrollPage page);
UIScreenScaffold BeginUIScreenScaffold(UIScreenScaffoldSpec spec);
void EndUIScreenScaffold(UIScreenScaffold scaffold);
#endif