Implemented GtkSizeRequest on GtkExpander and added test

Now the expander requests and distributes space naturally,
the expander widget prioritizes the child widget vertically
and only allocates the minimum height for width to the label
widget.
This commit is contained in:
Tristan Van Berkom
2010-08-05 12:48:13 -04:00
parent 95b3e63057
commit e83a8826e6
2 changed files with 356 additions and 111 deletions

View File

@ -546,6 +546,75 @@ TestInterface interfaces[] = {
NULL
},
{
"Wrapping Expander",
"This test demonstrates how the expander label can fill to its natural width "
"and also trade height for width.",
"<?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>"
" <child>"
" <object class=\"GtkExpander\" id=\"expander1\">"
" <property name=\"visible\">True</property>"
" <property name=\"can_focus\">True</property>"
" <child>"
" <object class=\"GtkLabel\" id=\"label2\">"
" <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">More wrapping text to fill the largish content area in the expander </property>"
" <property name=\"wrap\">True</property>"
" <property name=\"width_chars\">10</property>"
" <attributes>"
" <attribute name=\"weight\" value=\"bold\"/>"
" <attribute name=\"foreground\" value=\"#0000D0F00000\"/>"
" </attributes>"
" </object>"
" </child>"
" <child type=\"label\">"
" <object class=\"GtkLabel\" id=\"label1\">"
" <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">Here is some expander text that wraps</property>"
" <property name=\"wrap\">True</property>"
" <property name=\"width_chars\">10</property>"
" <attributes>"
" <attribute name=\"weight\" value=\"bold\"/>"
" <attribute name=\"foreground\" value=\"blue\"/>"
" </attributes>"
" </object>"
" </child>"
" </object>"
" <packing>"
" <property name=\"resize\">False</property>"
" <property name=\"shrink\">False</property>"
" </packing>"
" </child>"
" <child>"
" <object class=\"GtkLabel\" id=\"label3\">"
" <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">static\n"
"text\n"
"here</property>"
" <attributes>"
" <attribute name=\"foreground\" value=\"red\"/>"
" </attributes>"
" </object>"
" <packing>"
" <property name=\"resize\">True</property>"
" <property name=\"shrink\">True</property>"
" </packing>"
" </child>"
" </object>"
" </child>"
" </object>"
"</interface>",
NULL
},
};