~ken-vandine/unity/make-quicklists-work-again

« 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
#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