summaryrefslogtreecommitdiff
path: root/tests/testrevealer.c
blob: 0a97193587a8ef620069114fc1b4cbc9b7fbcf71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#include <gtk/gtk.h>

int
main (int argc,
      char ** argv)
{
  GtkWidget *window, *revealer, *box, *widget, *entry;

  gtk_init ();

  window = gtk_window_new ();
  gtk_widget_set_size_request (window, 300, 300);

  box = gtk_grid_new ();
  gtk_window_set_child (GTK_WINDOW (window), box);

  widget = gtk_label_new ("Some filler text to avoid\nresizing of the window");
  gtk_widget_set_margin_top (widget, 10);
  gtk_widget_set_margin_bottom (widget, 10);
  gtk_widget_set_margin_start (widget, 10);
  gtk_widget_set_margin_end (widget, 10);
  gtk_grid_attach (GTK_GRID (box), widget, 1, 1, 1, 1);

  widget = gtk_label_new ("Some filler text to avoid\nresizing of the window");
  gtk_widget_set_margin_top (widget, 10);
  gtk_widget_set_margin_bottom (widget, 10);
  gtk_widget_set_margin_start (widget, 10);
  gtk_widget_set_margin_end (widget, 10);
  gtk_grid_attach (GTK_GRID (box), widget, 4, 4, 1, 1);

  widget = gtk_toggle_button_new_with_label ("None");
  gtk_grid_attach (GTK_GRID (box), widget, 0, 0, 1, 1);
  revealer = gtk_revealer_new ();
  gtk_widget_set_halign (revealer, GTK_ALIGN_START);
  gtk_widget_set_valign (revealer, GTK_ALIGN_START);
  entry = gtk_entry_new ();
  gtk_editable_set_text (GTK_EDITABLE (entry), "00000");
  gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
  g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
  gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_NONE);
  gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
  gtk_grid_attach (GTK_GRID (box), revealer, 1, 0, 1, 1);

  widget = gtk_toggle_button_new_with_label ("Fade");
  gtk_grid_attach (GTK_GRID (box), widget, 5, 5, 1, 1);
  revealer = gtk_revealer_new ();
  gtk_widget_set_halign (revealer, GTK_ALIGN_END);
  gtk_widget_set_valign (revealer, GTK_ALIGN_END);
  entry = gtk_entry_new ();
  gtk_editable_set_text (GTK_EDITABLE (entry), "00000");
  gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
  g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
  gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_CROSSFADE);
  gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
  gtk_grid_attach (GTK_GRID (box), revealer, 4, 5, 1, 1);

  widget = gtk_toggle_button_new_with_label ("Slide");
  gtk_grid_attach (GTK_GRID (box), widget, 0, 2, 1, 1);
  revealer = gtk_revealer_new ();
  gtk_widget_set_hexpand (revealer, TRUE);
  gtk_widget_set_halign (revealer, GTK_ALIGN_START);
  entry = gtk_entry_new ();
  gtk_editable_set_text (GTK_EDITABLE (entry), "12345");
  gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
  g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
  gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT);
  gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
  gtk_grid_attach (GTK_GRID (box), revealer, 1, 2, 1, 1);

  widget = gtk_toggle_button_new_with_label ("Swing");
  gtk_widget_set_valign (widget, GTK_ALIGN_START);
  gtk_grid_attach (GTK_GRID (box), widget, 0, 3, 1, 1);
  revealer = gtk_revealer_new ();
  gtk_widget_set_hexpand (revealer, TRUE);
  gtk_widget_set_halign (revealer, GTK_ALIGN_START);
  gtk_widget_set_valign (revealer, GTK_ALIGN_START);
  entry = gtk_entry_new ();
  gtk_editable_set_text (GTK_EDITABLE (entry), "12345");
  gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
  g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
  gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SWING_RIGHT);
  gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
  gtk_grid_attach (GTK_GRID (box), revealer, 1, 3, 1, 1);

  widget = gtk_toggle_button_new_with_label ("Slide");
  gtk_grid_attach (GTK_GRID (box), widget, 2, 0, 1, 1);
  revealer = gtk_revealer_new ();
  gtk_widget_set_vexpand (revealer, TRUE);
  gtk_widget_set_valign (revealer, GTK_ALIGN_START);
  entry = gtk_entry_new ();
  gtk_editable_set_text (GTK_EDITABLE (entry), "23456");
  gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
  g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
  gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
  gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
  gtk_grid_attach (GTK_GRID (box), revealer, 2, 1, 1, 1);

  widget = gtk_toggle_button_new_with_label ("Swing");
  gtk_grid_attach (GTK_GRID (box), widget, 3, 0, 1, 1);
  revealer = gtk_revealer_new ();
  gtk_widget_set_vexpand (revealer, TRUE);
  gtk_widget_set_valign (revealer, GTK_ALIGN_START);
  entry = gtk_entry_new ();
  gtk_editable_set_text (GTK_EDITABLE (entry), "23456");
  gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
  g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
  gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SWING_DOWN);
  gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
  gtk_grid_attach (GTK_GRID (box), revealer, 3, 1, 1, 1);

  widget = gtk_toggle_button_new_with_label ("Slide");
  gtk_grid_attach (GTK_GRID (box), widget, 5, 2, 1, 1);
  revealer = gtk_revealer_new ();
  gtk_widget_set_hexpand (revealer, TRUE);
  gtk_widget_set_halign (revealer, GTK_ALIGN_END);
  entry = gtk_entry_new ();
  gtk_editable_set_text (GTK_EDITABLE (entry), "34567");
  gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
  g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
  gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT);
  gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
  gtk_grid_attach (GTK_GRID (box), revealer, 4, 2, 1, 1);

  widget = gtk_toggle_button_new_with_label ("Swing");
  gtk_widget_set_valign (widget, GTK_ALIGN_START);
  gtk_grid_attach (GTK_GRID (box), widget, 5, 3, 1, 1);
  revealer = gtk_revealer_new ();
  gtk_widget_set_hexpand (revealer, TRUE);
  gtk_widget_set_halign (revealer, GTK_ALIGN_END);
  gtk_widget_set_valign (revealer, GTK_ALIGN_START);
  entry = gtk_entry_new ();
  gtk_editable_set_text (GTK_EDITABLE (entry), "34567");
  gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
  g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
  gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SWING_LEFT);
  gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
  gtk_grid_attach (GTK_GRID (box), revealer, 4, 3, 1, 1);

  widget = gtk_toggle_button_new_with_label ("Slide");
  gtk_grid_attach (GTK_GRID (box), widget, 2, 5, 1, 1);
  revealer = gtk_revealer_new ();
  gtk_widget_set_vexpand (revealer, TRUE);
  gtk_widget_set_valign (revealer, GTK_ALIGN_END);
  entry = gtk_entry_new ();
  gtk_editable_set_text (GTK_EDITABLE (entry), "45678");
  gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
  g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
  gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP);
  gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
  gtk_grid_attach (GTK_GRID (box), revealer, 2, 4, 1, 1);

  widget = gtk_toggle_button_new_with_label ("Swing");
  gtk_grid_attach (GTK_GRID (box), widget, 3, 5, 1, 1);
  revealer = gtk_revealer_new ();
  gtk_widget_set_vexpand (revealer, TRUE);
  gtk_widget_set_valign (revealer, GTK_ALIGN_END);
  entry = gtk_entry_new ();
  gtk_editable_set_text (GTK_EDITABLE (entry), "45678");
  gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
  g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
  gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SWING_UP);
  gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
  gtk_grid_attach (GTK_GRID (box), revealer, 3, 4, 1, 1);

  gtk_widget_show (window);
  while (TRUE)
    g_main_context_iteration (NULL, TRUE);

  gtk_window_destroy (GTK_WINDOW (window));

  return 0;
}