]> Pileus Git - ~andy/gtk/blobdiff - tests/testheightforwidth.c
testscale: add a test for up/leftwards scales
[~andy/gtk] / tests / testheightforwidth.c
index f784864b6bf710a5914d9e11222e792743469d1e..7e10d297177768a4e1844c741810d222e75867f2 100644 (file)
@@ -15,9 +15,7 @@
  * Library General Public License for more details.
  *
  * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <gtk/gtk.h>
@@ -658,6 +656,261 @@ TestInterface interfaces[] = {
     "</interface>",
     NULL
   },
+
+  {
+    "Combo Boxes and Menus",
+    "This test shows wrapping and ellipsizing text in combo boxes (and consequently in menu items).",
+    "<?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=\"border_width\">8</property>"
+    "    <property name=\"default_width\">600</property>"
+    "    <child>"
+    "      <object class=\"GtkHPaned\" id=\"hpaned1\">"
+    "        <property name=\"visible\">True</property>"
+    "        <property name=\"can_focus\">True</property>"
+    "        <child>"
+    "          <object class=\"GtkVBox\" id=\"vbox1\">"
+    "            <property name=\"visible\">True</property>"
+    "            <property name=\"spacing\">5</property>"
+    "            <child>"
+    "              <object class=\"GtkHBox\" id=\"hbox1\">"
+    "                <property name=\"visible\">True</property>"
+    "                <property name=\"spacing\">5</property>"
+    "                <child>"
+    "                  <object class=\"GtkLabel\" id=\"label1\">"
+    "                    <property name=\"visible\">True</property>"
+    "                    <property name=\"label\" translatable=\"yes\">this combo box</property>"
+    "                    <attributes>"
+    "                      <attribute name=\"weight\" value=\"bold\"/>"
+    "                      <attribute name=\"foreground\" value=\"#b3460000eb1c\"/>"
+    "                    </attributes>"
+    "                  </object>"
+    "                  <packing>"
+    "                    <property name=\"expand\">True</property>"
+    "                    <property name=\"fill\">True</property>"
+    "                    <property name=\"position\">0</property>"
+    "                  </packing>"
+    "                </child>"
+    "                <child>"
+    "                  <object class=\"GtkLabel\" id=\"label2\">"
+    "                    <property name=\"visible\">True</property>"
+    "                    <property name=\"label\" translatable=\"yes\">contains some wrapping locations</property>"
+    "                    <property name=\"ellipsize\">end</property>"
+    "                    <property name=\"width_chars\">10</property>"
+    "                    <attributes>"
+    "                      <attribute name=\"weight\" value=\"bold\"/>"
+    "                      <attribute name=\"foreground\" value=\"#b3460000eb1c\"/>"
+    "                    </attributes>"
+    "                  </object>"
+    "                  <packing>"
+    "                    <property name=\"expand\">True</property>"
+    "                    <property name=\"fill\">True</property>"
+    "                    <property name=\"position\">1</property>"
+    "                  </packing>"
+    "                </child>"
+    "                <child>"
+    "                  <object class=\"GtkComboBox\" id=\"combobox1\">"
+    "                    <property name=\"visible\">True</property>"
+    "                    <property name=\"model\">liststore1</property>"
+    "                    <property name=\"active\">0</property>"
+    "                    <child>"
+    "                      <object class=\"GtkCellRendererPixbuf\" id=\"cellrenderertext1\"/>"
+    "                      <attributes>"
+    "                        <attribute name=\"stock-id\">1</attribute>"
+    "                      </attributes>"
+    "                    </child>"
+    "                    <child>"
+    "                      <object class=\"GtkCellRendererText\" id=\"cellrenderertext2\">"
+    "                        <property name=\"foreground\">purple</property>"
+    "                        <property name=\"weight\">600</property>"
+    "                        <property name=\"wrap_mode\">word</property>"
+    "                        <property name=\"wrap_width\">100</property>"
+    "                      </object>"
+    "                      <attributes>"
+    "                        <attribute name=\"text\">0</attribute>"
+    "                      </attributes>"
+    "                    </child>"
+    "                  </object>"
+    "                  <packing>"
+    "                    <property name=\"expand\">True</property>"
+    "                    <property name=\"fill\">True</property>"
+    "                    <property name=\"position\">2</property>"
+    "                  </packing>"
+    "                </child>"
+    "              </object>"
+    "              <packing>"
+    "                <property name=\"expand\">False</property>"
+    "                <property name=\"fill\">True</property>"
+    "                <property name=\"position\">0</property>"
+    "              </packing>"
+    "            </child>"
+    "            <child>"
+    "              <object class=\"GtkFrame\" id=\"frame1\">"
+    "                <property name=\"visible\">True</property>"
+    "                <property name=\"label_xalign\">0</property>"
+    "                <child>"
+    "                  <object class=\"GtkLabel\" id=\"label3\">"
+    "                    <property name=\"visible\">True</property>"
+    "                    <property name=\"label\" translatable=\"yes\">This test shows combo boxes\n"
+    "requesting and allocating space\n"
+    "for its backing content using\n"
+    "height-for-width geometry\n"
+    "management.\n"
+    "\n"
+    "Note this test also demonstrates\n"
+    "height-for-width menu items.</property>"
+    "                    <property name=\"justify\">center</property>"
+    "                    <attributes>"
+    "                      <attribute name=\"weight\" value=\"bold\"/>"
+    "                      <attribute name=\"foreground\" value=\"#00000000ffff\"/>"
+    "                    </attributes>"
+    "                  </object>"
+    "                </child>"
+    "              </object>"
+    "              <packing>"
+    "                <property name=\"expand\">True</property>"
+    "                <property name=\"fill\">True</property>"
+    "                <property name=\"position\">1</property>"
+    "              </packing>"
+    "            </child>"
+    "            <child>"
+    "              <object class=\"GtkHBox\" id=\"hbox2\">"
+    "                <property name=\"visible\">True</property>"
+    "                <property name=\"spacing\">5</property>"
+    "                <child>"
+    "                  <object class=\"GtkLabel\" id=\"label4\">"
+    "                    <property name=\"visible\">True</property>"
+    "                    <property name=\"label\" translatable=\"yes\">this combo box</property>"
+    "                    <attributes>"
+    "                      <attribute name=\"weight\" value=\"bold\"/>"
+    "                      <attribute name=\"foreground\" value=\"#ffffa5a50000\"/>"
+    "                    </attributes>"
+    "                  </object>"
+    "                  <packing>"
+    "                    <property name=\"expand\">True</property>"
+    "                    <property name=\"fill\">True</property>"
+    "                    <property name=\"position\">0</property>"
+    "                  </packing>"
+    "                </child>"
+    "                <child>"
+    "                  <object class=\"GtkLabel\" id=\"label5\">"
+    "                    <property name=\"visible\">True</property>"
+    "                    <property name=\"label\" translatable=\"yes\">contains some ellipsizing locations</property>"
+    "                    <property name=\"ellipsize\">end</property>"
+    "                    <property name=\"width_chars\">10</property>"
+    "                    <attributes>"
+    "                      <attribute name=\"weight\" value=\"bold\"/>"
+    "                      <attribute name=\"foreground\" value=\"#ffffa5a50000\"/>"
+    "                    </attributes>"
+    "                  </object>"
+    "                  <packing>"
+    "                    <property name=\"expand\">True</property>"
+    "                    <property name=\"fill\">True</property>"
+    "                    <property name=\"position\">1</property>"
+    "                  </packing>"
+    "                </child>"
+    "                <child>"
+    "                  <object class=\"GtkComboBox\" id=\"combobox2\">"
+    "                    <property name=\"visible\">True</property>"
+    "                    <property name=\"model\">liststore1</property>"
+    "                    <property name=\"active\">0</property>"
+    "                    <child>"
+    "                      <object class=\"GtkCellRendererPixbuf\" id=\"cellrenderertext3\"/>"
+    "                      <attributes>"
+    "                        <attribute name=\"stock-id\">1</attribute>"
+    "                      </attributes>"
+    "                    </child>"
+    "                    <child>"
+    "                      <object class=\"GtkCellRendererText\" id=\"cellrenderertext4\">"
+    "                        <property name=\"ellipsize\">end</property>"
+    "                        <property name=\"foreground\">orange</property>"
+    "                        <property name=\"weight\">600</property>"
+    "                        <property name=\"width_chars\">10</property>"
+    "                      </object>"
+    "                      <attributes>"
+    "                        <attribute name=\"text\">0</attribute>"
+    "                      </attributes>"
+    "                    </child>"
+    "                  </object>"
+    "                  <packing>"
+    "                    <property name=\"expand\">True</property>"
+    "                    <property name=\"fill\">True</property>"
+    "                    <property name=\"position\">2</property>"
+    "                  </packing>"
+    "                </child>"
+    "              </object>"
+    "              <packing>"
+    "                <property name=\"expand\">False</property>"
+    "                <property name=\"fill\">True</property>"
+    "                <property name=\"position\">2</property>"
+    "              </packing>"
+    "            </child>"
+    "          </object>"
+    "          <packing>"
+    "            <property name=\"resize\">True</property>"
+    "            <property name=\"shrink\">False</property>"
+    "          </packing>"
+    "        </child>"
+    "        <child>"
+    "          <object class=\"GtkLabel\" id=\"label6\">"
+    "            <property name=\"visible\">True</property>"
+    "            <property name=\"label\" translatable=\"yes\">Some static\n"
+    "text here\n"
+    "that shrinks.</property>"
+    "            <property name=\"justify\">center</property>"
+    "            <attributes>"
+    "              <attribute name=\"foreground\" value=\"#ffff00000000\"/>"
+    "            </attributes>"
+    "          </object>"
+    "          <packing>"
+    "            <property name=\"resize\">False</property>"
+    "            <property name=\"shrink\">True</property>"
+    "          </packing>"
+    "        </child>"
+    "      </object>"
+    "    </child>"
+    "  </object>"
+    "  <object class=\"GtkListStore\" id=\"liststore1\">"
+    "    <columns>"
+    "      <!-- column-name item-text -->"
+    "      <column type=\"gchararray\"/>"
+    "      <!-- column-name icon-name -->"
+    "      <column type=\"gchararray\"/>"
+    "    </columns>"
+    "    <data>"
+    "      <row>"
+    "        <col id=\"0\" translatable=\"yes\">Montreal, Quebec Canada</col>"
+    "        <col id=\"1\" translatable=\"yes\">gtk-yes</col>"
+    "      </row>"
+    "      <row>"
+    "        <col id=\"0\" translatable=\"yes\">Sao Paulo, SP Brazil</col>"
+    "        <col id=\"1\" translatable=\"yes\">gtk-no</col>"
+    "      </row>"
+    "      <row>"
+    "        <col id=\"0\" translatable=\"yes\">Buenos Aires, Argentina</col>"
+    "        <col id=\"1\" translatable=\"yes\">gtk-stop</col>"
+    "      </row>"
+    "      <row>"
+    "        <col id=\"0\" translatable=\"yes\">Los Angelos, California USA</col>"
+    "        <col id=\"1\" translatable=\"yes\">gtk-media-record</col>"
+    "      </row>"
+    "      <row>"
+    "        <col id=\"0\" translatable=\"yes\">Rio de Janeiro, RJ Brazil</col>"
+    "        <col id=\"1\" translatable=\"yes\">gtk-dialog-error</col>"
+    "      </row>"
+    "      <row>"
+    "        <col id=\"0\" translatable=\"yes\">Seoul, South Korea</col>"
+    "        <col id=\"1\" translatable=\"yes\">gtk-info</col>"
+    "      </row>"
+    "    </data>"
+    "  </object>"
+    "</interface>",
+    NULL
+  },
+  
 };
 
 
@@ -687,7 +940,7 @@ create_window (void)
   gint i;
 
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-  vbox   = gtk_vbox_new (FALSE, 6);
+  vbox   = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
 
   gtk_container_set_border_width (GTK_CONTAINER (window), 8);