mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
finish conversion to g_signal_* functions by using G_OBJECT and G_CALLBACK
2002-02-19 Sven Neumann <sven@gimp.org> * examples/*/*.c: finish conversion to g_signal_* functions by using G_OBJECT and G_CALLBACK and other assorted changes.
This commit is contained in:
parent
601302c7a3
commit
6dea3cae13
@ -1,3 +1,8 @@
|
||||
2002-02-19 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* examples/*/*.c: finish conversion to g_signal_* functions by
|
||||
using G_OBJECT and G_CALLBACK and other assorted changes.
|
||||
|
||||
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-02-19 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* examples/*/*.c: finish conversion to g_signal_* functions by
|
||||
using G_OBJECT and G_CALLBACK and other assorted changes.
|
||||
|
||||
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-02-19 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* examples/*/*.c: finish conversion to g_signal_* functions by
|
||||
using G_OBJECT and G_CALLBACK and other assorted changes.
|
||||
|
||||
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-02-19 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* examples/*/*.c: finish conversion to g_signal_* functions by
|
||||
using G_OBJECT and G_CALLBACK and other assorted changes.
|
||||
|
||||
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-02-19 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* examples/*/*.c: finish conversion to g_signal_* functions by
|
||||
using G_OBJECT and G_CALLBACK and other assorted changes.
|
||||
|
||||
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-02-19 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* examples/*/*.c: finish conversion to g_signal_* functions by
|
||||
using G_OBJECT and G_CALLBACK and other assorted changes.
|
||||
|
||||
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-02-19 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* examples/*/*.c: finish conversion to g_signal_* functions by
|
||||
using G_OBJECT and G_CALLBACK and other assorted changes.
|
||||
|
||||
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
|
||||
|
@ -37,8 +37,8 @@ int main( int argc,
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Arrow Buttons");
|
||||
|
||||
/* It's a good idea to do this for all windows. */
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
|
||||
/* Sets the border width of the window. */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
@ -11,8 +11,8 @@ int main( int argc,
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame");
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
/* Create an aspect_frame and add it to our toplevel window */
|
||||
|
@ -9,7 +9,7 @@ int main( int argc,
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_show (window);
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
|
@ -28,13 +28,13 @@ GtkWidget *create_bbox( gint horizontal,
|
||||
gtk_box_set_spacing (GTK_BOX (bbox), spacing);
|
||||
/*gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), child_w, child_h);*/
|
||||
|
||||
button = gtk_button_new_with_label ("OK");
|
||||
button = gtk_button_new_from_stock (GTK_STOCK_OK);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
|
||||
button = gtk_button_new_with_label ("Cancel");
|
||||
button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
|
||||
button = gtk_button_new_with_label ("Help");
|
||||
button = gtk_button_new_from_stock (GTK_STOCK_HELP);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
|
||||
return frame;
|
||||
@ -56,8 +56,8 @@ int main( int argc,
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Button Boxes");
|
||||
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (gtk_main_quit),
|
||||
NULL);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
@ -67,14 +67,12 @@ int main( int argc,
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Pixmap'd Buttons!");
|
||||
|
||||
#if 1
|
||||
/* It's a good idea to do this for all windows. */
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (exit), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
|
||||
g_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (exit), NULL);
|
||||
#endif
|
||||
g_signal_connect (G_OBJECT (window), "delete_event",
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
|
||||
/* Sets the border width of the window. */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
@ -84,8 +82,8 @@ int main( int argc,
|
||||
button = gtk_button_new ();
|
||||
|
||||
/* Connect the "clicked" signal of the button to our callback */
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (callback), (gpointer) "cool button");
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (callback), (gpointer) "cool button");
|
||||
|
||||
/* This calls our box creating function */
|
||||
box1 = xpm_label_box(window, "info.xpm", "cool button");
|
||||
|
@ -218,17 +218,17 @@ void calendar_select_font( GtkWidget *button,
|
||||
|
||||
gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
|
||||
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
&calendar->font_dialog);
|
||||
|
||||
g_signal_connect (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->ok_button),
|
||||
"clicked", GTK_SIGNAL_FUNC (calendar_font_selection_ok),
|
||||
g_signal_connect (G_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->ok_button),
|
||||
"clicked", G_CALLBACK (calendar_font_selection_ok),
|
||||
calendar);
|
||||
g_signal_connect_swapped (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->cancel_button),
|
||||
g_signal_connect_swapped (G_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->cancel_button),
|
||||
"clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
GTK_OBJECT (calendar->font_dialog));
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
calendar->font_dialog);
|
||||
}
|
||||
window=calendar->font_dialog;
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
@ -277,11 +277,11 @@ void create_calendar()
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "GtkCalendar Example");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 5);
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (gtk_main_quit),
|
||||
NULL);
|
||||
g_signal_connect (GTK_OBJECT (window), "delete-event",
|
||||
GTK_SIGNAL_FUNC (gtk_false),
|
||||
g_signal_connect (G_OBJECT (window), "delete-event",
|
||||
G_CALLBACK (gtk_false),
|
||||
NULL);
|
||||
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
@ -308,26 +308,26 @@ void create_calendar()
|
||||
calendar_set_flags (&calendar_data);
|
||||
gtk_calendar_mark_day (GTK_CALENDAR (calendar), 19);
|
||||
gtk_container_add( GTK_CONTAINER (frame), calendar);
|
||||
g_signal_connect (GTK_OBJECT (calendar), "month_changed",
|
||||
GTK_SIGNAL_FUNC (calendar_month_changed),
|
||||
g_signal_connect (G_OBJECT (calendar), "month_changed",
|
||||
G_CALLBACK (calendar_month_changed),
|
||||
&calendar_data);
|
||||
g_signal_connect (GTK_OBJECT (calendar), "day_selected",
|
||||
GTK_SIGNAL_FUNC (calendar_day_selected),
|
||||
g_signal_connect (G_OBJECT (calendar), "day_selected",
|
||||
G_CALLBACK (calendar_day_selected),
|
||||
&calendar_data);
|
||||
g_signal_connect (GTK_OBJECT (calendar), "day_selected_double_click",
|
||||
GTK_SIGNAL_FUNC (calendar_day_selected_double_click),
|
||||
g_signal_connect (G_OBJECT (calendar), "day_selected_double_click",
|
||||
G_CALLBACK (calendar_day_selected_double_click),
|
||||
&calendar_data);
|
||||
g_signal_connect (GTK_OBJECT (calendar), "prev_month",
|
||||
GTK_SIGNAL_FUNC (calendar_prev_month),
|
||||
g_signal_connect (G_OBJECT (calendar), "prev_month",
|
||||
G_CALLBACK (calendar_prev_month),
|
||||
&calendar_data);
|
||||
g_signal_connect (GTK_OBJECT (calendar), "next_month",
|
||||
GTK_SIGNAL_FUNC (calendar_next_month),
|
||||
g_signal_connect (G_OBJECT (calendar), "next_month",
|
||||
G_CALLBACK (calendar_next_month),
|
||||
&calendar_data);
|
||||
g_signal_connect (GTK_OBJECT (calendar), "prev_year",
|
||||
GTK_SIGNAL_FUNC (calendar_prev_year),
|
||||
g_signal_connect (G_OBJECT (calendar), "prev_year",
|
||||
G_CALLBACK (calendar_prev_year),
|
||||
&calendar_data);
|
||||
g_signal_connect (GTK_OBJECT (calendar), "next_year",
|
||||
GTK_SIGNAL_FUNC (calendar_next_year),
|
||||
g_signal_connect (G_OBJECT (calendar), "next_year",
|
||||
G_CALLBACK (calendar_next_year),
|
||||
&calendar_data);
|
||||
|
||||
|
||||
@ -347,18 +347,18 @@ void create_calendar()
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
toggle = gtk_check_button_new_with_label (flags[i].label);
|
||||
g_signal_connect (GTK_OBJECT (toggle),
|
||||
g_signal_connect (G_OBJECT (toggle),
|
||||
"toggled",
|
||||
GTK_SIGNAL_FUNC (calendar_toggle_flag),
|
||||
G_CALLBACK (calendar_toggle_flag),
|
||||
&calendar_data);
|
||||
gtk_box_pack_start (GTK_BOX (vbox3), toggle, TRUE, TRUE, 0);
|
||||
calendar_data.flag_checkboxes[i] = toggle;
|
||||
}
|
||||
/* Build the right font-button */
|
||||
button = gtk_button_new_with_label ("Font...");
|
||||
g_signal_connect (GTK_OBJECT (button),
|
||||
g_signal_connect (G_OBJECT (button),
|
||||
"clicked",
|
||||
GTK_SIGNAL_FUNC (calendar_select_font),
|
||||
G_CALLBACK (calendar_select_font),
|
||||
&calendar_data);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
||||
|
||||
@ -398,8 +398,8 @@ void create_calendar()
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
|
||||
|
||||
button = gtk_button_new_with_label ("Close");
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (gtk_main_quit),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
|
@ -92,10 +92,9 @@ int main( int argc,
|
||||
gtk_widget_set_size_request (GTK_WIDGET (window), 300, 150);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "GtkCList Example");
|
||||
gtk_signal_connect (GTK_OBJECT (window),
|
||||
"destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
NULL);
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (gtk_main_quit),
|
||||
NULL);
|
||||
|
||||
vbox=gtk_vbox_new (FALSE, 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
@ -115,9 +114,9 @@ int main( int argc,
|
||||
|
||||
/* When a selection is made, we want to know about it. The callback
|
||||
* used is selection_made, and its code can be found further down */
|
||||
gtk_signal_connect(GTK_OBJECT (clist), "select_row",
|
||||
GTK_SIGNAL_FUNC (selection_made),
|
||||
NULL);
|
||||
g_signal_connect (G_OBJECT (clist), "select_row",
|
||||
G_CALLBACK (selection_made),
|
||||
NULL);
|
||||
|
||||
/* It isn't necessary to shadow the border, but it looks nice :) */
|
||||
gtk_clist_set_shadow_type (GTK_CLIST (clist), GTK_SHADOW_OUT);
|
||||
@ -148,15 +147,15 @@ int main( int argc,
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button_hide_show, TRUE, TRUE, 0);
|
||||
|
||||
/* Connect our callbacks to the three buttons */
|
||||
gtk_signal_connect_object (GTK_OBJECT (button_add), "clicked",
|
||||
GTK_SIGNAL_FUNC (button_add_clicked),
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect_object (GTK_OBJECT (button_clear), "clicked",
|
||||
GTK_SIGNAL_FUNC (button_clear_clicked),
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect_object (GTK_OBJECT (button_hide_show), "clicked",
|
||||
GTK_SIGNAL_FUNC (button_hide_show_clicked),
|
||||
(gpointer) clist);
|
||||
g_signal_connect_swapped (G_OBJECT (button_add), "clicked",
|
||||
G_CALLBACK (button_add_clicked),
|
||||
clist);
|
||||
g_signal_connect_swapped (G_OBJECT (button_clear), "clicked",
|
||||
G_CALLBACK (button_clear_clicked),
|
||||
clist);
|
||||
g_signal_connect_swapped (G_OBJECT (button_hide_show), "clicked",
|
||||
G_CALLBACK (button_hide_show_clicked),
|
||||
clist);
|
||||
|
||||
gtk_widget_show (button_add);
|
||||
gtk_widget_show (button_clear);
|
||||
|
@ -42,8 +42,11 @@ int main( int argc,
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "GTK Entry");
|
||||
g_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (exit), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
g_signal_connect_swapped (G_OBJECT (window), "delete_event",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
window);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
@ -51,8 +54,8 @@ int main( int argc,
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_entry_set_max_length (GTK_ENTRY (entry), 50);
|
||||
g_signal_connect (GTK_OBJECT (entry), "activate",
|
||||
GTK_SIGNAL_FUNC (enter_callback),
|
||||
g_signal_connect (G_OBJECT (entry), "activate",
|
||||
G_CALLBACK (enter_callback),
|
||||
entry);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), "hello");
|
||||
tmp_pos = GTK_ENTRY (entry)->text_length;
|
||||
@ -68,22 +71,22 @@ int main( int argc,
|
||||
|
||||
check = gtk_check_button_new_with_label ("Editable");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), check, TRUE, TRUE, 0);
|
||||
g_signal_connect (GTK_OBJECT (check), "toggled",
|
||||
GTK_SIGNAL_FUNC (entry_toggle_editable), entry);
|
||||
g_signal_connect (G_OBJECT (check), "toggled",
|
||||
G_CALLBACK (entry_toggle_editable), entry);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
|
||||
gtk_widget_show (check);
|
||||
|
||||
check = gtk_check_button_new_with_label ("Visible");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), check, TRUE, TRUE, 0);
|
||||
g_signal_connect (GTK_OBJECT (check), "toggled",
|
||||
GTK_SIGNAL_FUNC (entry_toggle_visibility), entry);
|
||||
g_signal_connect (G_OBJECT (check), "toggled",
|
||||
G_CALLBACK (entry_toggle_visibility), entry);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
|
||||
gtk_widget_show (check);
|
||||
|
||||
button = gtk_button_new_with_label ("Close");
|
||||
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (exit),
|
||||
GTK_OBJECT (window));
|
||||
button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
|
||||
g_signal_connect_swapped (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
window);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default (button);
|
||||
|
@ -15,8 +15,8 @@ int main( int argc,
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Event Box");
|
||||
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (exit), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (exit), NULL);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
@ -37,8 +37,8 @@ int main( int argc,
|
||||
|
||||
/* And bind an action to it */
|
||||
gtk_widget_set_events (event_box, GDK_BUTTON_PRESS_MASK);
|
||||
g_signal_connect (GTK_OBJECT (event_box), "button_press_event",
|
||||
GTK_SIGNAL_FUNC (exit), NULL);
|
||||
g_signal_connect (G_OBJECT (event_box), "button_press_event",
|
||||
G_CALLBACK (exit), NULL);
|
||||
|
||||
/* Yet one more thing you need an X window for ... */
|
||||
|
||||
|
@ -8,12 +8,6 @@ void file_ok_sel( GtkWidget *w,
|
||||
g_print ("%s\n", gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));
|
||||
}
|
||||
|
||||
void destroy( GtkWidget *widget,
|
||||
gpointer data )
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
@ -24,16 +18,17 @@ int main( int argc,
|
||||
/* Create a new file selection widget */
|
||||
filew = gtk_file_selection_new ("File selection");
|
||||
|
||||
g_signal_connect (GTK_OBJECT (filew), "destroy",
|
||||
GTK_SIGNAL_FUNC (destroy), &filew);
|
||||
g_signal_connect (G_OBJECT (filew), "destroy",
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
/* Connect the ok_button to file_ok_sel function */
|
||||
g_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
|
||||
"clicked", GTK_SIGNAL_FUNC (file_ok_sel), filew );
|
||||
g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
|
||||
"clicked",
|
||||
G_CALLBACK (file_ok_sel), filew);
|
||||
|
||||
/* Connect the cancel_button to destroy the widget */
|
||||
g_signal_connect_swapped (GTK_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button),
|
||||
"clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
GTK_OBJECT (filew));
|
||||
g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button),
|
||||
"clicked",
|
||||
G_CALLBACK (gtk_widget_destroy), filew);
|
||||
|
||||
/* Lets set the filename, as if this were a save dialog, and we are giving
|
||||
a default filename */
|
||||
|
@ -34,8 +34,8 @@ int main( int argc,
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Fixed Container");
|
||||
|
||||
/* Here we connect the "destroy" event to a signal handler */
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
|
||||
/* Sets the border width of the window. */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
@ -52,8 +52,8 @@ int main( int argc,
|
||||
/* When the button receives the "clicked" signal, it will call the
|
||||
* function move_button() passing it the Fixed Container as its
|
||||
* argument. */
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (move_button), fixed);
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (move_button), fixed);
|
||||
|
||||
/* This packs the button into the fixed containers window. */
|
||||
gtk_fixed_put (GTK_FIXED (fixed), button, i*50, i*50);
|
||||
|
@ -16,8 +16,8 @@ int main( int argc,
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Frame Example");
|
||||
|
||||
/* Here we connect the "destroy" event to a signal handler */
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
|
||||
gtk_widget_set_size_request (window, 300, 300);
|
||||
/* Sets the border width of the window. */
|
||||
|
@ -1 +1,2 @@
|
||||
gtkdial
|
||||
dial_test
|
||||
|
@ -28,8 +28,8 @@ int main( int argc,
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Dial");
|
||||
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (exit), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (exit), NULL);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
@ -55,8 +55,8 @@ int main( int argc,
|
||||
gtk_box_pack_end (GTK_BOX (vbox), label, 0, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
g_signal_connect (GTK_OBJECT (adjustment), "value_changed",
|
||||
GTK_SIGNAL_FUNC (value_changed), label);
|
||||
g_signal_connect (G_OBJECT (adjustment), "value_changed",
|
||||
G_CALLBACK (value_changed), label);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
@ -29,30 +28,30 @@
|
||||
|
||||
/* Forward declarations */
|
||||
|
||||
static void gtk_dial_class_init (GtkDialClass *klass);
|
||||
static void gtk_dial_init (GtkDial *dial);
|
||||
static void gtk_dial_destroy (GtkObject *object);
|
||||
static void gtk_dial_realize (GtkWidget *widget);
|
||||
static void gtk_dial_class_init (GtkDialClass *klass);
|
||||
static void gtk_dial_init (GtkDial *dial);
|
||||
static void gtk_dial_destroy (GtkObject *object);
|
||||
static void gtk_dial_realize (GtkWidget *widget);
|
||||
static void gtk_dial_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void gtk_dial_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static gint gtk_dial_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
static gint gtk_dial_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event);
|
||||
static gint gtk_dial_button_release (GtkWidget *widget,
|
||||
GdkEventButton *event);
|
||||
static gint gtk_dial_motion_notify (GtkWidget *widget,
|
||||
GdkEventMotion *event);
|
||||
static gint gtk_dial_timer (GtkDial *dial);
|
||||
static void gtk_dial_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static gint gtk_dial_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
static gint gtk_dial_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event);
|
||||
static gint gtk_dial_button_release (GtkWidget *widget,
|
||||
GdkEventButton *event);
|
||||
static gint gtk_dial_motion_notify (GtkWidget *widget,
|
||||
GdkEventMotion *event);
|
||||
static gint gtk_dial_timer (GtkDial *dial);
|
||||
|
||||
static void gtk_dial_update_mouse (GtkDial *dial, gint x, gint y);
|
||||
static void gtk_dial_update (GtkDial *dial);
|
||||
static void gtk_dial_adjustment_changed (GtkAdjustment *adjustment,
|
||||
gpointer data);
|
||||
static void gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment,
|
||||
gpointer data);
|
||||
static void gtk_dial_adjustment_changed (GtkAdjustment *adjustment,
|
||||
gpointer data);
|
||||
static void gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment,
|
||||
gpointer data);
|
||||
|
||||
/* Local data */
|
||||
|
||||
@ -141,13 +140,12 @@ gtk_dial_destroy (GtkObject *object)
|
||||
{
|
||||
GtkDial *dial;
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (object));
|
||||
|
||||
dial = GTK_DIAL (object);
|
||||
|
||||
if (dial->adjustment)
|
||||
g_object_unref (GTK_OBJECT (dial->adjustment));
|
||||
g_object_unref (G_OBJECT (dial->adjustment));
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
@ -156,7 +154,6 @@ gtk_dial_destroy (GtkObject *object)
|
||||
GtkAdjustment*
|
||||
gtk_dial_get_adjustment (GtkDial *dial)
|
||||
{
|
||||
g_return_val_if_fail (dial != NULL, NULL);
|
||||
g_return_val_if_fail (GTK_IS_DIAL (dial), NULL);
|
||||
|
||||
return dial->adjustment;
|
||||
@ -166,7 +163,6 @@ void
|
||||
gtk_dial_set_update_policy (GtkDial *dial,
|
||||
GtkUpdateType policy)
|
||||
{
|
||||
g_return_if_fail (dial != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (dial));
|
||||
|
||||
dial->policy = policy;
|
||||
@ -176,24 +172,23 @@ void
|
||||
gtk_dial_set_adjustment (GtkDial *dial,
|
||||
GtkAdjustment *adjustment)
|
||||
{
|
||||
g_return_if_fail (dial != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (dial));
|
||||
|
||||
if (dial->adjustment)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (GTK_OBJECT (dial->adjustment), NULL, (gpointer) dial);
|
||||
g_object_unref (GTK_OBJECT (dial->adjustment));
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (dial->adjustment), NULL, (gpointer) dial);
|
||||
g_object_unref (G_OBJECT (dial->adjustment));
|
||||
}
|
||||
|
||||
dial->adjustment = adjustment;
|
||||
g_object_ref (GTK_OBJECT (dial->adjustment));
|
||||
g_object_ref (G_OBJECT (dial->adjustment));
|
||||
|
||||
g_signal_connect (GTK_OBJECT (adjustment), "changed",
|
||||
GTK_SIGNAL_FUNC (gtk_dial_adjustment_changed),
|
||||
(gpointer) dial);
|
||||
g_signal_connect (GTK_OBJECT (adjustment), "value_changed",
|
||||
GTK_SIGNAL_FUNC (gtk_dial_adjustment_value_changed),
|
||||
(gpointer) dial);
|
||||
g_signal_connect (G_OBJECT (adjustment), "changed",
|
||||
G_CALLBACK (gtk_dial_adjustment_changed),
|
||||
dial);
|
||||
g_signal_connect (G_OBJECT (adjustment), "value_changed",
|
||||
G_CALLBACK (gtk_dial_adjustment_value_changed),
|
||||
dial);
|
||||
|
||||
dial->old_value = adjustment->value;
|
||||
dial->old_lower = adjustment->lower;
|
||||
@ -209,7 +204,6 @@ gtk_dial_realize (GtkWidget *widget)
|
||||
GdkWindowAttr attributes;
|
||||
gint attributes_mask;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (widget));
|
||||
|
||||
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
|
||||
@ -252,7 +246,6 @@ gtk_dial_size_allocate (GtkWidget *widget,
|
||||
{
|
||||
GtkDial *dial;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (widget));
|
||||
g_return_if_fail (allocation != NULL);
|
||||
|
||||
@ -285,7 +278,6 @@ gtk_dial_expose (GtkWidget *widget,
|
||||
gint tick_length;
|
||||
gint i, inc;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
@ -360,7 +352,7 @@ gtk_dial_expose (GtkWidget *widget,
|
||||
|
||||
for (i = 0; i <= inc; i++)
|
||||
{
|
||||
theta = ((gfloat)i*M_PI / (18*inc/24.) - M_PI/6.);
|
||||
theta = ((gdouble)i*M_PI / (18*inc/24.) - M_PI/6.);
|
||||
|
||||
if ((theta - last) < (increment))
|
||||
continue;
|
||||
@ -420,7 +412,6 @@ gtk_dial_button_press (GtkWidget *widget,
|
||||
double d_parallel;
|
||||
double d_perpendicular;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
@ -460,7 +451,6 @@ gtk_dial_button_release (GtkWidget *widget,
|
||||
{
|
||||
GtkDial *dial;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
@ -477,7 +467,7 @@ gtk_dial_button_release (GtkWidget *widget,
|
||||
|
||||
if ((dial->policy != GTK_UPDATE_CONTINUOUS) &&
|
||||
(dial->old_value != dial->adjustment->value))
|
||||
g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
|
||||
gtk_adjustment_value_changed (dial->adjustment);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@ -491,7 +481,6 @@ gtk_dial_motion_notify (GtkWidget *widget,
|
||||
GdkModifierType mods;
|
||||
gint x, y, mask;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
@ -531,11 +520,10 @@ gtk_dial_motion_notify (GtkWidget *widget,
|
||||
static gint
|
||||
gtk_dial_timer (GtkDial *dial)
|
||||
{
|
||||
g_return_val_if_fail (dial != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_DIAL (dial), FALSE);
|
||||
|
||||
if (dial->policy == GTK_UPDATE_DELAYED)
|
||||
g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
|
||||
gtk_adjustment_value_changed (dial->adjustment);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -544,9 +532,8 @@ static void
|
||||
gtk_dial_update_mouse (GtkDial *dial, gint x, gint y)
|
||||
{
|
||||
gint xc, yc;
|
||||
gfloat old_value;
|
||||
gdouble old_value;
|
||||
|
||||
g_return_if_fail (dial != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (dial));
|
||||
|
||||
xc = GTK_WIDGET(dial)->allocation.width / 2;
|
||||
@ -571,7 +558,7 @@ gtk_dial_update_mouse (GtkDial *dial, gint x, gint y)
|
||||
{
|
||||
if (dial->policy == GTK_UPDATE_CONTINUOUS)
|
||||
{
|
||||
g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
|
||||
gtk_adjustment_value_changed (dial->adjustment);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -593,9 +580,8 @@ gtk_dial_update_mouse (GtkDial *dial, gint x, gint y)
|
||||
static void
|
||||
gtk_dial_update (GtkDial *dial)
|
||||
{
|
||||
gfloat new_value;
|
||||
gdouble new_value;
|
||||
|
||||
g_return_if_fail (dial != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (dial));
|
||||
|
||||
new_value = dial->adjustment->value;
|
||||
@ -608,8 +594,7 @@ gtk_dial_update (GtkDial *dial)
|
||||
|
||||
if (new_value != dial->adjustment->value)
|
||||
{
|
||||
dial->adjustment->value = new_value;
|
||||
g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
|
||||
gtk_adjustment_set_value (dial->adjustment, new_value);
|
||||
}
|
||||
|
||||
dial->angle = 7.*M_PI/6. - (new_value - dial->adjustment->lower) * 4.*M_PI/3. /
|
||||
@ -620,12 +605,12 @@ gtk_dial_update (GtkDial *dial)
|
||||
|
||||
static void
|
||||
gtk_dial_adjustment_changed (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
gpointer data)
|
||||
{
|
||||
GtkDial *dial;
|
||||
|
||||
g_return_if_fail (adjustment != NULL);
|
||||
g_return_if_fail (data != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (data));
|
||||
|
||||
dial = GTK_DIAL (data);
|
||||
|
||||
@ -648,7 +633,7 @@ gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment,
|
||||
GtkDial *dial;
|
||||
|
||||
g_return_if_fail (adjustment != NULL);
|
||||
g_return_if_fail (data != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (data));
|
||||
|
||||
dial = GTK_DIAL (data);
|
||||
|
||||
|
@ -53,14 +53,14 @@ int main( int argc,
|
||||
* titlebar), we ask it to call the delete_event () function
|
||||
* as defined above. The data passed to the callback
|
||||
* function is NULL and is ignored in the callback function. */
|
||||
g_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (delete_event), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "delete_event",
|
||||
G_CALLBACK (delete_event), NULL);
|
||||
|
||||
/* Here we connect the "destroy" event to a signal handler.
|
||||
* This event occurs when we call gtk_widget_destroy() on the window,
|
||||
* or if we return FALSE in the "delete_event" callback. */
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (destroy), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (destroy), NULL);
|
||||
|
||||
/* Sets the border width of the window. */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
@ -71,15 +71,15 @@ int main( int argc,
|
||||
/* When the button receives the "clicked" signal, it will call the
|
||||
* function hello() passing it NULL as its argument. The hello()
|
||||
* function is defined above. */
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (hello), NULL);
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (hello), NULL);
|
||||
|
||||
/* This will cause the window to be destroyed by calling
|
||||
* gtk_widget_destroy(window) when "clicked". Again, the destroy
|
||||
* signal could come from here, or the window manager. */
|
||||
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
GTK_OBJECT (window));
|
||||
g_signal_connect_swapped (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
window);
|
||||
|
||||
/* This packs the button into the window (a gtk container). */
|
||||
gtk_container_add (GTK_CONTAINER (window), button);
|
||||
|
@ -6,7 +6,7 @@
|
||||
void callback( GtkWidget *widget,
|
||||
gpointer data )
|
||||
{
|
||||
g_print ("Hello again - %s was pressed\n", (char *) data);
|
||||
g_print ("Hello again - %s was pressed\n", (gchar *) data);
|
||||
}
|
||||
|
||||
/* another callback */
|
||||
@ -39,8 +39,8 @@ int main( int argc,
|
||||
|
||||
/* Here we just set a handler for delete_event that immediately
|
||||
* exits GTK. */
|
||||
g_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (delete_event), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "delete_event",
|
||||
G_CALLBACK (delete_event), NULL);
|
||||
|
||||
/* Sets the border width of the window. */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
@ -58,8 +58,8 @@ int main( int argc,
|
||||
|
||||
/* Now when the button is clicked, we call the "callback" function
|
||||
* with a pointer to "button 1" as its argument */
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (callback), (gpointer) "button 1");
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (callback), "button 1");
|
||||
|
||||
/* Instead of gtk_container_add, we pack this button into the invisible
|
||||
* box, which has been packed into the window. */
|
||||
@ -74,8 +74,8 @@ int main( int argc,
|
||||
|
||||
/* Call the same callback function with a different argument,
|
||||
* passing a pointer to "button 2" instead. */
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (callback), (gpointer) "button 2");
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (callback), "button 2");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX (box1), button, TRUE, TRUE, 0);
|
||||
|
||||
|
@ -14,8 +14,8 @@ int main( int argc,
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (gtk_main_quit),
|
||||
NULL);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Label");
|
||||
|
@ -51,9 +51,8 @@ gint main( int argc,
|
||||
*/
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "GtkList Example");
|
||||
g_signal_connect (GTK_OBJECT (window),
|
||||
"destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (gtk_main_quit),
|
||||
NULL);
|
||||
|
||||
|
||||
@ -79,10 +78,9 @@ gint main( int argc,
|
||||
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
gtklist);
|
||||
gtk_widget_show (gtklist);
|
||||
gtk_signal_connect (GTK_OBJECT (gtklist),
|
||||
"selection_changed",
|
||||
GTK_SIGNAL_FUNC (sigh_print_selection),
|
||||
NULL);
|
||||
g_signal_connect (G_OBJECT (gtklist), "selection_changed",
|
||||
G_CALLBACK (sigh_print_selection),
|
||||
NULL);
|
||||
|
||||
/* We create a "Prison" to put a list item in ;) */
|
||||
frame=gtk_frame_new ("Prison");
|
||||
@ -95,10 +93,9 @@ gint main( int argc,
|
||||
/* Connect the sigh_button_event() signal handler to the List
|
||||
* which will handle the "arresting" of list items
|
||||
*/
|
||||
gtk_signal_connect (GTK_OBJECT (gtklist),
|
||||
"button_release_event",
|
||||
GTK_SIGNAL_FUNC (sigh_button_event),
|
||||
frame);
|
||||
g_signal_connect (G_OBJECT (gtklist), "button_release_event",
|
||||
G_CALLBACK (sigh_button_event),
|
||||
frame);
|
||||
|
||||
/* Create a separator */
|
||||
separator=gtk_hseparator_new ();
|
||||
@ -110,10 +107,9 @@ gint main( int argc,
|
||||
button=gtk_button_new_with_label ("Close");
|
||||
gtk_container_add (GTK_CONTAINER (vbox), button);
|
||||
gtk_widget_show (button);
|
||||
gtk_signal_connect_object (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
GTK_OBJECT (window));
|
||||
g_signal_connect_swapped (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
window);
|
||||
|
||||
|
||||
/* Now we create 5 list items, each having its own
|
||||
@ -133,9 +129,7 @@ gint main( int argc,
|
||||
gtk_container_add (GTK_CONTAINER (gtklist), list_item);
|
||||
gtk_widget_show (list_item);
|
||||
gtk_label_get (GTK_LABEL (label), &string);
|
||||
gtk_object_set_data (GTK_OBJECT (list_item),
|
||||
list_item_data_key,
|
||||
string);
|
||||
g_object_set_data (G_OBJECT (list_item), list_item_data_key, string);
|
||||
}
|
||||
/* Here, we are creating another 5 labels, this time
|
||||
* we use gtk_list_item_new_with_label() for the creation
|
||||
@ -156,9 +150,9 @@ gint main( int argc,
|
||||
list_item = gtk_list_item_new_with_label (buffer);
|
||||
dlist = g_list_prepend (dlist, list_item);
|
||||
gtk_widget_show (list_item);
|
||||
gtk_object_set_data (GTK_OBJECT (list_item),
|
||||
list_item_data_key,
|
||||
"ListItem with integrated Label");
|
||||
g_object_set_data (G_OBJECT (list_item),
|
||||
list_item_data_key,
|
||||
"ListItem with integrated Label");
|
||||
}
|
||||
gtk_list_append_items (GTK_LIST (gtklist), dlist);
|
||||
|
||||
@ -262,11 +256,9 @@ void sigh_print_selection( GtkWidget *gtklist,
|
||||
* and then query the data associated with list_item_data_key.
|
||||
* We then just print it */
|
||||
while (dlist) {
|
||||
GtkObject *list_item;
|
||||
gchar *item_data_string;
|
||||
const gchar *item_data_string;
|
||||
|
||||
list_item = GTK_OBJECT (dlist->data);
|
||||
item_data_string = g_object_get_data (G_OBJECT (list_item),
|
||||
item_data_string = g_object_get_data (G_OBJECT (dlist->data),
|
||||
list_item_data_key);
|
||||
g_print("%s ", item_data_string);
|
||||
|
||||
|
@ -1 +1,2 @@
|
||||
menu
|
||||
itemfactory
|
||||
|
@ -90,9 +90,9 @@ int main( int argc,
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
"WM destroy");
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (gtk_main_quit),
|
||||
NULL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Item Factory");
|
||||
gtk_widget_set_size_request (GTK_WIDGET (window), 300, 200);
|
||||
|
||||
|
@ -25,8 +25,8 @@ int main( int argc,
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "GTK Menu Test");
|
||||
g_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "delete_event",
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
|
||||
/* Init the menu-widget, and remember -- never
|
||||
* gtk_show_widget() the menu widget!!
|
||||
@ -52,9 +52,9 @@ int main( int argc,
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
|
||||
|
||||
/* Do something interesting when the menuitem is selected */
|
||||
g_signal_connect_swapped (GTK_OBJECT (menu_items), "activate",
|
||||
GTK_SIGNAL_FUNC (menuitem_response),
|
||||
(gpointer) g_strdup (buf));
|
||||
g_signal_connect_swapped (G_OBJECT (menu_items), "activate",
|
||||
G_CALLBACK (menuitem_response),
|
||||
g_strdup (buf));
|
||||
|
||||
/* Show the widget */
|
||||
gtk_widget_show (menu_items);
|
||||
@ -83,9 +83,9 @@ int main( int argc,
|
||||
|
||||
/* Create a button to which to attach menu as a popup */
|
||||
button = gtk_button_new_with_label ("press me");
|
||||
g_signal_connect_swapped (GTK_OBJECT (button), "event",
|
||||
GTK_SIGNAL_FUNC (button_press),
|
||||
GTK_OBJECT (menu));
|
||||
g_signal_connect_swapped (G_OBJECT (button), "event",
|
||||
G_CALLBACK (button_press),
|
||||
menu);
|
||||
gtk_box_pack_end (GTK_BOX (vbox), button, TRUE, TRUE, 2);
|
||||
gtk_widget_show (button);
|
||||
|
||||
|
@ -63,8 +63,8 @@ int main( int argc,
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
g_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (delete), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "delete_event",
|
||||
G_CALLBACK (delete), NULL);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
@ -126,43 +126,43 @@ int main( int argc,
|
||||
|
||||
/* Create a bunch of buttons */
|
||||
button = gtk_button_new_with_label ("close");
|
||||
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (delete), NULL);
|
||||
g_signal_connect_swapped (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (delete), NULL);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 1, 2);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("next page");
|
||||
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_notebook_next_page),
|
||||
GTK_OBJECT (notebook));
|
||||
g_signal_connect_swapped (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (gtk_notebook_next_page),
|
||||
notebook);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button, 1, 2, 1, 2);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("prev page");
|
||||
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_notebook_prev_page),
|
||||
GTK_OBJECT (notebook));
|
||||
g_signal_connect_swapped (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (gtk_notebook_prev_page),
|
||||
notebook);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button, 2, 3, 1, 2);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("tab position");
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (rotate_book),
|
||||
GTK_OBJECT(notebook));
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (rotate_book),
|
||||
notebook);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button, 3, 4, 1, 2);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("tabs/border on/off");
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (tabsborder_book),
|
||||
GTK_OBJECT (notebook));
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (tabsborder_book),
|
||||
notebook);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button, 4, 5, 1, 2);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("remove page");
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (remove_book),
|
||||
GTK_OBJECT (notebook));
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (remove_book),
|
||||
notebook);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button, 5, 6, 1, 2);
|
||||
gtk_widget_show (button);
|
||||
|
||||
|
@ -95,8 +95,8 @@ int main( int argc,
|
||||
/* You should always remember to connect the delete_event signal
|
||||
* to the main window. This is very important for proper intuitive
|
||||
* behavior */
|
||||
g_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (delete_event), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "delete_event",
|
||||
G_CALLBACK (delete_event), NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
/* We create a vertical box (vbox) to pack the horizontal boxes into.
|
||||
@ -259,9 +259,9 @@ int main( int argc,
|
||||
button = gtk_button_new_with_label ("Quit");
|
||||
|
||||
/* Setup the signal to terminate the program when the button is clicked */
|
||||
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
GTK_OBJECT (window));
|
||||
g_signal_connect_swapped (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (gtk_main_quit),
|
||||
window);
|
||||
/* Pack the button into the quitbox.
|
||||
* The last 3 arguments to gtk_box_pack_start are:
|
||||
* expand, fill, padding. */
|
||||
|
@ -109,8 +109,8 @@ int main( int argc,
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Paned Windows");
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
gtk_widget_set_size_request (GTK_WIDGET (window), 450, 400);
|
||||
|
||||
|
@ -57,8 +57,8 @@ int main( int argc,
|
||||
the application */
|
||||
gtk_init (&argc, &argv);
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (close_application), NULL);
|
||||
gtk_signal_connect (G_OBJECT (window), "delete_event",
|
||||
G_CALLBACK (close_application), NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
gtk_widget_show (window);
|
||||
|
||||
@ -78,8 +78,8 @@ int main( int argc,
|
||||
gtk_container_add (GTK_CONTAINER (window), button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (button_clicked), NULL);
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (button_clicked), NULL);
|
||||
|
||||
/* show the window */
|
||||
gtk_main ();
|
||||
|
@ -98,8 +98,8 @@ int main( int argc,
|
||||
pdata->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_resizable (GTK_WINDOW (pdata->window), TRUE);
|
||||
|
||||
g_signal_connect (GTK_OBJECT (pdata->window), "destroy",
|
||||
GTK_SIGNAL_FUNC (destroy_progress),
|
||||
g_signal_connect (G_OBJECT (pdata->window), "destroy",
|
||||
G_CALLBACK (destroy_progress),
|
||||
pdata);
|
||||
gtk_window_set_title (GTK_WINDOW (pdata->window), "GtkProgressBar");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (pdata->window), 0);
|
||||
@ -149,8 +149,8 @@ int main( int argc,
|
||||
gtk_table_attach (GTK_TABLE (table), check, 0, 1, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
|
||||
5, 5);
|
||||
g_signal_connect (GTK_OBJECT (check), "clicked",
|
||||
GTK_SIGNAL_FUNC (toggle_show_text),
|
||||
g_signal_connect (G_OBJECT (check), "clicked",
|
||||
G_CALLBACK (toggle_show_text),
|
||||
pdata);
|
||||
gtk_widget_show (check);
|
||||
|
||||
@ -159,8 +159,8 @@ int main( int argc,
|
||||
gtk_table_attach (GTK_TABLE (table), check, 0, 1, 1, 2,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
|
||||
5, 5);
|
||||
g_signal_connect (GTK_OBJECT (check), "clicked",
|
||||
GTK_SIGNAL_FUNC (toggle_activity_mode),
|
||||
g_signal_connect (G_OBJECT (check), "clicked",
|
||||
G_CALLBACK (toggle_activity_mode),
|
||||
pdata);
|
||||
gtk_widget_show (check);
|
||||
|
||||
@ -175,8 +175,8 @@ int main( int argc,
|
||||
gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
|
||||
5, 5);
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (set_continuous_mode),
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (set_continuous_mode),
|
||||
pdata);
|
||||
gtk_widget_show (button);
|
||||
|
||||
@ -187,8 +187,8 @@ int main( int argc,
|
||||
gtk_table_attach (GTK_TABLE (table), button, 2, 3, 1, 2,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
|
||||
5, 5);
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (set_discrete_mode),
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (set_discrete_mode),
|
||||
pdata);
|
||||
gtk_widget_show (button);
|
||||
|
||||
@ -198,9 +198,9 @@ int main( int argc,
|
||||
|
||||
/* Add a button to exit the program */
|
||||
button = gtk_button_new_with_label ("close");
|
||||
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
GTK_OBJECT (pdata->window));
|
||||
g_signal_connect_swapped (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
pdata->window);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
||||
/* This makes it so the button is the default. */
|
||||
|
@ -24,8 +24,8 @@ int main( int argc,
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
g_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (close_application),
|
||||
g_signal_connect (G_OBJECT (window), "delete_event",
|
||||
G_CALLBACK (close_application),
|
||||
NULL);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "radio buttons");
|
||||
@ -66,9 +66,9 @@ int main( int argc,
|
||||
gtk_widget_show (box2);
|
||||
|
||||
button = gtk_button_new_with_label ("close");
|
||||
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (close_application),
|
||||
GTK_OBJECT (window));
|
||||
g_signal_connect_swapped (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (close_application),
|
||||
window);
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default (button);
|
||||
|
@ -34,13 +34,11 @@ void cb_page_size( GtkAdjustment *get,
|
||||
set->page_size = get->value;
|
||||
set->page_increment = get->value;
|
||||
|
||||
/* This sets the adjustment and makes it emit the "changed" signal to
|
||||
reconfigure all the widgets that are attached to this signal. */
|
||||
gtk_adjustment_set_value (set, CLAMP (set->value,
|
||||
set->lower,
|
||||
(set->upper - set->page_size)));
|
||||
|
||||
/* Now emit the "changed" signal to reconfigure all the widgets that
|
||||
* are attached to this adjustment */
|
||||
g_signal_emit_by_name (GTK_OBJECT (set), "changed");
|
||||
}
|
||||
|
||||
void cb_draw_value( GtkToggleButton *button )
|
||||
@ -53,14 +51,14 @@ void cb_draw_value( GtkToggleButton *button )
|
||||
|
||||
/* Convenience functions */
|
||||
|
||||
GtkWidget *make_menu_item( gchar *name,
|
||||
GtkSignalFunc callback,
|
||||
gpointer data )
|
||||
GtkWidget *make_menu_item (gchar *name,
|
||||
GCallback callback,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *item;
|
||||
|
||||
item = gtk_menu_item_new_with_label (name);
|
||||
g_signal_connect (GTK_OBJECT (item), "activate",
|
||||
g_signal_connect (G_OBJECT (item), "activate",
|
||||
callback, data);
|
||||
gtk_widget_show (item);
|
||||
|
||||
@ -92,8 +90,8 @@ void create_range_controls( void )
|
||||
|
||||
/* Standard window-creating stuff */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (gtk_main_quit),
|
||||
NULL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "range controls");
|
||||
|
||||
@ -145,8 +143,8 @@ void create_range_controls( void )
|
||||
/* A checkbutton to control whether the value is displayed or not */
|
||||
button = gtk_check_button_new_with_label("Display value on scale widgets");
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
g_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
GTK_SIGNAL_FUNC (cb_draw_value), NULL);
|
||||
g_signal_connect (G_OBJECT (button), "toggled",
|
||||
G_CALLBACK (cb_draw_value), NULL);
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
@ -162,19 +160,19 @@ void create_range_controls( void )
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
item = make_menu_item ("Top",
|
||||
GTK_SIGNAL_FUNC (cb_pos_menu_select),
|
||||
G_CALLBACK (cb_pos_menu_select),
|
||||
GINT_TO_POINTER (GTK_POS_TOP));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
||||
|
||||
item = make_menu_item ("Bottom", GTK_SIGNAL_FUNC (cb_pos_menu_select),
|
||||
item = make_menu_item ("Bottom", G_CALLBACK (cb_pos_menu_select),
|
||||
GINT_TO_POINTER (GTK_POS_BOTTOM));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
||||
|
||||
item = make_menu_item ("Left", GTK_SIGNAL_FUNC (cb_pos_menu_select),
|
||||
item = make_menu_item ("Left", G_CALLBACK (cb_pos_menu_select),
|
||||
GINT_TO_POINTER (GTK_POS_LEFT));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
||||
|
||||
item = make_menu_item ("Right", GTK_SIGNAL_FUNC (cb_pos_menu_select),
|
||||
item = make_menu_item ("Right", G_CALLBACK (cb_pos_menu_select),
|
||||
GINT_TO_POINTER (GTK_POS_RIGHT));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
||||
|
||||
@ -198,17 +196,17 @@ void create_range_controls( void )
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
item = make_menu_item ("Continuous",
|
||||
GTK_SIGNAL_FUNC (cb_update_menu_select),
|
||||
G_CALLBACK (cb_update_menu_select),
|
||||
GINT_TO_POINTER (GTK_UPDATE_CONTINUOUS));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
||||
|
||||
item = make_menu_item ("Discontinuous",
|
||||
GTK_SIGNAL_FUNC (cb_update_menu_select),
|
||||
G_CALLBACK (cb_update_menu_select),
|
||||
GINT_TO_POINTER (GTK_UPDATE_DISCONTINUOUS));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
||||
|
||||
item = make_menu_item ("Delayed",
|
||||
GTK_SIGNAL_FUNC (cb_update_menu_select),
|
||||
G_CALLBACK (cb_update_menu_select),
|
||||
GINT_TO_POINTER (GTK_UPDATE_DELAYED));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
||||
|
||||
@ -229,8 +227,8 @@ void create_range_controls( void )
|
||||
gtk_widget_show (label);
|
||||
|
||||
adj2 = gtk_adjustment_new (1.0, 0.0, 5.0, 1.0, 1.0, 0.0);
|
||||
g_signal_connect (GTK_OBJECT (adj2), "value_changed",
|
||||
GTK_SIGNAL_FUNC (cb_digits_scale), NULL);
|
||||
g_signal_connect (G_OBJECT (adj2), "value_changed",
|
||||
G_CALLBACK (cb_digits_scale), NULL);
|
||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (adj2));
|
||||
gtk_scale_set_digits (GTK_SCALE (scale), 0);
|
||||
gtk_box_pack_start (GTK_BOX (box2), scale, TRUE, TRUE, 0);
|
||||
@ -249,8 +247,8 @@ void create_range_controls( void )
|
||||
gtk_widget_show (label);
|
||||
|
||||
adj2 = gtk_adjustment_new (1.0, 1.0, 101.0, 1.0, 1.0, 0.0);
|
||||
g_signal_connect (GTK_OBJECT (adj2), "value_changed",
|
||||
GTK_SIGNAL_FUNC (cb_page_size), adj1);
|
||||
g_signal_connect (G_OBJECT (adj2), "value_changed",
|
||||
G_CALLBACK (cb_page_size), adj1);
|
||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (adj2));
|
||||
gtk_scale_set_digits (GTK_SCALE (scale), 0);
|
||||
gtk_box_pack_start (GTK_BOX (box2), scale, TRUE, TRUE, 0);
|
||||
@ -269,8 +267,8 @@ void create_range_controls( void )
|
||||
gtk_widget_show (box2);
|
||||
|
||||
button = gtk_button_new_with_label ("Quit");
|
||||
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
g_signal_connect_swapped (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (gtk_main_quit),
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
|
@ -24,8 +24,8 @@ int main( int argc,
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
g_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (close_application), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "delete_event",
|
||||
G_CALLBACK (close_application), NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
/* Create a table for placing the ruler and the drawing area */
|
||||
@ -45,9 +45,9 @@ int main( int argc,
|
||||
hrule = gtk_hruler_new ();
|
||||
gtk_ruler_set_metric (GTK_RULER (hrule), GTK_PIXELS);
|
||||
gtk_ruler_set_range (GTK_RULER (hrule), 7, 13, 0, 20);
|
||||
g_signal_connect_swapped (GTK_OBJECT (area), "motion_notify_event",
|
||||
GTK_SIGNAL_FUNC (EVENT_METHOD (hrule, motion_notify_event)),
|
||||
GTK_OBJECT (hrule));
|
||||
g_signal_connect_swapped (G_OBJECT (area), "motion_notify_event",
|
||||
G_CALLBACK (EVENT_METHOD (hrule, motion_notify_event)),
|
||||
hrule);
|
||||
gtk_table_attach (GTK_TABLE (table), hrule, 1, 2, 0, 1,
|
||||
GTK_EXPAND|GTK_SHRINK|GTK_FILL, GTK_FILL, 0, 0);
|
||||
|
||||
@ -57,9 +57,9 @@ int main( int argc,
|
||||
vrule = gtk_vruler_new ();
|
||||
gtk_ruler_set_metric (GTK_RULER (vrule), GTK_PIXELS);
|
||||
gtk_ruler_set_range (GTK_RULER (vrule), 0, YSIZE, 10, YSIZE );
|
||||
g_signal_connect_swapped (GTK_OBJECT (area), "motion_notify_event",
|
||||
GTK_SIGNAL_FUNC (EVENT_METHOD (vrule, motion_notify_event)),
|
||||
GTK_OBJECT (vrule));
|
||||
g_signal_connect_swapped (G_OBJECT (area), "motion_notify_event",
|
||||
G_CALLBACK (EVENT_METHOD (vrule, motion_notify_event)),
|
||||
vrule);
|
||||
gtk_table_attach (GTK_TABLE (table), vrule, 0, 1, 1, 2,
|
||||
GTK_FILL, GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0);
|
||||
|
||||
|
@ -132,8 +132,8 @@ int main( int argc,
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (quit), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (quit), NULL);
|
||||
|
||||
/* Create the drawing area */
|
||||
|
||||
@ -145,17 +145,17 @@ int main( int argc,
|
||||
|
||||
/* Signals used to handle backing pixmap */
|
||||
|
||||
g_signal_connect (GTK_OBJECT (drawing_area), "expose_event",
|
||||
GTK_SIGNAL_FUNC (expose_event), NULL);
|
||||
g_signal_connect (GTK_OBJECT (drawing_area),"configure_event",
|
||||
GTK_SIGNAL_FUNC (configure_event), NULL);
|
||||
g_signal_connect (G_OBJECT (drawing_area), "expose_event",
|
||||
G_CALLBACK (expose_event), NULL);
|
||||
g_signal_connect (G_OBJECT (drawing_area),"configure_event",
|
||||
G_CALLBACK (configure_event), NULL);
|
||||
|
||||
/* Event signals */
|
||||
|
||||
g_signal_connect (GTK_OBJECT (drawing_area), "motion_notify_event",
|
||||
GTK_SIGNAL_FUNC (motion_notify_event), NULL);
|
||||
g_signal_connect (GTK_OBJECT (drawing_area), "button_press_event",
|
||||
GTK_SIGNAL_FUNC (button_press_event), NULL);
|
||||
g_signal_connect (G_OBJECT (drawing_area), "motion_notify_event",
|
||||
G_CALLBACK (motion_notify_event), NULL);
|
||||
g_signal_connect (G_OBJECT (drawing_area), "button_press_event",
|
||||
G_CALLBACK (button_press_event), NULL);
|
||||
|
||||
gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK
|
||||
| GDK_LEAVE_NOTIFY_MASK
|
||||
@ -167,9 +167,9 @@ int main( int argc,
|
||||
button = gtk_button_new_with_label ("Quit");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
||||
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
GTK_OBJECT (window));
|
||||
g_signal_connect_swapped (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
window);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
@ -157,12 +157,12 @@ create_input_dialog ()
|
||||
{
|
||||
inputd = gtk_input_dialog_new();
|
||||
|
||||
g_signal_connect (GTK_OBJECT (inputd), "destroy",
|
||||
GTK_SIGNAL_FUNC (input_dialog_destroy), &inputd);
|
||||
g_signal_connect_swapped (GTK_OBJECT (GTK_INPUT_DIALOG (inputd)->close_button),
|
||||
g_signal_connect (G_OBJECT (inputd), "destroy",
|
||||
G_CALLBACK (input_dialog_destroy), &inputd);
|
||||
g_signal_connect_swapped (G_OBJECT (GTK_INPUT_DIALOG (inputd)->close_button),
|
||||
"clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_hide),
|
||||
GTK_OBJECT (inputd));
|
||||
G_CALLBACK (gtk_widget_hide),
|
||||
inputd);
|
||||
gtk_widget_hide (GTK_INPUT_DIALOG (inputd)->save_button);
|
||||
|
||||
gtk_widget_show (inputd);
|
||||
@ -200,8 +200,8 @@ main (int argc, char *argv[])
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (quit), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (quit), NULL);
|
||||
|
||||
/* Create the drawing area */
|
||||
|
||||
@ -213,17 +213,17 @@ main (int argc, char *argv[])
|
||||
|
||||
/* Signals used to handle backing pixmap */
|
||||
|
||||
g_signal_connect (GTK_OBJECT (drawing_area), "expose_event",
|
||||
GTK_SIGNAL_FUNC (expose_event), NULL);
|
||||
g_signal_connect (GTK_OBJECT(drawing_area),"configure_event",
|
||||
GTK_SIGNAL_FUNC (configure_event), NULL);
|
||||
g_signal_connect (G_OBJECT (drawing_area), "expose_event",
|
||||
G_CALLBACK (expose_event), NULL);
|
||||
g_signal_connect (G_OBJECT(drawing_area),"configure_event",
|
||||
G_CALLBACK (configure_event), NULL);
|
||||
|
||||
/* Event signals */
|
||||
|
||||
g_signal_connect (GTK_OBJECT (drawing_area), "motion_notify_event",
|
||||
GTK_SIGNAL_FUNC (motion_notify_event), NULL);
|
||||
g_signal_connect (GTK_OBJECT (drawing_area), "button_press_event",
|
||||
GTK_SIGNAL_FUNC (button_press_event), NULL);
|
||||
g_signal_connect (G_OBJECT (drawing_area), "motion_notify_event",
|
||||
G_CALLBACK (motion_notify_event), NULL);
|
||||
g_signal_connect (G_OBJECT (drawing_area), "button_press_event",
|
||||
G_CALLBACK (button_press_event), NULL);
|
||||
|
||||
gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK
|
||||
| GDK_LEAVE_NOTIFY_MASK
|
||||
@ -239,16 +239,16 @@ main (int argc, char *argv[])
|
||||
button = gtk_button_new_with_label ("Input Dialog");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (create_input_dialog), NULL);
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (create_input_dialog), NULL);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("Quit");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
||||
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
GTK_OBJECT (window));
|
||||
g_signal_connect_swapped (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
window);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
@ -23,8 +23,8 @@ int main( int argc,
|
||||
/* Create a new dialog window for the scrolled window to be
|
||||
* packed into. */
|
||||
window = gtk_dialog_new ();
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (destroy), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (destroy), NULL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "GtkScrolledWindow example");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
gtk_widget_set_size_request (window, 300, 300);
|
||||
@ -71,9 +71,9 @@ int main( int argc,
|
||||
|
||||
/* Add a "close" button to the bottom of the dialog */
|
||||
button = gtk_button_new_with_label ("close");
|
||||
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
GTK_OBJECT (window));
|
||||
g_signal_connect_swapped (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
window);
|
||||
|
||||
/* this makes it so the button is the default. */
|
||||
|
||||
|
@ -1 +1,3 @@
|
||||
selection
|
||||
setselection
|
||||
gettargets
|
||||
|
@ -74,18 +74,18 @@ int main( int argc,
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Event Box");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (exit), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (exit), NULL);
|
||||
|
||||
/* Create a button the user can click to get targets */
|
||||
|
||||
button = gtk_button_new_with_label ("Get Targets");
|
||||
gtk_container_add (GTK_CONTAINER (window), button);
|
||||
|
||||
g_signal_connect (GTK_OBJECT(button), "clicked",
|
||||
GTK_SIGNAL_FUNC (get_targets), NULL);
|
||||
g_signal_connect (GTK_OBJECT(button), "selection_received",
|
||||
GTK_SIGNAL_FUNC (selection_received), NULL);
|
||||
g_signal_connect (G_OBJECT(button), "clicked",
|
||||
G_CALLBACK (get_targets), NULL);
|
||||
g_signal_connect (G_OBJECT(button), "selection_received",
|
||||
G_CALLBACK (selection_received), NULL);
|
||||
|
||||
gtk_widget_show (button);
|
||||
gtk_widget_show (window);
|
||||
|
@ -77,8 +77,8 @@ int main( int argc,
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Event Box");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (exit), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (exit), NULL);
|
||||
|
||||
/* Create a toggle button to act as the selection */
|
||||
|
||||
@ -86,17 +86,17 @@ int main( int argc,
|
||||
gtk_container_add (GTK_CONTAINER (window), selection_button);
|
||||
gtk_widget_show (selection_button);
|
||||
|
||||
g_signal_connect (GTK_OBJECT (selection_button), "toggled",
|
||||
GTK_SIGNAL_FUNC (selection_toggled), &have_selection);
|
||||
g_signal_connect (GTK_OBJECT (selection_button), "selection_clear_event",
|
||||
GTK_SIGNAL_FUNC (selection_clear), &have_selection);
|
||||
g_signal_connect (G_OBJECT (selection_button), "toggled",
|
||||
G_CALLBACK (selection_toggled), &have_selection);
|
||||
g_signal_connect (G_OBJECT (selection_button), "selection_clear_event",
|
||||
G_CALLBACK (selection_clear), &have_selection);
|
||||
|
||||
gtk_selection_add_target (selection_button,
|
||||
GDK_SELECTION_PRIMARY,
|
||||
GDK_SELECTION_TYPE_STRING,
|
||||
1);
|
||||
g_signal_connect (GTK_OBJECT (selection_button), "selection_get",
|
||||
GTK_SIGNAL_FUNC (selection_handle), &have_selection);
|
||||
g_signal_connect (G_OBJECT (selection_button), "selection_get",
|
||||
G_CALLBACK (selection_handle), &have_selection);
|
||||
|
||||
gtk_widget_show (selection_button);
|
||||
gtk_widget_show (window);
|
||||
|
@ -62,8 +62,8 @@ int main( int argc,
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (gtk_main_quit),
|
||||
NULL);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Spin Button");
|
||||
@ -158,24 +158,24 @@ int main( int argc,
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (2, 1, 5, 1, 1, 0);
|
||||
spinner2 = gtk_spin_button_new (adj, 0.0, 0);
|
||||
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner2), TRUE);
|
||||
g_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (change_digits),
|
||||
(gpointer) spinner2);
|
||||
g_signal_connect (G_OBJECT (adj), "value_changed",
|
||||
G_CALLBACK (change_digits),
|
||||
spinner2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), spinner2, FALSE, TRUE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 5);
|
||||
|
||||
button = gtk_check_button_new_with_label ("Snap to 0.5-ticks");
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (toggle_snap),
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (toggle_snap),
|
||||
spinner1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
|
||||
button = gtk_check_button_new_with_label ("Numeric only input mode");
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (toggle_numeric),
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (toggle_numeric),
|
||||
spinner1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
@ -186,15 +186,15 @@ int main( int argc,
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 5);
|
||||
button = gtk_button_new_with_label ("Value as Int");
|
||||
g_object_set_data (G_OBJECT (button), "user_data", val_label);
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (get_value),
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (get_value),
|
||||
GINT_TO_POINTER (1));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5);
|
||||
|
||||
button = gtk_button_new_with_label ("Value as Float");
|
||||
g_object_set_data (G_OBJECT (button), "user_data", val_label);
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (get_value),
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (get_value),
|
||||
GINT_TO_POINTER (2));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5);
|
||||
|
||||
@ -205,9 +205,9 @@ int main( int argc,
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, TRUE, 0);
|
||||
|
||||
button = gtk_button_new_with_label ("Close");
|
||||
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
GTK_OBJECT (window));
|
||||
g_signal_connect_swapped (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
window);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5);
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
|
@ -40,8 +40,8 @@ int main( int argc,
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "GTK Statusbar Example");
|
||||
g_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (exit), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "delete_event",
|
||||
G_CALLBACK (exit), NULL);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
@ -55,14 +55,14 @@ int main( int argc,
|
||||
GTK_STATUSBAR (status_bar), "Statusbar example");
|
||||
|
||||
button = gtk_button_new_with_label ("push item");
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (push_item), GINT_TO_POINTER (context_id));
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (push_item), GINT_TO_POINTER (context_id));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 2);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("pop last item");
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (pop_item), GINT_TO_POINTER (context_id));
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (pop_item), GINT_TO_POINTER (context_id));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 2);
|
||||
gtk_widget_show (button);
|
||||
|
||||
|
@ -35,8 +35,8 @@ int main( int argc,
|
||||
|
||||
/* Set a handler for delete_event that immediately
|
||||
* exits GTK. */
|
||||
g_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (delete_event), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "delete_event",
|
||||
G_CALLBACK (delete_event), NULL);
|
||||
|
||||
/* Sets the border width of the window. */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 20);
|
||||
@ -52,8 +52,8 @@ int main( int argc,
|
||||
|
||||
/* When the button is clicked, we call the "callback" function
|
||||
* with a pointer to "button 1" as its argument */
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (callback), (gpointer) "button 1");
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (callback), (gpointer) "button 1");
|
||||
|
||||
|
||||
/* Insert button 1 into the upper left quadrant of the table */
|
||||
@ -67,8 +67,8 @@ int main( int argc,
|
||||
|
||||
/* When the button is clicked, we call the "callback" function
|
||||
* with a pointer to "button 2" as its argument */
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (callback), (gpointer) "button 2");
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (callback), (gpointer) "button 2");
|
||||
/* Insert button 2 into the upper right quadrant of the table */
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button, 1, 2, 0, 1);
|
||||
|
||||
@ -79,8 +79,8 @@ int main( int argc,
|
||||
|
||||
/* When the button is clicked, we call the "delete_event" function
|
||||
* and the program exits */
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (delete_event), NULL);
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (delete_event), NULL);
|
||||
|
||||
/* Insert the quit button into the both
|
||||
* lower quadrants of the table */
|
||||
|
@ -49,9 +49,9 @@ int main( int argc,
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_size_request (window, 600, 500);
|
||||
gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, FALSE);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (close_application),
|
||||
NULL);
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (close_application),
|
||||
NULL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Text Widget Example");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
|
||||
@ -146,14 +146,14 @@ int main( int argc,
|
||||
|
||||
check = gtk_check_button_new_with_label ("Editable");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (check), "toggled",
|
||||
GTK_SIGNAL_FUNC (text_toggle_editable), text);
|
||||
g_signal_connect (G_OBJECT (check), "toggled",
|
||||
G_CALLBACK (text_toggle_editable), text);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
|
||||
gtk_widget_show (check);
|
||||
check = gtk_check_button_new_with_label ("Wrap Words");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (check), "toggled",
|
||||
GTK_SIGNAL_FUNC (text_toggle_word_wrap), text);
|
||||
g_signal_connect (G_OBJECT (check), "toggled",
|
||||
G_CALLBACK (text_toggle_word_wrap), text);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), FALSE);
|
||||
gtk_widget_show (check);
|
||||
|
||||
@ -167,8 +167,8 @@ int main( int argc,
|
||||
gtk_widget_show (box2);
|
||||
|
||||
button = gtk_button_new_with_label ("close");
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (close_application),
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (close_application),
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
|
@ -1 +1,2 @@
|
||||
tictactoe
|
||||
ttt_test
|
||||
|
@ -95,8 +95,8 @@ tictactoe_init (Tictactoe *ttt)
|
||||
ttt->buttons[i][j] = gtk_toggle_button_new ();
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), ttt->buttons[i][j],
|
||||
i, i+1, j, j+1);
|
||||
g_signal_connect (GTK_OBJECT (ttt->buttons[i][j]), "toggled",
|
||||
GTK_SIGNAL_FUNC (tictactoe_toggle), ttt);
|
||||
g_signal_connect (G_OBJECT (ttt->buttons[i][j]), "toggled",
|
||||
G_CALLBACK (tictactoe_toggle), ttt);
|
||||
gtk_widget_set_size_request (ttt->buttons[i][j], 20, 20);
|
||||
gtk_widget_show (ttt->buttons[i][j]);
|
||||
}
|
||||
@ -116,10 +116,12 @@ tictactoe_clear (Tictactoe *ttt)
|
||||
for (i = 0; i < 3; i++)
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
g_signal_handlers_block_by_func (GTK_OBJECT (ttt->buttons[i][j]), NULL, ttt);
|
||||
g_signal_handlers_block_by_func (G_OBJECT (ttt->buttons[i][j]),
|
||||
NULL, ttt);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ttt->buttons[i][j]),
|
||||
FALSE);
|
||||
g_signal_handlers_unblock_by_func (GTK_OBJECT (ttt->buttons[i][j]), NULL, ttt);
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (ttt->buttons[i][j]),
|
||||
NULL, ttt);
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,7 +154,7 @@ tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt)
|
||||
|
||||
if (success && found)
|
||||
{
|
||||
g_signal_emit (GTK_OBJECT (ttt),
|
||||
g_signal_emit (G_OBJECT (ttt),
|
||||
tictactoe_signals[TICTACTOE_SIGNAL], 0);
|
||||
break;
|
||||
}
|
||||
|
@ -22,8 +22,8 @@ int main( int argc,
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame");
|
||||
|
||||
g_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (exit), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (exit), NULL);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
@ -32,8 +32,8 @@ int main( int argc,
|
||||
gtk_container_add (GTK_CONTAINER (window), ttt);
|
||||
gtk_widget_show (ttt);
|
||||
|
||||
g_signal_connect (GTK_OBJECT (ttt), "tictactoe",
|
||||
GTK_SIGNAL_FUNC (win), NULL);
|
||||
g_signal_connect (G_OBJECT (ttt), "tictactoe",
|
||||
G_CALLBACK (win), NULL);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
|
@ -72,8 +72,8 @@ int main( int argc,
|
||||
|
||||
/* a generic toplevel window */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "delete_event",
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 5);
|
||||
|
||||
/* A generic scrolled window */
|
||||
@ -89,12 +89,12 @@ int main( int argc,
|
||||
tree = gtk_tree_new ();
|
||||
g_print ("root tree is %p\n", tree);
|
||||
/* connect all GtkTree:: signals */
|
||||
gtk_signal_connect (GTK_OBJECT (tree), "select_child",
|
||||
GTK_SIGNAL_FUNC (cb_select_child), tree);
|
||||
gtk_signal_connect (GTK_OBJECT (tree), "unselect_child",
|
||||
GTK_SIGNAL_FUNC (cb_unselect_child), tree);
|
||||
gtk_signal_connect (GTK_OBJECT(tree), "selection_changed",
|
||||
GTK_SIGNAL_FUNC(cb_selection_changed), tree);
|
||||
g_signal_connect (G_OBJECT (tree), "select_child",
|
||||
G_CALLBACK (cb_select_child), tree);
|
||||
g_signal_connect (G_OBJECT (tree), "unselect_child",
|
||||
G_CALLBACK (cb_unselect_child), tree);
|
||||
g_signal_connect (G_OBJECT(tree), "selection_changed",
|
||||
G_CALLBACK(cb_selection_changed), tree);
|
||||
/* Add it to the scrolled window */
|
||||
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||
tree);
|
||||
@ -111,16 +111,16 @@ int main( int argc,
|
||||
/* Create a tree item */
|
||||
item = gtk_tree_item_new_with_label (itemnames[i]);
|
||||
/* Connect all GtkItem:: and GtkTreeItem:: signals */
|
||||
gtk_signal_connect (GTK_OBJECT (item), "select",
|
||||
GTK_SIGNAL_FUNC (cb_itemsignal), "select");
|
||||
gtk_signal_connect (GTK_OBJECT (item), "deselect",
|
||||
GTK_SIGNAL_FUNC (cb_itemsignal), "deselect");
|
||||
gtk_signal_connect (GTK_OBJECT (item), "toggle",
|
||||
GTK_SIGNAL_FUNC (cb_itemsignal), "toggle");
|
||||
gtk_signal_connect (GTK_OBJECT (item), "expand",
|
||||
GTK_SIGNAL_FUNC (cb_itemsignal), "expand");
|
||||
gtk_signal_connect (GTK_OBJECT (item), "collapse",
|
||||
GTK_SIGNAL_FUNC (cb_itemsignal), "collapse");
|
||||
g_signal_connect (G_OBJECT (item), "select",
|
||||
G_CALLBACK (cb_itemsignal), "select");
|
||||
g_signal_connect (G_OBJECT (item), "deselect",
|
||||
G_CALLBACK (cb_itemsignal), "deselect");
|
||||
g_signal_connect (G_OBJECT (item), "toggle",
|
||||
G_CALLBACK (cb_itemsignal), "toggle");
|
||||
g_signal_connect (G_OBJECT (item), "expand",
|
||||
G_CALLBACK (cb_itemsignal), "expand");
|
||||
g_signal_connect (G_OBJECT (item), "collapse",
|
||||
G_CALLBACK (cb_itemsignal), "collapse");
|
||||
/* Add it to the parent tree */
|
||||
gtk_tree_append (GTK_TREE (tree), item);
|
||||
/* Show it - this can be done at any time */
|
||||
@ -133,10 +133,10 @@ int main( int argc,
|
||||
/* This is still necessary if you want these signals to be called
|
||||
for the subtree's children. Note that selection_change will be
|
||||
signalled for the root tree regardless. */
|
||||
gtk_signal_connect (GTK_OBJECT (subtree), "select_child",
|
||||
GTK_SIGNAL_FUNC (cb_select_child), subtree);
|
||||
gtk_signal_connect (GTK_OBJECT (subtree), "unselect_child",
|
||||
GTK_SIGNAL_FUNC (cb_unselect_child), subtree);
|
||||
g_signal_connect (G_OBJECT (subtree), "select_child",
|
||||
G_CALLBACK (cb_select_child), subtree);
|
||||
g_signal_connect (G_OBJECT (subtree), "unselect_child",
|
||||
G_CALLBACK (cb_unselect_child), subtree);
|
||||
/* This has absolutely no effect, because it is completely ignored
|
||||
in subtrees */
|
||||
gtk_tree_set_selection_mode (GTK_TREE (subtree),
|
||||
@ -156,16 +156,16 @@ int main( int argc,
|
||||
/* Create a subtree item, in much the same way */
|
||||
subitem = gtk_tree_item_new_with_label (itemnames[j]);
|
||||
/* Connect all GtkItem:: and GtkTreeItem:: signals */
|
||||
gtk_signal_connect (GTK_OBJECT (subitem), "select",
|
||||
GTK_SIGNAL_FUNC (cb_itemsignal), "select");
|
||||
gtk_signal_connect (GTK_OBJECT (subitem), "deselect",
|
||||
GTK_SIGNAL_FUNC (cb_itemsignal), "deselect");
|
||||
gtk_signal_connect (GTK_OBJECT (subitem), "toggle",
|
||||
GTK_SIGNAL_FUNC (cb_itemsignal), "toggle");
|
||||
gtk_signal_connect (GTK_OBJECT (subitem), "expand",
|
||||
GTK_SIGNAL_FUNC (cb_itemsignal), "expand");
|
||||
gtk_signal_connect (GTK_OBJECT (subitem), "collapse",
|
||||
GTK_SIGNAL_FUNC (cb_itemsignal), "collapse");
|
||||
g_signal_connect (G_OBJECT (subitem), "select",
|
||||
G_CALLBACK (cb_itemsignal), "select");
|
||||
g_signal_connect (G_OBJECT (subitem), "deselect",
|
||||
G_CALLBACK (cb_itemsignal), "deselect");
|
||||
g_signal_connect (G_OBJECT (subitem), "toggle",
|
||||
G_CALLBACK (cb_itemsignal), "toggle");
|
||||
g_signal_connect (G_OBJECT (subitem), "expand",
|
||||
G_CALLBACK (cb_itemsignal), "expand");
|
||||
g_signal_connect (G_OBJECT (subitem), "collapse",
|
||||
G_CALLBACK (cb_itemsignal), "collapse");
|
||||
g_print ("-> -> item %s->%p\n", itemnames[j], subitem);
|
||||
/* Add it to its parent tree */
|
||||
gtk_tree_append (GTK_TREE (subtree), subitem);
|
||||
|
@ -142,8 +142,8 @@ int main (int argc,
|
||||
* since we're making it a popup. */
|
||||
gtk_init (&argc, &argv);
|
||||
window = gtk_window_new (GTK_WINDOW_POPUP);
|
||||
g_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (close_application), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "delete_event",
|
||||
G_CALLBACK (close_application), NULL);
|
||||
gtk_widget_show (window);
|
||||
|
||||
/* Now for the pixmap and the pixmap widget */
|
||||
|
Loading…
Reference in New Issue
Block a user