Bonsoir,

Comme je n'arrive pas à generer du code C++ depuis Glade, je vais tenter de m'y coller directement à la main.
Pour ce faire, j'ai déjà édité le code en C, et je m'en sert de source pour faire mon fichier ihm.cpp
Pour le moment, la fenetre se résume à une barre de menu, un treeview (encore pas regardé dans le détail d'ailleurs) et un ou deux boutons.

le code est le suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
 
//fichier test de l'interface en C++ d'apres les données Generées par Glade en C
 
#include <string.h>
#include <stdio.h>
 
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
 
#define GLADE_HOOKUP_OBJECT(component,widget,name) \
  g_object_set_data_full (G_OBJECT (component), name, \
    gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
 
#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
  g_object_set_data (G_OBJECT (component), name, widget)
 
class ihm {
 
	private :
 
		GtkWidget *window;
		GtkWidget *vbox1;
		GtkWidget *menubar1;
		GtkWidget *menuitem1;
		GtkWidget *menuitem1_menu;
		GtkWidget *nouveau1;
		GtkWidget *ouvrir1;
		GtkWidget *enregistrer1;
		GtkWidget *enregistrer_sous1;
		GtkWidget *separatormenuitem1;
		GtkWidget *quitter1;
		GtkWidget *menuitem2;
		GtkWidget *menuitem2_menu;
		GtkWidget *couper1;
		GtkWidget *copier1;
		GtkWidget *coller1;
		GtkWidget *supprimer1;
		GtkWidget *menuitem3;
		GtkWidget *menuitem4;
		GtkWidget *menuitem4_menu;
		GtkWidget *about1;
		GtkWidget *hbox1;
		GtkWidget *vbox2;
		GtkWidget *scrolledwindow1;
		GtkWidget *treeview;
		GtkWidget *hbox2;
		GtkWidget *toolbar1;
		GtkIconSize tmp_toolbar_icon_size;
		GtkWidget *toolbar2;
		GtkWidget *toolitem1;
		GtkWidget *button1;
		GtkAccelGroup *accel_group;
 
 
	public :
 
void on_nouveau1_activate(GtkMenuItem * menuitem,
                          gpointer user_data)
{
 
}
 
 
void on_ouvrir1_activate(GtkMenuItem * menuitem,
                         gpointer user_data)
{
 
}
 
 
void on_enregistrer1_activate(GtkMenuItem * menuitem,
                              gpointer user_data)
{
 
}
 
 
void on_enregistrer_sous1_activate(GtkMenuItem * menuitem,
                                   gpointer user_data)
{
 
}
 
 
void on_quitter1_activate(GtkMenuItem * menuitem,
                          gpointer user_data)
{
 
}
 
 
void on_couper1_activate(GtkMenuItem * menuitem,
                         gpointer user_data)
{
 
}
 
 
void on_copier1_activate(GtkMenuItem * menuitem,
                         gpointer user_data)
{
 
}
 
 
void on_coller1_activate(GtkMenuItem * menuitem,
                         gpointer user_data)
{
 
}
 
 
void on_supprimer1_activate(GtkMenuItem * menuitem,
                            gpointer user_data)
{
 
}
 
 
void on_about1_activate(GtkMenuItem * menuitem,
                        gpointer user_data)
{
 
}
 
 
void on_treeview_row_activated(GtkTreeView * treeview,
                               GtkTreePath * path,
                               GtkTreeViewColumn * column,
                               gpointer user_data)
{
 
}
 
//==============================================================//
 
 
		//Constructeur
		ihm(){
			accel_group = gtk_accel_group_new ();
 
			window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
			gtk_widget_set_size_request (window, 600, 400);
			gtk_window_set_title (GTK_WINDOW (window), "IN55_IHM");
 
			vbox1 = gtk_vbox_new (FALSE, 0);
			gtk_widget_show (vbox1);
			gtk_container_add (GTK_CONTAINER (window), vbox1);
 
			menubar1 = gtk_menu_bar_new ();
			gtk_widget_show (menubar1);
			gtk_box_pack_start (GTK_BOX (vbox1), menubar1, FALSE, FALSE, 0);
 
			menuitem1 = gtk_menu_item_new_with_mnemonic ("_File");
			gtk_widget_show (menuitem1);
			gtk_container_add (GTK_CONTAINER (menubar1), menuitem1);
 
			menuitem1_menu = gtk_menu_new ();
			gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem1), menuitem1_menu);
 
			nouveau1 = gtk_image_menu_item_new_from_stock ("gtk-new", accel_group);
			gtk_widget_show (nouveau1);
			gtk_container_add (GTK_CONTAINER (menuitem1_menu), nouveau1);
 
			ouvrir1 = gtk_image_menu_item_new_from_stock ("gtk-open", accel_group);
			gtk_widget_show (ouvrir1);
			gtk_container_add (GTK_CONTAINER (menuitem1_menu), ouvrir1);
 
			enregistrer1 = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group);
			gtk_widget_show (enregistrer1);
			gtk_container_add (GTK_CONTAINER (menuitem1_menu), enregistrer1);
 
			enregistrer_sous1 = gtk_image_menu_item_new_from_stock ("gtk-save-as", accel_group);
			gtk_widget_show (enregistrer_sous1);
			gtk_container_add (GTK_CONTAINER (menuitem1_menu), enregistrer_sous1);
 
			separatormenuitem1 = gtk_separator_menu_item_new ();
			gtk_widget_show (separatormenuitem1);
			gtk_container_add (GTK_CONTAINER (menuitem1_menu), separatormenuitem1);
			gtk_widget_set_sensitive (separatormenuitem1, FALSE);
 
			quitter1 = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group);
			gtk_widget_show (quitter1);
			gtk_container_add (GTK_CONTAINER (menuitem1_menu), quitter1);
 
			menuitem2 = gtk_menu_item_new_with_mnemonic ("_Edit");
			gtk_widget_show (menuitem2);
			gtk_container_add (GTK_CONTAINER (menubar1), menuitem2);
 
			menuitem2_menu = gtk_menu_new ();
			gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem2), menuitem2_menu);
 
			couper1 = gtk_image_menu_item_new_from_stock ("gtk-cut", accel_group);
			gtk_widget_show (couper1);
			gtk_container_add (GTK_CONTAINER (menuitem2_menu), couper1);
 
			copier1 = gtk_image_menu_item_new_from_stock ("gtk-copy", accel_group);
			gtk_widget_show (copier1);
			gtk_container_add (GTK_CONTAINER (menuitem2_menu), copier1);
 
			coller1 = gtk_image_menu_item_new_from_stock ("gtk-paste", accel_group);
			gtk_widget_show (coller1);
			gtk_container_add (GTK_CONTAINER (menuitem2_menu), coller1);
 
			supprimer1 = gtk_image_menu_item_new_from_stock ("gtk-delete", accel_group);
			gtk_widget_show (supprimer1);
			gtk_container_add (GTK_CONTAINER (menuitem2_menu), supprimer1);
 
			menuitem3 = gtk_menu_item_new_with_mnemonic ("_View");
			gtk_widget_show (menuitem3);
			gtk_container_add (GTK_CONTAINER (menubar1), menuitem3);
 
			menuitem4 = gtk_menu_item_new_with_mnemonic ("_Help");
			gtk_widget_show (menuitem4);
			gtk_container_add (GTK_CONTAINER (menubar1), menuitem4);
 
			menuitem4_menu = gtk_menu_new ();
			gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem4), menuitem4_menu);
 
			about1 = gtk_menu_item_new_with_mnemonic ("_About");
			gtk_widget_show (about1);
			gtk_container_add (GTK_CONTAINER (menuitem4_menu), about1);
 
			hbox1 = gtk_hbox_new (FALSE, 0);
			gtk_widget_show (hbox1);
			gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0);
 
			vbox2 = gtk_vbox_new (FALSE, 0);
			gtk_widget_show (vbox2);
			gtk_box_pack_start (GTK_BOX (hbox1), vbox2, TRUE, TRUE, 0);
 
			scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
			gtk_widget_show (scrolledwindow1);
			gtk_box_pack_start (GTK_BOX (vbox2), scrolledwindow1, TRUE, TRUE, 0);
			gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_SHADOW_IN);
 
			treeview = gtk_tree_view_new ();
			gtk_widget_show (treeview);
			gtk_container_add (GTK_CONTAINER (scrolledwindow1), treeview);
			gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
			gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
 
			hbox2 = gtk_hbox_new (FALSE, 0);
			gtk_widget_show (hbox2);
			gtk_box_pack_start (GTK_BOX (vbox2), hbox2, TRUE, TRUE, 0);
 
			toolbar1 = gtk_toolbar_new ();
			gtk_widget_show (toolbar1);
			gtk_box_pack_start (GTK_BOX (hbox2), toolbar1, FALSE, FALSE, 0);
			gtk_toolbar_set_style (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_BOTH);
			tmp_toolbar_icon_size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (toolbar1));
 
			toolbar2 = gtk_toolbar_new ();
			gtk_widget_show (toolbar2);
			gtk_box_pack_start (GTK_BOX (hbox2), toolbar2, FALSE, FALSE, 0);
			gtk_toolbar_set_style (GTK_TOOLBAR (toolbar2), GTK_TOOLBAR_BOTH);
			tmp_toolbar_icon_size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (toolbar2));
 
			toolitem1 = (GtkWidget*) gtk_tool_item_new ();
			gtk_widget_show (toolitem1);
			gtk_container_add (GTK_CONTAINER (toolbar2), toolitem1);
 
			button1 = gtk_button_new_with_mnemonic ("button1");
			gtk_widget_show (button1);
			gtk_container_add (GTK_CONTAINER (toolitem1), button1);
 
			g_signal_connect ((gpointer) nouveau1, "activate",
			                G_CALLBACK (on_nouveau1_activate),
			                NULL);
			g_signal_connect ((gpointer) ouvrir1, "activate",
			                G_CALLBACK (on_ouvrir1_activate),
			                NULL);
			g_signal_connect ((gpointer) enregistrer1, "activate",
			                G_CALLBACK (on_enregistrer1_activate),
			                NULL);
			g_signal_connect ((gpointer) enregistrer_sous1, "activate",
			                G_CALLBACK (on_enregistrer_sous1_activate),
			                NULL);
			g_signal_connect ((gpointer) quitter1, "activate",
			                G_CALLBACK (on_quitter1_activate),
			                NULL);
			g_signal_connect ((gpointer) couper1, "activate",
			                G_CALLBACK (on_couper1_activate),
			                NULL);
			g_signal_connect ((gpointer) copier1, "activate",
			                G_CALLBACK (on_copier1_activate),
			                NULL);
			g_signal_connect ((gpointer) coller1, "activate",
			                G_CALLBACK (on_coller1_activate),
			                NULL);
			g_signal_connect ((gpointer) supprimer1, "activate",
			                G_CALLBACK (on_supprimer1_activate),
			                NULL);
			g_signal_connect ((gpointer) about1, "activate",
			                G_CALLBACK (on_about1_activate),
			                NULL);
			g_signal_connect ((gpointer) treeview, "row_activated",
			                G_CALLBACK (on_treeview_row_activated),
			                NULL);
 
			/* Store pointers to all widgets, for use by lookup_widget(). */
			GLADE_HOOKUP_OBJECT_NO_REF (window, window, "window");
			GLADE_HOOKUP_OBJECT (window, vbox1, "vbox1");
			GLADE_HOOKUP_OBJECT (window, menubar1, "menubar1");
			GLADE_HOOKUP_OBJECT (window, menuitem1, "menuitem1");
			GLADE_HOOKUP_OBJECT (window, menuitem1_menu, "menuitem1_menu");
			GLADE_HOOKUP_OBJECT (window, nouveau1, "nouveau1");
			GLADE_HOOKUP_OBJECT (window, ouvrir1, "ouvrir1");
			GLADE_HOOKUP_OBJECT (window, enregistrer1, "enregistrer1");
			GLADE_HOOKUP_OBJECT (window, enregistrer_sous1, "enregistrer_sous1");
			GLADE_HOOKUP_OBJECT (window, separatormenuitem1, "separatormenuitem1");
			GLADE_HOOKUP_OBJECT (window, quitter1, "quitter1");
			GLADE_HOOKUP_OBJECT (window, menuitem2, "menuitem2");
			GLADE_HOOKUP_OBJECT (window, menuitem2_menu, "menuitem2_menu");
			GLADE_HOOKUP_OBJECT (window, couper1, "couper1");
			GLADE_HOOKUP_OBJECT (window, copier1, "copier1");
			GLADE_HOOKUP_OBJECT (window, coller1, "coller1");
			GLADE_HOOKUP_OBJECT (window, supprimer1, "supprimer1");
			GLADE_HOOKUP_OBJECT (window, menuitem3, "menuitem3");
			GLADE_HOOKUP_OBJECT (window, menuitem4, "menuitem4");
			GLADE_HOOKUP_OBJECT (window, menuitem4_menu, "menuitem4_menu");
			GLADE_HOOKUP_OBJECT (window, about1, "about1");
			GLADE_HOOKUP_OBJECT (window, hbox1, "hbox1");
			GLADE_HOOKUP_OBJECT (window, vbox2, "vbox2");
			GLADE_HOOKUP_OBJECT (window, scrolledwindow1, "scrolledwindow1");
			GLADE_HOOKUP_OBJECT (window, treeview, "treeview");
			GLADE_HOOKUP_OBJECT (window, hbox2, "hbox2");
			GLADE_HOOKUP_OBJECT (window, toolbar1, "toolbar1");
			GLADE_HOOKUP_OBJECT (window, toolbar2, "toolbar2");
			GLADE_HOOKUP_OBJECT (window, toolitem1, "toolitem1");
			GLADE_HOOKUP_OBJECT (window, button1, "button1");
 
			gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
		}
 
 
 
 
}
A la compilation et apres avoir (je le pense) ajouté toutes les libs GTK dans les propriétés du projet : voila les jolis messages du compilateur :

Code x : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
In constructor `ihm::ihm()': 
argument of type `void (ihm::)(GtkMenuItem*, void*)' does not match `void (*)()' 
argument of type `void (ihm::)(GtkMenuItem*, void*)' does not match `void (*)()' 
...

argument of type `void (ihm::)(GtkTreeView*, GtkTreePath*, GtkTreeViewColumn*, void*)' does not match `void (*)()' 
At Global Scope:
expected unqualified-id at end of input 
expected `,' or `;' at end of input 
[Build Error]  [ihm.o] Error 1

Donc si cela vous parle... merci d'éclairer ma lanterne...