From a9444597dca9240abbdb8b51199c7e5606592316 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Tue, 23 Apr 2024 07:03:24 +0200 Subject: [PATCH] searching for a GtkHeaderBar without .ui XML file --- Makefile | 1 + exec | Bin 21904 -> 16440 bytes main.c | 185 +++++++------------------------------------------------ 3 files changed, 22 insertions(+), 164 deletions(-) diff --git a/Makefile b/Makefile index 72a96b0..51c4dbb 100644 --- a/Makefile +++ b/Makefile @@ -23,3 +23,4 @@ install: run: ./exec +// gcc $( pkg-config --cflags gtk4 ) -o exec main.c $( pkg-config --libs gtk4 ) diff --git a/exec b/exec index 63bf388e1122656410a49389da78aa236bc3f646..a00a6281ac58805aced56af63fc6c66fd4c9e5cf 100755 GIT binary patch literal 16440 zcmeHOeUKEz74O?aKoB@U?XWx9QYtwp9T^*z3VK*^Ex%nZ^vd)Yh3UVlTK{khl z*j4OGHXS(A;0W;&q*jjTs~)R>=u9D34;1wpF~e!7igt6v7*T2=Qq-GBA(6G{j=2^j z${H+;dKX|;VAc>q1USUWc3#LBQIf0F=jCFIc`bROrf3*ZyB_++@3Zv$t1UgE`$WI@ z3rc$EF4PMNy^zo&dQkY2DESk8f=5!=OV)<~A-1S>#__R|Q}2M#J0RqVdWAeu^8Foe zo9dUTuUqK#2!lPspG0pI^%14|ZU;T|%RifFn74}h+{WRw@F!6*oUAFK_c!IutPyKU z>ut%QzTSaCTc#tSsvY@`_MA45?u(|{lZAXohcA)VB2iznw4${Ma!qN~m)7+DA>UB2 z&DYi<<+D;V9~(b39;exc&37`-4mOH?qx$MtT^05SO#MY!>=VkPJ|=8B`os&zd^i@v zu?P-K^WZ@F*$5zA495&ONC$b87D5KwwEzyZGgYE#ie=Ph%+vT>0{M&Jzj-{!)XUE0|N@?JQcX^V^ewJ!YKU|_28 zIwJUE4Wa5P60(xZrM0MHYFS-Q#7x;7&c#?l&T9!>Nz2i!uE(OLtSY7g+?=85CeUo8 z7rFhq5sNcfPGmqiZz_f<%Pe80%c+3Ls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8^d(|JV?_PJ!O3PlecEgJ9wf2V9tFQ0bY;W#fv9`zAVJ}ueZ zvjyJVK>nGxX6qgJc2u1qz@6fz8FL?cMMK4g^UB@e;x8ZIsGa8aH5;%~JCaP>gM4D-2hOu)T8}2J&rS`I`F3P6`Ozq2`?%V?H3%A|#so2!v z3DchY!0qav;miT|o%h&VpL9+;;1y6lm!NXjzin?`x6Sq#>P!Kyv#HYqw0Sw8!M1w`2E?}e$rg01Vq|i0R4~gc zT91ywcaGeUb1j?(br8lh%a-BNM?*|=OosNn+==BK812u8dV%vf2PdS4(>S8JtmRE- z@=-5#SbMR7IvdU9M>VT^#WgMbbEeu7A^e&0Mn==H=iq$KX&H*<25`_w1!1EN3pPXr zUCXBOmRGF+Z$3JLx?1+$Tt@vt@J18*XpKY!x+d#It+*UlVS9lfh~M^ zRR@kSOqb;iXZrhjyvF|&nE&%P3VtRiSTG}?u|sckQ2A4S&j{lZRA!@yenRWZxn=Pwy^=bL#%P-A>eRX`9F?>R{Sa$n*YzIO=$?XcX3kp9KaD#+mRV@C8F z8v<0b8ug6~x&KkEuY~Zi9)zNJU6KCfe!~smQAG5uIRQ`rePcrI zlQ>MrhSZ5~M&UgQ(U}~m zJm!<8zQ+?#O&*UzmU;)ksj5%y7Be6Pe}PX^f8WA@;_q9ikTuM}86bMX`aUYAzT_E= zcu|%h_op1niM7;;??Iuy#9#6<^%4X4dr(Y}^(VajsF?baC(C(%%)?Enj^86_H1!+( z0VUq36Zs+=4XEz_5Zd?-iM~wA_a){0ziN4*1^)uNO@_YQx9q$MOn}Ha)D$iJ6KLSt zk^bd=fSl*}pbo4|qv**zz6@OsQS{}U40&@# Create a suitable cairo image surface yourself. - #include -/* Surface to store current scribbles */ -static cairo_surface_t *surface = NULL; +static void print (GtkWidget *widget, gpointer data) {g_print (data);} -static void -clear_surface (void) -{ - cairo_t *cr; - - cr = cairo_create (surface); - - cairo_set_source_rgb (cr, 1, 1, 1); - cairo_paint (cr); - - cairo_destroy (cr); -} - -/* Create a new surface of the appropriate size to store our scribbles */ -static void -resize_cb (GtkWidget *widget, - int width, - int height, - gpointer data) -{ - if (surface) - { - cairo_surface_destroy (surface); - surface = NULL; - } - - if (gtk_native_get_surface (gtk_widget_get_native (widget))) - { - surface = gdk_surface_create_similar_surface (gtk_native_get_surface (gtk_widget_get_native (widget)), - CAIRO_CONTENT_COLOR, - gtk_widget_get_width (widget), - gtk_widget_get_height (widget)); - - /* Initialize the surface to white */ - clear_surface (); - } -} - -/* Redraw the screen from the surface. Note that the draw - * callback receives a ready-to-be-used cairo_t that is already - * clipped to only draw the exposed areas of the widget - */ -static void -draw_cb (GtkDrawingArea *drawing_area, - cairo_t *cr, - int width, - int height, - gpointer data) -{ - cairo_set_source_surface (cr, surface, 0, 0); - cairo_paint (cr); -} - -/* Draw a rectangle on the surface at the given position */ -static void -draw_brush (GtkWidget *widget, - double x, - double y) -{ - cairo_t *cr; - - /* Paint to the surface, where we store our state */ - cr = cairo_create (surface); - - cairo_rectangle (cr, x - 3, y - 3, 6, 6); - cairo_fill (cr); - - cairo_destroy (cr); - - /* Now invalidate the drawing area. */ - gtk_widget_queue_draw (widget); -} - -static double start_x; -static double start_y; - -static void -drag_begin (GtkGestureDrag *gesture, - double x, - double y, - GtkWidget *area) -{ - start_x = x; - start_y = y; - - draw_brush (area, x, y); -} - -static void -drag_update (GtkGestureDrag *gesture, - double x, - double y, - GtkWidget *area) -{ - draw_brush (area, start_x + x, start_y + y); -} - -static void -drag_end (GtkGestureDrag *gesture, - double x, - double y, - GtkWidget *area) -{ - draw_brush (area, start_x + x, start_y + y); -} - -static void -pressed (GtkGestureClick *gesture, - int n_press, - double x, - double y, - GtkWidget *area) -{ - clear_surface (); - gtk_widget_queue_draw (area); -} - -static void -close_window (void) -{ - if (surface) - cairo_surface_destroy (surface); -} - -static void -activate (GtkApplication *app, - gpointer user_data) -{ +static void activate (GtkApplication *app, gpointer user_data) { GtkWidget *window; - GtkWidget *frame; - GtkWidget *drawing_area; - GtkGesture *drag; - GtkGesture *press; + GtkWidget *grid; + GtkWidget *button; + GtkHeaderBar *titlebar; window = gtk_application_window_new (app); - gtk_window_set_title (GTK_WINDOW (window), "Drawing Area"); + gtk_window_set_title (GTK_WINDOW (window), "Window"); + gtk_widget_set_size_request (GTK_WINDOW (window), 100, 0); - g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL); + titlebar = gtk_header_bar_new(); + gtk_window_set_titlebar (GTK_WINDOW (window), titlebar); - frame = gtk_frame_new (NULL); - gtk_window_set_child (GTK_WINDOW (window), frame); + grid = gtk_grid_new (); + gtk_window_set_child (GTK_WINDOW (window), grid); - drawing_area = gtk_drawing_area_new (); - /* set a minimum size */ - gtk_widget_set_size_request (drawing_area, 100, 100); + button = gtk_button_new_with_label ("I"); + g_signal_connect (button, "clicked", G_CALLBACK (print), "I'm n°1\n"); + gtk_grid_attach (GTK_GRID (grid), button, 0, 0, 1, 1); - gtk_frame_set_child (GTK_FRAME (frame), drawing_area); + button = gtk_button_new_with_label ("II"); + g_signal_connect (button, "clicked", G_CALLBACK (print), "I'm n°2\n"); + gtk_grid_attach (GTK_GRID (grid), button, 1, 0, 1, 1); - gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area), draw_cb, NULL, NULL); - - g_signal_connect_after (drawing_area, "resize", G_CALLBACK (resize_cb), NULL); - - drag = gtk_gesture_drag_new (); - gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), GDK_BUTTON_PRIMARY); - gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (drag)); - g_signal_connect (drag, "drag-begin", G_CALLBACK (drag_begin), drawing_area); - g_signal_connect (drag, "drag-update", G_CALLBACK (drag_update), drawing_area); - g_signal_connect (drag, "drag-end", G_CALLBACK (drag_end), drawing_area); - - press = gtk_gesture_click_new (); - gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (press), GDK_BUTTON_SECONDARY); - gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (press)); - - g_signal_connect (press, "pressed", G_CALLBACK (pressed), drawing_area); + button = gtk_button_new_with_label ("Quit"); + g_signal_connect (button, "clicked", G_CALLBACK (print), "bye !...\n"); + g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); + gtk_grid_attach (GTK_GRID (grid), button, 0, 1, 2, 1); gtk_window_present (GTK_WINDOW (window)); } @@ -205,4 +63,3 @@ main (int argc, return status; } -