summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/html.c81
1 files changed, 78 insertions, 3 deletions
diff --git a/src/html.c b/src/html.c
index 6445abf..d6d1bf1 100644
--- a/src/html.c
+++ b/src/html.c
@@ -35,9 +35,51 @@ static const gchar *styles =
"border: 0 none;\n"
"}\n"
"body {\n"
- "background-color: #CFCFCF;\n"
+ "background-color: #AFAFAF;\n"
"font-family: sans-serif;\n"
"}\n"
+ "div.notebook-h {\n"
+ "clear: left;\n"
+ "position: relative;\n"
+ "padding: 0;\n"
+ "}\n"
+ "div.notebook-h > input {\n"
+ "display: none;\n"
+ "}\n"
+ "div.notebook-h > label {\n"
+ "display: block;\n"
+ "background-color: #9F9F9F;\n"
+ "color: #5F5F5F;\n"
+ "float: left;\n"
+ "margin: 0 3px 0 0;\n"
+ "border-width: 1px 1px 0 1px;\n"
+ "border-style: solid;\n"
+ "border-color: #8F8F8F;\n"
+ "border-radius: 3px 3px 0 0;\n"
+ "padding: 6px;\n"
+ "font-weight: bold;\n"
+ "position: relative;\n"
+ "top: 3px;\n"
+ "}\n"
+ "div.notebook-h > input:checked + label {\n"
+ "background-color: #CFCFCF;\n"
+ "color: #000000;\n"
+ "padding: 6px 6px 7px 6px;\n"
+ "border-color: #9F9F9F;\n"
+ "position: relative;\n"
+ "top: 0;\n"
+ "z-index: 1;\n"
+ "}\n"
+ "div.notebook-h > div {\n"
+ "display: none;\n"
+ "background-color: #CFCFCF;\n"
+ "clear: left;\n"
+ "border: 1px solid #9F9F9F;\n"
+ "border-radius: 0 0 3px 3px;\n"
+ "position: relative;\n"
+ "top: -1px;\n"
+ "margin: 0;\n"
+ "}\n"
"form input, form select {\n"
"border: 1px solid #9F9F9F;\n"
"border-radius: 3px;\n"
@@ -213,8 +255,23 @@ mq_html_notebook(gboolean vertical, const gchar *name, guint current_page, ...)
va_start(ap, current_page);
while ((child = va_arg(ap, gchar *)) &&
(tab_label = va_arg(ap, gchar *))) {
- /* TODO: Page ID and control CSS */
+ i_str = g_strdup_printf("%zu", i);
+ len += strlen("<div id=\"_tab-page_");
+ len += name_len;
+ len += strlen("_");
+ len += strlen(i_str);
+ len += strlen("\">\n");
len += strlen(child);
+ len += strlen("</div>\n<style>div.notebook-") + 1;
+ len += strlen(" > input#_tab_");
+ len += name_len;
+ len += strlen("_");
+ len += strlen(i_str);
+ len += strlen(":checked ~ div#_tab-page_");
+ len += name_len;
+ len += strlen("_");
+ len += strlen(i_str);
+ len += strlen(" {\ndisplay: block;\n}\n</style>\n");
}
va_end(ap);
len += strlen("</div>\n");
@@ -251,11 +308,29 @@ mq_html_notebook(gboolean vertical, const gchar *name, guint current_page, ...)
}
va_end(ap);
va_start(ap, current_page);
+ i = 0;
while ((child = va_arg(ap, gchar *)) &&
(tab_label = va_arg(ap, gchar *))) {
- /* TODO: Page ID and control CSS */
+ i_str = g_strdup_printf("%zu", i);
+ ptr = g_stpcpy(ptr, "<div id=\"_tab-page_");
+ ptr = g_stpcpy(ptr, name);
+ ptr = g_stpcpy(ptr, "_");
+ ptr = g_stpcpy(ptr, i_str);
+ ptr = g_stpcpy(ptr, "\">\n");
ptr = g_stpcpy(ptr, child);
g_free(child);
+ ptr = g_stpcpy(ptr, "</div>\n<style>div.notebook-");
+ ptr = g_stpcpy(ptr, vertical ? "v" : "h");
+ ptr = g_stpcpy(ptr, " > input#_tab_");
+ ptr = g_stpcpy(ptr, name);
+ ptr = g_stpcpy(ptr, "_");
+ ptr = g_stpcpy(ptr, i_str);
+ ptr = g_stpcpy(ptr, ":checked ~ div#_tab-page_");
+ ptr = g_stpcpy(ptr, name);
+ ptr = g_stpcpy(ptr, "_");
+ ptr = g_stpcpy(ptr, i_str);
+ ptr = g_stpcpy(ptr, " {\ndisplay: block;\n}\n</style>\n");
+ ++i;
}
va_end(ap);
ptr = g_stpcpy(ptr, "</div>\n"); /* g_stpcpy() adds the NUL. */