[gtk+/native-layout: 59/59] Added test to demonstrate word-wrapping cell renderers in treeviews.



commit 9d97153738cc1efe79253af6e927d720f2833aaa
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Thu Jun 24 19:23:45 2010 -0400

    Added test to demonstrate word-wrapping cell renderers in treeviews.

 tests/testheightforwidth.c |  144 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 144 insertions(+), 0 deletions(-)
---
diff --git a/tests/testheightforwidth.c b/tests/testheightforwidth.c
index a589189..8529f01 100644
--- a/tests/testheightforwidth.c
+++ b/tests/testheightforwidth.c
@@ -685,6 +685,150 @@ TestInterface interfaces[] = {
     "</interface>",
     NULL
   },
+
+  {
+    "Wrapping Treeview",
+    "Demonstrates how treeviews can recalculate row heights based on allocated widths.",
+    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+    "<interface>"
+    "  <requires lib=\"gtk+\" version=\"2.20\"/>"
+    "  <!-- interface-naming-policy project-wide -->"
+    "  <object class=\"GtkWindow\" id=\"window\">"
+    "    <property name=\"default_width\">500</property>"
+    "    <child>"
+    "      <object class=\"GtkHPaned\" id=\"hpaned1\">"
+    "        <property name=\"visible\">True</property>"
+    "        <property name=\"can_focus\">True</property>"
+    "        <property name=\"position\">400</property>"
+    "        <child>"
+    "          <object class=\"GtkTreeView\" id=\"treeview1\">"
+    "            <property name=\"visible\">True</property>"
+    "            <property name=\"can_focus\">True</property>"
+    "            <property name=\"model\">liststore1</property>"
+    "            <property name=\"headers_clickable\">False</property>"
+    "            <property name=\"search_column\">0</property>"
+    "            <child>"
+    "              <object class=\"GtkTreeViewColumn\" id=\"treeviewcolumn1\">"
+    "                <property name=\"sizing\">autosize</property>"
+    "                <property name=\"title\" translatable=\"yes\">#1</property>"
+    "                <property name=\"expand\">True</property>"
+    "                <child>"
+    "                  <object class=\"GtkCellRendererText\" id=\"cellrenderertext1\">"
+    "                    <property name=\"width_chars\">10</property>"
+    "                    <property name=\"wrap_mode\">word</property>"
+    "                    <property name=\"wrap_width\">300</property>"
+    "                  </object>"
+    "                  <attributes>"
+    "                    <attribute name=\"text\">0</attribute>"
+    "                  </attributes>"
+    "                </child>"
+    "                <child>"
+    "                  <object class=\"GtkCellRendererPixbuf\" id=\"cellrendererpixbuf1\"/>"
+    "                  <attributes>"
+    "                    <attribute name=\"icon-name\">1</attribute>"
+    "                  </attributes>"
+    "                </child>"
+    "              </object>"
+    "            </child>"
+    "            <child>"
+    "              <object class=\"GtkTreeViewColumn\" id=\"treeviewcolumn2\">"
+    "                <property name=\"sizing\">autosize</property>"
+    "                <property name=\"title\" translatable=\"yes\">#2</property>"
+    "                <property name=\"expand\">True</property>"
+    "                <child>"
+    "                  <object class=\"GtkCellRendererPixbuf\" id=\"cellrendererpixbuf2\"/>"
+    "                  <attributes>"
+    "                    <attribute name=\"icon-name\">1</attribute>"
+    "                  </attributes>"
+    "                </child>"
+    "                <child>"
+    "                  <object class=\"GtkCellRendererText\" id=\"cellrenderertext2\">"
+    "                    <property name=\"ellipsize\">start</property>"
+    "                  </object>"
+    "                  <attributes>"
+    "                    <attribute name=\"text\">2</attribute>"
+    "                  </attributes>"
+    "                </child>"
+    "                <child>"
+    "                  <object class=\"GtkCellRendererText\" id=\"cellrenderertext3\">"
+    "                    <property name=\"width_chars\">10</property>"
+    "                    <property name=\"wrap_mode\">word</property>"
+    "                    <property name=\"wrap_width\">300</property>"
+    "                  </object>"
+    "                  <attributes>"
+    "                    <attribute name=\"text\">3</attribute>"
+    "                  </attributes>"
+    "                </child>"
+    "              </object>"
+    "            </child>"
+    "          </object>"
+    "          <packing>"
+    "            <property name=\"resize\">False</property>"
+    "            <property name=\"shrink\">False</property>"
+    "          </packing>"
+    "        </child>"
+    "        <child>"
+    "          <object class=\"GtkLabel\" id=\"label1\">"
+    "            <property name=\"visible\">True</property>"
+    "            <property name=\"label\" translatable=\"yes\">static\n"
+    "text\n"
+    "here</property>"
+    "          </object>"
+    "          <packing>"
+    "            <property name=\"resize\">True</property>"
+    "            <property name=\"shrink\">False</property>"
+    "          </packing>"
+    "        </child>"
+    "      </object>"
+    "    </child>"
+    "  </object>"
+    "  <object class=\"GtkListStore\" id=\"liststore1\">"
+    "    <columns>"
+    "      <!-- column-name first-text -->"
+    "      <column type=\"gchararray\"/>"
+    "      <!-- column-name icon-name -->"
+    "      <column type=\"gchararray\"/>"
+    "      <!-- column-name second-text -->"
+    "      <column type=\"gchararray\"/>"
+    "      <!-- column-name third-text -->"
+    "      <column type=\"gchararray\"/>"
+    "    </columns>"
+    "    <data>"
+    "      <row>"
+    "        <col id=\"0\" translatable=\"yes\">both columns contain word-wrapping</col>"
+    "        <col id=\"1\" translatable=\"yes\">gtk-ok</col>"
+    "        <col id=\"2\" translatable=\"yes\">this</col>"
+    "        <col id=\"3\" translatable=\"yes\">this</col>"
+    "      </row>"
+    "      <row>"
+    "        <col id=\"0\" translatable=\"yes\">cell renderers</col>"
+    "        <col id=\"1\" translatable=\"yes\">gtk-cancel</col>"
+    "        <col id=\"2\" translatable=\"yes\">renderer</col>"
+    "        <col id=\"3\" translatable=\"yes\">renderer</col>"
+    "      </row>"
+    "      <row>"
+    "        <col id=\"0\" translatable=\"yes\">to demonstrate height-for-width</col>"
+    "        <col id=\"1\" translatable=\"yes\">gtk-info</col>"
+    "        <col id=\"2\" translatable=\"yes\">is not</col>"
+    "        <col id=\"3\" translatable=\"yes\">can</col>"
+    "      </row>"
+    "      <row>"
+    "        <col id=\"0\" translatable=\"yes\">trading</col>"
+    "        <col id=\"1\" translatable=\"yes\">gtk-apply</col>"
+    "        <col id=\"2\" translatable=\"yes\">wide</col>"
+    "        <col id=\"3\" translatable=\"yes\">be</col>"
+    "      </row>"
+    "      <row>"
+    "        <col id=\"0\" translatable=\"yes\">for individual rows</col>"
+    "        <col id=\"1\" translatable=\"yes\">gtk-dialog-warning</col>"
+    "        <col id=\"2\" translatable=\"yes\">at all</col>"
+    "        <col id=\"3\" translatable=\"yes\">wide because of this long text.</col>"
+    "      </row>"
+    "    </data>"
+    "  </object>"
+    "</interface>",
+    NULL
+  },
 };
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]