/*
 * Copyright (c) 2009  Openismus GmbH
 *
 * im-switch-test: Input method switching test.
 * Build: cc -g -O -Wall `pkg-config --cflags --libs gtk+-2.0` -o im-switch-test im-switch-test.c
 *
 * im-switch-test is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * im-switch-test is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with im-switch-test; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <gtk/gtk.h>

int main(int argc, char** argv)
{
  GtkWidget* dialog;
  GtkWidget* content;
  GtkWidget* table;
  GtkWidget* entry_default;
  GtkWidget* entry_ipa;
  GtkWidget* label_default;
  GtkWidget* label_ipa;

  gtk_init(&argc, &argv);

  dialog = gtk_dialog_new_with_buttons("Input method switch test", NULL,
                                       GTK_DIALOG_NO_SEPARATOR,
                                       GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
                                       NULL);
  content = gtk_dialog_get_content_area(GTK_DIALOG(dialog));

  table = gtk_table_new(2, 2, FALSE);
  gtk_container_set_border_width(GTK_CONTAINER(table), 12);
  gtk_table_set_row_spacings(GTK_TABLE(table), 12);
  gtk_table_set_col_spacings(GTK_TABLE(table), 12);
  gtk_box_pack_start(GTK_BOX(content), table, TRUE, TRUE, 0);

  entry_default = gtk_entry_new();
  gtk_table_attach(GTK_TABLE(table), entry_default, 1, 2, 0, 1,
                   GTK_EXPAND|GTK_FILL, GTK_EXPAND, 0, 0);

  entry_ipa = g_object_new(GTK_TYPE_ENTRY, "im-module", "ipa", NULL);
  gtk_table_attach(GTK_TABLE(table), entry_ipa, 1, 2, 1, 2,
                   GTK_EXPAND|GTK_FILL, GTK_EXPAND, 0, 0);

  label_default = gtk_label_new_with_mnemonic("_Default:");
  gtk_misc_set_alignment(GTK_MISC(label_default), 0.0, 0.5);
  gtk_label_set_mnemonic_widget(GTK_LABEL(label_default), entry_default);
  gtk_table_attach(GTK_TABLE(table), label_default, 0, 1, 0, 1,
                   GTK_FILL, 0, 0, 0);

  label_ipa = gtk_label_new_with_mnemonic("_Phonetic:");
  gtk_misc_set_alignment(GTK_MISC(label_ipa), 0.0, 0.5);
  gtk_label_set_mnemonic_widget(GTK_LABEL(label_ipa), entry_ipa);
  gtk_table_attach(GTK_TABLE(table), label_ipa, 0, 1, 1, 2,
                   GTK_FILL, 0, 0, 0);

  gtk_widget_show_all(table);
  gtk_widget_show(dialog);

  if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_NONE)
    gtk_widget_destroy(dialog);

  return 0;
}


