// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
/*
* Copyright (C) 2010 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* Authored by: Jason Smith
*/
#ifndef BAMFLAUNCHERICON_H
#define BAMFLAUNCHERICON_H
/* Compiz */
#include
#include
#include
#include
#include
#include
#include "SimpleLauncherIcon.h"
class Launcher;
class BamfLauncherIcon : public SimpleLauncherIcon
{
public:
BamfLauncherIcon(Launcher* IconManager, BamfApplication *app, CompScreen *screen);
virtual ~BamfLauncherIcon();
const char* DesktopFile ();
bool IsSticky ();
protected:
void OnMouseClick (int button);
std::list GetMenus ();
void UpdateIconGeometries (nux::Point3 center);
void OnCenterStabilized (nux::Point3 center);
void AddProperties (GVariantBuilder *builder);
const gchar * GetRemoteUri ();
nux::DndAction OnQueryAcceptDrop (std::list uris);
void OnAcceptDrop (std::list uris);
void OnDndEnter ();
void OnDndLeave ();
void ActivateLauncherIcon ();
void OpenInstanceLauncherIcon ();
std::list ValidateUrisForLaunch (std::list uris);
private:
BamfApplication *m_App;
CompScreen *m_Screen;
std::map _menu_clients;
std::map _menu_items;
DbusmenuMenuitem *_menu_desktop_shortcuts;
gchar *_remote_uri;
bool _dnd_hovered;
guint _dnd_hover_timer;
void EnsureWindowState ();
void UpdateMenus ();
void OpenInstanceWithUris (std::list uris);
void Focus ();
bool Spread (int state, bool force);
void EnsureMenuItemsReady ();
void OnWindowMinimized (guint32 xid);
bool OwnsWindow (Window w);
static void OnClosed (BamfView *view, gpointer data);
static void OnUserVisibleChanged (BamfView *view, gboolean visible, gpointer data);
static void OnActiveChanged (BamfView *view, gboolean active, gpointer data);
static void OnRunningChanged (BamfView *view, gboolean running, gpointer data);
static void OnUrgentChanged (BamfView *view, gboolean urgent, gpointer data);
static void OnChildAdded (BamfView *view, BamfView *child, gpointer data);
static void OnChildRemoved (BamfView *view, BamfView *child, gpointer data);
static void OnQuit (DbusmenuMenuitem *item, int time, BamfLauncherIcon *self);
static void OnLaunch (DbusmenuMenuitem *item, int time, BamfLauncherIcon *self);
static void OnTogglePin (DbusmenuMenuitem *item, int time, BamfLauncherIcon *self);
static gboolean OnDndHoveredTimeout (gpointer data);
};
#endif // BAMFLAUNCHERICON_H