~mial/ubuntu/oneiric/unity/bug-791810

« back to all changes in this revision

Viewing changes to src/Launcher.h

Import the work done so far with Compiz

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2
 
/*
3
 
 * Copyright (C) 2010 Canonical Ltd
4
 
 *
5
 
 * This program is free software: you can redistribute it and/or modify
6
 
 * it under the terms of the GNU General Public License version 3 as
7
 
 * published by the Free Software Foundation.
8
 
 *
9
 
 * This program is distributed in the hope that it will be useful,
10
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
 * GNU General Public License for more details.
13
 
 *
14
 
 * You should have received a copy of the GNU General Public License
15
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
 
 *
17
 
 * Authored by: Jason Smith <jason.smith@canonical.com>
18
 
 * Authored by: Jay Taoko <jay.taoko@canonical.com>
19
 
 */
20
 
 
21
 
#ifndef LAUNCHER_H
22
 
#define LAUNCHER_H
23
 
 
24
 
#include <sys/time.h>
25
 
 
26
 
#include <Nux/View.h>
27
 
#include <Nux/BaseWindow.h>
28
 
#include <Nux/TimerProc.h>
29
 
#include <NuxGraphics/IOpenGLAsmShader.h>
30
 
 
31
 
#include "AbstractIconRenderer.h"
32
 
#include "BackgroundEffectHelper.h"
33
 
#include "DNDCollectionWindow.h"
34
 
#include "DndData.h"
35
 
#include "GeisAdapter.h"
36
 
#include "Introspectable.h"
37
 
#include "LauncherIcon.h"
38
 
#include "LauncherDragWindow.h"
39
 
#include "LauncherHideMachine.h"
40
 
#include "LauncherHoverMachine.h"
41
 
 
42
 
#define ANIM_DURATION_SHORT_SHORT 100
43
 
#define ANIM_DURATION_SHORT 125
44
 
#define ANIM_DURATION       200
45
 
#define ANIM_DURATION_LONG  350
46
 
 
47
 
#define SUPER_TAP_DURATION  250
48
 
#define SHORTCUTS_SHOWN_DELAY  750
49
 
#define START_DRAGICON_DURATION 250
50
 
#define BEFORE_HIDE_LAUNCHER_ON_SUPER_DURATION 1000
51
 
 
52
 
#define IGNORE_REPEAT_SHORTCUT_DURATION  250
53
 
 
54
 
#define MAX_SUPERKEY_LABELS 10
55
 
 
56
 
class LauncherModel;
57
 
class QuicklistView;
58
 
class LauncherIcon;
59
 
class LauncherDragWindow;
60
 
 
61
 
 
62
 
using namespace unity::ui;
63
 
 
64
 
class Launcher : public unity::Introspectable, public nux::View
65
 
{
66
 
  NUX_DECLARE_OBJECT_TYPE(Launcher, nux::View);
67
 
public:
68
 
  typedef enum
69
 
  {
70
 
    LAUNCHER_HIDE_NEVER,
71
 
    LAUNCHER_HIDE_AUTOHIDE,
72
 
    LAUNCHER_HIDE_DODGE_WINDOWS,
73
 
    LAUNCHER_HIDE_DODGE_ACTIVE_WINDOW,
74
 
  } LauncherHideMode;
75
 
 
76
 
  typedef enum
77
 
  {
78
 
    LAUNCH_ANIMATION_NONE,
79
 
    LAUNCH_ANIMATION_PULSE,
80
 
    LAUNCH_ANIMATION_BLINK,
81
 
  } LaunchAnimation;
82
 
 
83
 
  typedef enum
84
 
  {
85
 
    URGENT_ANIMATION_NONE,
86
 
    URGENT_ANIMATION_PULSE,
87
 
    URGENT_ANIMATION_WIGGLE,
88
 
  } UrgentAnimation;
89
 
 
90
 
  typedef enum
91
 
  {
92
 
    FADE_OR_SLIDE,
93
 
    SLIDE_ONLY,
94
 
    FADE_ONLY,
95
 
    FADE_AND_SLIDE,
96
 
  } AutoHideAnimation;
97
 
 
98
 
  typedef enum
99
 
  {
100
 
    BACKLIGHT_ALWAYS_ON,
101
 
    BACKLIGHT_NORMAL,
102
 
    BACKLIGHT_ALWAYS_OFF,
103
 
    BACKLIGHT_EDGE_TOGGLE,
104
 
    BACKLIGHT_NORMAL_EDGE_TOGGLE
105
 
  } BacklightMode;
106
 
 
107
 
  Launcher(nux::BaseWindow* parent, NUX_FILE_LINE_PROTO);
108
 
  ~Launcher();
109
 
 
110
 
  nux::Property<Display*> display;
111
 
 
112
 
  virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
113
 
  virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
114
 
  virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
115
 
 
116
 
  LauncherIcon* GetSelectedMenuIcon();
117
 
 
118
 
  void SetIconSize(int tile_size, int icon_size);
119
 
  void SetBackgroundAlpha(float background_alpha);
120
 
 
121
 
  LauncherHideMachine* HideMachine() { return _hide_machine; }
122
 
 
123
 
  bool Hidden()
124
 
  {
125
 
    return _hidden;
126
 
  }
127
 
  bool ShowOnEdge()
128
 
  {
129
 
    return _hide_machine->GetShowOnEdge();
130
 
  }
131
 
 
132
 
  void SetModel(LauncherModel* model);
133
 
  LauncherModel* GetModel();
134
 
 
135
 
  void SetFloating(bool floating);
136
 
 
137
 
  void SetHideMode(LauncherHideMode hidemode);
138
 
  LauncherHideMode GetHideMode();
139
 
 
140
 
  void StartKeyShowLauncher();
141
 
  void EndKeyShowLauncher();
142
 
 
143
 
  void SetBacklightMode(BacklightMode mode);
144
 
  BacklightMode GetBacklightMode();
145
 
  bool IsBackLightModeToggles();
146
 
 
147
 
  void SetLaunchAnimation(LaunchAnimation animation);
148
 
  LaunchAnimation GetLaunchAnimation();
149
 
 
150
 
  void SetUrgentAnimation(UrgentAnimation animation);
151
 
  UrgentAnimation GetUrgentAnimation();
152
 
 
153
 
  void SetAutoHideAnimation(AutoHideAnimation animation);
154
 
  AutoHideAnimation GetAutoHideAnimation();
155
 
 
156
 
  void EdgeRevealTriggered(int x, int y);
157
 
 
158
 
  gboolean CheckSuperShortcutPressed(Display *x_display, unsigned int key_sym, unsigned long key_code, unsigned long key_state, char* key_string);
159
 
  void SetLatestShortcut(guint64 shortcut);
160
 
 
161
 
  nux::BaseWindow* GetParent()
162
 
  {
163
 
    return _parent;
164
 
  };
165
 
 
166
 
  static void SetTimeStruct(struct timespec* timer, struct timespec* sister = 0, int sister_relation = 0);
167
 
 
168
 
  virtual void RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags);
169
 
  virtual void RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags);
170
 
  virtual void RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
171
 
  virtual void RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags);
172
 
  virtual void RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags);
173
 
  virtual void RecvMouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
174
 
  virtual void RecvMouseWheel(int x, int y, int wheel_delta, unsigned long button_flags, unsigned long key_flags);
175
 
  virtual void RecvMouseDownOutsideArea(int x, int y, unsigned long button_flags, unsigned long key_flags);
176
 
 
177
 
  virtual void RecvKeyPressed(unsigned long    eventType  ,   /*event type*/
178
 
    unsigned long    keysym     ,   /*event keysym*/
179
 
    unsigned long    state      ,   /*event state*/
180
 
    const char*      character  ,   /*character*/
181
 
    unsigned short   keyCount       /*key repeat count*/);
182
 
 
183
 
  virtual void RecvQuicklistOpened(QuicklistView* quicklist);
184
 
  virtual void RecvQuicklistClosed(QuicklistView* quicklist);
185
 
 
186
 
  void startKeyNavMode();
187
 
  void leaveKeyNavMode(bool preserve_focus = true);
188
 
 
189
 
  void exitKeyNavMode();    // Connected to signal OnEndFocus
190
 
 
191
 
  int GetMouseX();
192
 
  int GetMouseY();
193
 
 
194
 
  void CheckWindowOverLauncher();
195
 
  void EnableCheckWindowOverLauncher(gboolean enabled);
196
 
 
197
 
  sigc::signal<void, char*, LauncherIcon*> launcher_addrequest;
198
 
  sigc::signal<void, LauncherIcon*> launcher_removerequest;
199
 
  sigc::signal<void> selection_change;
200
 
  sigc::signal<void> hidden_changed;
201
 
 
202
 
 
203
 
  // Key navigation
204
 
  virtual bool InspectKeyEvent(unsigned int eventType,
205
 
                               unsigned int keysym,
206
 
                               const char* character);
207
 
 
208
 
protected:
209
 
  // Introspectable methods
210
 
  const gchar* GetName();
211
 
  void AddProperties(GVariantBuilder* builder);
212
 
 
213
 
  void ProcessDndEnter();
214
 
  void ProcessDndLeave();
215
 
  void ProcessDndMove(int x, int y, std::list<char*> mimes);
216
 
  void ProcessDndDrop(int x, int y);
217
 
private:
218
 
  typedef nux::ObjectPtr<nux::BaseTexture> BaseTexturePtr;
219
 
 
220
 
  typedef enum
221
 
  {
222
 
    ACTION_NONE,
223
 
    ACTION_DRAG_LAUNCHER,
224
 
    ACTION_DRAG_ICON,
225
 
    ACTION_DRAG_EXTERNAL,
226
 
  } LauncherActionState;
227
 
 
228
 
  typedef enum
229
 
  {
230
 
    TIME_ENTER,
231
 
    TIME_LEAVE,
232
 
    TIME_DRAG_END,
233
 
    TIME_DRAG_THRESHOLD,
234
 
    TIME_AUTOHIDE,
235
 
    TIME_DRAG_EDGE_TOUCH,
236
 
    TIME_DRAG_OUT,
237
 
    TIME_TAP_SUPER,
238
 
    TIME_SUPER_PRESSED,
239
 
 
240
 
    TIME_LAST
241
 
  } LauncherActionTimes;
242
 
 
243
 
  void OnWindowMaybeIntellihide(guint32 xid);
244
 
  void OnWindowMaybeIntellihideDelayed(guint32 xid);
245
 
  static gboolean CheckWindowOverLauncherSync(Launcher* self);
246
 
  void OnWindowMapped(guint32 xid);
247
 
  void OnWindowUnmapped(guint32 xid);
248
 
 
249
 
  void OnDragStart(GeisAdapter::GeisDragData* data);
250
 
  void OnDragUpdate(GeisAdapter::GeisDragData* data);
251
 
  void OnDragFinish(GeisAdapter::GeisDragData* data);
252
 
 
253
 
  void OnPluginStateChanged();
254
 
 
255
 
  void OnViewPortSwitchStarted();
256
 
  void OnViewPortSwitchEnded();
257
 
 
258
 
  static gboolean AnimationTimeout(gpointer data);
259
 
  static gboolean SuperShowLauncherTimeout(gpointer data);
260
 
  static gboolean SuperHideLauncherTimeout(gpointer data);
261
 
  static gboolean SuperShowShortcutsTimeout(gpointer data);
262
 
  static gboolean StrutHack(gpointer data);
263
 
  static gboolean MoveFocusToKeyNavModeTimeout(gpointer data);
264
 
  static gboolean StartIconDragTimeout(gpointer data);
265
 
  static gboolean ResetRepeatShorcutTimeout(gpointer data);
266
 
 
267
 
  void SetMousePosition(int x, int y);
268
 
 
269
 
  void SetStateMouseOverLauncher(bool over_launcher);
270
 
  void SetStateKeyNav(bool keynav_activated);
271
 
 
272
 
  bool MouseBeyondDragThreshold();
273
 
 
274
 
  void OnDragWindowAnimCompleted();
275
 
 
276
 
  bool IconNeedsAnimation(LauncherIcon* icon, struct timespec const& current);
277
 
  bool IconDrawEdgeOnly(LauncherIcon* icon);
278
 
  bool AnimationInProgress();
279
 
 
280
 
  void SetActionState(LauncherActionState actionstate);
281
 
  LauncherActionState GetActionState();
282
 
 
283
 
  void EnsureAnimation();
284
 
  void EnsureScrollTimer();
285
 
 
286
 
  bool MouseOverTopScrollArea();
287
 
  bool MouseOverTopScrollExtrema();
288
 
 
289
 
  bool MouseOverBottomScrollArea();
290
 
  bool MouseOverBottomScrollExtrema();
291
 
 
292
 
  static gboolean OnScrollTimeout(gpointer data);
293
 
  static gboolean OnUpdateDragManagerTimeout(gpointer data);
294
 
 
295
 
  float DnDStartProgress(struct timespec const& current);
296
 
  float DnDExitProgress(struct timespec const& current);
297
 
  float GetHoverProgress(struct timespec const& current);
298
 
  float AutohideProgress(struct timespec const& current);
299
 
  float DragThresholdProgress(struct timespec const& current);
300
 
  float DragHideProgress(struct timespec const& current);
301
 
  float DragOutProgress(struct timespec const& current);
302
 
  float IconDesatValue(LauncherIcon* icon, struct timespec const& current);
303
 
  float IconPresentProgress(LauncherIcon* icon, struct timespec const& current);
304
 
  float IconUrgentProgress(LauncherIcon* icon, struct timespec const& current);
305
 
  float IconShimmerProgress(LauncherIcon* icon, struct timespec const& current);
306
 
  float IconUrgentPulseValue(LauncherIcon* icon, struct timespec const& current);
307
 
  float IconPulseOnceValue(LauncherIcon *icon, struct timespec const &current);
308
 
  float IconUrgentWiggleValue(LauncherIcon* icon, struct timespec const& current);
309
 
  float IconStartingBlinkValue(LauncherIcon* icon, struct timespec const& current);
310
 
  float IconStartingPulseValue(LauncherIcon* icon, struct timespec const& current);
311
 
  float IconBackgroundIntensity(LauncherIcon* icon, struct timespec const& current);
312
 
  float IconProgressBias(LauncherIcon* icon, struct timespec const& current);
313
 
  float IconDropDimValue(LauncherIcon* icon, struct timespec const& current);
314
 
  float IconCenterTransitionProgress(LauncherIcon* icon, struct timespec const& current);
315
 
 
316
 
  void SetHover(bool hovered);
317
 
  void SetHidden(bool hidden);
318
 
 
319
 
  void  SetDndDelta(float x, float y, nux::Geometry const& geo, timespec const& current);
320
 
  float DragLimiter(float x);
321
 
 
322
 
  void SetupRenderArg(LauncherIcon* icon, struct timespec const& current, RenderArg& arg);
323
 
  void FillRenderArg(LauncherIcon* icon,
324
 
                     RenderArg& arg,
325
 
                     nux::Point3& center,
326
 
                     float folding_threshold,
327
 
                     float folded_size,
328
 
                     float folded_spacing,
329
 
                     float autohide_offset,
330
 
                     float folded_z_distance,
331
 
                     float animation_neg_rads,
332
 
                     struct timespec const& current);
333
 
 
334
 
  void RenderArgs(std::list<RenderArg> &launcher_args,
335
 
                  nux::Geometry& box_geo, float* launcher_alpha);
336
 
 
337
 
  void OnIconAdded(LauncherIcon* icon);
338
 
  void OnIconRemoved(LauncherIcon* icon);
339
 
  void OnOrderChanged();
340
 
 
341
 
  void OnIconNeedsRedraw(AbstractLauncherIcon* icon);
342
 
 
343
 
  static void OnPlaceViewHidden(GVariant* data, void* val);
344
 
  static void OnPlaceViewShown(GVariant* data, void* val);
345
 
 
346
 
  void DesaturateIcons();
347
 
  void SaturateIcons();
348
 
 
349
 
  static void OnBGColorChanged (GVariant *data, void *val);
350
 
 
351
 
  static void OnActionDone(GVariant* data, void* val);
352
 
 
353
 
  void RenderIconToTexture(nux::GraphicsEngine& GfxContext, LauncherIcon* icon, nux::ObjectPtr<nux::IOpenGLBaseTexture> texture);
354
 
 
355
 
  LauncherIcon* MouseIconIntersection(int x, int y);
356
 
  void EventLogic();
357
 
  void MouseDownLogic(int x, int y, unsigned long button_flags, unsigned long key_flags);
358
 
  void MouseUpLogic(int x, int y, unsigned long button_flags, unsigned long key_flags);
359
 
 
360
 
  void StartIconDragRequest(int x, int y);
361
 
  void StartIconDrag(LauncherIcon* icon);
362
 
  void EndIconDrag();
363
 
  void UpdateDragWindowPosition(int x, int y);
364
 
 
365
 
  float GetAutohidePositionMin();
366
 
  float GetAutohidePositionMax();
367
 
 
368
 
  virtual void PreLayoutManagement();
369
 
  virtual long PostLayoutManagement(long LayoutResult);
370
 
  virtual void PositionChildLayout(float offsetX, float offsetY);
371
 
 
372
 
  void SetOffscreenRenderTarget(nux::ObjectPtr<nux::IOpenGLBaseTexture> texture);
373
 
  void RestoreSystemRenderTarget();
374
 
 
375
 
  gboolean TapOnSuper();
376
 
 
377
 
  void OnDisplayChanged(Display* display);
378
 
  void OnDNDDataCollected(const std::list<char*>& mimes);
379
 
  
380
 
  void DndReset();
381
 
  void DndHoveredIconReset();
382
 
 
383
 
  nux::HLayout* m_Layout;
384
 
  int m_ContentOffsetY;
385
 
 
386
 
  // used by keyboard/a11y-navigation
387
 
  LauncherIcon* _current_icon;
388
 
  LauncherIcon* m_ActiveTooltipIcon;
389
 
  LauncherIcon* _icon_under_mouse;
390
 
  LauncherIcon* _icon_mouse_down;
391
 
  LauncherIcon* _drag_icon;
392
 
 
393
 
  int           _current_icon_index;
394
 
  int           _last_icon_index;
395
 
 
396
 
  QuicklistView* _active_quicklist;
397
 
 
398
 
  bool  _hovered;
399
 
  bool  _floating;
400
 
  bool  _hidden;
401
 
  bool  _render_drag_window;
402
 
  bool  _check_window_over_launcher;
403
 
 
404
 
  bool          _shortcuts_shown;
405
 
  bool          _keynav_activated;
406
 
  guint64       _latest_shortcut;
407
 
 
408
 
  BacklightMode _backlight_mode;
409
 
 
410
 
  float _folded_angle;
411
 
  float _neg_folded_angle;
412
 
  float _folded_z_distance;
413
 
  float _launcher_top_y;
414
 
  float _launcher_bottom_y;
415
 
 
416
 
  LauncherHideMode _hidemode;
417
 
 
418
 
  LauncherActionState _launcher_action_state;
419
 
  LaunchAnimation _launch_animation;
420
 
  UrgentAnimation _urgent_animation;
421
 
  AutoHideAnimation _autohide_animation;
422
 
 
423
 
  nux::ObjectPtr<nux::IOpenGLBaseTexture> _offscreen_drag_texture;
424
 
 
425
 
  int _space_between_icons;
426
 
  int _icon_size;
427
 
  int _icon_image_size;
428
 
  int _icon_image_size_delta;
429
 
  int _icon_glow_size;
430
 
  int _dnd_delta_y;
431
 
  int _dnd_delta_x;
432
 
  int _postreveal_mousemove_delta_x;
433
 
  int _postreveal_mousemove_delta_y;
434
 
  int _launcher_drag_delta;
435
 
  int _enter_y;
436
 
  int _last_button_press;
437
 
  int _drag_out_id;
438
 
  float _drag_out_delta_x;
439
 
  float _background_alpha;
440
 
 
441
 
  int _bfb_width;
442
 
  int _bfb_height;
443
 
 
444
 
  guint _autoscroll_handle;
445
 
  guint _focus_keynav_handle;
446
 
  guint _super_show_launcher_handle;
447
 
  guint _super_hide_launcher_handle;
448
 
  guint _super_show_shortcuts_handle;
449
 
  guint _start_dragicon_handle;
450
 
  guint _dnd_check_handle;
451
 
  guint _ignore_repeat_shortcut_handle;
452
 
 
453
 
  nux::Point2   _mouse_position;
454
 
  nux::Point2   _bfb_mouse_position;
455
 
  nux::AbstractPaintLayer* m_BackgroundLayer;
456
 
  nux::BaseWindow* _parent;
457
 
  LauncherModel* _model;
458
 
  LauncherDragWindow* _drag_window;
459
 
  LauncherHideMachine* _hide_machine;
460
 
  LauncherHoverMachine* _hover_machine;
461
 
 
462
 
  unity::DndData _dnd_data;
463
 
  nux::DndAction    _drag_action;
464
 
  bool              _data_checked;
465
 
  bool              _steal_drag;
466
 
  bool              _drag_edge_touching;
467
 
  LauncherIcon*     _dnd_hovered_icon;
468
 
  unity::DNDCollectionWindow* _collection_window;
469
 
  sigc::connection _on_data_collected_connection;
470
 
 
471
 
  Atom              _selection_atom;
472
 
 
473
 
  guint             _launcher_animation_timeout;
474
 
 
475
 
  /* gdbus */
476
 
  guint                       _dbus_owner;
477
 
  static const gchar          introspection_xml[];
478
 
  static GDBusInterfaceVTable interface_vtable;
479
 
 
480
 
  static void OnBusAcquired(GDBusConnection* connection, const gchar* name, gpointer user_data);
481
 
  static void OnNameAcquired(GDBusConnection* connection, const gchar* name, gpointer user_data);
482
 
  static void OnNameLost(GDBusConnection* connection, const gchar* name, gpointer user_data);
483
 
  static void handle_dbus_method_call(GDBusConnection*       connection,
484
 
                                      const gchar*           sender,
485
 
                                      const gchar*           object_path,
486
 
                                      const gchar*           interface_name,
487
 
                                      const gchar*           method_name,
488
 
                                      GVariant*              parameters,
489
 
                                      GDBusMethodInvocation* invocation,
490
 
                                      gpointer               user_data);
491
 
 
492
 
  struct timespec  _times[TIME_LAST];
493
 
 
494
 
  bool _initial_drag_animation;
495
 
 
496
 
  guint _ubus_handles[4];
497
 
 
498
 
  nux::Color _background_color;
499
 
  BaseTexturePtr   launcher_sheen_;
500
 
  bool _dash_is_open;
501
 
 
502
 
  AbstractIconRenderer::Ptr icon_renderer;
503
 
  BackgroundEffectHelper bg_effect_helper_;
504
 
};
505
 
 
506
 
#endif // LAUNCHER_H
 
1
#ifndef LAUNCHER_H
 
2
#define LAUNCHER_H
 
3
 
 
4
#include <Nux/View.h>
 
5
#include <Nux/BaseWindow.h>
 
6
#include "LauncherIcon.h"
 
7
#include "NuxGraphics/IOpenGLAsmShader.h"
 
8
#include "Nux/TimerProc.h"
 
9
 
 
10
class LauncherModel;
 
11
 
 
12
class Launcher : public nux::View
 
13
{
 
14
public:
 
15
    Launcher(NUX_FILE_LINE_PROTO);
 
16
    ~Launcher();
 
17
 
 
18
    virtual long ProcessEvent(nux::IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
 
19
    virtual void Draw(nux::GraphicsContext& GfxContext, bool force_draw);
 
20
    virtual void DrawContent(nux::GraphicsContext& GfxContext, bool force_draw);
 
21
    virtual void PostDraw(nux::GraphicsContext& GfxContext, bool force_draw);
 
22
 
 
23
    LauncherIcon* GetActiveTooltipIcon() {return m_ActiveTooltipIcon;}
 
24
    LauncherIcon* GetActiveMenuIcon() {return m_ActiveMenuIcon;}
 
25
 
 
26
    bool TooltipNotify(LauncherIcon* Icon);
 
27
    bool MenuNotify(LauncherIcon* Icon);
 
28
    
 
29
    void SetIconSize(int tile_size, int icon_size, nux::BaseWindow *parent);
 
30
    void NotifyMenuTermination(LauncherIcon* Icon);
 
31
    
 
32
    void SetModel (LauncherModel *model);
 
33
    
 
34
    virtual void RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags);
 
35
    virtual void RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags);
 
36
    virtual void RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
 
37
    virtual void RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags);
 
38
    virtual void RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags);
 
39
    virtual void RecvMouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
 
40
    virtual void RecvMouseWheel(int x, int y, int wheel_delta, unsigned long button_flags, unsigned long key_flags);
 
41
 
 
42
private:
 
43
  typedef enum
 
44
  {
 
45
    LAUNCHER_FOLDED,
 
46
    LAUNCHER_UNFOLDED
 
47
  } LauncherState;
 
48
 
 
49
  typedef enum
 
50
  {
 
51
    ACTION_NONE,
 
52
    ACTION_DRAG_LAUNCHER,
 
53
    ACTION_DRAG_ICON,
 
54
  } LauncherActionState;
 
55
 
 
56
  void OnIconAdded (void *icon_pointer);
 
57
  void OnIconRemoved (void *icon_pointer);
 
58
  void OnOrderChanged ();
 
59
 
 
60
 
 
61
  void OnIconNeedsRedraw (void *icon);
 
62
 
 
63
  void FoldingCallback(void* v);
 
64
  void RevealCallback(void* v);
 
65
 
 
66
  void RenderIcon (nux::GraphicsContext& GfxContext, LauncherIcon* launcher_view);
 
67
  void RenderIconImage(nux::GraphicsContext& GfxContext, LauncherIcon* launcher_view);
 
68
  void UpdateIconXForm ();
 
69
  LauncherIcon* MouseIconIntersection (int x, int y);
 
70
  void EventLogic ();
 
71
  void MouseDownLogic ();
 
72
  void MouseUpLogic ();
 
73
 
 
74
  void SlideDown(float stepy, int mousedy);
 
75
  void SlideUp(float stepy, int mousedy);
 
76
 
 
77
  virtual void PreLayoutManagement();
 
78
  virtual long PostLayoutManagement(long LayoutResult);
 
79
  virtual void PositionChildLayout(float offsetX, float offsetY);
 
80
 
 
81
  void OrderRevealedIcons();
 
82
  void OrderFoldedIcons(int FocusIconIndex);
 
83
  void ScheduleRevealAnimation ();
 
84
  void ScheduleFoldAnimation ();
 
85
 
 
86
  nux::HLayout* m_Layout;
 
87
  int m_ContentOffsetY;
 
88
 
 
89
  LauncherIcon* m_ActiveTooltipIcon;
 
90
  LauncherIcon* m_ActiveMenuIcon;
 
91
 
 
92
  float _folding_angle;
 
93
  float _angle_rate;
 
94
  float _timer_intervals;
 
95
  int   _space_between_icons;
 
96
  int   _anim_duration;
 
97
  float _folded_angle;
 
98
  float _neg_folded_angle;
 
99
  float _folded_z_distance;
 
100
  float _launcher_top_y;
 
101
  float _launcher_bottom_y;
 
102
  LauncherState _launcher_state;
 
103
  LauncherActionState _launcher_action_state;
 
104
  LauncherIcon* _icon_under_mouse;
 
105
  LauncherIcon* _icon_mouse_down;
 
106
  int _icon_size;
 
107
  int _icon_image_size;
 
108
  int _icon_image_size_delta;
 
109
  nux::BaseTexture* _icon_bkg_texture;
 
110
  nux::BaseTexture* _icon_outline_texture;
 
111
  int _dnd_delta;
 
112
  int _dnd_security;
 
113
 
 
114
  nux::TimerFunctor* _folding_functor;
 
115
  nux::TimerHandle _folding_timer_handle;
 
116
  nux::TimerFunctor* _reveal_functor;
 
117
  nux::TimerHandle _reveal_timer_handle;
 
118
 
 
119
  nux::Matrix4  _view_matrix;
 
120
  nux::Matrix4  _projection_matrix;
 
121
  nux::Point2   _mouse_position;
 
122
  nux::IntrusiveSP<nux::IOpenGLShaderProgram>    _shader_program_uv_persp_correction;
 
123
  nux::IntrusiveSP<nux::IOpenGLAsmShaderProgram> _AsmShaderProg;
 
124
  nux::BaseTexture* m_RunningIndicator;
 
125
  nux::BaseTexture* m_ActiveIndicator;
 
126
  nux::AbstractPaintLayer* m_BackgroundLayer;
 
127
  LauncherModel* _model;
 
128
};
 
129
 
 
130
#endif // LAUNCHER_H
 
131
 
 
132