mirror of https://github.com/daleclack/My_GtkUi
Update text editor
This commit is contained in:
parent
1c103d31b2
commit
0a9ec3704d
|
@ -3,18 +3,37 @@
|
||||||
struct _TextEditor
|
struct _TextEditor
|
||||||
{
|
{
|
||||||
GtkApplicationWindow parent_instance;
|
GtkApplicationWindow parent_instance;
|
||||||
|
GtkWidget *header;
|
||||||
|
GtkWidget *main_box;
|
||||||
|
GtkWidget *text_view, *scrolled_win;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE(TextEditor, text_editor, GTK_TYPE_APPLICATION_WINDOW)
|
G_DEFINE_TYPE(TextEditor, text_editor, GTK_TYPE_APPLICATION_WINDOW)
|
||||||
|
|
||||||
static void text_editor_init(TextEditor *self)
|
static void text_editor_init(TextEditor *self)
|
||||||
{
|
{
|
||||||
|
// Use headerbar for title and more info
|
||||||
|
self->header = gtk_header_bar_new();
|
||||||
gtk_window_set_title(GTK_WINDOW(self), "Text editor");
|
gtk_window_set_title(GTK_WINDOW(self), "Text editor");
|
||||||
|
gtk_window_set_titlebar(GTK_WINDOW(self), self->header);
|
||||||
|
gtk_window_set_default_size(GTK_WINDOW(self), 800, 450);
|
||||||
|
|
||||||
|
// Create box for layouts
|
||||||
|
self->main_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
|
||||||
|
self->scrolled_win = gtk_scrolled_window_new();
|
||||||
|
|
||||||
|
// Create text view
|
||||||
|
self->text_view = gtk_text_view_new();
|
||||||
|
gtk_widget_set_hexpand(self->text_view, TRUE);
|
||||||
|
gtk_widget_set_vexpand(self->text_view, TRUE);
|
||||||
|
gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(self->scrolled_win), self->text_view);
|
||||||
|
|
||||||
|
gtk_box_append(GTK_BOX(self->main_box), self->scrolled_win);
|
||||||
|
gtk_window_set_child(GTK_WINDOW(self), self->main_box);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void text_editor_class_init(TextEditorClass *klass)
|
static void text_editor_class_init(TextEditorClass *klass)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEditor *text_editor_new()
|
TextEditor *text_editor_new()
|
||||||
|
|
Loading…
Reference in New Issue