feat(bar): 实现 bar_draw 渲染骨架及文字排版绘制接口

This commit is contained in:
2026-06-08 22:57:34 +08:00
parent 62f6bab611
commit 8c145fb1b4
5 changed files with 126 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
#include <cairo.h>
#include <stddef.h>
#include <stdint.h>
#include <zdwm/bar.h>
#include <zdwm/types.h>
@@ -92,3 +93,32 @@ void bar_cleanup(bar_t *bar) {
p_delete(&bar->bars);
bar->count = 0;
}
static void bar_draw_item(
zdwm_bar_item_t *item,
text_context_t *context,
cairo_t *cr,
int32_t width,
int32_t height
) {
/* TODO: */
}
void bar_draw(bar_t *bar) {
auto ctx = bar->ctx;
for (size_t i = 0; i < bar->count; ++i) {
auto bar_output = &bar->bars[i];
auto cr = bar_output->cr;
auto width = bar_output->width;
auto height = bar_output->height;
for (size_t j = 0; j < ZDWM_BAR_SIDE_COUNT; ++j) {
auto side = &bar_output->sides[j];
for (size_t k = 0; k < side->count; ++k) {
auto item = &side->items[k];
bar_draw_item(item, ctx, cr, width, height);
}
}
}
}