Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::UI::Widget::Bin Class Reference

The Bin is a widget that can hold a single child. More...

#include <bin.h>

Inheritance diagram for Inkscape::UI::Widget::Bin:
Inkscape::UI::Toolbar::ToolbarWidget Inkscape::UI::View::SVGViewWidget Inkscape::UI::Widget::ColorPalette Inkscape::UI::Toolbar::CommandToolbar Inkscape::UI::Toolbar::Toolbar Inkscape::UI::Toolbar::ArcToolbar Inkscape::UI::Toolbar::BooleansToolbar Inkscape::UI::Toolbar::Box3DToolbar Inkscape::UI::Toolbar::CalligraphyToolbar Inkscape::UI::Toolbar::ConnectorToolbar Inkscape::UI::Toolbar::DropperToolbar Inkscape::UI::Toolbar::EraserToolbar Inkscape::UI::Toolbar::GradientToolbar Inkscape::UI::Toolbar::LPEToolbar Inkscape::UI::Toolbar::MarkerToolbar Inkscape::UI::Toolbar::MeasureToolbar Inkscape::UI::Toolbar::MeshToolbar Inkscape::UI::Toolbar::NodeToolbar Inkscape::UI::Toolbar::ObjectPickerToolbar Inkscape::UI::Toolbar::PageToolbar Inkscape::UI::Toolbar::PaintbucketToolbar Inkscape::UI::Toolbar::PencilToolbar Inkscape::UI::Toolbar::RectToolbar Inkscape::UI::Toolbar::SelectToolbar Inkscape::UI::Toolbar::SpiralToolbar Inkscape::UI::Toolbar::SprayToolbar Inkscape::UI::Toolbar::StarToolbar Inkscape::UI::Toolbar::TextToolbar Inkscape::UI::Toolbar::TweakToolbar Inkscape::UI::Toolbar::ZoomToolbar

Public Member Functions

 Bin (Gtk::Widget *child=nullptr)
 
 Bin (BaseObjectType *cobject, Glib::RefPtr< Gtk::Builder > const &)
 
Gtk::Widget * get_child ()
 Gets the child widget, or nullptr if none.
 
Gtk::Widget const * get_child () const
 Gets the child widget, or nullptr if none.
 
void set_child (Gtk::Widget *child)
 Sets (parents) the child widget, or unsets (unparents) it if child is null.
 
void set_child (Gtk::Widget &child)
 Convenience function: Sets (parents) the child widget.
 
void unset_child ()
 Convenience function: Unsets (unparents) the child widget.
 
template<typename F >
sigc::connection connectBeforeResize (F &&slot)
 Register a handler to run immediately before a resize operation.
 
template<typename F >
sigc::connection connectAfterResize (F &&slot)
 Register a handler to run immediately after a resize operation.
 

Protected Member Functions

void measure_vfunc (Gtk::Orientation orientation, int for_size, int &min, int &nat, int &min_baseline, int &nat_baseline) const override
 
virtual void on_size_allocate (int width, int height, int baseline)
 

Private Member Functions

void _construct ()
 
Gtk::SizeRequestMode get_request_mode_vfunc () const override
 
void size_allocate_vfunc (int width, int height, int baseline) override
 

Private Attributes

Gtk::Widget * _child = nullptr
 
sigc::signal< void(int, int, int)> _signal_before_resize
 
sigc::signal< void(int, int, int)> _signal_after_resize
 

Detailed Description

The Bin is a widget that can hold a single child.

Itʼs useful for subclassing as it encapsulates propagating the size request/allocation from/to the child, sparing implementors of custom widgets from having to repeat that every time, without e.g. inheriting more complex bases like Box & exposing all their API, and without losing access to size_allocate_vfunc() via using a layout manager

Definition at line 30 of file bin.h.

Constructor & Destructor Documentation

◆ Bin() [1/2]

Inkscape::UI::Widget::Bin::Bin ( Gtk::Widget *  child = nullptr)

Definition at line 25 of file bin.cpp.

References _construct(), child, and set_child().

◆ Bin() [2/2]

Inkscape::UI::Widget::Bin::Bin ( BaseObjectType *  cobject,
Glib::RefPtr< Gtk::Builder > const &   
)

Definition at line 31 of file bin.cpp.

References _child, and _construct().

Member Function Documentation

◆ _construct()

void Inkscape::UI::Widget::Bin::_construct ( )
private

Definition at line 18 of file bin.cpp.

References Inkscape::UI::containerize().

Referenced by Bin(), and Bin().

◆ connectAfterResize()

template<typename F >
sigc::connection Inkscape::UI::Widget::Bin::connectAfterResize ( F &&  slot)
inline

Register a handler to run immediately after a resize operation.

Definition at line 59 of file bin.h.

References _signal_after_resize.

Referenced by Inkscape::UI::Widget::ColorPalette::ColorPalette(), and Inkscape::UI::Widget::ColorWheelBase::construct().

◆ connectBeforeResize()

template<typename F >
sigc::connection Inkscape::UI::Widget::Bin::connectBeforeResize ( F &&  slot)
inline

Register a handler to run immediately before a resize operation.

Definition at line 53 of file bin.h.

References _signal_before_resize.

Referenced by Inkscape::UI::Dialog::XmlTree::XmlTree().

◆ get_child() [1/2]

Gtk::Widget * Inkscape::UI::Widget::Bin::get_child ( )
inline

Gets the child widget, or nullptr if none.

Definition at line 37 of file bin.h.

References _child.

◆ get_child() [2/2]

Gtk::Widget const * Inkscape::UI::Widget::Bin::get_child ( ) const
inline

Gets the child widget, or nullptr if none.

Definition at line 40 of file bin.h.

References _child.

◆ get_request_mode_vfunc()

Gtk::SizeRequestMode Inkscape::UI::Widget::Bin::get_request_mode_vfunc ( ) const
overrideprivate

Definition at line 69 of file bin.cpp.

References _child.

◆ measure_vfunc()

void Inkscape::UI::Widget::Bin::measure_vfunc ( Gtk::Orientation  orientation,
int  for_size,
int &  min,
int &  nat,
int &  min_baseline,
int &  nat_baseline 
) const
overrideprotected

Definition at line 74 of file bin.cpp.

References _child.

◆ on_size_allocate()

void Inkscape::UI::Widget::Bin::on_size_allocate ( int  width,
int  height,
int  baseline 
)
protectedvirtual

◆ set_child() [1/2]

void Inkscape::UI::Widget::Bin::set_child ( Gtk::Widget &  child)
inline

Convenience function: Sets (parents) the child widget.

Definition at line 46 of file bin.h.

References child, and set_child().

Referenced by set_child().

◆ set_child() [2/2]

void Inkscape::UI::Widget::Bin::set_child ( Gtk::Widget *  child)

◆ size_allocate_vfunc()

void Inkscape::UI::Widget::Bin::size_allocate_vfunc ( int  width,
int  height,
int  baseline 
)
overrideprivate

◆ unset_child()

void Inkscape::UI::Widget::Bin::unset_child ( )
inline

Convenience function: Unsets (unparents) the child widget.

Definition at line 49 of file bin.h.

References set_child().

Member Data Documentation

◆ _child

Gtk::Widget* Inkscape::UI::Widget::Bin::_child = nullptr
private

◆ _signal_after_resize

sigc::signal<void (int, int, int)> Inkscape::UI::Widget::Bin::_signal_after_resize
private

Definition at line 73 of file bin.h.

Referenced by connectAfterResize(), and size_allocate_vfunc().

◆ _signal_before_resize

sigc::signal<void (int, int, int)> Inkscape::UI::Widget::Bin::_signal_before_resize
private

Definition at line 72 of file bin.h.

Referenced by connectBeforeResize(), and size_allocate_vfunc().


The documentation for this class was generated from the following files: