[−]Struct gtk::Container
A GTK+ user interface is constructed by nesting widgets inside widgets.
Container widgets are the inner nodes in the resulting tree of widgets:
they contain other widgets. So, for example, you might have a Window
containing a Frame
containing a Label
. If you wanted an image instead
of a textual label inside the frame, you might replace the Label
widget
with a Image
widget.
There are two major kinds of container widgets in GTK+. Both are subclasses
of the abstract Container
base class.
The first type of container widget has a single child widget and derives
from Bin
. These containers are decorators, which
add some kind of functionality to the child. For example, a Button
makes
its child into a clickable button; a Frame
draws a frame around its child
and a Window
places its child widget inside a top-level window.
The second type of container can have more than one child; its purpose is to
manage layout. This means that these containers assign
sizes and positions to their children. For example, a HBox
arranges its
children in a horizontal row, and a Grid
arranges the widgets it contains
in a two-dimensional grid.
Child properties
Container
introduces child properties.
These are object properties that are not specific
to either the container or the contained widget, but rather to their relation.
Typical examples of child properties are the position or pack-type of a widget
which is contained in a Box
.
Container
as Buildable
The Container
implementation of the Buildable
interface supports
a <packing>
element for children, which can contain multiple <property>
elements that specify child properties for the child.
Since 2.16, child properties can also be marked as translatable using the same “translatable”, “comments” and “context” attributes that are used for regular properties.
Since 3.16, containers can have a <focus-chain>
element containing multiple
<widget>
elements, one for each child that should be added to the focus
chain. The ”name” attribute gives the id of the widget.
An example of these properties in UI definitions:
<object class="GtkBox">
<child>
<object class="GtkEntry" id="entry1"/>
<packing>
<property name="pack-type">start</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry2"/>
</child>
<focus-chain>
<widget name="entry1"/>
<widget name="entry2"/>
</focus-chain>
</object>
Implements
Trait Implementations
impl Clone for Container
[+]
impl Debug for Container
[+]
impl Display for Container
[src][+]
impl Eq for Container
impl Hash for Container
[+]
impl IsA<Buildable> for Container
impl IsA<Container> for AboutDialog
impl IsA<Container> for ActionBar
impl IsA<Container> for Button
impl IsA<Container> for ButtonBox
impl IsA<Container> for CheckButton
impl IsA<Container> for CheckMenuItem
impl IsA<Container> for ColorButton
impl IsA<Container> for ColorChooserDialog
impl IsA<Container> for ColorChooserWidget
impl IsA<Container> for ComboBox
impl IsA<Container> for ComboBoxText
impl IsA<Container> for Dialog
impl IsA<Container> for AppChooserButton
impl IsA<Container> for EventBox
impl IsA<Container> for Expander
impl IsA<Container> for FileChooserButton
impl IsA<Container> for FileChooserDialog
impl IsA<Container> for FileChooserWidget
impl IsA<Container> for Fixed
impl IsA<Container> for FlowBox
impl IsA<Container> for FlowBoxChild
impl IsA<Container> for FontButton
impl IsA<Container> for FontChooserDialog
impl IsA<Container> for AppChooserDialog
impl IsA<Container> for FontChooserWidget
impl IsA<Container> for Frame
impl IsA<Container> for Grid
impl IsA<Container> for HeaderBar
impl IsA<Container> for IconView
impl IsA<Container> for InfoBar
impl IsA<Container> for Layout
impl IsA<Container> for LinkButton
impl IsA<Container> for ListBox
impl IsA<Container> for ListBoxRow
impl IsA<Container> for AppChooserWidget
impl IsA<Container> for LockButton
impl IsA<Container> for Menu
impl IsA<Container> for MenuBar
impl IsA<Container> for MenuButton
impl IsA<Container> for MenuItem
impl IsA<Container> for MenuShell
impl IsA<Container> for MenuToolButton
impl IsA<Container> for MessageDialog
impl IsA<Container> for ModelButton
impl IsA<Container> for Notebook
impl IsA<Container> for ApplicationWindow
impl IsA<Container> for OffscreenWindow
impl IsA<Container> for Overlay
impl IsA<Container> for Paned
impl IsA<Container> for PlacesSidebar
impl IsA<Container> for Plug
impl IsA<Container> for Popover
impl IsA<Container> for PopoverMenu
impl IsA<Container> for RadioButton
impl IsA<Container> for RadioMenuItem
impl IsA<Container> for RadioToolButton
impl IsA<Container> for AspectFrame
impl IsA<Container> for RecentChooserDialog
impl IsA<Container> for RecentChooserMenu
impl IsA<Container> for RecentChooserWidget
impl IsA<Container> for Revealer
impl IsA<Container> for ScaleButton
impl IsA<Container> for ScrolledWindow
impl IsA<Container> for SearchBar
impl IsA<Container> for SeparatorMenuItem
impl IsA<Container> for SeparatorToolItem
impl IsA<Container> for ShortcutLabel
impl IsA<Container> for Assistant
impl IsA<Container> for ShortcutsGroup
impl IsA<Container> for ShortcutsSection
impl IsA<Container> for ShortcutsShortcut
impl IsA<Container> for ShortcutsWindow
impl IsA<Container> for Socket
impl IsA<Container> for Stack
impl IsA<Container> for StackSidebar
impl IsA<Container> for StackSwitcher
impl IsA<Container> for Statusbar
impl IsA<Container> for TextView
impl IsA<Container> for Bin
impl IsA<Container> for ToggleButton
impl IsA<Container> for ToggleToolButton
impl IsA<Container> for ToolButton
impl IsA<Container> for ToolItem
impl IsA<Container> for ToolItemGroup
impl IsA<Container> for ToolPalette
impl IsA<Container> for Toolbar
impl IsA<Container> for TreeView
impl IsA<Container> for Viewport
impl IsA<Container> for VolumeButton
impl IsA<Container> for Box
impl IsA<Container> for Window
impl IsA<Widget> for Container
impl Ord for Container
[+]
impl<T: ObjectType> PartialEq<T> for Container
[+]
impl<T: ObjectType> PartialOrd<T> for Container
[+]
impl StaticType for Container
[+]
Auto Trait Implementations
impl RefUnwindSafe for Container
impl !Send for Container
impl !Sync for Container
impl Unpin for Container
impl UnwindSafe for Container
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<Super, Sub> CanDowncast<Sub> for Super where
Sub: IsA<Super>,
Super: IsA<Super>,
Sub: IsA<Super>,
Super: IsA<Super>,
impl<T> Cast for T where
T: ObjectType,
[+]
T: ObjectType,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> ObjectExt for T where
T: ObjectType,
[+]
T: ObjectType,
impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[+]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[+]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[+]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[+]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[+]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
impl<T> ToOwned for T where
T: Clone,
[src][+]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src][+]
T: Display + ?Sized,
impl<T> ToValue for T where
T: SetValue + ?Sized,
[+]
T: SetValue + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,