mbtray.h
/* libmb
* Copyright (C) 2002 Matthew Allum
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _MB_TRAY_H_
#define _MB_TRAY_H_
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/Xmd.h>
#include <libmb/mb.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct MBTrayApp MBTrayApp;
/* TOGO ? */
typedef void (*MBTrayBackgroundCB)( void *user_data ) ;
typedef void (*MBTrayAppResizeCB)( MBTrayApp *mb, int width, int height ) ;
typedef void (*MBTrayAppPaintCB)( MBTrayApp *mb, Drawable drawable ) ;
typedef void (*MBTrayAppContextCB)( MBTrayApp *mb ) ;
typedef void (*MBTrayAppButtonEventCB)( MBTrayApp *mb_tray_app,
int x,
int y,
Bool is_release ) ;
typedef void (*MBTrayAppXEventCB)( MBTrayApp *mb_tray_app, XEvent *event ) ;
typedef void (*MBTrayAppThemeChangeCB)( MBTrayApp *mb_tray_app, char *theme_name ) ;
typedef void (*MBTrayAppPollCB)( MBTrayApp *mb_tray_app) ;
MBTrayApp*
mb_tray_app_new (unsigned char *app_name,
MBTrayAppResizeCB resize_cb,
MBTrayAppPaintCB paint_cb,
int *argc,
char ***argv);
MBTrayApp*
mb_tray_app_new_with_display ( unsigned char *app_name,
MBTrayAppResizeCB resize_cb,
MBTrayAppPaintCB paint_cb,
int *argc,
char ***argv,
Display *display);
void
mb_tray_app_set_xevent_callback (MBTrayApp *mb_tray_app,
MBTrayAppXEventCB xevent_cb );
void
mb_tray_app_set_button_callback (MBTrayApp *mb_tray_app,
MBTrayAppButtonEventCB button_cb );
void
mb_tray_app_set_theme_change_callback (MBTrayApp *mb_tray_app,
MBTrayAppThemeChangeCB theme_cb );
void
mb_tray_app_set_timeout_callback (MBTrayApp *mb_tray_app,
MBTrayAppPollCB poll_cb,
struct timeval *tv);
void
mb_tray_app_set_resize_callback (MBTrayApp *mb_tray_app,
MBTrayAppResizeCB resize_cb );
void
mb_tray_app_set_paint_callback (MBTrayApp *mb_tray_app,
MBTrayAppPaintCB paint_cb );
void
mb_tray_app_set_context_callback (MBTrayApp *mb_tray_app,
MBTrayAppContextCB context_cb );
void
mb_tray_app_request_size (MBTrayApp *mb_tray_app,
int width,
int height );
void
mb_tray_app_request_offset (MBTrayApp *mb_tray_app,
int offset);
void
mb_tray_app_set_poll_timeout (MBTrayApp *mb_tray_app,
struct timeval *tv );
void
mb_tray_app_repaint (MBTrayApp *mb_tray_app);
void
mb_tray_app_tray_send_message (MBTrayApp *mb_tray_app,
unsigned char *msg,
int timeout);
void
mb_tray_app_set_name (MBTrayApp *mb_tray_app,
unsigned char *name);
void
mb_tray_app_set_context_info (MBTrayApp *mb_tray_app,
unsigned char *info);
void
mb_tray_app_set_icon(MBTrayApp *mb_tray_app,
MBPixbuf *pixbuf,
MBPixbufImage *image);
void
mb_tray_app_set_session ( MBTrayApp *mb_tray_app,
Bool val );
Bool
mb_tray_app_get_session ( MBTrayApp *mb_tray_app );
Bool
mb_tray_app_get_absolute_coords (MBTrayApp *mb_tray_app,
int *x,
int *y );
void
mb_tray_app_set_user_data (MBTrayApp *mb_tray_app,
void *data );
void*
mb_tray_app_get_user_data (MBTrayApp *mb_tray_app);
Bool
mb_tray_app_tray_is_vertical (MBTrayApp *mb_tray_app );
MBPixbufImage *
mb_tray_app_get_background (MBTrayApp *mb_tray_app,
MBPixbuf *pixbuf);
char *
mb_tray_app_get_theme_name (MBTrayApp *mb_tray_app);
long
mb_tray_app_get_xevent_mask (MBTrayApp *mb_tray_app );
void
mb_tray_app_set_xevent_mask (MBTrayApp *mb_tray_app, long mask);
Display*
mb_tray_app_xdisplay (MBTrayApp *mb_tray_app);
int
mb_tray_app_xscreen (MBTrayApp *mb_tray_app);
Window
mb_tray_app_xrootwin(MBTrayApp *mb_tray_app);
Window
mb_tray_app_xwin (MBTrayApp *mb_tray_app);
int
mb_tray_app_width (MBTrayApp *mb_tray_app);
int
mb_tray_app_height (MBTrayApp *mb_tray_app);
int
mb_tray_app_offset ( MBTrayApp *mb_tray_app ) ;
void
mb_tray_app_main_init ( MBTrayApp *mb_tray_app );
void
mb_tray_app_main (MBTrayApp *mb_tray_app);
void
mb_tray_app_hide (MBTrayApp *mb_tray_app );
void
mb_tray_app_unhide (MBTrayApp *mb_tray_app );
void
mb_tray_app_main_quit (MBTrayApp *mb_tray_app);
void
mb_tray_handle_xevent (MBTrayApp *mb_tray_app,
XEvent *xevent);
/* ---------- Older stuff below ----------------------------------------- */
int mb_tray_init(Display* dpy, Window win);
Window mb_tray_get_window(void);
void mb_tray_init_session_info(Display *d, Window win, char **argv, int argc);
void mb_tray_handle_event(Display *dpy, Window win, XEvent *an_event);
void mb_tray_send_message(Display *d, Window win,
unsigned char* msg, int timeout);
void mb_tray_map_window (Display* dpy, Window win);
void
mb_tray_bg_change_cb_set(MBTrayBackgroundCB bg_changed_cb, void *user_data);
Bool mb_tray_get_bg_col(Display *dpy, XColor *xcol);
void
mb_tray_window_icon_set(Display *dpy, Window win_panel, MBPixbufImage *img);
void mb_tray_unmap_window (Display* dpy, Window win);
MBPixbufImage *mb_tray_get_bg_img(MBPixbuf *pb, Window win);
#ifdef __cplusplus
}
#endif
#endif
mb_tray_app_set_context_info
void mb_tray_app_set_context_info(MBTrayApp *mb_tray_app, unsigned char *info)
Sets text for extra button in window message.
mb_tray_app_get_session
Bool mb_tray_app_get_session(MBTrayApp *mb_tray_app)
Get session state.
mb_tray_app_set_context_callback
void mb_tray_app_set_context_callback(MBTrayApp *mb_tray_app, MBTrayAppContextCB context_cb)
Sets the 'context' callback.
mb_tray_app_set_paint_callback
void mb_tray_app_set_paint_callback(MBTrayApp *mb_tray_app, MBTrayAppPaintCB paint_cb)
Sets the callback function for panel app paint.
mb_tray_app_set_resize_callback
void mb_tray_app_set_resize_callback(MBTrayApp *mb_tray_app, MBTrayAppResizeCB resize_cb)
Sets the callback function to be notifed when the panel app is resized.
mb_tray_app_new
MBTrayApp * mb_tray_app_new(unsigned char *app_name, MBTrayAppResizeCB resize_cb, MBTrayAppPaintCB paint_cb, int *argc, char ***argv)
Constructs a new tray app instance.
mb_tray_app_repaint
void mb_tray_app_repaint(MBTrayApp *mb_tray_app)
Requests the app is repainted - the paint callback will get called.
mb_tray_app_xdisplay
Display * mb_tray_app_xdisplay(MBTrayApp *mb_tray_app)
Gets the tray apps X display.
MBPixbufImage
struct MBPixbufImage MBPixbufImage
mb_tray_app_set_poll_timeout
void mb_tray_app_set_poll_timeout(MBTrayApp *mb_tray_app, struct timeval *tv)
Set timing for any timeout callbacks.
mb_tray_app_set_icon
void mb_tray_app_set_icon(MBTrayApp *mb_tray_app, MBPixbuf *pixbuf, MBPixbufImage *image)
Sets the tray app icon.
mb_tray_app_xscreen
int mb_tray_app_xscreen(MBTrayApp *mb_tray_app)
Gets the tray app X screen.
mb_tray_app_set_user_data
void mb_tray_app_set_user_data(MBTrayApp *mb_tray_app, void *data)
Set any user data to be attached to the tray app instance.
MBTrayAppThemeChangeCB
void(* MBTrayAppThemeChangeCB)(MBTrayApp *mb_tray_app, char *theme_name)
Definition: mbtray.h:175
MBTrayAppButtonEventCB
void(* MBTrayAppButtonEventCB)(MBTrayApp *mb_tray_app, int x, int y, Bool is_release)
Definition: mbtray.h:157
mb_tray_app_new_with_display
MBTrayApp * mb_tray_app_new_with_display(unsigned char *app_name, MBTrayAppResizeCB resize_cb, MBTrayAppPaintCB paint_cb, int *argc, char ***argv, Display *display)
Constructs a new tray app instance.
mb_tray_app_request_size
void mb_tray_app_request_size(MBTrayApp *mb_tray_app, int width, int height)
Requests a new size for the application.
mb_tray_app_set_session
void mb_tray_app_set_session(MBTrayApp *mb_tray_app, Bool val)
Enable app to show session data so tray can 'remember it' for future sessions.
mb_tray_app_get_xevent_mask
long mb_tray_app_get_xevent_mask(MBTrayApp *mb_tray_app)
Returns the current X Event mask used by the tray app.
mb_tray_app_width
int mb_tray_app_width(MBTrayApp *mb_tray_app)
Gets the tray width.
MBTrayAppPaintCB
void(* MBTrayAppPaintCB)(MBTrayApp *mb, Drawable drawable)
Definition: mbtray.h:139
mb_tray_app_xwin
Window mb_tray_app_xwin(MBTrayApp *mb_tray_app)
Gets the tray app window.
mb_tray_app_get_user_data
void * mb_tray_app_get_user_data(MBTrayApp *mb_tray_app)
Gets any user data to be attached to the tray app instance.
mb_tray_app_set_button_callback
void mb_tray_app_set_button_callback(MBTrayApp *mb_tray_app, MBTrayAppButtonEventCB button_cb)
Sets the callback function for a mouse button press/release.
mb_tray_app_unhide
void mb_tray_app_unhide(MBTrayApp *mb_tray_app)
Unhides ( redocks ) the tray app.
mb_tray_app_main_init
void mb_tray_app_main_init(MBTrayApp *mb_tray_app)
Inits the main loop.
MBTrayAppPollCB
void(* MBTrayAppPollCB)(MBTrayApp *mb_tray_app)
Definition: mbtray.h:182
mb_tray_app_set_theme_change_callback
void mb_tray_app_set_theme_change_callback(MBTrayApp *mb_tray_app, MBTrayAppThemeChangeCB theme_cb)
Sets the callback function for a theme change.
mb_tray_app_offset
int mb_tray_app_offset(MBTrayApp *mb_tray_app)
Gets the apps offset from the panels origin
mb_tray_app_main
void mb_tray_app_main(MBTrayApp *mb_tray_app)
Runs the tray app main loop until mb_tray_app_main_quit is called.
MBTrayAppXEventCB
void(* MBTrayAppXEventCB)(MBTrayApp *mb_tray_app, XEvent *event)
Definition: mbtray.h:168
mb_tray_app_set_timeout_callback
void mb_tray_app_set_timeout_callback(MBTrayApp *mb_tray_app, MBTrayAppPollCB poll_cb, struct timeval *tv)
Sets the callback function for a theme change.
mb_tray_app_get_background
MBPixbufImage * mb_tray_app_get_background(MBTrayApp *mb_tray_app, MBPixbuf *pixbuf)
Gets the panel background for the area covered by the tray app.
MBPixbuf
struct MBPixbuf MBPixbuf
mb_tray_app_set_name
void mb_tray_app_set_name(MBTrayApp *mb_tray_app, unsigned char *name)
Sets the tray app name.
mb_tray_app_hide
void mb_tray_app_hide(MBTrayApp *mb_tray_app)
Hides ( undocks ) the tray app.
mb_tray_app_xrootwin
Window mb_tray_app_xrootwin(MBTrayApp *mb_tray_app)
Gets the tray app root window.
mb_tray_app_request_offset
void mb_tray_app_request_offset(MBTrayApp *mb_tray_app, int offset)
Requests the app positional offset in terms of the panels orientation from the origin of the tray.
mb_tray_app_set_xevent_mask
void mb_tray_app_set_xevent_mask(MBTrayApp *mb_tray_app, long mask)
Safely sets the X Event mask used to select what events the xevent callback recieves.
MBTrayAppResizeCB
void(* MBTrayAppResizeCB)(MBTrayApp *mb, int width, int height)
Definition: mbtray.h:125
mb_tray_handle_xevent
void mb_tray_handle_xevent(MBTrayApp *mb_tray_app, XEvent *xevent)
Runs a single iteration of the mainloop.
mb_tray_app_height
int mb_tray_app_height(MBTrayApp *mb_tray_app)
Gets the tray height.
mb_tray_app_get_theme_name
char * mb_tray_app_get_theme_name(MBTrayApp *mb_tray_app)
Returns the current theme.
mb_tray_app_tray_send_message
void mb_tray_app_tray_send_message(MBTrayApp *mb_tray_app, unsigned char *msg, int timeout)
Sends a messsage to the tray, used to visually inform or notify the user.
mb_tray_app_set_xevent_callback
void mb_tray_app_set_xevent_callback(MBTrayApp *mb_tray_app, MBTrayAppXEventCB xevent_cb)
Sets the callback function for any extra x event processing.
MBTrayApp
struct MBTrayApp MBTrayApp
Definition: mbtray.h:114
mb_tray_app_get_absolute_coords
Bool mb_tray_app_get_absolute_coords(MBTrayApp *mb_tray_app, int *x, int *y)
Gets the tray app co-ordinates relative to the root window.
mb_tray_app_main_quit
void mb_tray_app_main_quit(MBTrayApp *mb_tray_app)
Stops mb_tray_app_main.