aboutsummaryrefslogtreecommitdiff
path: root/src/stardict-view.h
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-07-09 20:18:01 +0200
committerPřemysl Eric Janouch <p@janouch.name>2021-10-15 11:46:09 +0200
commit9d7bc2a839b5f5200489a64c348acc02ee6ceb8f (patch)
treee4f0bcf6d5c4a10dd0457c294a462ab403a08458 /src/stardict-view.h
parentf812fae922eec06235c9e566b78c7f0fb46a709b (diff)
downloadtdv-9d7bc2a839b5f5200489a64c348acc02ee6ceb8f.tar.gz
tdv-9d7bc2a839b5f5200489a64c348acc02ee6ceb8f.tar.xz
tdv-9d7bc2a839b5f5200489a64c348acc02ee6ceb8f.zip
sdgtk: add and use a custom listview widget
Nothing in GTK+ appears to be suited for what are virtually infinite lists. Our workaround with GtkLabel and GtkScrolledWindow has been heavily suboptimal and needs to be replaced. Use Pango directly to handle our relatively simple needs. Upgrades: - the widget can be scrolled, - keywords are repeated for each definition line, - definition lines are now wrapped, and support 'g' and 'x' fields. Downgrades: - text can no longer be selected, so far.
Diffstat (limited to 'src/stardict-view.h')
-rw-r--r--src/stardict-view.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/stardict-view.h b/src/stardict-view.h
new file mode 100644
index 0000000..206238b
--- /dev/null
+++ b/src/stardict-view.h
@@ -0,0 +1,34 @@
+/*
+ * StarDict GTK+ UI - dictionary view component
+ *
+ * Copyright (c) 2021, Přemysl Eric Janouch <p@janouch.name>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifndef STARDICT_VIEW_H
+#define STARDICT_VIEW_H
+
+#include <gtk/gtk.h>
+
+#include "stardict.h"
+
+#define STARDICT_TYPE_VIEW (stardict_view_get_type ())
+G_DECLARE_FINAL_TYPE (StardictView, stardict_view, STARDICT, VIEW, GtkWidget)
+
+GtkWidget *stardict_view_new (void);
+void stardict_view_set_position (StardictView *view,
+ StardictDict *dict, guint position);
+void stardict_view_set_matched (StardictView *view, const gchar *matched);
+
+#endif // ! STARDICT_VIEW_H