Example #1
0
gint newf(GtkWidget *widget, gpointer data) {
  if (!really(widget,data))
    return TRUE;
  doc->file_new();
  mainwin->list->setView(ALL);
  mainwin->redraw();
  return TRUE;
}
Example #2
0
gint exit(GtkWidget *widget, gpointer data) {
  if (!really(widget,data))
  {
    doc->exiting = true;
    return TRUE;
  }
  cout << doc->unmodified << endl;
  gtk_main_quit();
  return FALSE;
}
Example #3
0
gint open(GtkWidget *widget, gpointer data) {
  if (!really(widget,data))
    return TRUE;
  GtkFileSelection *fsel = GTK_FILE_SELECTION(gtk_file_selection_new("Open"));
  gtk_signal_connect(GTK_OBJECT(fsel->ok_button), "clicked", GTK_SIGNAL_FUNC(openok), fsel);
  gtk_signal_connect_object(GTK_OBJECT(fsel->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(fsel));
  gtk_window_set_transient_for(GTK_WINDOW(fsel), GTK_WINDOW(mainwin->getWidget()));
  gtk_widget_show(GTK_WIDGET(fsel));
  return TRUE;
}
Example #4
0
unsigned int getNumberOfQuestions(void)
{
	printf("Number of questions = ");
	int numberOfQuestions = 0;

	int i = 0;
	while (scanf("%d", &numberOfQuestions) < 0 || numberOfQuestions <= 0)
	{
		really(i++);
	}
	
	return (unsigned int)numberOfQuestions;
}
Example #5
0
difficulty getDifficulty(void)
{
	printf("Difficulty [Easy=%d, Medium=%d, Hard=%d] = ", EASY, MEDIUM, HARD);
	difficulty difficulty = -1;

	int i = 0;
	while (true)
	{
		if (scanf("%d", &difficulty) < 0)
		{
			really(i++);
		}
		if (!isDifficulty(difficulty))
		{
			really(i++);
		}
		else
		{
			break;
		}
	}
	return difficulty;
}