libcrn  3.9.5
A document image processing library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Friends | List of all members
GtkCRN::SelectionBox Class Reference

A Gtk::Box-like widget with multiple selection, reordering and drag'n drop features. More...

#include <GtkCRNSelectionBox.h>

+ Inheritance diagram for GtkCRN::SelectionBox:
+ Collaboration diagram for GtkCRN::SelectionBox:

Public Member Functions

 SelectionBox (crn::Orientation ori)
 Constructor. More...
 
virtual ~SelectionBox () override
 Destructor. More...
 
bool get_homogeneous () const
 Return value: true if the box is homogeneous. More...
 
void set_homogeneous (bool homogeneous=true)
 Sets the Gtk::Box:homogeneous property of box, controlling whether or not all children of box are given equal space in the box. More...
 
int get_spacing () const
 Gets the value set by set_spacing(). More...
 
void set_spacing (int spacing)
 Sets the Gtk::Box:spacing property of box, which is the number of pixels to place between children of box. More...
 
void pack_start (Gtk::Widget &child, Gtk::PackOptions options=Gtk::PACK_EXPAND_WIDGET, guint padding=0)
 Left/top side insert a widget to a box. More...
 
void pack_start (Gtk::Widget &child, bool expand, bool fill, guint padding=0)
 Left/top side insert a widget to a box. More...
 
void pack_end (Gtk::Widget &child, Gtk::PackOptions options=Gtk::PACK_EXPAND_WIDGET, guint padding=0)
 Right/bottom side insert a widget to a box. More...
 
void pack_end (Gtk::Widget &child, bool expand, bool fill, guint padding=0)
 Right/bottom side insert a widget to a box. More...
 
void clear ()
 Erase all elements. More...
 
void set_policy (Gtk::PolicyType hscrollbar_policy, Gtk::PolicyType vscrollbar_policy)
 Sets the scrolling policy. More...
 
crn::Orientation get_orientation () const
 Returns the orientation of the box. More...
 
void set_can_reorder (bool reorder=true)
 Sets if the elements can be reordered by the user. More...
 
bool get_can_reorder () const
 Returns if the elements can be reordered by the user. More...
 
std::vector< Gtk::Widget * > get_selection () const
 Returns the list of selected widgets. More...
 
Gtk::Widget * get_last_selected () const
 Returns the last widget that was selected. More...
 
std::vector< Gtk::Widget * > get_content () const
 Returns the list of widgets inside the box. More...
 
size_t get_nb_children () const
 Returns the number of widgets inside the box. More...
 
void set_selection (size_t index)
 Sets the selection (one element) More...
 
void set_selected (size_t index, bool selected=true, bool silent=false)
 Adds or remove an element from the selection. More...
 
bool is_selected (size_t index)
 Is an element selected? More...
 
void select_all ()
 Selects all elements. More...
 
void deselect_all ()
 Deselects all elements. More...
 
void select_odd ()
 Selects even elements (1st, 3rd…) More...
 
void select_even ()
 Selects odd elements (2nd, 4th…) More...
 
void invert_selection ()
 Inverts the view selection. More...
 
void select_first ()
 If selection size is <= 1, then select the first item, else move last_selected to the first selected element. More...
 
void select_previous ()
 If selection size is 0, the select the first element, if selection size is 1, then select the previous item, else move last_selected to the previous selected element. More...
 
void select_next ()
 If selection size is 0, the select the first element, if selection size is 1, then select the next item, else move last_selected to the next selected element. More...
 
void select_last ()
 If selection size is <= 1, then select the last item, else move last_selected to the last selected element. More...
 
sigc::signal< void,
std::vector< size_t >
, std::vector< size_t > > 
signal_moved ()
 Signals when a widget was moved. Connect to void on_moved(moved_to, moved_from). More...
 
sigc::signal< void, int,
crn::StringUTF8
signal_droppedin ()
 Signals when something was dropped from another application. Connect to void on_droppedin(int position, crn::StringUTF8 data). More...
 
sigc::signal< void,
Gtk::Widget *, const
std::vector< Gtk::Widget * > > 
signal_selection_changed ()
 Signal when the selection has changed. Connect to void on_selection_changed(Gtk::Widget last_selected_widget, const std::vector<Gtk::Widget> selection). More...
 

Friends

class Element
 

Detailed Description

A Gtk::Box-like widget with multiple selection, reordering and drag'n drop features.

Definition at line 39 of file GtkCRNSelectionBox.h.

Constructor & Destructor Documentation

SelectionBox::SelectionBox ( crn::Orientation  ori)

Constructor.

Constructor

Exceptions
Glib::OptionErrorinvalid orientation
Parameters
[in]orithe orientation of the box

Definition at line 42 of file GtkCRNSelectionBox.cpp.

SelectionBox::~SelectionBox ( )
overridevirtual

Destructor.

Destructor

Definition at line 89 of file GtkCRNSelectionBox.cpp.

Member Function Documentation

void SelectionBox::clear ( )

Erase all elements.

Erase all elements

Definition at line 156 of file GtkCRNSelectionBox.cpp.

void SelectionBox::deselect_all ( )

Deselects all elements.

Definition at line 786 of file GtkCRNSelectionBox.cpp.

bool GtkCRN::SelectionBox::get_can_reorder ( ) const
inline

Returns if the elements can be reordered by the user.

Definition at line 89 of file GtkCRNSelectionBox.h.

std::vector< Gtk::Widget * > SelectionBox::get_content ( ) const

Returns the list of widgets inside the box.

Returns the list of widgets inside the box

Returns
a vector of pointers to widgets

Definition at line 188 of file GtkCRNSelectionBox.cpp.

bool GtkCRN::SelectionBox::get_homogeneous ( ) const
inline

Return value: true if the box is homogeneous.

Definition at line 52 of file GtkCRNSelectionBox.h.

Gtk::Widget * SelectionBox::get_last_selected ( ) const

Returns the last widget that was selected.

Returns the last widget that was selected

Returns
a pointer to the last selected widget

Definition at line 202 of file GtkCRNSelectionBox.cpp.

size_t GtkCRN::SelectionBox::get_nb_children ( ) const
inline

Returns the number of widgets inside the box.

Definition at line 99 of file GtkCRNSelectionBox.h.

crn::Orientation GtkCRN::SelectionBox::get_orientation ( ) const
inline

Returns the orientation of the box.

Definition at line 84 of file GtkCRNSelectionBox.h.

std::vector< Gtk::Widget * > SelectionBox::get_selection ( ) const

Returns the list of selected widgets.

Returns the list of selected widgets

Returns
a vector of pointers to widgets

Definition at line 171 of file GtkCRNSelectionBox.cpp.

int GtkCRN::SelectionBox::get_spacing ( ) const
inline

Gets the value set by set_spacing().

Definition at line 56 of file GtkCRNSelectionBox.h.

void SelectionBox::invert_selection ( )

Inverts the view selection.

Definition at line 842 of file GtkCRNSelectionBox.cpp.

bool SelectionBox::is_selected ( size_t  index)

Is an element selected?

Is an element selected?

Exceptions
Glib::OptionErrorindex out of bounds
Parameters
[in]indexthe index of the element to check
Returns
true if the element is selected, false else

Definition at line 759 of file GtkCRNSelectionBox.cpp.

void SelectionBox::pack_end ( Gtk::Widget &  child,
Gtk::PackOptions  options = Gtk::PACK_EXPAND_WIDGET,
guint  padding = 0 
)

Right/bottom side insert a widget to a box.

Right/bottom side insert a widget to a box.

[Widget.Widget.Widget.......NewWidget.Widget.Widget.Widget]

Parameters
[in]childthe widget to add
[in]optionsthe packing options
[in]paddingthe space to add around the widget

Definition at line 132 of file GtkCRNSelectionBox.cpp.

void SelectionBox::pack_end ( Gtk::Widget &  child,
bool  expand,
bool  fill,
guint  padding = 0 
)

Right/bottom side insert a widget to a box.

Right/bottom side insert a widget to a box.

[Widget.Widget.Widget.......NewWidget.Widget.Widget.Widget]

Parameters
[in]childthe widget to add
[in]expandshall the widget expand to all free space
[in]fillshall the widget fill its allocated space
[in]paddingthe space to add around the widget

Definition at line 148 of file GtkCRNSelectionBox.cpp.

void SelectionBox::pack_start ( Gtk::Widget &  child,
Gtk::PackOptions  options = Gtk::PACK_EXPAND_WIDGET,
guint  padding = 0 
)

Left/top side insert a widget to a box.

Left/top side insert a widget to a box.

[Widget.Widget.Widget.NewWidget.......Widget.Widget.Widget]

Parameters
[in]childthe widget to add
[in]optionsthe packing options
[in]paddingthe space to add around the widget

Definition at line 101 of file GtkCRNSelectionBox.cpp.

void SelectionBox::pack_start ( Gtk::Widget &  child,
bool  expand,
bool  fill,
guint  padding = 0 
)

Left/top side insert a widget to a box.

Left/top side insert a widget to a box.

[Widget.Widget.Widget.NewWidget.......Widget.Widget.Widget]

Parameters
[in]childthe widget to add
[in]expandshall the widget expand to all free space
[in]fillshall the widget fill its allocated space
[in]paddingthe space to add around the widget

Definition at line 117 of file GtkCRNSelectionBox.cpp.

void SelectionBox::select_all ( )

Selects all elements.

Definition at line 768 of file GtkCRNSelectionBox.cpp.

void SelectionBox::select_even ( )

Selects odd elements (2nd, 4th…)

Definition at line 804 of file GtkCRNSelectionBox.cpp.

void SelectionBox::select_first ( )

If selection size is <= 1, then select the first item, else move last_selected to the first selected element.

If selection size is <= 1, then select the first item, else move last_selected to the first selected element

Definition at line 857 of file GtkCRNSelectionBox.cpp.

void SelectionBox::select_last ( )

If selection size is <= 1, then select the last item, else move last_selected to the last selected element.

If selection size is <= 1, then select the last item, else move last_selected to the last selected element

Definition at line 979 of file GtkCRNSelectionBox.cpp.

void SelectionBox::select_next ( )

If selection size is 0, the select the first element, if selection size is 1, then select the next item, else move last_selected to the next selected element.

If selection size is 0, the select the first element, if selection size is 1, then select the next item, else move last_selected to the next selected element

Definition at line 935 of file GtkCRNSelectionBox.cpp.

void SelectionBox::select_odd ( )

Selects even elements (1st, 3rd…)

Definition at line 823 of file GtkCRNSelectionBox.cpp.

void SelectionBox::select_previous ( )

If selection size is 0, the select the first element, if selection size is 1, then select the previous item, else move last_selected to the previous selected element.

If selection size is 0, the select the first element, if selection size is 1, then select the previous item, else move last_selected to the previous selected element

Definition at line 891 of file GtkCRNSelectionBox.cpp.

void GtkCRN::SelectionBox::set_can_reorder ( bool  reorder = true)
inline

Sets if the elements can be reordered by the user.

Definition at line 87 of file GtkCRNSelectionBox.h.

void GtkCRN::SelectionBox::set_homogeneous ( bool  homogeneous = true)
inline

Sets the Gtk::Box:homogeneous property of box, controlling whether or not all children of box are given equal space in the box.

Definition at line 54 of file GtkCRNSelectionBox.h.

void GtkCRN::SelectionBox::set_policy ( Gtk::PolicyType  hscrollbar_policy,
Gtk::PolicyType  vscrollbar_policy 
)
inline

Sets the scrolling policy.

Definition at line 77 of file GtkCRNSelectionBox.h.

void SelectionBox::set_selected ( size_t  index,
bool  selected = true,
bool  silent = false 
)

Adds or remove an element from the selection.

Adds or remove an element from the selection

Exceptions
Glib::OptionErrorindex out of bounds
Parameters
[in]indexthe index of the element add or remove from selection
[in]selectedshall the element be selected or deselected?
[in]silentif true, does not signal selection change

Definition at line 721 of file GtkCRNSelectionBox.cpp.

void SelectionBox::set_selection ( size_t  index)

Sets the selection (one element)

Sets the selection to one element

Exceptions
Glib::OptionErrorindex out of bounds
Parameters
[in]indexthe index of the element to select

Definition at line 704 of file GtkCRNSelectionBox.cpp.

void GtkCRN::SelectionBox::set_spacing ( int  spacing)
inline

Sets the Gtk::Box:spacing property of box, which is the number of pixels to place between children of box.

Definition at line 58 of file GtkCRNSelectionBox.h.

sigc::signal<void, int, crn::StringUTF8> GtkCRN::SelectionBox::signal_droppedin ( )
inline

Signals when something was dropped from another application. Connect to void on_droppedin(int position, crn::StringUTF8 data).

Definition at line 132 of file GtkCRNSelectionBox.h.

sigc::signal<void, std::vector<size_t>, std::vector<size_t> > GtkCRN::SelectionBox::signal_moved ( )
inline

Signals when a widget was moved. Connect to void on_moved(moved_to, moved_from).

Definition at line 129 of file GtkCRNSelectionBox.h.

sigc::signal<void, Gtk::Widget*, const std::vector<Gtk::Widget*> > GtkCRN::SelectionBox::signal_selection_changed ( )
inline

Signal when the selection has changed. Connect to void on_selection_changed(Gtk::Widget last_selected_widget, const std::vector<Gtk::Widget> selection).

Definition at line 134 of file GtkCRNSelectionBox.h.

Friends And Related Function Documentation

friend class Element
friend

Definition at line 191 of file GtkCRNSelectionBox.h.


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