LibMB  1.9
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
35 extern "C" {
36 #endif
37 
114 typedef struct MBTrayApp MBTrayApp;
115 
116 /* TOGO ? */
117 typedef void (*MBTrayBackgroundCB)( void *user_data ) ;
118 
125 typedef void (*MBTrayAppResizeCB)( MBTrayApp *mb, int width, int height ) ;
126 
139 typedef void (*MBTrayAppPaintCB)( MBTrayApp *mb, Drawable drawable ) ;
140 
150 typedef void (*MBTrayAppContextCB)( MBTrayApp *mb ) ;
151 
157 typedef void (*MBTrayAppButtonEventCB)( MBTrayApp *mb_tray_app,
158  int x,
159  int y,
160  Bool is_release ) ;
161 
168 typedef void (*MBTrayAppXEventCB)( MBTrayApp *mb_tray_app, XEvent *event ) ;
169 
175 typedef void (*MBTrayAppThemeChangeCB)( MBTrayApp *mb_tray_app, char *theme_name ) ;
176 
182 typedef void (*MBTrayAppPollCB)( MBTrayApp *mb_tray_app) ;
183 
184 
216 MBTrayApp*
217 mb_tray_app_new (unsigned char *app_name,
218  MBTrayAppResizeCB resize_cb,
219  MBTrayAppPaintCB paint_cb,
220  int *argc,
221  char ***argv);
222 
238 MBTrayApp*
239 mb_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 
253 void
255  MBTrayAppXEventCB xevent_cb );
256 
263 void
265  MBTrayAppButtonEventCB button_cb );
266 
273 void
275  MBTrayAppThemeChangeCB theme_cb );
276 
284 void
286  MBTrayAppPollCB poll_cb,
287  struct timeval *tv);
288 
295 void
297  MBTrayAppResizeCB resize_cb );
298 
305 void
307  MBTrayAppPaintCB paint_cb );
308 
315 void
317  MBTrayAppContextCB context_cb );
318 
331 void
332 mb_tray_app_request_size (MBTrayApp *mb_tray_app,
333  int width,
334  int height );
335 
347 void
349  int offset);
350 
358 void
360  struct timeval *tv );
361 
367 void
368 mb_tray_app_repaint (MBTrayApp *mb_tray_app);
369 
377 void
379  unsigned char *msg,
380  int timeout);
381 
388 void
389 mb_tray_app_set_name (MBTrayApp *mb_tray_app,
390  unsigned char *name);
391 
398 void
400  unsigned char *info);
401 
409 void
410 mb_tray_app_set_icon(MBTrayApp *mb_tray_app,
411  MBPixbuf *pixbuf,
412  MBPixbufImage *image);
413 
422 void
423 mb_tray_app_set_session ( MBTrayApp *mb_tray_app,
424  Bool val );
425 
432 Bool
433 mb_tray_app_get_session ( MBTrayApp *mb_tray_app );
434 
443 Bool
445  int *x,
446  int *y );
447 
454 void
455 mb_tray_app_set_user_data (MBTrayApp *mb_tray_app,
456  void *data );
457 
464 void*
465 mb_tray_app_get_user_data (MBTrayApp *mb_tray_app);
466 
467 
468 Bool
469 mb_tray_app_tray_is_vertical (MBTrayApp *mb_tray_app );
470 
480  MBPixbuf *pixbuf);
481 
488 char *
490 
497 long
498 mb_tray_app_get_xevent_mask (MBTrayApp *mb_tray_app );
499 
507 void
508 mb_tray_app_set_xevent_mask (MBTrayApp *mb_tray_app, long mask);
509 
510 
517 Display*
518 mb_tray_app_xdisplay (MBTrayApp *mb_tray_app);
519 
526 int
527 mb_tray_app_xscreen (MBTrayApp *mb_tray_app);
528 
535 Window
536 mb_tray_app_xrootwin(MBTrayApp *mb_tray_app);
537 
544 Window
545 mb_tray_app_xwin (MBTrayApp *mb_tray_app);
546 
553 int
554 mb_tray_app_width (MBTrayApp *mb_tray_app);
555 
562 int
563 mb_tray_app_height (MBTrayApp *mb_tray_app);
564 
571 int
572 mb_tray_app_offset ( MBTrayApp *mb_tray_app ) ;
573 
581 void
582 mb_tray_app_main_init ( MBTrayApp *mb_tray_app );
583 
589 void
590 mb_tray_app_main (MBTrayApp *mb_tray_app);
591 
597 void
598 mb_tray_app_hide (MBTrayApp *mb_tray_app );
599 
605 void
606 mb_tray_app_unhide (MBTrayApp *mb_tray_app );
607 
608 
614 void
615 mb_tray_app_main_quit (MBTrayApp *mb_tray_app);
616 
623 void
624 mb_tray_handle_xevent (MBTrayApp *mb_tray_app,
625  XEvent *xevent);
626 
627 
628 
629 /* ---------- Older stuff below ----------------------------------------- */
630 
631 
632 int mb_tray_init(Display* dpy, Window win);
633 
634 Window mb_tray_get_window(void);
635 
636 void mb_tray_init_session_info(Display *d, Window win, char **argv, int argc);
637 
638 void mb_tray_handle_event(Display *dpy, Window win, XEvent *an_event);
639 
640 void mb_tray_send_message(Display *d, Window win,
641  unsigned char* msg, int timeout);
642 
643 void mb_tray_map_window (Display* dpy, Window win);
644 
645 void
646 mb_tray_bg_change_cb_set(MBTrayBackgroundCB bg_changed_cb, void *user_data);
647 
648 Bool mb_tray_get_bg_col(Display *dpy, XColor *xcol);
649 
650 void
651 mb_tray_window_icon_set(Display *dpy, Window win_panel, MBPixbufImage *img);
652 
653 void mb_tray_unmap_window (Display* dpy, Window win);
654 
655 MBPixbufImage *mb_tray_get_bg_img(MBPixbuf *pb, Window win);
656 
659 #ifdef __cplusplus
660 }
661 #endif
662 
663 #endif