LibMB 1.12
mbtray.h
1/* libmb
2 * Copyright (C) 2002 Matthew Allum
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 */
19
20#ifndef _MB_TRAY_H_
21#define _MB_TRAY_H_
22
23#include <stdio.h>
24#include <stdlib.h>
25#include <sys/types.h>
26#include <unistd.h>
27#include <X11/Xlib.h>
28#include <X11/Xutil.h>
29#include <X11/Xatom.h>
30#include <X11/Xmd.h>
31
32#include <libmb/mb.h>
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
114typedef struct MBTrayApp MBTrayApp;
115
116/* TOGO ? */
117typedef void (*MBTrayBackgroundCB)( void *user_data ) ;
118
125typedef void (*MBTrayAppResizeCB)( MBTrayApp *mb, int width, int height ) ;
126
139typedef void (*MBTrayAppPaintCB)( MBTrayApp *mb, Drawable drawable ) ;
140
150typedef void (*MBTrayAppContextCB)( MBTrayApp *mb ) ;
151
157typedef void (*MBTrayAppButtonEventCB)( MBTrayApp *mb_tray_app,
158 int x,
159 int y,
160 Bool is_release ) ;
161
168typedef void (*MBTrayAppXEventCB)( MBTrayApp *mb_tray_app, XEvent *event ) ;
169
175typedef void (*MBTrayAppThemeChangeCB)( MBTrayApp *mb_tray_app, char *theme_name ) ;
176
182typedef void (*MBTrayAppPollCB)( MBTrayApp *mb_tray_app) ;
183
184
216MBTrayApp*
217mb_tray_app_new (unsigned char *app_name,
218 MBTrayAppResizeCB resize_cb,
219 MBTrayAppPaintCB paint_cb,
220 int *argc,
221 char ***argv);
222
238MBTrayApp*
239mb_tray_app_new_with_display ( unsigned char *app_name,
240 MBTrayAppResizeCB resize_cb,
241 MBTrayAppPaintCB paint_cb,
242 int *argc,
243 char ***argv,
244 Display *display);
245
253void
255 MBTrayAppXEventCB xevent_cb );
256
263void
265 MBTrayAppButtonEventCB button_cb );
266
273void
275 MBTrayAppThemeChangeCB theme_cb );
276
284void
286 MBTrayAppPollCB poll_cb,
287 struct timeval *tv);
288
295void
297 MBTrayAppResizeCB resize_cb );
298
305void
307 MBTrayAppPaintCB paint_cb );
308
315void
317 MBTrayAppContextCB context_cb );
318
331void
333 int width,
334 int height );
335
347void
349 int offset);
350
358void
360 struct timeval *tv );
361
367void
369
377void
379 unsigned char *msg,
380 int timeout);
381
388void
390 unsigned char *name);
391
398void
400 unsigned char *info);
401
409void
411 MBPixbuf *pixbuf,
412 MBPixbufImage *image);
413
422void
424 Bool val );
425
432Bool
434
443Bool
445 int *x,
446 int *y );
447
454void
456 void *data );
457
464void*
466
467
468Bool
469mb_tray_app_tray_is_vertical (MBTrayApp *mb_tray_app );
470
480 MBPixbuf *pixbuf);
481
488char *
490
497long
499
507void
508mb_tray_app_set_xevent_mask (MBTrayApp *mb_tray_app, long mask);
509
510
517Display*
519
526int
528
535Window
537
544Window
546
553int
555
562int
564
571int
573
581void
583
589void
591
597void
599
605void
607
608
614void
616
623void
625 XEvent *xevent);
626
627
628
629/* ---------- Older stuff below ----------------------------------------- */
630
631
632int mb_tray_init(Display* dpy, Window win);
633
634Window mb_tray_get_window(void);
635
636void mb_tray_init_session_info(Display *d, Window win, char **argv, int argc);
637
638void mb_tray_handle_event(Display *dpy, Window win, XEvent *an_event);
639
640void mb_tray_send_message(Display *d, Window win,
641 unsigned char* msg, int timeout);
642
643void mb_tray_map_window (Display* dpy, Window win);
644
645void
646mb_tray_bg_change_cb_set(MBTrayBackgroundCB bg_changed_cb, void *user_data);
647
648Bool mb_tray_get_bg_col(Display *dpy, XColor *xcol);
649
650void
651mb_tray_window_icon_set(Display *dpy, Window win_panel, MBPixbufImage *img);
652
653void mb_tray_unmap_window (Display* dpy, Window win);
654
655MBPixbufImage *mb_tray_get_bg_img(MBPixbuf *pb, Window win);
656
659#ifdef __cplusplus
660}
661#endif
662
663#endif
struct MBPixbufImage MBPixbufImage
Type for representing an mbpixbuf image.
void mb_tray_app_unhide(MBTrayApp *mb_tray_app)
Unhides ( redocks ) the tray app.
void mb_tray_app_main(MBTrayApp *mb_tray_app)
Runs the tray app main loop until mb_tray_app_main_quit is called.
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.
void mb_tray_app_main_quit(MBTrayApp *mb_tray_app)
Stops mb_tray_app_main.
void mb_tray_app_set_context_info(MBTrayApp *mb_tray_app, unsigned char *info)
Sets text for extra button in window message.
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.
void mb_tray_app_set_name(MBTrayApp *mb_tray_app, unsigned char *name)
Sets the tray app name.
void mb_tray_app_set_paint_callback(MBTrayApp *mb_tray_app, MBTrayAppPaintCB paint_cb)
Sets the callback function for panel app paint.
void(* MBTrayAppPaintCB)(MBTrayApp *mb, Drawable drawable)
Callback for a handling a 'paint' or expose event.
Definition mbtray.h:139
char * mb_tray_app_get_theme_name(MBTrayApp *mb_tray_app)
Returns the current theme.
long mb_tray_app_get_xevent_mask(MBTrayApp *mb_tray_app)
Returns the current X Event mask used by the tray app.
int mb_tray_app_offset(MBTrayApp *mb_tray_app)
Gets the apps offset from the panels origin
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.
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.
void(* MBTrayAppPollCB)(MBTrayApp *mb_tray_app)
Callback for a Timeout event.
Definition mbtray.h:182
Window mb_tray_app_xwin(MBTrayApp *mb_tray_app)
Gets the tray app window.
void mb_tray_app_set_icon(MBTrayApp *mb_tray_app, MBPixbuf *pixbuf, MBPixbufImage *image)
Sets the tray app icon.
void mb_tray_app_set_context_callback(MBTrayApp *mb_tray_app, MBTrayAppContextCB context_cb)
Sets the 'context' callback.
void(* MBTrayAppResizeCB)(MBTrayApp *mb, int width, int height)
Callback for a resize.
Definition mbtray.h:125
struct MBTrayApp MBTrayApp
Opaque structure used for representing a tray app.
Definition mbtray.h:114
Bool mb_tray_app_get_session(MBTrayApp *mb_tray_app)
Get session state.
int mb_tray_app_width(MBTrayApp *mb_tray_app)
Gets the tray width.
void mb_tray_handle_xevent(MBTrayApp *mb_tray_app, XEvent *xevent)
Runs a single iteration of the mainloop.
void mb_tray_app_set_theme_change_callback(MBTrayApp *mb_tray_app, MBTrayAppThemeChangeCB theme_cb)
Sets the callback function for a theme change.
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.
void mb_tray_app_request_size(MBTrayApp *mb_tray_app, int width, int height)
Requests a new size for the application.
void mb_tray_app_set_poll_timeout(MBTrayApp *mb_tray_app, struct timeval *tv)
Set timing for any timeout callbacks.
void mb_tray_app_set_button_callback(MBTrayApp *mb_tray_app, MBTrayAppButtonEventCB button_cb)
Sets the callback function for a mouse button press/release.
void * mb_tray_app_get_user_data(MBTrayApp *mb_tray_app)
Gets any user data to be attached to the tray app instance.
void(* MBTrayAppThemeChangeCB)(MBTrayApp *mb_tray_app, char *theme_name)
Callback for a theme change.
Definition mbtray.h:175
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.
Window mb_tray_app_xrootwin(MBTrayApp *mb_tray_app)
Gets the tray app root window.
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.
void(* MBTrayAppXEventCB)(MBTrayApp *mb_tray_app, XEvent *event)
Callback for an X event.
Definition mbtray.h:168
int mb_tray_app_height(MBTrayApp *mb_tray_app)
Gets the tray height.
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.
void mb_tray_app_repaint(MBTrayApp *mb_tray_app)
Requests the app is repainted - the paint callback will get called.
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.
void(* MBTrayAppButtonEventCB)(MBTrayApp *mb_tray_app, int x, int y, Bool is_release)
Callback for a button event.
Definition mbtray.h:157
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.
void mb_tray_app_hide(MBTrayApp *mb_tray_app)
Hides ( undocks ) the tray app.
void mb_tray_app_set_xevent_callback(MBTrayApp *mb_tray_app, MBTrayAppXEventCB xevent_cb)
Sets the callback function for any extra x event processing.
MBPixbufImage * mb_tray_app_get_background(MBTrayApp *mb_tray_app, MBPixbuf *pixbuf)
Gets the panel background for the area covered by the tray app.
Display * mb_tray_app_xdisplay(MBTrayApp *mb_tray_app)
Gets the tray apps X display.
int mb_tray_app_xscreen(MBTrayApp *mb_tray_app)
Gets the tray app X screen.
void mb_tray_app_main_init(MBTrayApp *mb_tray_app)
Inits the main loop.