JG ROOT Tools libraries
version 5.0 - august 2014
|
#include <RGItemSelectionBox.hh>
Public Member Functions | |
RGItemSelectionBox (TGWindow *p, const char *txt_src=NULL, const char *txt_dest=NULL, const UInt_t opts=0, const UInt_t w_min=80, const UInt_t h_min=80) | |
virtual | ~RGItemSelectionBox () |
virtual void | MapSubwindows () |
virtual RGItemListBox * | GetSrcItemListBox () const |
virtual RGItemListBox * | GetDestItemListBox () const |
virtual TGVerticalFrame * | GetCenterFrame () const |
virtual TGButton * | AddSrcButton (const char *text, const Int_t id, const char *tooltip=NULL) |
virtual TGButton * | AddSrcButton (TGButton *but, const Int_t id) |
virtual TGButton * | AddDestButton (const char *text, const Int_t id, const char *tooltip=NULL) |
virtual TGButton * | AddDestButton (TGButton *but, const Int_t id) |
virtual TGButton * | AddCenterButton (const char *text, const Int_t id, const char *tooltip=NULL) |
virtual TGButton * | AddCenterButton (TGButton *but, const Int_t id) |
virtual TGFrame * | AddSrcBottomFrame (TGFrame *f, TGLayoutHints *l=NULL) |
virtual TGFrame * | AddDestBottomFrame (TGFrame *f, TGLayoutHints *l=NULL) |
virtual Int_t | AddItem (const string &s, void *ptr=NULL, const Bool_t update=true) |
virtual Int_t | AddItem (const GItem &d, const Bool_t update=true) |
virtual Int_t | AddItem (GItem *d, const Bool_t update=true) |
virtual void | RemoveItem (const Int_t n, const Bool_t update=true) |
virtual GItem * | GetItem (Int_t id) const |
virtual GSubItem * | GetSrcItem (Int_t id) const |
virtual GSubItem * | GetDestItem (Int_t id) const |
virtual void | SrcSelectionRemove () |
virtual void | DestSelectionRemove () |
virtual GItemListIter | SrcBegin () const |
virtual GItemListIter | SrcEnd () const |
virtual GItemListIter | DestBegin () const |
virtual GItemListIter | DestEnd () const |
virtual GItemListIter | Begin () const |
virtual GItemListIter | End () const |
virtual GItemListIter | Null () const |
virtual Int_t | GetSize () const |
virtual Int_t | GetSrcSize () const |
virtual Int_t | GetDestSize () const |
virtual void | UpdateSelectionBox () |
virtual Int_t | ItemToDest (const Int_t num, const Bool_t update=false) |
virtual Int_t | SrcItemToDest (const Int_t num, const Bool_t update=false) |
virtual void | SrcDoubleClicked (Int_t n) |
virtual void | DestDoubleClicked (Int_t n) |
virtual void | SrcSelectionToDest () |
virtual void | DestSelectionToSrc () |
virtual void | ItemRemoved (ULong_t ptr) |
virtual void | SrcItemRemoved (ULong_t ptr) |
virtual void | DestItemRemoved (ULong_t ptr) |
virtual void | CustomClicked (Int_t id) |
virtual void | SelectionChanged () |
virtual void | SrcSelectionChanged () |
virtual void | DestSelectionChanged () |
ClassDef (RGItemSelectionBox, 0) | |
Protected Member Functions | |
RGItemSelectionBox (const RGItemSelectionBox &original) | |
virtual void | RemoveSelectedItem (const Bool_t update=true) |
virtual void | RemoveSubItems (GItem *supp, const Bool_t update=true, const Bool_t sub_signal=true) |
virtual void | SelectionRemove (RGItemListBox *ilb) |
Protected Attributes | |
UInt_t | list_w_min |
List widget minimum width. | |
UInt_t | list_h_min |
List widget minimum height. | |
UInt_t | options |
Widget options. | |
GItemList | item_list |
Input list of elements (global list) | |
RGItemListBox * | src_box |
Source selection box. | |
RGItemListBox * | dest_box |
Destination selection box. | |
TGVerticalFrame * | w_center_frame |
Central frame for buttons. | |
TGTextButton * | w_add_button |
Add to selection button. | |
TGTextButton * | w_remove_button |
Remove from selection button. | |
Private Member Functions | |
GObject (RGItemSelectionBox) | |
This class defines a widget with 2 lists for selection of elements. One list (on the left) is the source of objects, the other one (on the right), is the selection. Each list management is based on a RGItemListBox object.
The class RGItemSelectionBox only defines one list of objects as an input (the global list), and the elements of this global list are copied in the source and destination lists of RGItemListBox objects.
The elements of the source and destination lists have the same name than the elements from the global list, and the user data pointer is set to the global list GItem (and not to the user object itself). Thus, elements from the source or destination lists is uniquely associated to a element in the global list: if an element is removed in the global list is removed, all elements corresponding in the source and destination sub-lists are removed also. But if the global list element was present several times in the list, these elements are not removed.
The user data for source and destination lists can be modified compared to the global list, and can be different in source and destination sub-lists. This feature allows for example to set specific properties to the selected objects, and keep track of the information until the end of use of the selection widget. This requires to have specific signals when elements from the source or the destination sub-lists are removed (such signal is not emitted when the element is moved between source and destination sub-lists).
The options are in principle fixed at widget creation.
RGItemSelectionBox::RGItemSelectionBox | ( | TGWindow * | p, |
const char * | txt_src = NULL , |
||
const char * | txt_dest = NULL , |
||
const UInt_t | opts = 0 , |
||
const UInt_t | w_min = 80 , |
||
const UInt_t | h_min = 80 |
||
) |
Constructor.
p | parent widget |
txt_src | source list label |
txt_dest | destination list label |
opts | options |
w_min | minimum width of list widget |
h_min | minimum height of list widget |
References dest_box, item_list, list_h_min, list_w_min, options, src_box, w_add_button, w_center_frame, and w_remove_button.
|
protected |
Copy constructor, not implemented.
original | object to copy |
References dest_box, src_box, w_add_button, w_center_frame, and w_remove_button.
|
virtual |
Destructor.
References item_list, and RemoveItem().
|
private |
Macro from GCpp library that defines the following functions:
|
virtual |
Overload of TGFrame function.
Referenced by AddCenterButton(), AddDestButton(), and AddSrcButton().
|
inlinevirtual |
Get source list widget pointer.
References src_box.
|
inlinevirtual |
Get destination list widget pointer.
References dest_box.
|
inlinevirtual |
Get central buttons frame pointer.
References w_center_frame.
|
virtual |
Add a button to source list side buttons. The button emits a signal CustomClicked(Int_t id).
text | button text |
id | button identification number |
tooltip | information message |
|
virtual |
Add a button to source list side buttons. The button emits a signal CustomClicked(Int_t id).
but | button pointer |
id | button identification number |
References RGItemListBox::GetSideFrame(), MapSubwindows(), and src_box.
|
virtual |
Add a button to destination list side buttons. The button emits a signal CustomClicked(Int_t id).
text | button text |
id | button identification number |
tooltip | information message |
|
virtual |
Add a button to destination list side buttons. The button emits a signal CustomClicked(Int_t id).
but | button pointer |
id | button identification number |
References dest_box, RGItemListBox::GetSideFrame(), and MapSubwindows().
|
virtual |
Add a button to the central buttons area. The button emits a signal CustomClicked(Int_t id).
text | button text |
id | button identification number |
tooltip | information message |
|
virtual |
Add a button to the central buttons area. The button emits a signal CustomClicked(Int_t id).
but | button pointer |
id | button identification number |
References MapSubwindows(), and w_center_frame.
|
inlinevirtual |
Add a bottom frame to source list widget.
f | frame pointer |
l | layout pointer |
References RGItemListBox::AddBottomFrame(), and src_box.
|
inlinevirtual |
Add a bottom frame to destination list widget.
f | frame pointer |
l | layout pointer |
References RGItemListBox::AddBottomFrame(), and dest_box.
|
inlinevirtual |
Add an item to the global list. If the element is accepted, a GSubItem is added to the source list, with same name and a pointer to the global list RGItem.
The function returns the index of the added element (in global list) and -1 in case of failure.
The list-box is updated, except if argument update is false. This should only be used in cases several elements will be added. In such case, only the objects list is updated (item_list), and not the list-box widgets.
s | element name |
ptr | user data pointer |
update | flag for list-box update |
Referenced by AddItem().
|
inlinevirtual |
Add an item to the global list (the item is cloned). If the element is accepted, a GSubItem is added to the source list, with same name and a pointer to the global list RGItem.
The function returns the index of the added element (in global list) and -1 in case of failure.
The list-box is updated, except if argument update is false. This should only be used in cases several elements will be added. In such case, only the objects list is updated (item_list), and not the list-box widgets.
item | element to add (cloned) |
update | flag for list-box update |
References AddItem().
|
virtual |
Add an item to the global list (the item is adopted). If the element is accepted, a GSubItem is added to the source list, with same name and a pointer to the global list RGItem.
The function returns the index of the added element (in global list) and -1 in case of failure.
The list-box is updated, except if argument update is false. This should only be used in cases several elements will be added. In such case, only the objects list is updated (item_list), and not the list-box widgets.
item | pointer to the element to add (adopted) |
update | flag for list-box update |
References RGItemListBox::AddItem(), item_list, and src_box.
|
virtual |
Remove an element from the global list. Default behavior is that the list-box is updated from the list of elements, except if argument update is false. This should only be used in cases several elements will be removed. In such case, only the objects list is updated (item_list), and not the list-box widgets. All elements from the source and destination list corresponding to this item are removed.
n | index of element to remove |
update | flag for list-boxes update |
References item_list, ItemRemoved(), and RemoveSubItems().
Referenced by ~RGItemSelectionBox().
|
inlinevirtual |
|
inlinevirtual |
Get the pointer to a element of the source list.
id | element number |
References RGItemListBox::GetItem(), and src_box.
|
inlinevirtual |
Get the pointer to a element of the destination list.
id | element number |
References dest_box, and RGItemListBox::GetItem().
|
protectedvirtual |
Remove all selected elements (from selction flag) from the global list. This function is used by the functions that remove selected elements in source or destination list.
update | flag for list-boxes update |
References item_list, ItemRemoved(), RemoveSubItems(), and UpdateSelectionBox().
Referenced by SelectionRemove().
|
protectedvirtual |
Remove elements in source and destination lists that correspond to the argument item pointer. This function is called by the functions removing elements in the global list.
supp | pointer to item to be removed from global list |
update | flag for list-box update |
sub_signal | indicate if signals for removal of source and destination (sub-) lists elements must be sent |
References dest_box, DestItemRemoved(), RGItemListBox::GetItem(), RGItemListBox::GetItemNumber(), RGItemListBox::RemoveItem(), src_box, SrcItemRemoved(), and RGItemListBox::UpdateListBox().
Referenced by RemoveItem(), and RemoveSelectedItem().
|
inlinevirtual |
Remove from global list the elements selected in the source list.
References SelectionRemove(), and src_box.
|
inlinevirtual |
Remove from global list the elements selected in the destination list.
References dest_box, and SelectionRemove().
|
protectedvirtual |
Remove from global list the selected elements in the argument list (that is either the source or the destination list).
ilb | pointer to RGItemListBox selection widget |
References RGItemListBox::Begin(), dest_box, RGItemListBox::GetSelectedNumber(), item_list, RGItemListBox::Null(), RemoveSelectedItem(), and src_box.
Referenced by DestSelectionRemove(), and SrcSelectionRemove().
|
inlinevirtual |
Get the iterator on first element of source list.
References RGItemListBox::Begin(), and src_box.
Referenced by ItemToDest(), and SrcItemToDest().
|
inlinevirtual |
Get the iterator on last element of source list.
References RGItemListBox::End(), and src_box.
|
inlinevirtual |
Get the iterator on first element of destination list.
References RGItemListBox::Begin(), and dest_box.
|
inlinevirtual |
Get the iterator on last element of destination list.
References dest_box, and RGItemListBox::End().
|
inlinevirtual |
|
inlinevirtual |
Get the iterator on last element of global list.
References item_list.
|
inlinevirtual |
Get the null iterator of list of elements.
References item_list.
Referenced by ItemToDest(), and SrcItemToDest().
|
inlinevirtual |
Get the global list number of elements (size).
References item_list.
|
inlinevirtual |
Get the source list number of elements (size).
References RGItemListBox::GetSize(), and src_box.
|
inlinevirtual |
Get the destination list number of elements (size).
References dest_box, and RGItemListBox::GetSize().
|
inlinevirtual |
Update display of the source and destination list-boexes.
References dest_box, src_box, and RGItemListBox::UpdateListBox().
Referenced by RemoveSelectedItem().
|
virtual |
Set a element of global list in the destination list (final selection). The signal for selection change is sent. The function returns the destination list index (or -1 in case of problem).
num | element number in global list |
update | flag for list-boxex update |
References Begin(), Null(), SrcBegin(), and SrcItemToDest().
|
virtual |
Send a element of source list in the destination list (final selection). The signal for selection change is sent. The function returns the destination list index (or -1 in case of problem).
num | element number in global list |
update | flag for list-boxex update |
References RGItemListBox::AddItem(), dest_box, Null(), options, RGItemListBox::RemoveItem(), SelectionChanged(), src_box, SrcBegin(), and RGItemListBox::UpdateListBox().
Referenced by ItemToDest().
|
virtual |
Slot called when an element of source list is double-clicked: selected elements in the source list are sent to the destination list.
n | number of the double-clicked element (source list) |
References SrcSelectionToDest().
|
virtual |
Slot called when an element of destination list is double-clicked: selected elements in the destination list are returned to the source list.
n | number of the double-clicked element (destination list) |
References DestSelectionToSrc().
|
virtual |
Slot called when sending an element from the source list to the destination list. If multiple instance selection is active, the objects are dupplicated in the destination list, but not removed from the source list. In any case, there is no emission of the remove signal, since elements are either copied, or moved, but not suppressed.
References RGItemListBox::AddItem(), RGItemListBox::Begin(), dest_box, DestSelectionChanged(), RGItemListBox::GetSelectedNumber(), RGItemListBox::Null(), options, RGItemListBox::Select(), SelectionChanged(), RGItemListBox::SelectionRemove(), src_box, SrcSelectionChanged(), and RGItemListBox::UpdateListBox().
Referenced by SrcDoubleClicked().
|
virtual |
Slot called when returning an element from the destination list to the source list. If multiple instance selection is active, the objects are just removed from the destination list, else they are sent back to the source list. In case they are deleted, the signal for removal of detsination elements is sent.
References RGItemListBox::AddItem(), RGItemListBox::Begin(), dest_box, DestItemRemoved(), DestSelectionChanged(), RGItemListBox::GetItem(), RGItemListBox::GetItemNumber(), RGItemListBox::GetSelectedNumber(), RGItemListBox::Null(), options, RGItemListBox::RemoveItem(), RGItemListBox::Select(), SelectionChanged(), src_box, SrcSelectionChanged(), and RGItemListBox::UpdateListBox().
Referenced by DestDoubleClicked().
|
inlinevirtual |
Signal sent when removing an element from the global list.
ptr | pointer (converted to ULong_t) on the user data of the element |
Referenced by RemoveItem(), and RemoveSelectedItem().
|
inlinevirtual |
Signal sent when an element is removed from the source list. The signal is not sent if the element is just moved to the destination list.
ptr | pointer (converted to ULong_t) on the user data of the element |
Referenced by RemoveSubItems().
|
inlinevirtual |
Signal sent when an element is removed from the destination list. The signal is not sent if the element is just moved to the source list.
ptr | pointer (converted to ULong_t) on the user data of the element |
Referenced by DestSelectionToSrc(), and RemoveSubItems().
|
inlinevirtual |
Signal sent when a user button is clicked.
id | identification number of the button |
|
inlinevirtual |
Signal sent when selection list (destination) has been modified.
Referenced by DestSelectionToSrc(), SrcItemToDest(), and SrcSelectionToDest().
|
inlinevirtual |
Signal sent when selection in source list has changed.
Referenced by DestSelectionToSrc(), and SrcSelectionToDest().
|
inlinevirtual |
Signal sent when selection in destination list has changed.
Referenced by DestSelectionToSrc(), and SrcSelectionToDest().
RGItemSelectionBox::ClassDef | ( | RGItemSelectionBox | , |
0 | |||
) |
For ROOT dictionary.