UI text
authorJohn Tsiombikas <nuclear@member.fsf.org>
Mon, 3 Jul 2023 21:14:38 +0000 (00:14 +0300)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Mon, 3 Jul 2023 21:14:38 +0000 (00:14 +0300)
src/app.c
src/rtk.c

index d62ef60..a79777f 100644 (file)
--- a/src/app.c
+++ b/src/app.c
@@ -326,11 +326,21 @@ static void gui_blit(int x, int y, rtk_icon *icon)
 
 static void gui_drawtext(int x, int y, const char *str)
 {
+       use_font(uifont);
+       dtx_position(x, y);
+       dtx_color(0, 0, 0, 1);
+       dtx_string(str);
 }
 
 static void gui_textrect(const char *str, rtk_rect *rect)
 {
-       rect->x = rect->y = 0;
-       rect->width = 20;
-       rect->height = 10;/* TODO */
+       struct dtx_box dbox;
+
+       use_font(uifont);
+       dtx_string_box(str, &dbox);
+
+       rect->x = dbox.x;
+       rect->y = dbox.y;
+       rect->width = dbox.width;
+       rect->height = dbox.height;
 }
index 4049f88..fe1c649 100644 (file)
--- a/src/rtk.c
+++ b/src/rtk.c
@@ -687,6 +687,8 @@ static void draw_window(rtk_widget *w)
                        tbrect.width -= 2;
                        tbrect.height -= 2;
                        gfx.fill(&tbrect, COL_WINFRM);
+
+                       gfx.drawtext(tbrect.x, tbrect.y + tbrect.height - 1, w->any.text);
                }
 
                gfx.fill(&rect, COL_BG);