+ draw_titlebar();
+ draw_tabs();
+}
+
+static void draw_titlebar()
+{
+}
+
+static void draw_tabs()
+{
+}
+
+static void layout_text(const char *text)
+{
+ text_lines.clear();
+ if(!text) return;
+ if(!ui_font) return;
+
+ dtx_use_font(ui_font, ui_font_size);
+
+ float pos = text_padding;
+ text_lines.push_back(text);
+ const char *last_break = 0;
+
+ while(*text) {
+ if(*text == '\n') { // paragraph break
+ text_lines.push_back(text);
+ text_lines.push_back(++text);
+ pos = text_padding;
+ last_break = 0;
+ continue;
+ }
+
+ int code = dtx_utf8_char_code(text);
+ const char *next = dtx_utf8_next_char((char*)text);
+ pos += dtx_glyph_width(code);
+
+ if(pos >= size.x - text_padding) {
+ if(text == text_lines.back()) {
+ // not even a single character fits on a line... abort
+ warning_log("text layout failed. glyph %d doesn't fit in line (%g)\n", code, size.x - 2.0 * text_padding);
+ text_lines.clear();
+ return;
+ }
+ if(last_break) {
+ text_lines.push_back(last_break + 1);
+ last_break = 0;
+ } else {
+ // no good point to break, just break here
+ text_lines.push_back(text);
+ }
+ pos = text_padding;
+ }
+ text = next;
+ }