~3v1n0/unity/overlay-border-scale

« back to all changes in this revision

Viewing changes to plugins/unityshell/src/LauncherIcon.h

  • Committer: Daniel van Vugt
  • Date: 2012-03-14 06:24:18 UTC
  • mfrom: (2108 unity)
  • mto: This revision was merged to the branch mainline in revision 2146.
  • Revision ID: daniel.van.vugt@canonical.com-20120314062418-nprucpbr0m7qky5e
MergedĀ latestĀ lp:unity

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
public:
61
61
  typedef nux::ObjectPtr<nux::BaseTexture> BaseTexturePtr;
62
62
 
63
 
  LauncherIcon(Launcher* launcher);
 
63
  LauncherIcon();
64
64
 
65
65
  virtual ~LauncherIcon();
66
66
 
67
 
  Launcher* GetLauncher()
68
 
  {
69
 
    return _launcher;
70
 
  };
71
 
 
72
67
  bool SetTooltipText(std::string& target, std::string const& value);
73
68
 
74
69
  void    SetShortcut(guint64 shortcut);
77
72
 
78
73
  void SetSortPriority(int priority);
79
74
 
80
 
  void RecvMouseEnter();
81
 
 
82
 
  void RecvMouseLeave();
83
 
 
84
 
  void RecvMouseDown(int button);
85
 
 
86
 
  void RecvMouseUp(int button);
87
 
 
88
 
  void RecvMouseClick(int button);
 
75
  void RecvMouseEnter(int monitor);
 
76
 
 
77
  void RecvMouseLeave(int monitor);
 
78
 
 
79
  void RecvMouseDown(int button, int monitor);
 
80
 
 
81
  void RecvMouseUp(int button, int monitor);
 
82
 
 
83
  void RecvMouseClick(int button, int monitor);
89
84
 
90
85
  void HideTooltip();
91
86
 
92
 
  bool OpenQuicklist(bool default_to_first_item = false);
93
 
 
94
 
  void        SetCenter(nux::Point3 center);
95
 
 
96
 
  nux::Point3 GetCenter();
 
87
  void ShowTooltip();
 
88
 
 
89
  bool OpenQuicklist(bool default_to_first_item = false, int monitor = -1);
 
90
 
 
91
  void        SetCenter(nux::Point3 center, int parent_monitor, nux::Geometry parent_geo);
 
92
 
 
93
  nux::Point3 GetCenter(int monitor);
97
94
 
98
95
  virtual void Activate(ActionArg arg);
99
96
 
101
98
 
102
99
  void SaveCenter();
103
100
 
 
101
  nux::Point3 GetSavedCenter(int monitor);
 
102
 
104
103
  int SortPriority();
105
104
 
106
 
  int RelatedWindows();
 
105
  virtual std::vector<Window> Windows () { return std::vector<Window> (); }
107
106
 
108
 
  virtual std::vector<Window> RelatedXids () { return std::vector<Window> (); }
 
107
  virtual std::vector<Window> WindowsForMonitor (int monitor) { return std::vector<Window> (); }
109
108
 
110
109
  virtual std::string NameForWindow (Window window) { return std::string(); }
111
110
 
112
 
  const bool HasWindowOnViewport();
 
111
  const bool WindowVisibleOnMonitor(int monitor);
 
112
 
 
113
  const bool WindowVisibleOnViewport();
113
114
 
114
115
  virtual bool IsSpacer()
115
116
  {
126
127
 
127
128
  void DeleteEmblem();
128
129
 
129
 
  virtual bool ShowInSwitcher()
 
130
  virtual bool ShowInSwitcher(bool current)
130
131
  {
131
132
    return false;
132
133
  };
136
137
    return 0;
137
138
  }
138
139
 
139
 
  bool GetQuirk(Quirk quirk);
 
140
  bool GetQuirk(Quirk quirk) const;
140
141
 
141
142
  void SetQuirk(Quirk quirk, bool value);
142
143
 
143
144
  struct timespec GetQuirkTime(Quirk quirk);
144
145
 
145
 
  IconType Type();
 
146
  IconType GetIconType();
146
147
 
147
148
  virtual nux::Color BackgroundColor();
148
149
 
185
186
 
186
187
  void SetIconType(IconType type);
187
188
 
188
 
  std::vector<nux::Vector4> & GetTransform(TransformIndex index);
189
 
 
190
 
  static void SetSkipTooltipDelay(gboolean skip_tooltip_delay);
191
 
 
192
 
  sigc::signal<void, LauncherIcon*> remove;
193
 
 
194
 
  sigc::connection needs_redraw_connection;
195
 
  sigc::connection on_icon_added_connection;
196
 
  sigc::connection on_icon_removed_connection;
197
 
  sigc::connection on_order_changed_connection;
198
 
  sigc::connection on_expo_terminated_connection;
 
189
  virtual std::string DesktopFile() { return std::string(""); }
 
190
 
 
191
  virtual bool IsSticky() const { return false; }
 
192
 
 
193
  virtual bool IsVisible() const { return false; }
 
194
 
 
195
  virtual void AboutToRemove() {}
 
196
  
 
197
  virtual void Stick(bool save = true) {}
 
198
  
 
199
  virtual void UnStick() {}
199
200
 
200
201
protected:
 
202
  std::vector<nux::Point3> GetCenters();
 
203
 
201
204
  std::string GetName() const;
202
205
 
203
206
  void AddProperties(GVariantBuilder* builder);
208
211
 
209
212
  void ResetQuirkTime(Quirk quirk);
210
213
 
211
 
  void SetRelatedWindows(int windows);
212
 
 
213
214
  void Remove();
214
215
 
215
216
  void SetProgress(float progress);
216
217
 
217
 
  void SetHasWindowOnViewport(bool val);
 
218
  void SetWindowVisibleOnMonitor(bool val, int monitor);
218
219
 
219
220
  void Present(float urgency, int length);
220
221
 
226
227
 
227
228
  virtual nux::BaseTexture* GetTextureForSize(int size) = 0;
228
229
 
229
 
  virtual void OnCenterStabilized(nux::Point3 center) {}
 
230
  virtual void OnCenterStabilized(std::vector<nux::Point3> center) {}
230
231
 
231
232
  virtual const gchar* GetRemoteUri()
232
233
  {
276
277
 
277
278
  void OnRemoteProgressVisibleChanged(LauncherEntryRemote* remote);
278
279
 
279
 
  Launcher* _launcher;
280
 
 
281
 
  nux::Tooltip* _tooltip;
282
 
  QuicklistView* _quicklist;
283
 
 
284
 
  static nux::Tooltip* _current_tooltip;
285
 
  static QuicklistView* _current_quicklist;
 
280
  void EmitNeedsRedraw();
 
281
 
 
282
  void EmitRemove();
286
283
 
287
284
  // This looks like a case for boost::logical::tribool
288
285
  static int _current_theme_is_mono;
289
286
 
290
287
  DbusmenuClient* _menuclient_dynamic_quicklist;
291
288
 
292
 
  friend class Launcher;
293
 
  friend class LauncherModel;
294
 
 
295
289
private:
296
290
  typedef struct
297
291
  {
299
293
    Quirk quirk;
300
294
  } DelayedUpdateArg;
301
295
 
 
296
  nux::ObjectPtr<Tooltip> _tooltip;
 
297
  nux::ObjectPtr<QuicklistView> _quicklist;
 
298
 
302
299
  static void ChildRealized(DbusmenuMenuitem* newitem, QuicklistView* quicklist);
303
300
  static void RootChanged(DbusmenuClient* client, DbusmenuMenuitem* newroot, QuicklistView* quicklist);
304
301
  static gboolean OnPresentTimeout(gpointer data);
305
302
  static gboolean OnCenterTimeout(gpointer data);
306
303
  static gboolean OnDelayedUpdateTimeout(gpointer data);
307
 
  static gboolean OnTooltipTimeout(gpointer data);
308
304
 
309
305
  void ColorForIcon(GdkPixbuf* pixbuf, nux::Color& background, nux::Color& glow);
310
306
 
311
 
  bool             _has_visible_window;
312
 
  bool             _quicklist_is_initialized;
313
 
  bool             _remote_urgent;
314
 
  float            _present_urgency;
315
 
  float            _progress;
316
 
  guint            _center_stabilize_handle;
317
 
  guint            _present_time_handle;
318
 
  guint            _time_delay_handle;
319
 
  guint            _tooltip_delay_handle;
320
 
  int              _related_windows;
321
 
  int              _sort_priority;
322
 
  nux::Color       _background_color;
323
 
  nux::Color       _glow_color;
324
 
  static gboolean  _skip_tooltip_delay;
325
 
 
326
 
  gint64           _shortcut;
327
 
 
328
 
  nux::Point3      _center;
329
 
  nux::Point3      _last_stable;
330
 
  nux::Point3      _saved_center;
331
 
  IconType         _icon_type;
 
307
  void LoadTooltip();
 
308
  void LoadQuicklist();
 
309
 
 
310
  bool              _remote_urgent;
 
311
  float             _present_urgency;
 
312
  float             _progress;
 
313
  guint             _center_stabilize_handle;
 
314
  guint             _present_time_handle;
 
315
  guint             _time_delay_handle;
 
316
  int               _sort_priority;
 
317
  int               _last_monitor;
 
318
  nux::Color        _background_color;
 
319
  nux::Color        _glow_color;
 
320
 
 
321
  gint64            _shortcut;
 
322
 
 
323
  IconType                 _icon_type;
 
324
  
 
325
  std::vector<nux::Point3> _center;
 
326
  std::vector<bool> _has_visible_window;
 
327
  std::vector<nux::Point3> _last_stable;
 
328
  std::vector<nux::Geometry> _parent_geo;
 
329
  std::vector<nux::Point3> _saved_center;
332
330
 
333
331
  static GtkIconTheme* _unity_theme;
334
332
 
338
336
  struct timespec  _quirk_times[QUIRK_LAST];
339
337
 
340
338
  std::list<LauncherEntryRemote*> _entry_list;
341
 
  std::map<TransformIndex, std::vector<nux::Vector4> > transform_map;
342
 
  
343
339
};
344
340
 
345
341
}