libcrn
3.9.5
A document image processing library
|
A Gtk::Box-like widget with multiple selection, reordering and drag'n drop features. More...
#include <GtkCRNSelectionBox.h>
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 |
A Gtk::Box-like widget with multiple selection, reordering and drag'n drop features.
Definition at line 39 of file GtkCRNSelectionBox.h.
SelectionBox::SelectionBox | ( | crn::Orientation | ori | ) |
Constructor.
Constructor
Glib::OptionError | invalid orientation |
[in] | ori | the orientation of the box |
Definition at line 42 of file GtkCRNSelectionBox.cpp.
|
overridevirtual |
void SelectionBox::clear | ( | ) |
void SelectionBox::deselect_all | ( | ) |
Deselects all elements.
Definition at line 786 of file GtkCRNSelectionBox.cpp.
|
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
Definition at line 188 of file GtkCRNSelectionBox.cpp.
|
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
Definition at line 202 of file GtkCRNSelectionBox.cpp.
|
inline |
Returns the number of widgets inside the box.
Definition at line 99 of file GtkCRNSelectionBox.h.
|
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
Definition at line 171 of file GtkCRNSelectionBox.cpp.
|
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?
Glib::OptionError | index out of bounds |
[in] | index | the index of the element to check |
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]
[in] | child | the widget to add |
[in] | options | the packing options |
[in] | padding | the 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]
[in] | child | the widget to add |
[in] | expand | shall the widget expand to all free space |
[in] | fill | shall the widget fill its allocated space |
[in] | padding | the 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]
[in] | child | the widget to add |
[in] | options | the packing options |
[in] | padding | the 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]
[in] | child | the widget to add |
[in] | expand | shall the widget expand to all free space |
[in] | fill | shall the widget fill its allocated space |
[in] | padding | the 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.
|
inline |
Sets if the elements can be reordered by the user.
Definition at line 87 of file GtkCRNSelectionBox.h.
|
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.
|
inline |
Sets the scrolling policy.
Definition at line 77 of file GtkCRNSelectionBox.h.
Adds or remove an element from the selection.
Adds or remove an element from the selection
Glib::OptionError | index out of bounds |
[in] | index | the index of the element add or remove from selection |
[in] | selected | shall the element be selected or deselected? |
[in] | silent | if 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
Glib::OptionError | index out of bounds |
[in] | index | the index of the element to select |
Definition at line 704 of file GtkCRNSelectionBox.cpp.
|
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.
|
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.
|
inline |
Signals when a widget was moved. Connect to void on_moved(moved_to, moved_from).
Definition at line 129 of file GtkCRNSelectionBox.h.
|
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.
|
friend |
Definition at line 191 of file GtkCRNSelectionBox.h.