~didrocks/unity/launcher-bug-fix-fest

« back to all changes in this revision

Viewing changes to src/LauncherIcon.h

Import the work done so far with Compiz

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef LAUNCHERICON_H
 
2
#define LAUNCHERICON_H
 
3
 
 
4
#include <Nux/Nux.h>
 
5
#include <Nux/BaseWindow.h>
 
6
#include <NuxCore/Math/MathInc.h>
 
7
 
 
8
#include <sigc++/trackable.h>
 
9
#include <sigc++/signal.h>
 
10
#include <sigc++/functors/ptr_fun.h>
 
11
#include <sigc++/functors/mem_fun.h>
 
12
 
 
13
#include <gtk/gtk.h>
 
14
 
 
15
#include "Tooltip.h"
 
16
 
 
17
class Launcher;
 
18
 
 
19
typedef enum
 
20
{
 
21
  LAUNCHER_ICON_TYPE_NONE,
 
22
  LAUNCHER_ICON_TYPE_BEGIN,
 
23
  LAUNCHER_ICON_TYPE_FAVORITE,
 
24
  LAUNCHER_ICON_TYPE_APPLICATION,
 
25
  LAUNCHER_ICON_TYPE_PLACE,
 
26
  LAUNCHER_ICON_TYPE_DEVICE,
 
27
  LAUNCHER_ICON_TYPE_TRASH,
 
28
  LAUNCHER_ICON_TYPE_END,
 
29
} LauncherIconType;
 
30
 
 
31
class LauncherIcon: public sigc::trackable
 
32
{
 
33
public:
 
34
    LauncherIcon(Launcher* IconManager);
 
35
    ~LauncherIcon();
 
36
 
 
37
    void         SetTooltipText (const TCHAR* text);
 
38
    
 
39
    nux::NString GetTooltipText ();
 
40
    
 
41
    bool Visible ();
 
42
    bool Active  ();
 
43
    bool Running ();
 
44
 
 
45
    void RecvMouseEnter ();
 
46
 
 
47
    void RecvMouseLeave ();
 
48
    
 
49
    void HideTooltip ();
 
50
    
 
51
    int SortPriority ();
 
52
    
 
53
    LauncherIconType Type ();
 
54
    
 
55
    nux::Color BackgroundColor ();
 
56
    
 
57
    nux::BaseTexture * TextureForSize (int size);
 
58
    
 
59
    sigc::signal<void> MouseDown;
 
60
    sigc::signal<void> MouseUp;
 
61
    sigc::signal<void> MouseEnter;
 
62
    sigc::signal<void> MouseLeave;
 
63
    sigc::signal<void> MouseClick;
 
64
    
 
65
    sigc::signal<void, void *> show;
 
66
    sigc::signal<void, void *> hide;
 
67
    sigc::signal<void, void *> remove;
 
68
    sigc::signal<void, void *> needs_redraw;
 
69
protected:
 
70
 
 
71
    void SetVisible (bool visible);
 
72
    void SetActive (bool active);
 
73
    void SetRunning (bool running);
 
74
    
 
75
    void SetIconType (LauncherIconType type);
 
76
    void SetSortPriority (int priority);
 
77
 
 
78
    virtual nux::BaseTexture * GetTextureForSize (int size) = 0;
 
79
 
 
80
    nux::BaseTexture * TextureFromGtkTheme (const char *name, int size);
 
81
 
 
82
    nux::NString m_TooltipText;
 
83
    //! the window this icon belong too.
 
84
    nux::BaseWindow* m_Window;
 
85
    Launcher* m_IconManager;
 
86
 
 
87
    float         _folding_angle;   //!< angle of folded icon in radian.
 
88
    float         _folding_angle_delta;   //!< Difference between start and end.
 
89
    nux::Point2   _point[4];       //!< screen space projection of icon.
 
90
    nux::Point3   _position;
 
91
    nux::Point3   _position_delta;
 
92
    nux::Vector4  _xform_screen_coord [4];
 
93
    nux::Vector4  _xform_icon_screen_coord [4];
 
94
    bool          _mouse_inside;
 
95
 
 
96
    nux::Tooltip* _tooltip;
 
97
 
 
98
 
 
99
    friend class Launcher;
 
100
    friend class LauncherController;
 
101
 
 
102
private:
 
103
    nux::Color ColorForIcon (GdkPixbuf *pixbuf);
 
104
 
 
105
    nux::Color       _background_color;
 
106
    bool             _visible;
 
107
    bool             _active;
 
108
    bool             _running;
 
109
    int              _sort_priority;
 
110
    LauncherIconType _icon_type;
 
111
};
 
112
 
 
113
#endif // LAUNCHERICON_H
 
114