140
140
Launcher::Launcher(nux::BaseWindow* parent,
141
141
NUX_FILE_LINE_DECL)
142
142
: View(NUX_FILE_LINE_PARAM)
143
, _launcher_drag_delta_max(0)
144
, _launcher_drag_delta_min(0)
144
146
, _collection_window(NULL)
145
147
, _background_color(nux::color::DimGray)
200
202
_folded_angle = 1.0f;
201
203
_neg_folded_angle = -1.0f;
202
204
_space_between_icons = 5;
203
_last_delta_y = 0.0f;
204
205
_folded_z_distance = 10.0f;
205
206
_launcher_action_state = ACTION_NONE;
206
207
_icon_under_mouse = NULL;
1202
1202
last_geo = box_geo;
1205
// logically dnd exit only restores to the clamped ranges
1206
// hover_progress restores to 0
1207
_launcher_drag_delta_max = 0.0f;
1208
_launcher_drag_delta_min = std::min(0.0f, launcher_height - sum);
1205
1210
if (hover_progress > 0.0f && _launcher_drag_delta != 0)
1207
1212
float delta_y = _launcher_drag_delta;
1209
// logically dnd exit only restores to the clamped ranges
1210
// hover_progress restores to 0
1212
float min = MIN(0.0f, launcher_height - sum);
1214
if (_launcher_drag_delta > max)
1215
delta_y = max + DragLimiter(delta_y - max);
1216
else if (_launcher_drag_delta < min)
1217
delta_y = min + DragLimiter(delta_y - min);
1214
if (_launcher_drag_delta > _launcher_drag_delta_max)
1215
delta_y = _launcher_drag_delta_max + DragLimiter(delta_y - _launcher_drag_delta_max);
1216
else if (_launcher_drag_delta < _launcher_drag_delta_min)
1217
delta_y = _launcher_drag_delta_min + DragLimiter(delta_y - _launcher_drag_delta_min);
1219
1219
if (GetActionState() != ACTION_DRAG_LAUNCHER)
1221
1221
float dnd_progress = DnDExitProgress(current);
1223
if (_launcher_drag_delta > max)
1224
delta_y = max + (delta_y - max) * dnd_progress;
1225
else if (_launcher_drag_delta < min)
1226
delta_y = min + (delta_y - min) * dnd_progress;
1223
if (_launcher_drag_delta > _launcher_drag_delta_max)
1224
delta_y = _launcher_drag_delta_max + (delta_y - _launcher_drag_delta_max) * dnd_progress;
1225
else if (_launcher_drag_delta < _launcher_drag_delta_min)
1226
delta_y = _launcher_drag_delta_min + (delta_y - _launcher_drag_delta_min) * dnd_progress;
1228
1228
if (dnd_progress == 0.0f)
1229
1229
_launcher_drag_delta = (int) delta_y;
1655
nux::ObjectPtr<nux::View> const& Launcher::GetActiveTooltip() const
1657
return _active_tooltip;
1660
nux::ObjectPtr<LauncherDragWindow> Launcher::GetDraggedIcon() const
1662
return nux::ObjectPtr<LauncherDragWindow>(_drag_window);
1659
1666
Launcher::SetActionState(LauncherActionState actionstate)
1724
1731
gboolean Launcher::OnScrollTimeout(gpointer data)
1726
1733
Launcher* self = (Launcher*) data;
1727
nux::Geometry geo = self->GetGeometry();
1728
gboolean anim = TRUE;
1734
gboolean continue_animation = TRUE;
1731
// Always check _scroll_limit_reached to ensure we don't keep spinning
1732
// this timer if the mouse happens to be left idle over one of the autoscroll
1733
// hotspots on the launcher.
1735
1736
if (self->IsInKeyNavMode() || !self->_hovered ||
1736
self->_scroll_limit_reached ||
1737
1737
self->GetActionState() == ACTION_DRAG_LAUNCHER)
1739
continue_animation = FALSE;
1739
1741
else if (self->MouseOverTopScrollArea())
1741
if (self->MouseOverTopScrollExtrema())
1743
if (self->_launcher_drag_delta >= self->_launcher_drag_delta_max)
1744
continue_animation = FALSE;
1745
else if (self->MouseOverTopScrollExtrema())
1742
1746
self->_launcher_drag_delta += 6;
1744
1748
self->_launcher_drag_delta += 3;
1746
1750
else if (self->MouseOverBottomScrollArea())
1748
if (self->MouseOverBottomScrollExtrema())
1752
if (self->_launcher_drag_delta <= self->_launcher_drag_delta_min)
1753
continue_animation = FALSE;
1754
else if (self->MouseOverBottomScrollExtrema())
1749
1755
self->_launcher_drag_delta -= 6;
1751
1757
self->_launcher_drag_delta -= 3;
1761
continue_animation = FALSE;
1764
if (continue_animation != FALSE)
1757
1766
self->EnsureAnimation();
1760
1770
self->_autoscroll_handle = 0;
1761
self->_scroll_limit_reached = false;
1773
return continue_animation;
1767
1776
void Launcher::EnsureScrollTimer()
1815
1824
EnsureAnimation();
1817
1826
icon->needs_redraw.connect(sigc::mem_fun(this, &Launcher::OnIconNeedsRedraw));
1827
icon->tooltip_visible.connect(sigc::mem_fun(this, &Launcher::OnTooltipVisible));
1820
1830
void Launcher::OnIconRemoved(AbstractLauncherIcon::Ptr icon)