-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgui.cpp
More file actions
72 lines (55 loc) · 2.08 KB
/
gui.cpp
File metadata and controls
72 lines (55 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "gui.h"
#include <gtk/gtk.h>
GUIManager::GUIManager()
{
GtkApplication *app;
int status;
app = gtk_application_new ("org.dolphinhats.glitch", G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), 0, NULL);
g_object_unref (app);
}
GUIManager::~GUIManager()
{
//delete everything
}
void GUIManager::activate (GtkApplication* app, gpointer user_data)
{
GtkWidget *window;
GtkWidget *image;
GtkWidget *picker, *table, *label;
GtkWidget *imageBox;
GtkWidget *bbox;
GtkWidget *button;
window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Test Window");
gtk_window_set_default_size (GTK_WINDOW (window), 500, 500);
table = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (table), 10);
gtk_grid_set_row_homogeneous (GTK_GRID (table), true);
gtk_grid_set_baseline_row (GTK_GRID (table),0);
gtk_grid_set_column_spacing (GTK_GRID (table), 10);
gtk_grid_set_column_homogeneous (GTK_GRID (table), true);
gtk_container_add (GTK_CONTAINER (window), table);
label = gtk_label_new ("File:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (label, TRUE);
picker = gtk_file_chooser_button_new ("Pick a File",
GTK_FILE_CHOOSER_ACTION_OPEN);
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
gtk_grid_attach (GTK_GRID (table), picker, 1, 0, 1, 1);
imageBox = gtk_frame_new (NULL);
gtk_grid_attach (GTK_GRID (table), imageBox, 2, 0, 3, 3);
bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
gtk_grid_attach (GTK_GRID (table), bbox, 0, 2, 3, 1);
/*
button = gtk_button_new_with_label (("OK"));
gtk_container_add (GTK_CONTAINER (bbox), button);
g_signal_connect (G_OBJECT (button), "start",
G_CALLBACK (), NULL);
*/
//give file preview
//go
gtk_widget_show_all(window);
}