Menus and connect_to_method in Gtk--
- From: Derek Wyatt <derek scar utoronto ca>
- To: gtk-list redhat com
- Subject: Menus and connect_to_method in Gtk--
- Date: Sat, 30 May 1998 20:23:25 -0400 (EDT)
Howdie.
My connect to methods don't seem to be working and i can't figure out why.
The actual menu works great. It displays wonderfully and is well behaved.
But...
I keep getting the same compilation error about the signal template... i'm
hoping someone can take a few minutes and help me out here.
Here's the error i get:
g++ -c -Wall menu.cc
menu.cc: In method `FileMenu::FileMenu()':
menu.cc:33: no matching function for call to `connect_to_method
(Signal_proxy0<void,Gtk_MenuItem> &, FileMenu *, int (FileMenu::*)())'
make: *** [menu.o] Error 1
Here's the code (I'm removing the irrelevent stuff):
-------------------- start window code -------------------------
class MasterWin : public Gtk_Window
{
MasterMenu menu;
public:
MasterWin();
MasterWin(gint x, gint y, gchar const *title);
gint delete_event_impl(GdkEventAny *);
void add(Gtk_Widget *w) { vbox.pack_start(w,FALSE,FALSE,0); }
};
MasterWin::MasterWin(gint x, gint y, gchar const *title)
{
add(&menu); // internal method to this class
menu.show();
}
----------------- end window code ------------------------------
----------------- start menu code ------------------------------
class FileMenu : public Gtk_Menu
{
Gtk_MenuItem *newFile, *open, *save, *saveAs, *quit;
public:
int quit_program(void);
FileMenu();
};
class MasterMenu : public Gtk_MenuBar
{
Gtk_MenuItem fileSub;
FileMenu fileMenu;
public:
MasterMenu();
};
MasterMenu::MasterMenu() : fileSub("File")
{
fileSub.show();
fileSub.set_submenu(&fileMenu);
append(&fileSub);
}
FileMenu::FileMenu()
{
append(newFile = new Gtk_MenuItem("New"));
append(open = new Gtk_MenuItem("Open"));
append(save = new Gtk_MenuItem("Save"));
append(saveAs = new Gtk_MenuItem("Save As"));
append(quit = new Gtk_MenuItem("Quit"));
newFile->show();
saveAs->show();
save->show();
open->show();
newFile->show();
quit->show();
connect_to_method(newFile->activate, this, &quit_program);
}
------------------------ end menu code -------------------------
THANKS!!!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]