comparison third_party/raylib/custom.h @ 173:827c6ac504cd hg-web

Merged in default here.
author MrJuneJune <me@mrjunejune.com>
date Mon, 19 Jan 2026 18:59:10 -0800
parents 058de208e640
children
comparison
equal deleted inserted replaced
151:c033667da5f9 173:827c6ac504cd
1 #ifndef CUSTOM_UI
2 #define CUSTOM_UI
3
4 #include "dowa/dowa.h"
5 #include "third_party/raylib/include/raylib.h"
6
7 // ============================================================================
8 // COLOR SCHEME - Easily modifiable color palette
9 // ============================================================================
10
11 typedef struct {
12 Color primary; // Main accent color (Orange)
13 Color secondary; // Secondary background (Beige/Egg white)
14 Color background; // Main background (White)
15 Color text; // Text color (Black)
16 Color text_light; // Light text (White - for dark backgrounds)
17 Color border; // Border color
18 Color highlight; // Highlight/hover color
19 Color success; // Success indicator
20 Color error; // Error indicator
21 Color muted; // Muted/disabled elements
22 } ColorScheme;
23
24 // Global color scheme - initialize with PostDog_InitColorScheme()
25 extern ColorScheme g_colors;
26
27 void PostDog_InitColorScheme(void);
28 void PostDog_SetColorScheme(ColorScheme scheme);
29
30 // Predefined color schemes
31 ColorScheme PostDog_DefaultColorScheme(void);
32 ColorScheme PostDog_DarkColorScheme(void);
33
34 // ============================================================================
35 // FUNCTIONALITY HELPERS
36 // ============================================================================
37
38 void DefaultBehaviours(void);
39 void IncreaseFontSize(void);
40 void DecreaseFontSize(void);
41
42 // ============================================================================
43 // LAYOUT HELPERS
44 // ============================================================================
45
46 Rectangle RightOf(Rectangle ref, float padding);
47 Rectangle Below(Rectangle ref, float padding);
48 Rectangle LeftColumn(Rectangle container, float ratio, float padding);
49 Rectangle RightColumn(Rectangle container, Rectangle leftCol, float padding);
50 Rectangle HorizontalSplit(Rectangle container, float ratio);
51 Rectangle VerticalSplit(Rectangle container, float ratio);
52 Rectangle AddPadding(Rectangle rect, float padding);
53 Rectangle AddPaddingAll(Rectangle rect, float top, float right, float down, float left);
54 Rectangle AddPaddingHorizontal(Rectangle rect, float padding);
55 Rectangle AddPaddingVertical(Rectangle rect, float padding);
56
57 // ============================================================================
58 // DRAWING HELPERS
59 // ============================================================================
60
61 void DrawRectangleSelectiveRounded(Rectangle rec, float radius, int segments, Color color,
62 boolean roundTL, boolean roundTR, boolean roundBR, boolean roundBL);
63 void DrawRectangleSelectiveRoundedLines(Rectangle rec, float radius, int segments, Color color,
64 boolean roundTL, boolean roundTR, boolean roundBR, boolean roundBL);
65
66 // ============================================================================
67 // CUSTOM TAB COMPONENT
68 // ============================================================================
69
70 // Tab configuration
71 typedef struct {
72 const char **labels; // Array of tab labels
73 int count; // Number of tabs
74 int *active_tab; // Pointer to active tab index
75 float padding; // Padding between tabs
76 float corner_radius; // Corner radius for rounded tabs
77 Color active_color; // Color for active tab
78 Color inactive_color; // Color for inactive tab
79 Color text_color; // Text color
80 Color active_text_color; // Text color for active tab
81 } TabConfig;
82
83 // Draw tabs and return true if active tab changed
84 // Usage: PostDog_TabBar(bounds, config) where config contains all tab settings
85 boolean PostDog_TabBar(Rectangle bounds, TabConfig config);
86
87 // Simplified tab bar - uses default styling from color scheme
88 // Returns true if tab changed
89 boolean PostDog_TabBarSimple(Rectangle bounds, const char **labels, int count, int *active_tab);
90
91 // ============================================================================
92 // COMBINED INPUT COMPONENTS
93 // ============================================================================
94
95 // Dropdown + TextBox combined component
96 // Draws a dropdown on the left, text input on the right, with shared rounded border
97 typedef struct {
98 // Dropdown settings
99 const char *dropdown_items; // Semicolon-separated items: "GET;POST;PUT;DELETE"
100 int *dropdown_active; // Pointer to active dropdown index
101 boolean *dropdown_edit_mode; // Pointer to dropdown edit mode state
102 float dropdown_width; // Width of dropdown (ratio 0.0-1.0 or absolute if > 1.0)
103
104 // TextBox settings
105 char *text_buffer; // Text buffer for input
106 int text_buffer_size; // Size of text buffer
107 boolean *text_edit_mode; // Pointer to text edit mode state
108
109 // Styling
110 float corner_radius;
111 Color background_color;
112 Color border_color;
113 Color text_color;
114
115 // Optional: per-item colors for dropdown (NULL to use default text_color)
116 Color *item_colors; // Array of colors matching dropdown items count
117 int item_count; // Number of items (required if item_colors is set)
118 } DropdownTextBoxConfig;
119
120 boolean PostDog_DropdownTextBox(Rectangle bounds, DropdownTextBoxConfig config);
121
122 // ============================================================================
123 // PANEL COMPONENTS
124 // ============================================================================
125
126 // Split panel - two panels side by side with shared rounded border
127 typedef struct {
128 float split_ratio; // 0.0-1.0, ratio of left panel
129 float corner_radius;
130 Color left_color;
131 Color right_color;
132 Color border_color;
133 float gap; // Gap between panels (0 for seamless)
134 } SplitPanelConfig;
135
136 // Returns rectangles for left and right content areas
137 void PostDog_SplitPanel(Rectangle bounds, SplitPanelConfig config,
138 Rectangle *out_left, Rectangle *out_right);
139
140 // Draw split panel background only (for custom content)
141 void PostDog_SplitPanelDraw(Rectangle bounds, SplitPanelConfig config);
142
143 #endif // CUSTOM_UI