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);
|
|
|
|
long screenX();
|
|
|
|
long screenY();
|
|
|
|
long width();
|
|
|
|
long height();
|
|
|
|
|
|
|
|
//"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"
|
|
|
|
void (*onDoubleClick)(gTrayIcon *sender);
|
|
|
|
void (*onMousePress)(gTrayIcon *sender);
|
|
|
|
void (*onMouseRelease)(gTrayIcon *sender);
|
|
|
|
void (*onMouseWheel)(gTrayIcon *sender);
|
|
|
|
void (*onMenu)(gTrayIcon *sender);
|
|
|
|
void (*onDestroy)(gTrayIcon *sender);
|
|
|
|
void (*onFocusEnter)(gTrayIcon *sender);
|
|
|
|
void (*onFocusLeave)(gTrayIcon *sender);
|
|
|
|
void (*onEnter)(gTrayIcon *sender);
|
|
|
|
void (*onLeave)(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"
|
|
|
|
GtkWidget *plug;
|
|
|
|
gPicture *_icon;
|
|
|
|
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(); }
|
2008-08-31 00:32:21 +00:00
|
|
|
void refresh();
|
2007-12-30 16:41:49 +00:00
|
|
|
void updateTooltip();
|
2008-08-31 00:32:21 +00:00
|
|
|
void cleanUp();
|
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;
|
2008-08-31 00:32:21 +00:00
|
|
|
GtkStyle *_style;
|
2007-12-30 16:41:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|