testcellarea.c 19.4 KB
Newer Older
1 2 3
#include <gtk/gtk.h>
#include "cellareascaffold.h"

4 5 6
/*******************************************************
 *                      Simple Test                    *
 *******************************************************/
7 8 9 10 11 12 13
enum {
  SIMPLE_COLUMN_NAME,
  SIMPLE_COLUMN_ICON,
  SIMPLE_COLUMN_DESCRIPTION,
  N_SIMPLE_COLUMNS
};

14 15
static GtkCellRenderer *cell_1 = NULL, *cell_2 = NULL, *cell_3 = NULL;

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
static GtkTreeModel *
simple_list_model (void)
{
  GtkTreeIter   iter;
  GtkListStore *store = 
    gtk_list_store_new (N_SIMPLE_COLUMNS,
			G_TYPE_STRING,  /* name text */
			G_TYPE_STRING,  /* icon name */
			G_TYPE_STRING); /* description text */

  gtk_list_store_append (store, &iter);
  gtk_list_store_set (store, &iter, 
		      SIMPLE_COLUMN_NAME, "Alice in wonderland",
		      SIMPLE_COLUMN_ICON, "gtk-execute",
		      SIMPLE_COLUMN_DESCRIPTION, 
31 32 33 34
		      "Twas brillig, and the slithy toves "
		      "did gyre and gimble in the wabe; "
		      "all mimsy were the borogoves, "
		      "and the mome raths outgrabe",
35 36 37 38 39 40 41 42 43 44 45 46 47
		      -1);

  gtk_list_store_append (store, &iter);
  gtk_list_store_set (store, &iter, 
		      SIMPLE_COLUMN_NAME, "Marry Poppins",
		      SIMPLE_COLUMN_ICON, "gtk-yes",
		      SIMPLE_COLUMN_DESCRIPTION, "Supercalifragilisticexpialidocious",
		      -1);

  gtk_list_store_append (store, &iter);
  gtk_list_store_set (store, &iter, 
		      SIMPLE_COLUMN_NAME, "George Bush",
		      SIMPLE_COLUMN_ICON, "gtk-dialog-warning",
48 49
		      SIMPLE_COLUMN_DESCRIPTION, "It's a very good question, very direct, "
		      "and I'm not going to answer it",
50 51 52 53 54 55 56 57 58 59
		      -1);

  gtk_list_store_append (store, &iter);
  gtk_list_store_set (store, &iter, 
		      SIMPLE_COLUMN_NAME, "Whinnie the pooh",
		      SIMPLE_COLUMN_ICON, "gtk-stop",
		      SIMPLE_COLUMN_DESCRIPTION, "The most wonderful thing about tiggers, "
		      "is tiggers are wonderful things",
		      -1);

60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
  gtk_list_store_append (store, &iter);
  gtk_list_store_set (store, &iter, 
		      SIMPLE_COLUMN_NAME, "Aleister Crowley",
		      SIMPLE_COLUMN_ICON, "gtk-about",
		      SIMPLE_COLUMN_DESCRIPTION, 
		      "Thou shalt do what thou wilt shall be the whole of the law",
		      -1);

  gtk_list_store_append (store, &iter);
  gtk_list_store_set (store, &iter, 
		      SIMPLE_COLUMN_NAME, "Mark Twain",
		      SIMPLE_COLUMN_ICON, "gtk-quit",
		      SIMPLE_COLUMN_DESCRIPTION, 
		      "Giving up smoking is the easiest thing in the world. "
		      "I know because I've done it thousands of times.",
		      -1);


78 79 80
  return (GtkTreeModel *)store;
}

81 82
static GtkWidget *
simple_scaffold (void)
83 84
{
  GtkTreeModel *model;
85
  GtkWidget *scaffold;
86 87 88 89 90 91 92 93 94 95 96 97
  GtkCellArea *area;
  GtkCellRenderer *renderer;

  scaffold = cell_area_scaffold_new ();
  gtk_widget_show (scaffold);

  model = simple_list_model ();

  cell_area_scaffold_set_model (CELL_AREA_SCAFFOLD (scaffold), model);

  area = cell_area_scaffold_get_area (CELL_AREA_SCAFFOLD (scaffold));

98
  cell_1 = renderer = gtk_cell_renderer_text_new ();
99
  gtk_cell_area_box_pack_start (GTK_CELL_AREA_BOX (area), renderer, FALSE, FALSE, FALSE);
100 101
  gtk_cell_area_attribute_connect (area, renderer, "text", SIMPLE_COLUMN_NAME);

102
  cell_2 = renderer = gtk_cell_renderer_pixbuf_new ();
103
  g_object_set (G_OBJECT (renderer), "xalign", 0.0F, NULL);
104
  gtk_cell_area_box_pack_start (GTK_CELL_AREA_BOX (area), renderer, TRUE, FALSE, FALSE);
105 106
  gtk_cell_area_attribute_connect (area, renderer, "stock-id", SIMPLE_COLUMN_ICON);

107
  cell_3 = renderer = gtk_cell_renderer_text_new ();
108 109 110 111
  g_object_set (G_OBJECT (renderer), 
		"wrap-mode", PANGO_WRAP_WORD,
		"wrap-width", 215,
		NULL);
112
  gtk_cell_area_box_pack_start (GTK_CELL_AREA_BOX (area), renderer, FALSE, TRUE, FALSE);
113 114
  gtk_cell_area_attribute_connect (area, renderer, "text", SIMPLE_COLUMN_DESCRIPTION);

115 116 117 118 119 120 121
  return scaffold;
}

static void
orientation_changed (GtkComboBox      *combo,
		     CellAreaScaffold *scaffold)
{
122
  GtkCellArea   *area = cell_area_scaffold_get_area (scaffold);
123 124
  GtkOrientation orientation = gtk_combo_box_get_active (combo);

125
  gtk_orientable_set_orientation (GTK_ORIENTABLE (area), orientation);
126 127
}

128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
static void
align_cell_2_toggled (GtkToggleButton  *toggle,
		      CellAreaScaffold *scaffold)
{
  GtkCellArea *area = cell_area_scaffold_get_area (scaffold);
  gboolean     align = gtk_toggle_button_get_active (toggle);

  gtk_cell_area_cell_set (area, cell_2, "align", align, NULL);
}

static void
align_cell_3_toggled (GtkToggleButton  *toggle,
		      CellAreaScaffold *scaffold)
{
  GtkCellArea *area = cell_area_scaffold_get_area (scaffold);
  gboolean     align = gtk_toggle_button_get_active (toggle);

  gtk_cell_area_cell_set (area, cell_3, "align", align, NULL);
}

static void
expand_cell_1_toggled (GtkToggleButton  *toggle,
		       CellAreaScaffold *scaffold)
{
  GtkCellArea *area = cell_area_scaffold_get_area (scaffold);
  gboolean     expand = gtk_toggle_button_get_active (toggle);

  gtk_cell_area_cell_set (area, cell_1, "expand", expand, NULL);
}

static void
expand_cell_2_toggled (GtkToggleButton  *toggle,
		       CellAreaScaffold *scaffold)
{
  GtkCellArea *area = cell_area_scaffold_get_area (scaffold);
  gboolean     expand = gtk_toggle_button_get_active (toggle);

  gtk_cell_area_cell_set (area, cell_2, "expand", expand, NULL);
}

static void
expand_cell_3_toggled (GtkToggleButton  *toggle,
		       CellAreaScaffold *scaffold)
{
  GtkCellArea *area = cell_area_scaffold_get_area (scaffold);
  gboolean     expand = gtk_toggle_button_get_active (toggle);

  gtk_cell_area_cell_set (area, cell_3, "expand", expand, NULL);
}

178 179 180 181 182 183 184 185
static void
simple_cell_area (void)
{
  GtkWidget *window, *widget;
  GtkWidget *scaffold, *frame, *vbox, *hbox;

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

186 187
  gtk_window_set_title (GTK_WINDOW (window), "CellArea expand and alignments");

188 189
  scaffold = simple_scaffold ();

190
  hbox  = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
191
  frame = gtk_frame_new (NULL);
192
  gtk_widget_show (hbox);
193 194
  gtk_widget_show (frame);

195
  gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
196
  gtk_widget_set_halign (frame, GTK_ALIGN_FILL);
197 198

  gtk_container_add (GTK_CONTAINER (frame), scaffold);
199 200 201 202

  gtk_box_pack_end (GTK_BOX (hbox), frame, TRUE, TRUE, 0);

  /* Now add some controls */
203
  vbox  = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
204 205 206 207 208 209 210 211 212 213 214 215 216
  gtk_widget_show (vbox);
  gtk_box_pack_end (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);

  widget = gtk_combo_box_text_new ();
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical");
  gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "changed",
                    G_CALLBACK (orientation_changed), scaffold);

217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
  widget = gtk_check_button_new_with_label ("Align 2nd Cell");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
  
  g_signal_connect (G_OBJECT (widget), "toggled",
                    G_CALLBACK (align_cell_2_toggled), scaffold);

  widget = gtk_check_button_new_with_label ("Align 3rd Cell");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
  
  g_signal_connect (G_OBJECT (widget), "toggled",
                    G_CALLBACK (align_cell_3_toggled), scaffold);


  widget = gtk_check_button_new_with_label ("Expand 1st Cell");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
  
  g_signal_connect (G_OBJECT (widget), "toggled",
                    G_CALLBACK (expand_cell_1_toggled), scaffold);

  widget = gtk_check_button_new_with_label ("Expand 2nd Cell");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
  
  g_signal_connect (G_OBJECT (widget), "toggled",
                    G_CALLBACK (expand_cell_2_toggled), scaffold);

  widget = gtk_check_button_new_with_label ("Expand 3rd Cell");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
  
  g_signal_connect (G_OBJECT (widget), "toggled",
                    G_CALLBACK (expand_cell_3_toggled), scaffold);
257 258

  gtk_container_add (GTK_CONTAINER (window), hbox);
259 260 261 262

  gtk_widget_show (window);
}

263 264 265
/*******************************************************
 *                      Focus Test                     *
 *******************************************************/
266 267
static GtkCellRenderer *focus_renderer, *sibling_renderer;

268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
enum {
  FOCUS_COLUMN_NAME,
  FOCUS_COLUMN_CHECK,
  FOCUS_COLUMN_STATIC_TEXT,
  N_FOCUS_COLUMNS
};

static GtkTreeModel *
focus_list_model (void)
{
  GtkTreeIter   iter;
  GtkListStore *store = 
    gtk_list_store_new (N_FOCUS_COLUMNS,
			G_TYPE_STRING,  /* name text */
			G_TYPE_BOOLEAN, /* check */
			G_TYPE_STRING); /* static text */

  gtk_list_store_append (store, &iter);
  gtk_list_store_set (store, &iter, 
		      FOCUS_COLUMN_NAME, "Enter a string",
		      FOCUS_COLUMN_CHECK, TRUE,
		      FOCUS_COLUMN_STATIC_TEXT, "Does it fly ?",
		      -1);

  gtk_list_store_append (store, &iter);
  gtk_list_store_set (store, &iter, 
		      FOCUS_COLUMN_NAME, "Enter a string",
		      FOCUS_COLUMN_CHECK, FALSE,
		      FOCUS_COLUMN_STATIC_TEXT, "Would you put it in a toaster ?",
		      -1);

  gtk_list_store_append (store, &iter);
  gtk_list_store_set (store, &iter, 
		      FOCUS_COLUMN_NAME, "Type something",
		      FOCUS_COLUMN_CHECK, FALSE,
		      FOCUS_COLUMN_STATIC_TEXT, "Does it feed on cute kittens ?",
		      -1);

  return (GtkTreeModel *)store;
}

309 310
static void
cell_toggled (GtkCellRendererToggle *cell_renderer,
311
	      const gchar           *path,
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
	      CellAreaScaffold      *scaffold)
{
  GtkTreeModel *model = cell_area_scaffold_get_model (scaffold);
  GtkTreeIter   iter;
  gboolean      active;

  g_print ("Cell toggled !\n");

  if (!gtk_tree_model_get_iter_from_string (model, &iter, path))
    return;

  gtk_tree_model_get (model, &iter, FOCUS_COLUMN_CHECK, &active, -1);
  gtk_list_store_set (GTK_LIST_STORE (model), &iter, FOCUS_COLUMN_CHECK, !active, -1);
}

327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343
static void
cell_edited (GtkCellRendererToggle *cell_renderer,
	     const gchar           *path,
	     const gchar           *new_text,
	     CellAreaScaffold      *scaffold)
{
  GtkTreeModel *model = cell_area_scaffold_get_model (scaffold);
  GtkTreeIter   iter;

  g_print ("Cell edited with new text '%s' !\n", new_text);

  if (!gtk_tree_model_get_iter_from_string (model, &iter, path))
    return;

  gtk_list_store_set (GTK_LIST_STORE (model), &iter, FOCUS_COLUMN_NAME, new_text, -1);
}

344
static GtkWidget *
345
focus_scaffold (gboolean color_bg, GtkCellRenderer **focus, GtkCellRenderer **sibling)
346 347 348 349
{
  GtkTreeModel *model;
  GtkWidget *scaffold;
  GtkCellArea *area;
350
  GtkCellRenderer *renderer, *toggle;
351 352 353 354 355 356 357 358 359 360 361 362

  scaffold = cell_area_scaffold_new ();
  gtk_widget_show (scaffold);

  model = focus_list_model ();

  cell_area_scaffold_set_model (CELL_AREA_SCAFFOLD (scaffold), model);

  area = cell_area_scaffold_get_area (CELL_AREA_SCAFFOLD (scaffold));

  renderer = gtk_cell_renderer_text_new ();
  g_object_set (G_OBJECT (renderer), "editable", TRUE, NULL);
363
  gtk_cell_area_box_pack_start (GTK_CELL_AREA_BOX (area), renderer, TRUE, FALSE, FALSE);
364 365
  gtk_cell_area_attribute_connect (area, renderer, "text", FOCUS_COLUMN_NAME);

366 367 368
  if (color_bg)
    g_object_set (G_OBJECT (renderer), "cell-background", "red", NULL);

369 370 371
  g_signal_connect (G_OBJECT (renderer), "edited",
		    G_CALLBACK (cell_edited), scaffold);

372
  toggle = renderer = gtk_cell_renderer_toggle_new ();
373
  g_object_set (G_OBJECT (renderer), "xalign", 0.0F, NULL);
374
  gtk_cell_area_box_pack_start (GTK_CELL_AREA_BOX (area), renderer, FALSE, TRUE, FALSE);
375 376
  gtk_cell_area_attribute_connect (area, renderer, "active", FOCUS_COLUMN_CHECK);

377 378
  if (color_bg)
    g_object_set (G_OBJECT (renderer), "cell-background", "green", NULL);
379 380 381

  if (focus)
    *focus = renderer;
382

383 384 385
  g_signal_connect (G_OBJECT (renderer), "toggled",
		    G_CALLBACK (cell_toggled), scaffold);

386
  renderer = gtk_cell_renderer_text_new ();
387 388 389 390
  g_object_set (G_OBJECT (renderer), 
		"wrap-mode", PANGO_WRAP_WORD,
		"wrap-width", 150,
		NULL);
391 392 393

  if (color_bg)
    g_object_set (G_OBJECT (renderer), "cell-background", "blue", NULL);
394 395 396

  if (sibling)
    *sibling = renderer;
397

398
  gtk_cell_area_box_pack_start (GTK_CELL_AREA_BOX (area), renderer, FALSE, TRUE, FALSE);
399 400
  gtk_cell_area_attribute_connect (area, renderer, "text", FOCUS_COLUMN_STATIC_TEXT);

401
  gtk_cell_area_add_focus_sibling (area, toggle, renderer);
402

403 404 405
  return scaffold;
}

406 407 408 409 410 411 412 413 414 415 416 417 418 419 420
static void
focus_sibling_toggled (GtkToggleButton  *toggle,
		       CellAreaScaffold *scaffold)
{
  GtkCellArea *area = cell_area_scaffold_get_area (scaffold);
  gboolean     active = gtk_toggle_button_get_active (toggle);

  if (active)
    gtk_cell_area_add_focus_sibling (area, focus_renderer, sibling_renderer);
  else
    gtk_cell_area_remove_focus_sibling (area, focus_renderer, sibling_renderer);

  gtk_widget_queue_draw (GTK_WIDGET (scaffold));
}

421 422 423 424 425 426 427 428

static void
focus_cell_area (void)
{
  GtkWidget *window, *widget;
  GtkWidget *scaffold, *frame, *vbox, *hbox;

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
429
  hbox  = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
430
  gtk_widget_show (hbox);
431

432 433
  gtk_window_set_title (GTK_WINDOW (window), "Focus and editable cells");

434
  scaffold = focus_scaffold (FALSE, &focus_renderer, &sibling_renderer);
435 436 437 438 439 440 441 442 443

  frame = gtk_frame_new (NULL);
  gtk_widget_show (frame);

  gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
  gtk_widget_set_halign (frame, GTK_ALIGN_FILL);

  gtk_container_add (GTK_CONTAINER (frame), scaffold);

444 445 446
  gtk_box_pack_end (GTK_BOX (hbox), frame, TRUE, TRUE, 0);

  /* Now add some controls */
447
  vbox  = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
448 449 450
  gtk_widget_show (vbox);
  gtk_box_pack_end (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);

451 452 453 454 455 456 457 458 459 460
  widget = gtk_combo_box_text_new ();
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical");
  gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "changed",
                    G_CALLBACK (orientation_changed), scaffold);

461
  widget = gtk_check_button_new_with_label ("Focus Sibling");
462
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
463 464 465
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);

466 467 468
  g_signal_connect (G_OBJECT (widget), "toggled",
                    G_CALLBACK (focus_sibling_toggled), scaffold);

469
  gtk_container_add (GTK_CONTAINER (window), hbox);
470 471 472 473 474

  gtk_widget_show (window);
}


475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519

/*******************************************************
 *                  Background Area                    *
 *******************************************************/
static void
cell_spacing_changed (GtkSpinButton    *spin_button,
		      CellAreaScaffold *scaffold)
{
  GtkCellArea *area = cell_area_scaffold_get_area (scaffold);
  gint        value;

  value = (gint)gtk_spin_button_get_value (spin_button);

  gtk_cell_area_box_set_spacing (GTK_CELL_AREA_BOX (area), value);
}

static void
row_spacing_changed (GtkSpinButton    *spin_button,
		     CellAreaScaffold *scaffold)
{
  gint value;

  value = (gint)gtk_spin_button_get_value (spin_button);

  cell_area_scaffold_set_row_spacing (scaffold, value);
}

static void
indentation_changed (GtkSpinButton    *spin_button,
		     CellAreaScaffold *scaffold)
{
  gint value;

  value = (gint)gtk_spin_button_get_value (spin_button);

  cell_area_scaffold_set_indentation (scaffold, value);
}

static void
background_area (void)
{
  GtkWidget *window, *widget, *label, *main_vbox;
  GtkWidget *scaffold, *frame, *vbox, *hbox;

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
520 521
  hbox  = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
  main_vbox  = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
522 523 524 525 526 527 528 529
  gtk_widget_show (hbox);
  gtk_widget_show (main_vbox);
  gtk_container_add (GTK_CONTAINER (window), main_vbox);

  gtk_window_set_title (GTK_WINDOW (window), "Background Area");

  label = gtk_label_new ("In this example, row spacing gets devided into the background area, "
			 "column spacing is added between each background area, indentation is "
530
			 "prepended space distributed to the background area.");
531 532 533 534 535
  gtk_label_set_line_wrap  (GTK_LABEL (label), TRUE);
  gtk_label_set_width_chars  (GTK_LABEL (label), 40);
  gtk_widget_show (label);
  gtk_box_pack_start (GTK_BOX (main_vbox), label, FALSE, FALSE, 0);

536
  scaffold = focus_scaffold (TRUE, NULL, NULL);
537 538 539 540 541 542 543 544 545 546 547 548

  frame = gtk_frame_new (NULL);
  gtk_widget_show (frame);

  gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
  gtk_widget_set_halign (frame, GTK_ALIGN_FILL);

  gtk_container_add (GTK_CONTAINER (frame), scaffold);

  gtk_box_pack_end (GTK_BOX (hbox), frame, TRUE, TRUE, 0);

  /* Now add some controls */
549
  vbox  = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565
  gtk_widget_show (vbox);
  gtk_box_pack_end (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);

  widget = gtk_combo_box_text_new ();
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical");
  gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "changed",
                    G_CALLBACK (orientation_changed), scaffold);

  widget = gtk_spin_button_new_with_range (0, 10, 1);
  label = gtk_label_new ("Cell spacing");
566
  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
567 568 569 570 571 572 573 574 575 576 577 578 579
  gtk_widget_show (hbox);
  gtk_widget_show (label);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
  gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "value-changed",
                    G_CALLBACK (cell_spacing_changed), scaffold);


  widget = gtk_spin_button_new_with_range (0, 10, 1);
  label = gtk_label_new ("Row spacing");
580
  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
581 582 583 584 585 586 587 588 589 590 591 592
  gtk_widget_show (hbox);
  gtk_widget_show (label);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
  gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "value-changed",
                    G_CALLBACK (row_spacing_changed), scaffold);

  widget = gtk_spin_button_new_with_range (0, 30, 1);
  label = gtk_label_new ("Intentation");
593
  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611
  gtk_widget_show (hbox);
  gtk_widget_show (label);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
  gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "value-changed",
                    G_CALLBACK (indentation_changed), scaffold);

  gtk_widget_show (window);
}






612 613 614 615 616
int
main (int argc, char *argv[])
{
  gtk_init (NULL, NULL);

617 618 619
  if (g_getenv ("RTL"))
    gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);

620
  simple_cell_area ();
621
  focus_cell_area ();
622
  background_area ();
623 624 625 626 627

  gtk_main ();

  return 0;
}