mirror of https://github.com/daleclack/My_GtkUi
Update custom title bar
This commit is contained in:
parent
4501c1903b
commit
b81414180b
|
@ -108,7 +108,7 @@ static void calc_app_init(CalcApp *self)
|
||||||
self->title_bar = my_titlebar_new();
|
self->title_bar = my_titlebar_new();
|
||||||
gtk_window_set_title(GTK_WINDOW(self), "Calculator");
|
gtk_window_set_title(GTK_WINDOW(self), "Calculator");
|
||||||
gtk_window_set_icon_name(GTK_WINDOW(self), "calcapp");
|
gtk_window_set_icon_name(GTK_WINDOW(self), "calcapp");
|
||||||
my_titlebar_set_window(self->title_bar, GTK_WIDGET(self));
|
my_titlebar_set_window(self->title_bar, self);
|
||||||
|
|
||||||
// Link Signals
|
// Link Signals
|
||||||
g_signal_connect(self->btnanswer, "clicked", G_CALLBACK(btnanswer_clicked), self);
|
g_signal_connect(self->btnanswer, "clicked", G_CALLBACK(btnanswer_clicked), self);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "DrawApp.h"
|
#include "DrawApp.h"
|
||||||
#include "MyFinder.h"
|
#include "MyFinder.h"
|
||||||
#include "MyLimit.h"
|
#include "MyLimit.h"
|
||||||
|
#include "MyTitleBar.h"
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
@ -21,6 +22,9 @@ struct _DrawApp
|
||||||
{
|
{
|
||||||
GtkWindow parent_instance;
|
GtkWindow parent_instance;
|
||||||
|
|
||||||
|
// Custom Title Bar
|
||||||
|
MyTitleBar *title_bar;
|
||||||
|
|
||||||
// Child widgets
|
// Child widgets
|
||||||
GtkWidget *draw_area;
|
GtkWidget *draw_area;
|
||||||
GtkWidget *fill_check;
|
GtkWidget *fill_check;
|
||||||
|
@ -289,6 +293,8 @@ static void draw_app_init(DrawApp *self)
|
||||||
// Initalize window
|
// Initalize window
|
||||||
gtk_window_set_title(GTK_WINDOW(self), "Drawing App");
|
gtk_window_set_title(GTK_WINDOW(self), "Drawing App");
|
||||||
gtk_window_set_icon_name(GTK_WINDOW(self), "drawing_app");
|
gtk_window_set_icon_name(GTK_WINDOW(self), "drawing_app");
|
||||||
|
self->title_bar = my_titlebar_new();
|
||||||
|
my_titlebar_set_window(self->title_bar, self);
|
||||||
// gtk_window_set_default_size(GTK_WINDOW(self), 640, 480);
|
// gtk_window_set_default_size(GTK_WINDOW(self), 640, 480);
|
||||||
|
|
||||||
// Create widgets
|
// Create widgets
|
||||||
|
|
|
@ -20,7 +20,7 @@ static void ctrl_win_close(MyTitleBar *self)
|
||||||
gtk_window_close(GTK_WINDOW(self->ctrl_window));
|
gtk_window_close(GTK_WINDOW(self->ctrl_window));
|
||||||
}
|
}
|
||||||
|
|
||||||
void my_titlebar_set_window(MyTitleBar *self, GtkWidget *window)
|
void _my_titlebar_set_window(MyTitleBar *self, GtkWidget *window)
|
||||||
{
|
{
|
||||||
gtk_window_set_titlebar(GTK_WINDOW(window), self->header);
|
gtk_window_set_titlebar(GTK_WINDOW(window), self->header);
|
||||||
self->ctrl_window = window;
|
self->ctrl_window = window;
|
||||||
|
|
|
@ -2,8 +2,11 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#define my_titlebar_set_window(title_bar, window) \
|
||||||
|
_my_titlebar_set_window(My_TitleBar(title_bar), GTK_WIDGET(window))
|
||||||
|
|
||||||
G_DECLARE_FINAL_TYPE(MyTitleBar, my_titlebar, My, TitleBar, GObject)
|
G_DECLARE_FINAL_TYPE(MyTitleBar, my_titlebar, My, TitleBar, GObject)
|
||||||
|
|
||||||
void my_titlebar_set_window(MyTitleBar *title_bar, GtkWidget *window);
|
void _my_titlebar_set_window(MyTitleBar *title_bar, GtkWidget *window);
|
||||||
|
|
||||||
MyTitleBar *my_titlebar_new();
|
MyTitleBar *my_titlebar_new();
|
Loading…
Reference in New Issue