Ardour  9.0-pre0-822-g12e3bc5c20
Gtkmm2ext::DnDVBox< T > Class Template Reference

#include <dndvbox.h>

Inheritance diagram for Gtkmm2ext::DnDVBox< T >:
[legend]

Public Member Functions

 DnDVBox (std::list< Gtk::TargetEntry > targets, Gdk::DragAction actions=Gdk::ACTION_COPY)
 
virtual ~DnDVBox ()
 
void add_child (T *child, std::list< Gtk::TargetEntry > targets=std::list< Gtk::TargetEntry >())
 
std::list< T * > children ()
 
std::list< T * > selection (bool sorted=false) const
 
void set_active (T *c)
 
bool selected (T *child) const
 
void clear ()
 
void select_all ()
 
void select_none ()
 
std::pair< T *, double > get_child_at_position (int y) const
 
void set_spacing (int s)
 
void remove_placeholder ()
 
int add_placeholder (double y)
 

Public Attributes

sigc::signal< void > Reordered
 
sigc::signal< bool, GdkEventButton *, T * > ButtonPress
 
sigc::signal< bool, GdkEventButton *, T * > ButtonRelease
 
sigc::signal< void, DnDVBox *, T *, Glib::RefPtr< Gdk::DragContext > const & > DropFromAnotherBox
 
sigc::signal< void, Gtk::SelectionData const &, T *, Glib::RefPtr< Gdk::DragContext > const & > DropFromExternal
 
sigc::signal< void > SelectionChanged
 
sigc::signal< void, T & > SelectionAdded
 
sigc::signal< bool, DnDVBox *, T * > DragRefuse
 

Private Member Functions

double bottom_of_child_ignoring_placeholder (T *child) const
 
double get_children_around_position (int y, T **before, T **at, T **after) const
 
void drag_begin (Glib::RefPtr< Gdk::DragContext > const &context, T *child)
 
bool icon_expose (GdkEventExpose *)
 
void drag_data_get (Glib::RefPtr< Gdk::DragContext > const &context, Gtk::SelectionData &selection_data, guint, guint, T *child)
 
void drag_data_received (Glib::RefPtr< Gdk::DragContext > const &context, int, int y, Gtk::SelectionData const &selection_data, guint, guint time)
 
void drag_end (Glib::RefPtr< Gdk::DragContext > const &, T *)
 
int create_or_update_placeholder (double c)
 
bool drag_motion (Glib::RefPtr< Gdk::DragContext > const &ctx, int, int y, guint tme)
 
void drag_leave (Glib::RefPtr< Gdk::DragContext > const &, guint)
 
bool button_press (GdkEventButton *ev, T *child)
 
bool button_release (GdkEventButton *ev, T *child)
 
void setup_child_state (T *c)
 
void clear_selection ()
 
void add_to_selection (T *child)
 
void remove_from_selection (T *child)
 
T * child_from_widget (Gtk::Widget const *w) const
 

Private Attributes

Gtk::VBox _internal_vbox
 
std::list< Gtk::TargetEntry > _targets
 
Gdk::DragAction _actions
 
std::list< T * > _children
 
std::list< T * > _selection
 
T * _active
 
Gtk::Window * _drag_icon
 
bool _expecting_unwanted_button_event
 
Gtk::Label * _placeholder
 
T * _drag_child
 

Static Private Attributes

static DnDVBox_drag_source = 0
 

Detailed Description

template<class T>
class Gtkmm2ext::DnDVBox< T >

A VBox whose contents can be dragged and dropped

Definition at line 62 of file dndvbox.h.

Constructor & Destructor Documentation

◆ DnDVBox()

template<class T >
Gtkmm2ext::DnDVBox< T >::DnDVBox ( std::list< Gtk::TargetEntry >  targets,
Gdk::DragAction  actions = Gdk::ACTION_COPY 
)
inline

Definition at line 65 of file dndvbox.h.

◆ ~DnDVBox()

template<class T >
virtual Gtkmm2ext::DnDVBox< T >::~DnDVBox ( )
inlinevirtual

Definition at line 93 of file dndvbox.h.

Member Function Documentation

◆ add_child()

template<class T >
void Gtkmm2ext::DnDVBox< T >::add_child ( T *  child,
std::list< Gtk::TargetEntry >  targets = std::list<Gtk::TargetEntry>() 
)
inline

Add a child at the end of the widget. The DnDVBox will take responsibility for deleting the child

Definition at line 101 of file dndvbox.h.

◆ add_placeholder()

template<class T >
int Gtkmm2ext::DnDVBox< T >::add_placeholder ( double  y)
inline

Add a placeholder where a child would be put if it were added at the given y position.

Parameters
yy position within the DnDVBox.
Returns
index of child that the placeholder represents, or -1 if it is at the end of all children.

Definition at line 237 of file dndvbox.h.

◆ add_to_selection()

template<class T >
void Gtkmm2ext::DnDVBox< T >::add_to_selection ( T *  child)
inlineprivate

Definition at line 641 of file dndvbox.h.

◆ bottom_of_child_ignoring_placeholder()

template<class T >
double Gtkmm2ext::DnDVBox< T >::bottom_of_child_ignoring_placeholder ( T *  child) const
inlineprivate
Returns
the bottom y position of a child, pretending any placeholder is not there.

Definition at line 266 of file dndvbox.h.

◆ button_press()

template<class T >
bool Gtkmm2ext::DnDVBox< T >::button_press ( GdkEventButton *  ev,
T *  child 
)
inlineprivate

Definition at line 539 of file dndvbox.h.

◆ button_release()

template<class T >
bool Gtkmm2ext::DnDVBox< T >::button_release ( GdkEventButton *  ev,
T *  child 
)
inlineprivate

Definition at line 611 of file dndvbox.h.

◆ child_from_widget()

template<class T >
T* Gtkmm2ext::DnDVBox< T >::child_from_widget ( Gtk::Widget const *  w) const
inlineprivate

Definition at line 661 of file dndvbox.h.

◆ children()

template<class T >
std::list<T*> Gtkmm2ext::DnDVBox< T >::children ( )
inline
Returns
Children, sorted into the order that they are currently being displayed in the widget

Definition at line 121 of file dndvbox.h.

◆ clear()

template<class T >
void Gtkmm2ext::DnDVBox< T >::clear ( )
inline

Clear all children from the widget

Definition at line 176 of file dndvbox.h.

◆ clear_selection()

template<class T >
void Gtkmm2ext::DnDVBox< T >::clear_selection ( )
inlineprivate

Definition at line 632 of file dndvbox.h.

◆ create_or_update_placeholder()

template<class T >
int Gtkmm2ext::DnDVBox< T >::create_or_update_placeholder ( double  c)
inlineprivate

Insert a placeholder at a given fractional child position, creating it if necessary.

Parameters
cFractional child position.
Returns
index of child that the placeholder represents, or -1 if it is at the end of all children.

Definition at line 453 of file dndvbox.h.

◆ drag_begin()

template<class T >
void Gtkmm2ext::DnDVBox< T >::drag_begin ( Glib::RefPtr< Gdk::DragContext > const &  context,
T *  child 
)
inlineprivate

Definition at line 333 of file dndvbox.h.

◆ drag_data_get()

template<class T >
void Gtkmm2ext::DnDVBox< T >::drag_data_get ( Glib::RefPtr< Gdk::DragContext > const &  context,
Gtk::SelectionData &  selection_data,
guint  ,
guint  ,
T *  child 
)
inlineprivate

Definition at line 379 of file dndvbox.h.

◆ drag_data_received()

template<class T >
void Gtkmm2ext::DnDVBox< T >::drag_data_received ( Glib::RefPtr< Gdk::DragContext > const &  context,
int  ,
int  y,
Gtk::SelectionData const &  selection_data,
guint  ,
guint  time 
)
inlineprivate

Definition at line 386 of file dndvbox.h.

◆ drag_end()

template<class T >
void Gtkmm2ext::DnDVBox< T >::drag_end ( Glib::RefPtr< Gdk::DragContext > const &  ,
T *   
)
inlineprivate

Definition at line 437 of file dndvbox.h.

◆ drag_leave()

template<class T >
void Gtkmm2ext::DnDVBox< T >::drag_leave ( Glib::RefPtr< Gdk::DragContext > const &  ,
guint   
)
inlineprivate

Definition at line 534 of file dndvbox.h.

◆ drag_motion()

template<class T >
bool Gtkmm2ext::DnDVBox< T >::drag_motion ( Glib::RefPtr< Gdk::DragContext > const &  ctx,
int  ,
int  y,
guint  tme 
)
inlineprivate

Definition at line 467 of file dndvbox.h.

◆ get_child_at_position()

template<class T >
std::pair<T*, double> Gtkmm2ext::DnDVBox< T >::get_child_at_position ( int  y) const
inline
Parameters
yy coordinate.
Returns
Pair consisting of the child under y (or 0) and the (fractional) index of the child under y (or -1)

Definition at line 209 of file dndvbox.h.

◆ get_children_around_position()

template<class T >
double Gtkmm2ext::DnDVBox< T >::get_children_around_position ( int  y,
T **  before,
T **  at,
T **  after 
) const
inlineprivate

Look at a y coordinate and find the children below y, and the ones either side.

Parameters
yy position.
beforeFilled in with the child before, or 0.
atFilled in with the child under y, or 0.
afterFilled in with the child after, or 0.
Returns
Fractional position in terms of child height, or -1 if not over a child.

Definition at line 288 of file dndvbox.h.

◆ icon_expose()

template<class T >
bool Gtkmm2ext::DnDVBox< T >::icon_expose ( GdkEventExpose *  )
inlineprivate

Definition at line 361 of file dndvbox.h.

◆ remove_from_selection()

template<class T >
void Gtkmm2ext::DnDVBox< T >::remove_from_selection ( T *  child)
inlineprivate

Definition at line 651 of file dndvbox.h.

◆ remove_placeholder()

template<class T >
void Gtkmm2ext::DnDVBox< T >::remove_placeholder ( )
inline

Definition at line 225 of file dndvbox.h.

◆ select_all()

template<class T >
void Gtkmm2ext::DnDVBox< T >::select_all ( )
inline

Definition at line 189 of file dndvbox.h.

◆ select_none()

template<class T >
void Gtkmm2ext::DnDVBox< T >::select_none ( )
inline

Definition at line 199 of file dndvbox.h.

◆ selected()

template<class T >
bool Gtkmm2ext::DnDVBox< T >::selected ( T *  child) const
inline
Parameters
childChild
Returns
true if the child is selected, otherwise false.

Definition at line 171 of file dndvbox.h.

◆ selection()

template<class T >
std::list<T*> Gtkmm2ext::DnDVBox< T >::selection ( bool  sorted = false) const
inline
Returns
Selected children

Definition at line 138 of file dndvbox.h.

◆ set_active()

template<class T >
void Gtkmm2ext::DnDVBox< T >::set_active ( T *  c)
inline

Set the ‘active’ child; this is simply a child which is set to have the visual state "active" for whatever purposes the client may have.

Parameters
cChild, or 0 for none.

Definition at line 157 of file dndvbox.h.

◆ set_spacing()

template<class T >
void Gtkmm2ext::DnDVBox< T >::set_spacing ( int  s)
inline

Definition at line 221 of file dndvbox.h.

◆ setup_child_state()

template<class T >
void Gtkmm2ext::DnDVBox< T >::setup_child_state ( T *  c)
inlineprivate

Setup a child's visual state correctly

Definition at line 626 of file dndvbox.h.

Member Data Documentation

◆ _actions

template<class T >
Gdk::DragAction Gtkmm2ext::DnDVBox< T >::_actions
private

Definition at line 677 of file dndvbox.h.

◆ _active

template<class T >
T* Gtkmm2ext::DnDVBox< T >::_active
private

Definition at line 680 of file dndvbox.h.

◆ _children

template<class T >
std::list<T*> Gtkmm2ext::DnDVBox< T >::_children
private

Definition at line 678 of file dndvbox.h.

◆ _drag_child

template<class T >
T* Gtkmm2ext::DnDVBox< T >::_drag_child
private

Our child being dragged, or 0

Definition at line 688 of file dndvbox.h.

◆ _drag_icon

template<class T >
Gtk::Window* Gtkmm2ext::DnDVBox< T >::_drag_icon
private

Definition at line 681 of file dndvbox.h.

◆ _drag_source

template<class T >
DnDVBox< T > * Gtkmm2ext::DnDVBox< T >::_drag_source = 0
staticprivate

Definition at line 690 of file dndvbox.h.

◆ _expecting_unwanted_button_event

template<class T >
bool Gtkmm2ext::DnDVBox< T >::_expecting_unwanted_button_event
private

Definition at line 682 of file dndvbox.h.

◆ _internal_vbox

template<class T >
Gtk::VBox Gtkmm2ext::DnDVBox< T >::_internal_vbox
private

Definition at line 675 of file dndvbox.h.

◆ _placeholder

template<class T >
Gtk::Label* Gtkmm2ext::DnDVBox< T >::_placeholder
private

A blank label used as a placeholder to indicate where an item would go if it were dropped or inserted "now".

Definition at line 686 of file dndvbox.h.

◆ _selection

template<class T >
std::list<T*> Gtkmm2ext::DnDVBox< T >::_selection
private

Definition at line 679 of file dndvbox.h.

◆ _targets

template<class T >
std::list<Gtk::TargetEntry> Gtkmm2ext::DnDVBox< T >::_targets
private

Definition at line 676 of file dndvbox.h.

◆ ButtonPress

template<class T >
sigc::signal<bool, GdkEventButton*, T*> Gtkmm2ext::DnDVBox< T >::ButtonPress

A button has been pressed over the widget

Definition at line 246 of file dndvbox.h.

◆ ButtonRelease

template<class T >
sigc::signal<bool, GdkEventButton*, T*> Gtkmm2ext::DnDVBox< T >::ButtonRelease

A button has been release over the widget

Definition at line 249 of file dndvbox.h.

◆ DragRefuse

template<class T >
sigc::signal<bool, DnDVBox*, T*> Gtkmm2ext::DnDVBox< T >::DragRefuse

Definition at line 259 of file dndvbox.h.

◆ DropFromAnotherBox

template<class T >
sigc::signal<void, DnDVBox*, T*, Glib::RefPtr<Gdk::DragContext> const & > Gtkmm2ext::DnDVBox< T >::DropFromAnotherBox

A child has been dropped onto this DnDVBox from another one; Parameters are the source DnDVBox, our child which the other one was dropped on (or 0) and the DragContext.

Definition at line 254 of file dndvbox.h.

◆ DropFromExternal

template<class T >
sigc::signal<void, Gtk::SelectionData const &, T*, Glib::RefPtr<Gdk::DragContext> const & > Gtkmm2ext::DnDVBox< T >::DropFromExternal

Definition at line 255 of file dndvbox.h.

◆ Reordered

template<class T >
sigc::signal<void> Gtkmm2ext::DnDVBox< T >::Reordered

Children have been reordered by a drag

Definition at line 243 of file dndvbox.h.

◆ SelectionAdded

template<class T >
sigc::signal<void,T&> Gtkmm2ext::DnDVBox< T >::SelectionAdded

Definition at line 257 of file dndvbox.h.

◆ SelectionChanged

template<class T >
sigc::signal<void> Gtkmm2ext::DnDVBox< T >::SelectionChanged

Definition at line 256 of file dndvbox.h.


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