[gtk/wip/matthiasc/popup: 45/63] Add entries to testpopup
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/popup: 45/63] Add entries to testpopup
- Date: Mon, 4 Mar 2019 04:33:40 +0000 (UTC)
commit 44d6f939e4d6fe2caf944011c6f68b051423e226
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Feb 25 09:14:00 2019 -0500
Add entries to testpopup
This is to test focus handling.
tests/testpopup.c | 26 ++++++++------------------
1 file changed, 8 insertions(+), 18 deletions(-)
---
diff --git a/tests/testpopup.c b/tests/testpopup.c
index ba49c81036..ed669eddf3 100644
--- a/tests/testpopup.c
+++ b/tests/testpopup.c
@@ -1,29 +1,19 @@
#include <gtk/gtk.h>
-static void
-draw_popup (GtkDrawingArea *da,
- cairo_t *cr,
- int width,
- int height,
- gpointer data)
-{
- cairo_set_source_rgb (cr, 1, 0, 0);
- cairo_paint (cr);
-}
-
static gboolean
create_popup (GtkWidget *parent,
GtkWidget *label)
{
- GtkWidget *popup, *da;
+ GtkWidget *popup, *box;
popup = gtk_popup_new ();
gtk_popup_set_relative_to (GTK_POPUP (popup), label);
- da = gtk_drawing_area_new ();
- gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), draw_popup, NULL, NULL);
- gtk_container_add (GTK_CONTAINER (popup), da);
-
- gtk_widget_set_size_request (GTK_WIDGET (popup), 20, 20);
+ gtk_style_context_add_class (gtk_widget_get_style_context (popup), "background");
+ gtk_style_context_add_class (gtk_widget_get_style_context (popup), "frame");
+ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
+ gtk_container_add (GTK_CONTAINER (box), gtk_label_new ("Test"));
+ gtk_container_add (GTK_CONTAINER (box), gtk_entry_new ());
+ gtk_container_add (GTK_CONTAINER (popup), box);
gtk_widget_show (popup);
@@ -41,7 +31,7 @@ main (int argc, char *argv[])
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
- label = gtk_label_new ("x");
+ label = gtk_entry_new ();
gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (window), label);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]