702.3.1
by Michael Terry
add modelines and fix up some inconsistent tabbings |
1 |
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
|
648.2.3
by Jason Smith
Fix line endings |
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 |
*
|
|
19 |
*/
|
|
20 |
||
21 |
#ifndef LAUNCHERICON_H
|
|
22 |
#define LAUNCHERICON_H
|
|
23 |
||
24 |
#include <Nux/Nux.h> |
|
25 |
#include <Nux/BaseWindow.h> |
|
26 |
#include <NuxCore/Math/MathInc.h> |
|
27 |
||
28 |
#include <sigc++/trackable.h> |
|
29 |
#include <sigc++/signal.h> |
|
30 |
#include <sigc++/functors/ptr_fun.h> |
|
31 |
#include <sigc++/functors/mem_fun.h> |
|
32 |
||
33 |
#include <gtk/gtk.h> |
|
34 |
#include <libdbusmenu-glib/client.h> |
|
35 |
#include <libdbusmenu-glib/menuitem.h> |
|
36 |
||
37 |
#include "Tooltip.h" |
|
38 |
#include "QuicklistView.h" |
|
652.1.2
by Jason Smith
add introspection to launcher icon |
39 |
#include "Introspectable.h" |
726.3.10
by Jason Smith
ensure super short lived windows do not result in a jumpy animation |
40 |
#include "Launcher.h" |
811.1.6
by Jason Smith
hook up libunity to launcher |
41 |
#include "LauncherEntryRemote.h" |
648.2.3
by Jason Smith
Fix line endings |
42 |
|
43 |
class Launcher; |
|
44 |
class QuicklistView; |
|
45 |
||
798.4.1
by Loïc Molinari
Adapted to new nux::Object API |
46 |
class LauncherIcon : public Introspectable, public nux::InitiallyUnownedObject |
648.2.3
by Jason Smith
Fix line endings |
47 |
{
|
750.1.2
by Alejandro Piñeiro
Initial unity/nux atk module implementation |
48 |
NUX_DECLARE_OBJECT_TYPE (LauncherIcon, nux::InitiallyUnownedObject); |
648.2.3
by Jason Smith
Fix line endings |
49 |
public: |
702.3.5
by Michael Terry
revert all indenting fixes I made |
50 |
typedef enum |
51 |
{
|
|
52 |
TYPE_NONE, |
|
53 |
TYPE_BEGIN, |
|
54 |
TYPE_FAVORITE, |
|
55 |
TYPE_APPLICATION, |
|
697.4.19
by Neil Jagdish Patel
fix icon position |
56 |
TYPE_EXPO, |
702.3.5
by Michael Terry
revert all indenting fixes I made |
57 |
TYPE_PLACE, |
58 |
TYPE_DEVICE, |
|
59 |
TYPE_TRASH, |
|
60 |
TYPE_END, |
|
61 |
} IconType; |
|
62 |
||
63 |
typedef enum |
|
64 |
{
|
|
65 |
QUIRK_VISIBLE, |
|
66 |
QUIRK_ACTIVE, |
|
67 |
QUIRK_RUNNING, |
|
68 |
QUIRK_URGENT, |
|
69 |
QUIRK_PRESENTED, |
|
70 |
QUIRK_STARTING, |
|
71 |
QUIRK_SHIMMER, |
|
72 |
QUIRK_CENTER_SAVED, |
|
73 |
QUIRK_PROGRESS, |
|
831.3.6
by Jason Smith
implement hinting of drop targets |
74 |
QUIRK_DROP_PRELIGHT, |
75 |
QUIRK_DROP_DIM, |
|
702.3.5
by Michael Terry
revert all indenting fixes I made |
76 |
|
77 |
QUIRK_LAST, |
|
78 |
} Quirk; |
|
79 |
||
80 |
LauncherIcon(Launcher* launcher); |
|
81 |
virtual ~LauncherIcon(); |
|
82 |
||
894.2.1
by Alejandro Piñeiro
[a11y] AtkSelection implementation |
83 |
Launcher* GetLauncher () {return _launcher;}; |
84 |
||
702.3.5
by Michael Terry
revert all indenting fixes I made |
85 |
void SetTooltipText (const TCHAR* text); |
86 |
||
87 |
nux::NString GetTooltipText (); |
|
88 |
||
873.1.1
by Didier Roche
initial work, still issues with adding/removing icons and places not activated |
89 |
void SetShortcut (guint64 shortcut); |
90 |
guint64 GetShortcut (); |
|
91 |
||
702.3.5
by Michael Terry
revert all indenting fixes I made |
92 |
void RecvMouseEnter (); |
93 |
void RecvMouseLeave (); |
|
94 |
void RecvMouseDown (int button); |
|
95 |
void RecvMouseUp (int button); |
|
96 |
||
97 |
void HideTooltip (); |
|
854.3.3
by Mirco Müller
Removed debugging output, got rid of FocusIn/Out callbacks, hooked up ql-key-nav with real functionality, switching from ql-key-nav back to launcher-key-nav still failing, disabled menu-items in ql are not dealt with atm for ql-key-nav |
98 |
void OpenQuicklist (bool default_to_first_item = false); |
803.1.4
by Mirco Müller
Hook up opening a quicklist on keyboard-navigation, keyboard-navigation of the quicklist itself will come from a separate branch |
99 |
|
702.3.5
by Michael Terry
revert all indenting fixes I made |
100 |
void SetCenter (nux::Point3 center); |
101 |
nux::Point3 GetCenter (); |
|
803.1.1
by Mirco Müller
modified: |
102 |
|
851.1.3
by Didier Roche
don't mess with public virtual method |
103 |
void Activate (); |
104 |
void OpenInstance (); |
|
803.1.1
by Mirco Müller
modified: |
105 |
|
702.3.5
by Michael Terry
revert all indenting fixes I made |
106 |
void SaveCenter (); |
107 |
||
108 |
int SortPriority (); |
|
109 |
||
110 |
int RelatedWindows (); |
|
111 |
||
756.1.1
by Jason Smith
More work on launcher design conformance |
112 |
bool HasVisibleWindow (); |
113 |
||
702.3.5
by Michael Terry
revert all indenting fixes I made |
114 |
float PresentUrgency (); |
115 |
||
116 |
float GetProgress (); |
|
117 |
||
811.1.6
by Jason Smith
hook up libunity to launcher |
118 |
void SetEmblemIconName (const char *name); |
119 |
void SetEmblemText (const char *text); |
|
120 |
||
121 |
void DeleteEmblem (); |
|
122 |
||
702.3.5
by Michael Terry
revert all indenting fixes I made |
123 |
bool GetQuirk (Quirk quirk); |
124 |
struct timespec GetQuirkTime (Quirk quirk); |
|
125 |
||
126 |
IconType Type (); |
|
127 |
||
128 |
virtual nux::Color BackgroundColor (); |
|
129 |
virtual nux::Color GlowColor (); |
|
130 |
||
811.1.6
by Jason Smith
hook up libunity to launcher |
131 |
const gchar * RemoteUri () { return GetRemoteUri (); } |
132 |
||
702.3.5
by Michael Terry
revert all indenting fixes I made |
133 |
nux::BaseTexture * TextureForSize (int size); |
134 |
||
811.1.1
by Jason Smith
start implementation of emblems |
135 |
nux::BaseTexture * Emblem (); |
136 |
||
702.3.5
by Michael Terry
revert all indenting fixes I made |
137 |
std::list<DbusmenuMenuitem *> Menus (); |
138 |
||
811.1.6
by Jason Smith
hook up libunity to launcher |
139 |
void InsertEntryRemote (LauncherEntryRemote *remote); |
140 |
void RemoveEntryRemote (LauncherEntryRemote *remote); |
|
141 |
||
831.3.6
by Jason Smith
implement hinting of drop targets |
142 |
nux::DndAction QueryAcceptDrop (std::list<char *> paths) { return OnQueryAcceptDrop (paths); } |
831.3.1
by Jason Smith
implement drag to open |
143 |
void AcceptDrop (std::list<char *> paths) { return OnAcceptDrop (paths); } |
848.1.1
by Jason Smith
implement DND hover to trigger scale |
144 |
void SendDndEnter () { OnDndEnter (); } |
145 |
void SendDndLeave () { OnDndLeave (); } |
|
831.3.1
by Jason Smith
implement drag to open |
146 |
|
702.3.5
by Michael Terry
revert all indenting fixes I made |
147 |
sigc::signal<void, int> MouseDown; |
148 |
sigc::signal<void, int> MouseUp; |
|
149 |
sigc::signal<void> MouseEnter; |
|
150 |
sigc::signal<void> MouseLeave; |
|
151 |
sigc::signal<void, int> MouseClick; |
|
152 |
||
153 |
sigc::signal<void, LauncherIcon *> show; |
|
154 |
sigc::signal<void, LauncherIcon *> hide; |
|
155 |
sigc::signal<void, LauncherIcon *> remove; |
|
156 |
sigc::signal<void, LauncherIcon *> needs_redraw; |
|
648.2.3
by Jason Smith
Fix line endings |
157 |
protected: |
702.3.5
by Michael Terry
revert all indenting fixes I made |
158 |
const gchar * GetName (); |
159 |
void AddProperties (GVariantBuilder *builder); |
|
160 |
||
161 |
void SetQuirk (Quirk quirk, bool value); |
|
162 |
||
163 |
void UpdateQuirkTimeDelayed (guint ms, Quirk quirk); |
|
164 |
void UpdateQuirkTime (Quirk quirk); |
|
165 |
void ResetQuirkTime (Quirk quirk); |
|
166 |
||
167 |
void SetRelatedWindows (int windows); |
|
168 |
void Remove (); |
|
169 |
||
170 |
void SetProgress (float progress); |
|
171 |
||
756.1.1
by Jason Smith
More work on launcher design conformance |
172 |
void SetHasVisibleWindow (bool val); |
173 |
||
702.3.5
by Michael Terry
revert all indenting fixes I made |
174 |
void Present (float urgency, int length); |
175 |
void Unpresent (); |
|
176 |
||
177 |
void SetIconType (IconType type); |
|
178 |
void SetSortPriority (int priority); |
|
179 |
||
811.1.1
by Jason Smith
start implementation of emblems |
180 |
void SetEmblem (nux::BaseTexture *emblem); |
877.3.4
by Mirco Müller
make superkey-shortcuts dynamic for special/places icons, so they automatically adapt to a localized shortcut-binding from .place file |
181 |
void SetSuperkeyLabel (nux::BaseTexture* label); |
182 |
nux::BaseTexture* GetSuperkeyLabel (); |
|
811.1.1
by Jason Smith
start implementation of emblems |
183 |
|
702.3.5
by Michael Terry
revert all indenting fixes I made |
184 |
virtual std::list<DbusmenuMenuitem *> GetMenus (); |
185 |
virtual nux::BaseTexture * GetTextureForSize (int size) = 0; |
|
186 |
||
811.1.6
by Jason Smith
hook up libunity to launcher |
187 |
virtual void OnCenterStabilized (nux::Point3 center) {} |
188 |
||
189 |
virtual const gchar * GetRemoteUri () { return 0; } |
|
831.3.1
by Jason Smith
implement drag to open |
190 |
|
831.3.6
by Jason Smith
implement hinting of drop targets |
191 |
virtual nux::DndAction OnQueryAcceptDrop (std::list<char *> files) { return nux::DNDACTION_NONE; } |
831.3.1
by Jason Smith
implement drag to open |
192 |
virtual void OnAcceptDrop (std::list<char *> files) {} |
848.1.1
by Jason Smith
implement DND hover to trigger scale |
193 |
virtual void OnDndEnter () {} |
194 |
virtual void OnDndLeave () {} |
|
851.1.3
by Didier Roche
don't mess with public virtual method |
195 |
|
196 |
virtual void ActivateLauncherIcon () {} |
|
197 |
virtual void OpenInstanceLauncherIcon () {} |
|
702.3.5
by Michael Terry
revert all indenting fixes I made |
198 |
|
199 |
nux::BaseTexture * TextureFromGtkTheme (const char *name, int size); |
|
200 |
nux::BaseTexture * TextureFromPath (const char *name, int size); |
|
201 |
||
811.1.6
by Jason Smith
hook up libunity to launcher |
202 |
void OnRemoteEmblemChanged (LauncherEntryRemote *remote); |
203 |
void OnRemoteCountChanged (LauncherEntryRemote *remote); |
|
204 |
void OnRemoteProgressChanged (LauncherEntryRemote *remote); |
|
205 |
void OnRemoteQuicklistChanged (LauncherEntryRemote *remote); |
|
206 |
||
207 |
void OnRemoteEmblemVisibleChanged (LauncherEntryRemote *remote); |
|
208 |
void OnRemoteCountVisibleChanged (LauncherEntryRemote *remote); |
|
209 |
void OnRemoteProgressVisibleChanged (LauncherEntryRemote *remote); |
|
210 |
||
702.3.5
by Michael Terry
revert all indenting fixes I made |
211 |
nux::NString m_TooltipText; |
212 |
//! the window this icon belong too.
|
|
213 |
nux::BaseWindow* m_Window; |
|
214 |
Launcher* _launcher; |
|
215 |
||
216 |
std::map<std::string, nux::Vector4*> _xform_coords; |
|
217 |
bool _mouse_inside; |
|
218 |
float _folding_angle; |
|
219 |
||
220 |
nux::Tooltip *_tooltip; |
|
221 |
QuicklistView *_quicklist; |
|
222 |
||
223 |
static nux::Tooltip *_current_tooltip; |
|
224 |
static QuicklistView *_current_quicklist; |
|
225 |
||
226 |
||
227 |
friend class Launcher; |
|
228 |
friend class LauncherController; |
|
831.3.8
by Jason Smith
Implement dropping .desktop files onto the launcher + animations |
229 |
friend class LauncherModel; |
648.2.3
by Jason Smith
Fix line endings |
230 |
|
231 |
private: |
|
702.3.5
by Michael Terry
revert all indenting fixes I made |
232 |
typedef struct |
233 |
{
|
|
234 |
LauncherIcon *self; |
|
235 |
Quirk quirk; |
|
236 |
} DelayedUpdateArg; |
|
237 |
||
238 |
static void ChildRealized (DbusmenuMenuitem *newitem, QuicklistView *quicklist); |
|
239 |
static void RootChanged (DbusmenuClient * client, DbusmenuMenuitem *newroot, QuicklistView *quicklist); |
|
240 |
static gboolean OnPresentTimeout (gpointer data); |
|
241 |
static gboolean OnCenterTimeout (gpointer data); |
|
242 |
static gboolean OnDelayedUpdateTimeout (gpointer data); |
|
243 |
||
244 |
void ColorForIcon (GdkPixbuf *pixbuf, nux::Color &background, nux::Color &glow); |
|
245 |
||
246 |
nux::Color _background_color; |
|
247 |
nux::Color _glow_color; |
|
248 |
int _sort_priority; |
|
249 |
int _related_windows; |
|
250 |
float _present_urgency; |
|
251 |
float _progress; |
|
252 |
guint _present_time_handle; |
|
253 |
guint _center_stabilize_handle; |
|
254 |
bool _quicklist_is_initialized; |
|
756.1.1
by Jason Smith
More work on launcher design conformance |
255 |
bool _has_visible_window; |
702.3.5
by Michael Terry
revert all indenting fixes I made |
256 |
|
873.1.1
by Didier Roche
initial work, still issues with adding/removing icons and places not activated |
257 |
gint64 _shortcut; |
258 |
||
702.3.5
by Michael Terry
revert all indenting fixes I made |
259 |
nux::Point3 _center; |
260 |
nux::Point3 _last_stable; |
|
261 |
nux::Point3 _saved_center; |
|
811.1.1
by Jason Smith
start implementation of emblems |
262 |
IconType _icon_type; |
263 |
||
264 |
nux::BaseTexture* _emblem; |
|
877.3.4
by Mirco Müller
make superkey-shortcuts dynamic for special/places icons, so they automatically adapt to a localized shortcut-binding from .place file |
265 |
nux::BaseTexture* _superkey_label; |
702.3.5
by Michael Terry
revert all indenting fixes I made |
266 |
|
267 |
bool _quirks[QUIRK_LAST]; |
|
268 |
struct timespec _quirk_times[QUIRK_LAST]; |
|
648.2.3
by Jason Smith
Fix line endings |
269 |
|
811.1.6
by Jason Smith
hook up libunity to launcher |
270 |
std::list<LauncherEntryRemote *> _entry_list; |
648.2.3
by Jason Smith
Fix line endings |
271 |
};
|
272 |
||
273 |
#endif // LAUNCHERICON_H |
|
274 |