Update gtk41
This commit is contained in:
parent
5a89260798
commit
e092956d3a
|
@ -33,7 +33,15 @@
|
|||
<property name="show-close-button">True</property>
|
||||
<property name="decoration-layout">close,minimize,maximize:icon</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkButton" id="btnsize">
|
||||
<property name="label" translatable="yes">Win size</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
|
|
@ -26,7 +26,16 @@
|
|||
</object>
|
||||
</child>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="title" translatable="yes">gtk41</property>
|
||||
<property name="show-close-button">True</property>
|
||||
<property name="decoration-layout">close,minimize,maximize:icon</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
#include <gtk/gtk.h>
|
||||
#include "res/winpe.xpm"
|
||||
|
||||
void get_winsize(GtkWidget *widget,GtkWindow *window){
|
||||
gint width,height;
|
||||
gtk_window_get_size(window,&width,&height);
|
||||
g_print("%d %d\n",width,height);
|
||||
}
|
||||
|
||||
gboolean window_resize(GtkWidget *widget,GdkEvent *event,GtkBuilder *builder){
|
||||
//Get window size
|
||||
gint width,height;
|
||||
|
@ -22,6 +28,9 @@ static void gtkmain(GtkApplication *app,gpointer user_data){
|
|||
GtkBuilder *builder=gtk_builder_new_from_file("res/window.ui");
|
||||
GObject *window=gtk_builder_get_object(builder,"window");
|
||||
gtk_application_add_window(app,GTK_WINDOW(window));
|
||||
//Get window size
|
||||
GObject *btnsize=gtk_builder_get_object(builder,"btnsize");
|
||||
g_signal_connect(btnsize,"clicked",G_CALLBACK(get_winsize),window);
|
||||
gtk_widget_show_all(GTK_WIDGET(window));
|
||||
g_signal_connect(window,"window-state-event",G_CALLBACK(window_resize),builder);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue