2
* Copyright (C) 2010 Canonical Ltd
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Jason Smith <jason.smith@canonical.com>
20
#ifndef LAUNCHERICON_H
21
#define LAUNCHERICON_H
24
#include <Nux/BaseWindow.h>
25
#include <NuxCore/Math/MathInc.h>
27
#include <sigc++/trackable.h>
28
#include <sigc++/signal.h>
29
#include <sigc++/functors/ptr_fun.h>
30
#include <sigc++/functors/mem_fun.h>
33
#include <libdbusmenu-glib/client.h>
41
LAUNCHER_ICON_TYPE_NONE,
42
LAUNCHER_ICON_TYPE_BEGIN,
43
LAUNCHER_ICON_TYPE_FAVORITE,
44
LAUNCHER_ICON_TYPE_APPLICATION,
45
LAUNCHER_ICON_TYPE_PLACE,
46
LAUNCHER_ICON_TYPE_DEVICE,
47
LAUNCHER_ICON_TYPE_TRASH,
48
LAUNCHER_ICON_TYPE_END,
51
class LauncherIcon: public nux::InitiallyUnownedObject, public sigc::trackable
54
LauncherIcon(Launcher* IconManager);
57
void SetTooltipText (const TCHAR* text);
59
nux::NString GetTooltipText ();
66
void RecvMouseEnter ();
67
void RecvMouseLeave ();
73
int RelatedWindows ();
75
struct timeval ShowTime ();
76
struct timeval HideTime ();
77
struct timeval RunningTime ();
78
struct timeval UrgentTime ();
80
LauncherIconType Type ();
82
nux::Color BackgroundColor ();
84
nux::BaseTexture * TextureForSize (int size);
86
std::list<DbusmenuClient *> Menus ();
88
sigc::signal<void, int> MouseDown;
89
sigc::signal<void, int> MouseUp;
90
sigc::signal<void> MouseEnter;
91
sigc::signal<void> MouseLeave;
92
sigc::signal<void, int> MouseClick;
94
sigc::signal<void, void *> show;
95
sigc::signal<void, void *> hide;
96
sigc::signal<void, void *> remove;
97
sigc::signal<void, void *> needs_redraw;
100
void SetVisible (bool visible);
101
void SetActive (bool active);
102
void SetRunning (bool running);
103
void SetUrgent (bool urgent);
104
void SetRelatedWindows (int windows);
107
void SetIconType (LauncherIconType type);
108
void SetSortPriority (int priority);
110
virtual std::list<DbusmenuClient *> GetMenus ();
111
virtual nux::BaseTexture * GetTextureForSize (int size) = 0;
113
nux::BaseTexture * TextureFromGtkTheme (const char *name, int size);
115
nux::NString m_TooltipText;
116
//! the window this icon belong too.
117
nux::BaseWindow* m_Window;
118
Launcher* m_IconManager;
120
nux::Vector4 _xform_screen_coord [4];
121
nux::Vector4 _xform_icon_screen_coord [4];
123
float _folding_angle;
125
nux::Tooltip* _tooltip;
128
friend class Launcher;
129
friend class LauncherController;
132
nux::Color ColorForIcon (GdkPixbuf *pixbuf);
134
nux::Color _background_color;
140
int _related_windows;
141
LauncherIconType _icon_type;
142
struct timeval _show_time;
143
struct timeval _hide_time;
144
struct timeval _running_time;
145
struct timeval _urgent_time;
148
#endif // LAUNCHERICON_H