aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-03-03 11:16:45 +0100
committerThomas White <taw@physics.org>2020-07-29 18:42:24 +0200
commit0cc363a630b80f44fa1367cb50fcd9f2f1669e2d (patch)
tree645075e21f5e819d49a17e7bb1940871695f2e3c
parent3b607da513b05e6c5ae47b4da722c9788894297c (diff)
Add buttons in icon region
-rw-r--r--src/crystfel_gui.c48
1 files changed, 46 insertions, 2 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c
index e67ff7f6..10070e38 100644
--- a/src/crystfel_gui.c
+++ b/src/crystfel_gui.c
@@ -264,6 +264,44 @@ static void load_image_list(struct crystfelproject *proj, const char *filename)
}
+static void add_button(GtkWidget *vbox, const char *label, const char *imagen,
+ GCallback callback, struct crystfelproject *proj)
+{
+ GtkWidget *button;
+ GtkWidget *image;
+
+ button = gtk_button_new_with_label(label);
+ g_object_set(G_OBJECT(button), "image-position", GTK_POS_TOP, NULL);
+ image = gtk_image_new_from_icon_name(imagen, GTK_ICON_SIZE_DIALOG);
+ g_object_set(G_OBJECT(button), "image", image, NULL);
+ g_object_set(G_OBJECT(button), "always-show-image", TRUE, NULL);
+ gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
+ gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(button), FALSE, FALSE, 4);
+
+ if ( callback != NULL ) {
+ g_signal_connect(G_OBJECT(button), "clicked",
+ G_CALLBACK(callback), proj);
+ }
+}
+
+
+static void add_task_buttons(GtkWidget *vbox, struct crystfelproject *proj)
+{
+ add_button(vbox, "Find data", "folder-pictures",
+ G_CALLBACK(NULL), proj);
+ add_button(vbox, "Peak detection", "edit-find",
+ G_CALLBACK(NULL), proj);
+ add_button(vbox, "Determine unit cell", "document-page-setup",
+ G_CALLBACK(NULL), proj);
+ add_button(vbox, "Index and integrate", "system-run",
+ G_CALLBACK(NULL), proj);
+ add_button(vbox, "Merge", "applications-science",
+ G_CALLBACK(NULL), proj);
+ add_button(vbox, "Figures of merit", "trophy-gold",
+ G_CALLBACK(NULL), proj);
+}
+
+
int main(int argc, char *argv[])
{
int c;
@@ -380,11 +418,17 @@ int main(int argc, char *argv[])
gtk_paned_pack2(GTK_PANED(hpaned), GTK_WIDGET(frame), TRUE, TRUE);
/* Icon region at left */
- proj.icons = gtk_drawing_area_new();
+ proj.icons = gtk_vbox_new(FALSE, 0.0);
+ scroll = gtk_scrolled_window_new(NULL, NULL);
+ gtk_container_set_border_width(GTK_CONTAINER(proj.icons), 16);
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
frame = gtk_frame_new(NULL);
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
- gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(proj.icons));
+ gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(scroll));
+ gtk_container_add(GTK_CONTAINER(scroll), GTK_WIDGET(proj.icons));
gtk_paned_pack1(GTK_PANED(hpaned), GTK_WIDGET(frame), FALSE, FALSE);
+ add_task_buttons(proj.icons, &proj);
/* Report (text) region at bottom */
proj.report = gtk_text_view_new();