~ubuntu-branches/ubuntu/breezy/groundhog/breezy

« back to all changes in this revision

Viewing changes to src/dialog.cc

  • Committer: Bazaar Package Importer
  • Author(s): Stephen M Moraco
  • Date: 2003-06-18 19:46:15 UTC
  • mto: (2.1.1 warty)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20030618194615-sztk57bkfjhmctl4
Tags: upstream-1.4
ImportĀ upstreamĀ versionĀ 1.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Groundhog -- a simple logic game
2
 
 * Copyright (C) 1998-2001 Maurits Rijk
 
2
 * Copyright (C) 1998-2002 Maurits Rijk
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
5
5
 * it under the terms of the GNU General Public License as published by
34
34
   gtk_window_set_title(GTK_WINDOW(_window), title);
35
35
 
36
36
   // Ok button
37
 
   GtkWidget* button = gtk_button_new_with_label(_("Ok"));
38
 
   GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
39
 
   gtk_signal_connect(GTK_OBJECT(button), "clicked",
40
 
                      GTK_SIGNAL_FUNC(Dialog::OkCB), this);
41
 
   gtk_signal_connect(GTK_OBJECT(_window), "delete_event",
42
 
                      GTK_SIGNAL_FUNC(Dialog::DeleteCB), this);
 
37
   GtkWidget* button = gtk_dialog_add_button(GTK_DIALOG(_window),
 
38
                                             GTK_STOCK_OK, 
 
39
                                             GTK_RESPONSE_NONE);
 
40
   g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(Dialog::OkCB), 
 
41
                    this);
 
42
   g_signal_connect(G_OBJECT(_window), "delete_event",
 
43
                    G_CALLBACK(Dialog::DeleteCB), this);
43
44
 
44
 
   gtk_box_pack_start(GTK_BOX(GTK_DIALOG(_window)->action_area), button, TRUE,
45
 
                      TRUE, 0);
46
45
   gtk_widget_grab_default(button);
47
 
   gtk_widget_show(button);
 
46
}
 
47
 
 
48
void
 
49
Dialog::DoDialog()
 
50
{
 
51
 
 
52
   if (GTK_WIDGET_VISIBLE(_window))
 
53
      gdk_window_raise(_window->window);
 
54
   else
 
55
      gtk_widget_show_all(_window);
48
56
}
49
57
 
50
58
void
70
78
void
71
79
Dialog::AddCancelButton()
72
80
{
73
 
   GtkWidget* button = gtk_button_new_with_label(_("Cancel"));
74
 
   gtk_signal_connect(GTK_OBJECT(button), "clicked",
75
 
                      GTK_SIGNAL_FUNC(Dialog::CancelCB), (gpointer) this);
76
 
   gtk_box_pack_start(GTK_BOX(GTK_DIALOG(_window)->action_area), button, TRUE,
77
 
                      TRUE, 0);
78
 
   gtk_widget_show(button);
 
81
   GtkWidget* button = gtk_dialog_add_button(GTK_DIALOG(_window),
 
82
                                             GTK_STOCK_CANCEL,
 
83
                                             GTK_RESPONSE_NONE);
 
84
   g_signal_connect(G_OBJECT(button), "clicked",
 
85
                    G_CALLBACK(Dialog::CancelCB), (gpointer) this);
79
86
}
80
87
 
81
88