Main Page   
  Widgets   
   Namespaces   
   Book   
 
 
Gtk::Container Class Reference 
[Widgets ] 
 Abstract container class. 
More... 
Inheritance diagram for Gtk::Container:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
[legend ] List of all members. 
 
Public Types  
typedef SigC::Slot1< void, 
 Widget & >  ForeachSlot  
Public Methods  
virtual  ~Container  () 
GtkContainer*  gobj  () 
const GtkContainer*  gobj  () const 
void  set_border_width  (guint border_width) 
  Sets the border width of the container.   
guint  get_border_width  () const 
  Retrieves the border width of the container.   
virtual void  add  (Widget & widget) 
void  remove  (Widget & widget) 
  Removes widget  from container  .   
void  set_resize_mode  (ResizeMode  resize_mode) 
  Sets the resize mode for the container.   
ResizeMode  get_resize_mode  () const 
  Returns the resize mode for the container.   
void  check_resize  () 
  Request that contained widgets check their size.   
void  foreach  (const ForeachSlot & slot) 
  Operate on contained items This is largely an internal used mainly for things like creating duplicates of internal lists and other such operations.   
Glib::ListHandle <Widget *> get_children  () 
  Returns the the container's non-internal children.   
Glib::ListHandle <const Widget *> get_children  () const 
  Returns the the container's non-internal children.   
void  propagate_expose  (Widget & child, GdkEventExpose* event) 
  When a container receives an expose event, it must send synthetic expose events to all children that don't have their own Gdk::Windows.   
void  set_focus_chain  (const Glib::ListHandle <Widget *>& focusable_widgets) 
  Sets a focus chain, overriding the one computed automatically by GTK+.   
void  set_focus_chain  (const Glib::ListHandle <const Widget *>& focusable_widgets) const 
  Sets a focus chain, overriding the one computed automatically by GTK+.   
bool  has_focus_chain  () const 
Glib::ListHandle <Widget *> get_focus_chain  () 
void  unset_focus_chain  () 
  Removes a focus chain explicitly set with set_focus_chain() .   
void  set_reallocate_redraws  (bool needs_redraws=true) 
  Sets the reallocate_redraws  flag of the container to the given value.   
void  set_focus_child  (Widget & widget) 
  Sets the focus on a child.   
void  set_focus_vadjustment  (Adjustment & adjustment) 
Adjustment * get_focus_vadjustment  () 
  Retrieves the vertical focus adjustment for the container.   
const Adjustment *  get_focus_vadjustment  () const 
  Retrieves the vertical focus adjustment for the container.   
void  set_focus_hadjustment  (Adjustment & adjustment) 
Adjustment * get_focus_hadjustment  () 
  Retrieves the horizontal focus adjustment for the container.   
const Adjustment *  get_focus_hadjustment  () const 
  Retrieves the horizontal focus adjustment for the container.   
void  resize_children  () 
GType  child_type  () 
  Returns the type of the children supported by the container.   
Glib::SignalProxy1 < void, 
 Widget * > signal_add  () 
Glib::SignalProxy1 < void, 
 Widget * > signal_remove  () 
Glib::SignalProxy0 <void> signal_check_resize  () 
Glib::SignalProxy1 < void, 
 Widget * > signal_set_focus_child  () 
Glib::PropertyProxy <guint> property_border_width  () 
Glib::PropertyProxy <ResizeMode > property_resize_mode  () 
Glib::PropertyProxy_WriteOnly < 
 Widget * > property_child  () 
void  show_all_children  (bool recursive=true) 
Protected Methods  
virtual GtkType  child_type_vfunc  () 
virtual void  forall_vfunc  (gboolean include_internals, GtkCallback callback, gpointer callback_data) 
virtual char*  composite_name_vfunc  (GtkWidget* child) 
virtual void  set_child_property_vfunc  (GtkWidget* child, guint property_id, const GValue* value, GParamSpec* pspec) 
virtual void  get_child_property_vfunc  (GtkWidget* child, guint property_id, GValue* value, GParamSpec* pspec) 
virtual void  on_add  (Widget * widget) 
virtual void  on_remove  (Widget * widget) 
virtual void  on_check_resize  () 
virtual void  on_set_focus_child  (Widget * widget) 
  Container  () 
Related Functions  
(Note that these are not member functions.)  
Gtk::Container*  wrap  (GtkContainer* object, bool take_copy=false) 
Detailed Description 
Abstract container class.
This is the abstract container from which all gtk+ widgets which hold other items derive from. It mainly houses virtual functions used for inserting and removing children. Containers in gtk+ may hold one item or many items depending on the implementation.
This interface is used for all single item holding containers. Multi-item containers provide their own unique interface as their items are generally more complex. The methods of the derived classes should be prefered over these. 
Member Typedef Documentation 
  
    
      
        
           typedef SigC::Slot1<void, Widget &> Gtk::Container::ForeachSlot
        
     
   
Constructor & Destructor Documentation 
  
    
      
        
           virtual Gtk::Container::~Container  
          ( 
                      
          )  
           [virtual] 
         
      
     
   
  
    
      
        
           Gtk::Container::Container  
          ( 
                      
          )  
           [protected] 
         
      
     
   
Member Function Documentation 
  
    
      
        
           virtual void Gtk::Container::add  
          ( 
          Widget &  
            widget            
          )  
           [virtual] 
         
      
     
   
  
    
      
        
           void Gtk::Container::check_resize  
          ( 
                      
          )  
           
         
      
     
   
  
    
       
     
    
Request that contained widgets check their size.
    
 
   
  
    
      
        
           GType Gtk::Container::child_type  
          ( 
                      
          )  
           
         
      
     
   
  
    
       
     
    
Returns the type of the children supported by the container.
Note that this may return G::TYPE_NONE to indicate that no more children can be added, e.g. for a Gtk::Paned  which already has two children. 
Returns: A G::Type.   
     
   
  
    
      
        
           virtual GtkType Gtk::Container::child_type_vfunc  
          ( 
                      
          )  
           [protected, virtual] 
         
      
     
   
  
    
      
        
           virtual char* Gtk::Container::composite_name_vfunc  
          ( 
          GtkWidget*  
            child            
          )  
           [protected, virtual] 
         
      
     
   
  
    
      
        
           virtual void Gtk::Container::forall_vfunc  
          ( 
          gboolean  
            include_internals ,  
         
        
           
           
          GtkCallback  
            callback ,  
         
        
           
           
          gpointer  
            callback_data  
         
        
           
          )  
           [protected, virtual] 
         
      
     
   
  
    
      
        
           void Gtk::Container::foreach  
          ( 
          const ForeachSlot &  
            slot            
          )  
           
         
      
     
   
  
    
       
     
    
Operate on contained items This is largely an internal used mainly for things like creating duplicates of internal lists and other such operations.
The result is lossy as it only gets the the main child and not its external pieces.
For example notebook pages contain a page, a label, and a menu item. But this only operates on the pages.     
 
   
  
    
      
        
           guint Gtk::Container::get_border_width  
          ( 
                      
          )  
           const 
         
      
     
   
  
    
       
     
    
Retrieves the border width of the container.
See set_border_width() . 
Returns: The current border width.   
     
   
  
    
      
        
           virtual void Gtk::Container::get_child_property_vfunc  
          ( 
          GtkWidget*  
            child ,  
         
        
           
           
          guint  
            property_id ,  
         
        
           
           
          GValue*  
            value ,  
         
        
           
           
          GParamSpec*  
            pspec  
         
        
           
          )  
           [protected, virtual] 
         
      
     
   
  
    
       
     
    
Returns the the container's non-internal children.
See forall() for details on what constitutes an "internal" child. 
Returns: A newly-allocated list of the container's non-internal children.   
     
   
  
    
       
     
    
Returns the the container's non-internal children.
See forall() for details on what constitutes an "internal" child. 
Returns: A newly-allocated list of the container's non-internal children.   
     
   
  
    
      
        
           const Adjustment * Gtk::Container::get_focus_hadjustment  
          ( 
                      
          )  
           const 
         
      
     
   
  
    
       
     
    
Retrieves the horizontal focus adjustment for the container.
See set_focus_hadjustment() . 
Returns: The horizontal focus adjustment, or 0 if none has been set.   
     
   
  
    
      
        
           Adjustment * Gtk::Container::get_focus_hadjustment  
          ( 
                      
          )  
           
         
      
     
   
  
    
       
     
    
Retrieves the horizontal focus adjustment for the container.
See set_focus_hadjustment() . 
Returns: The horizontal focus adjustment, or 0 if none has been set.   
     
   
  
    
      
        
           const Adjustment * Gtk::Container::get_focus_vadjustment  
          ( 
                      
          )  
           const 
         
      
     
   
  
    
       
     
    
Retrieves the vertical focus adjustment for the container.
See set_focus_vadjustment() . 
Returns: The vertical focus adjustment, or 0 if none has been set.   
     
   
  
    
      
        
           Adjustment * Gtk::Container::get_focus_vadjustment  
          ( 
                      
          )  
           
         
      
     
   
  
    
       
     
    
Retrieves the vertical focus adjustment for the container.
See set_focus_vadjustment() . 
Returns: The vertical focus adjustment, or 0 if none has been set.   
     
   
  
    
      
        
           ResizeMode  Gtk::Container::get_resize_mode  
          ( 
                      
          )  
           const 
         
      
     
   
  
    
       
     
    
Returns the resize mode for the container.
See set_resize_mode() . 
Returns: The current resize mode.   
     
   
  
    
      
        
           const GtkContainer* Gtk::Container::gobj  
          ( 
                      
          )  
           const [inline] 
         
      
     
   
  
    
       
     
    
Reimplemented from Gtk::Widget .
Reimplemented in Gtk::Alignment , Gtk::AspectFrame , Gtk::Bin , Gtk::Box , Gtk::VBox , Gtk::HBox , Gtk::Button , Gtk::ButtonBox , Gtk::VButtonBox , Gtk::HButtonBox , Gtk::CheckButton , Gtk::CheckMenuItem , Gtk::ColorSelection , Gtk::ColorSelectionDialog , Gtk::ComboDropDownItem , Gtk::ComboDropDown , Gtk::Combo , Gtk::GammaCurve , Gtk::Dialog , Gtk::EventBox , Gtk::FileSelection , Gtk::Fixed , Gtk::FontSelection , Gtk::FontSelectionDialog , Gtk::Frame , Gtk::HandleBox , Gtk::ImageMenuItem , Gtk::InputDialog , Gtk::Item , Gtk::Layout , Gtk::Menu , Gtk::MenuBar , Gtk::MenuItem , Gtk::MenuShell , Gtk::MessageDialog , Gtk::Notebook , Gtk::OptionMenu , Gtk::Paned , Gtk::HPaned , Gtk::VPaned , Gtk::Plug , Gtk::RadioButton , Gtk::RadioMenuItem , Gtk::ScrolledWindow , Gtk::SeparatorMenuItem , Gtk::Socket , Gtk::Statusbar , Gtk::Table , Gtk::TearoffMenuItem , Gtk::TextView , Gtk::ToggleButton , Gtk::Toolbar , Gtk::TreeView , Gtk::Viewport , and Gtk::Window .    
 
   
  
    
      
        
           GtkContainer* Gtk::Container::gobj  
          ( 
                      
          )  
           [inline] 
         
      
     
   
  
    
       
     
    
Reimplemented from Gtk::Widget .
Reimplemented in Gtk::Alignment , Gtk::AspectFrame , Gtk::Bin , Gtk::Box , Gtk::VBox , Gtk::HBox , Gtk::Button , Gtk::ButtonBox , Gtk::VButtonBox , Gtk::HButtonBox , Gtk::CheckButton , Gtk::CheckMenuItem , Gtk::ColorSelection , Gtk::ColorSelectionDialog , Gtk::ComboDropDownItem , Gtk::ComboDropDown , Gtk::Combo , Gtk::GammaCurve , Gtk::Dialog , Gtk::EventBox , Gtk::FileSelection , Gtk::Fixed , Gtk::FontSelection , Gtk::FontSelectionDialog , Gtk::Frame , Gtk::HandleBox , Gtk::ImageMenuItem , Gtk::InputDialog , Gtk::Item , Gtk::Layout , Gtk::Menu , Gtk::MenuBar , Gtk::MenuItem , Gtk::MenuShell , Gtk::MessageDialog , Gtk::Notebook , Gtk::OptionMenu , Gtk::Paned , Gtk::HPaned , Gtk::VPaned , Gtk::Plug , Gtk::RadioButton , Gtk::RadioMenuItem , Gtk::ScrolledWindow , Gtk::SeparatorMenuItem , Gtk::Socket , Gtk::Statusbar , Gtk::Table , Gtk::TearoffMenuItem , Gtk::TextView , Gtk::ToggleButton , Gtk::Toolbar , Gtk::TreeView , Gtk::Viewport , and Gtk::Window .    
 
   
  
    
      
        
           bool Gtk::Container::has_focus_chain  
          ( 
                      
          )  
           const 
         
      
     
   
  
    
      
        
           virtual void Gtk::Container::on_add  
          ( 
          Widget *  
            widget            
          )  
           [protected, virtual] 
         
      
     
   
  
    
      
        
           virtual void Gtk::Container::on_check_resize  
          ( 
                      
          )  
           [protected, virtual] 
         
      
     
   
  
    
      
        
           virtual void Gtk::Container::on_remove  
          ( 
          Widget *  
            widget            
          )  
           [protected, virtual] 
         
      
     
   
  
    
      
        
           virtual void Gtk::Container::on_set_focus_child  
          ( 
          Widget *  
            widget            
          )  
           [protected, virtual] 
         
      
     
   
  
    
      
        
           void Gtk::Container::propagate_expose  
          ( 
          Widget &  
            child ,  
         
        
           
           
          GdkEventExpose*  
            event  
         
        
           
          )  
           
         
      
     
   
  
    
       
     
    
When a container receives an expose event, it must send synthetic expose events to all children that don't have their own Gdk::Windows.
This function provides a convenient way of doing this. A container, when it receives an expose event, calls propagate_expose()  once for each child, passing in the event the container received.
propagate_expose()  takes care of deciding whether an expose event needs to be sent to the child, intersecting the event's area with the child area, and sending the event.
In most cases, a container can simply either simply inherit the ::expose implementation from Gtk::Container, or, do some drawing and then chain to the ::expose implementation from Gtk::Container. 
Parameters: 
  
    child  A child of container  .   
    event  A expose event sent to container.   
  
  
     
   
  
    
      
        
           void Gtk::Container::remove  
          ( 
          Widget &  
            widget            
          )  
           
         
      
     
   
  
    
       
     
    
Removes widget  from container  .
widget  must be inside container  . Note that container  will own a reference to widget  , and that this may be the last reference held; so removing a widget from its container can destroy that widget. If you want to use widget  again, you need to add a reference to it while it's not inside a container, using Glib::object_ref(). 
Parameters: 
  
    widget  A current child of container  .   
  
  
     
   
  
    
      
        
           void Gtk::Container::resize_children  
          ( 
                      
          )  
           
         
      
     
   
  
    
      
        
           void Gtk::Container::set_border_width  
          ( 
          guint  
            border_width            
          )  
           
         
      
     
   
  
    
       
     
    
Sets the border width of the container.
The border width of a container is the amount of space to leave around the outside of the container. The only exception to this is Gtk::Window; because toplevel windows can't leave space outside, they leave the space inside. The border is added on all sides of the container. To add space to only one side, one approach is to create a Gtk::Alignment  widget, call Gtk::Widget::set_usize() to give it a size, and place it on the side of the container as a spacer. 
Parameters: 
  
    border_width  Amount of blank space to leave outside  the container. Valid values are in the range 0-65535 pixels.   
  
  
Examples:  
thread/dispatcher.cc .       
   
  
    
      
        
           virtual void Gtk::Container::set_child_property_vfunc  
          ( 
          GtkWidget*  
            child ,  
         
        
           
           
          guint  
            property_id ,  
         
        
           
           
          const GValue*  
            value ,  
         
        
           
           
          GParamSpec*  
            pspec  
         
        
           
          )  
           [protected, virtual] 
         
      
     
   
  
    
       
     
    
Sets a focus chain, overriding the one computed automatically by GTK+.
In principle each widget in the chain should be a descendant of the container, but this is not enforced by this method, since it's allowed to set the focus chain before you pack the widgets, or have a widget in the chain that isn't always packed. The necessary checks are done when the focus chain is actually traversed. 
Parameters: 
  
    focusable_widgets  The new focus chain.   
  
  
     
   
  
    
       
     
    
Sets a focus chain, overriding the one computed automatically by GTK+.
In principle each widget in the chain should be a descendant of the container, but this is not enforced by this method, since it's allowed to set the focus chain before you pack the widgets, or have a widget in the chain that isn't always packed. The necessary checks are done when the focus chain is actually traversed. 
Parameters: 
  
    focusable_widgets  The new focus chain.   
  
  
     
   
  
    
      
        
           void Gtk::Container::set_focus_child  
          ( 
          Widget &  
            widget            
          )  
           
         
      
     
   
  
    
       
     
    
Sets the focus on a child.
    
 
   
  
    
      
        
           void Gtk::Container::set_focus_hadjustment  
          ( 
          Adjustment &  
            adjustment            
          )  
           
         
      
     
   
  
    
      
        
           void Gtk::Container::set_focus_vadjustment  
          ( 
          Adjustment &  
            adjustment            
          )  
           
         
      
     
   
  
    
      
        
           void Gtk::Container::set_reallocate_redraws  
          ( 
          bool  
            needs_redraws  = true           
          )  
           
         
      
     
   
  
    
       
     
    
Sets the reallocate_redraws  flag of the container to the given value.
Containers requesting reallocation redraws get automatically redrawn if any of their children changed allocation. 
Parameters: 
  
    needs_redraws  The new value for the container's reallocate_redraws  flag.   
  
  
     
   
  
    
      
        
           void Gtk::Container::set_resize_mode  
          ( 
          ResizeMode   
            resize_mode            
          )  
           
         
      
     
   
  
    
       
     
    
Sets the resize mode for the container.
The resize mode of a container determines whether a resize request will be passed to the container's parent, queued for later execution or executed immediately. 
Parameters: 
  
    resize_mode  The new resize mode.   
  
  
     
   
  
    
      
        
           void Gtk::Container::show_all_children  
          ( 
          bool  
            recursive  = true           
          )  
           
         
      
     
   
  
    
       
     
    
Prototype: void add(Widget* widget)  
     
   
  
    
       
     
    
Prototype: void check_resize()  
     
   
  
    
       
     
    
Prototype: void remove(Widget* widget)  
     
   
  
    
       
     
    
Prototype: void set_focus_child(Widget* widget)  
     
   
  
    
      
        
           void Gtk::Container::unset_focus_chain  
          ( 
                      
          )  
           
         
      
     
   
Friends And Related Function Documentation 
  
    
      
        
           Gtk::Container* wrap  
          ( 
          GtkContainer*  
            object ,  
         
        
           
           
          bool  
            take_copy  = false 
         
        
           
          )  
           [related] 
         
      
     
   
 The documentation for this class was generated from the following file:
Generated for gtkmm by 
Doxygen  1.3-rc1 © 1997-2001