2009-08-17 10:41:51 +00:00
|
|
|
/***************************************************************************
|
|
|
|
|
|
|
|
gtrayicon.h
|
|
|
|
|
2013-08-03 15:38:01 +00:00
|
|
|
(c) 2000-2013 Benoît Minisini <gambas@users.sourceforge.net>
|
2009-08-17 10:41:51 +00:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
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, write to the Free Software
|
2011-06-03 00:51:09 +00:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
2011-12-31 02:39:20 +00:00
|
|
|
MA 02110-1301, USA.
|
2009-08-17 10:41:51 +00:00
|
|
|
|
|
|
|
***************************************************************************/
|
2011-12-31 02:39:20 +00:00
|
|
|
|
2007-12-30 16:41:49 +00:00
|
|
|
#ifndef __GTRAYICON_H
|
|
|
|
#define __GTRAYICON_H
|
|
|
|
|
|
|
|
class gTrayIcon
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//"Properties"
|
|
|
|
gTrayIcon();
|
|
|
|
~gTrayIcon();
|
|
|
|
|
|
|
|
void *hFree;
|
|
|
|
|
|
|
|
char *key();
|
|
|
|
gPicture* picture() { return _icon; }
|
|
|
|
void setPicture(gPicture *pic);
|
|
|
|
char* toolTip();
|
|
|
|
void setToolTip(char *txt);
|
|
|
|
bool isVisible();
|
|
|
|
void setVisible(bool vl);
|
2013-12-27 01:07:28 +00:00
|
|
|
int screenX();
|
|
|
|
int screenY();
|
|
|
|
int width();
|
|
|
|
int height();
|
2007-12-30 16:41:49 +00:00
|
|
|
|
|
|
|
//"Methods"
|
|
|
|
void destroy();
|
|
|
|
void show() { setVisible(true); }
|
|
|
|
void hide() { setVisible(false); }
|
2008-12-08 01:22:08 +00:00
|
|
|
int loopLevel() { return _loopLevel; }
|
2007-12-30 16:41:49 +00:00
|
|
|
|
|
|
|
//"Events"
|
[INTERPRETER]
* NEW: Add a new GB.Component.Declare() API, that allows a component to
dynamically register a class description.
[INFORMER]
* NEW: A component now can declare classes through a GB_OPTIONAL_CLASSES
public symbol. Theses classes are included into the information file,
but are not automatically loaded as the ones defined through the
GB_CLASSES symbol.
[GB.FORM.STATUSICON]
* NEW: This component has been removed and replaced by gb.dbus.trayicon.
* NEW: This component now provide TrayIcon and TrayIcons classes that have
exactly the same interface as the old ones.
[GB.DBUS]
* NEW: Remove the now useless DBusConnection.Raise(). The DBusConnection
Register() and Unregister() are kept for backward-compatibility reason.
* NEW: Add DBus.Raise() and DBus[].Raise() to raise signals. At the moment,
there is no difference between the two methods, as there no mean to
indicate the sender raising a signal. I don't know yet how DBus decides
which service sends a signal!
[GB.DBUS.TRAYICON]
* NEW: This component implements the tray icon DBus protocol. It is
automatically loaded by the GUI components.
[GB.GTK]
* NEW: Load the 'gb.dbus' and 'gb.dbus.trayicon' components if the current
desktop is KDE >= 4. Otherwise, use the old TrayIcon implementation.
* BUG: Fix the old TrayIcon implementation, so that it matches the QT one.
[GB.GTK3]
* NEW: Load the 'gb.dbus' and 'gb.dbus.trayicon' components if the current
desktop is KDE >= 4. Otherwise, use the old TrayIcon implementation.
* BUG: Fix the component name in deprecation warning messages.
* BUG: Fix the old TrayIcon implementation, so that it matches the QT one.
[GB.QT4]
* NEW: Load the 'gb.dbus' and 'gb.dbus.trayicon' components if the current
desktop is KDE >= 4. Otherwise, use the old TrayIcon implementation.
[GB.QT5]
* NEW: Load the 'gb.dbus' and 'gb.dbus.trayicon' components if the current
desktop is KDE >= 4. Otherwise, use the old TrayIcon implementation.
git-svn-id: svn://localhost/gambas/trunk@7154 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2015-06-29 01:46:51 +00:00
|
|
|
void (*onClick)(gTrayIcon *sender);
|
|
|
|
void (*onScroll)(gTrayIcon *sender);
|
2007-12-30 16:41:49 +00:00
|
|
|
void (*onMenu)(gTrayIcon *sender);
|
|
|
|
void (*onDestroy)(gTrayIcon *sender);
|
|
|
|
|
|
|
|
//"Static"
|
|
|
|
|
|
|
|
static int count() { return g_list_length(trayicons); }
|
2013-09-08 17:15:55 +00:00
|
|
|
static int visibleCount() { return _visible_count; }
|
2007-12-30 16:41:49 +00:00
|
|
|
static gTrayIcon *get(int index) { return (gTrayIcon *)g_list_nth_data(trayicons, index); }
|
|
|
|
static void exit();
|
2008-07-17 00:16:44 +00:00
|
|
|
static gPicture *defaultIcon();
|
2012-05-19 12:54:48 +00:00
|
|
|
static bool hasSystemTray();
|
2007-12-30 16:41:49 +00:00
|
|
|
|
|
|
|
//"Private"
|
2013-12-27 01:07:28 +00:00
|
|
|
GtkStatusIcon *plug;
|
2007-12-30 16:41:49 +00:00
|
|
|
gPicture *_icon;
|
2014-06-03 21:02:01 +00:00
|
|
|
int _iconw, _iconh;
|
2007-12-30 16:41:49 +00:00
|
|
|
char *buftext;
|
|
|
|
bool onHide;
|
2008-12-08 01:22:08 +00:00
|
|
|
int _loopLevel;
|
2008-07-17 00:16:44 +00:00
|
|
|
gPicture *getIcon() { return _icon ? _icon : defaultIcon(); }
|
2007-12-30 16:41:49 +00:00
|
|
|
void updateTooltip();
|
2013-12-27 01:07:28 +00:00
|
|
|
void updatePicture();
|
2007-12-30 16:41:49 +00:00
|
|
|
|
|
|
|
static GList *trayicons;
|
2008-07-17 00:16:44 +00:00
|
|
|
static gPicture *_default_icon;
|
2008-08-31 00:32:21 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2013-09-08 17:15:55 +00:00
|
|
|
static int _visible_count;
|
2007-12-30 16:41:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|