LibMB
1.9
|
00001 /* libmb 00002 * Copyright (C) 2002 Matthew Allum 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to the 00016 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 * Boston, MA 02111-1307, USA. 00018 */ 00019 00020 #ifndef _MB_TRAY_H_ 00021 #define _MB_TRAY_H_ 00022 00023 #include <stdio.h> 00024 #include <stdlib.h> 00025 #include <sys/types.h> 00026 #include <unistd.h> 00027 #include <X11/Xlib.h> 00028 #include <X11/Xutil.h> 00029 #include <X11/Xatom.h> 00030 #include <X11/Xmd.h> 00031 00032 #include "libmb/mb.h" 00033 00034 #ifdef __cplusplus 00035 extern "C" { 00036 #endif 00037 00114 typedef struct MBTrayApp MBTrayApp; 00115 00116 /* TOGO ? */ 00117 typedef void (*MBTrayBackgroundCB)( void *user_data ) ; 00118 00125 typedef void (*MBTrayAppResizeCB)( MBTrayApp *mb, int width, int height ) ; 00126 00139 typedef void (*MBTrayAppPaintCB)( MBTrayApp *mb, Drawable drawable ) ; 00140 00150 typedef void (*MBTrayAppContextCB)( MBTrayApp *mb ) ; 00151 00157 typedef void (*MBTrayAppButtonEventCB)( MBTrayApp *mb_tray_app, 00158 int x, 00159 int y, 00160 Bool is_release ) ; 00161 00168 typedef void (*MBTrayAppXEventCB)( MBTrayApp *mb_tray_app, XEvent *event ) ; 00169 00175 typedef void (*MBTrayAppThemeChangeCB)( MBTrayApp *mb_tray_app, char *theme_name ) ; 00176 00182 typedef void (*MBTrayAppPollCB)( MBTrayApp *mb_tray_app) ; 00183 00184 00216 MBTrayApp* 00217 mb_tray_app_new (unsigned char *app_name, 00218 MBTrayAppResizeCB resize_cb, 00219 MBTrayAppPaintCB paint_cb, 00220 int *argc, 00221 char ***argv); 00222 00238 MBTrayApp* 00239 mb_tray_app_new_with_display ( unsigned char *app_name, 00240 MBTrayAppResizeCB resize_cb, 00241 MBTrayAppPaintCB paint_cb, 00242 int *argc, 00243 char ***argv, 00244 Display *display); 00245 00253 void 00254 mb_tray_app_set_xevent_callback (MBTrayApp *mb_tray_app, 00255 MBTrayAppXEventCB xevent_cb ); 00256 00263 void 00264 mb_tray_app_set_button_callback (MBTrayApp *mb_tray_app, 00265 MBTrayAppButtonEventCB button_cb ); 00266 00273 void 00274 mb_tray_app_set_theme_change_callback (MBTrayApp *mb_tray_app, 00275 MBTrayAppThemeChangeCB theme_cb ); 00276 00284 void 00285 mb_tray_app_set_timeout_callback (MBTrayApp *mb_tray_app, 00286 MBTrayAppPollCB poll_cb, 00287 struct timeval *tv); 00288 00295 void 00296 mb_tray_app_set_resize_callback (MBTrayApp *mb_tray_app, 00297 MBTrayAppResizeCB resize_cb ); 00298 00305 void 00306 mb_tray_app_set_paint_callback (MBTrayApp *mb_tray_app, 00307 MBTrayAppPaintCB paint_cb ); 00308 00315 void 00316 mb_tray_app_set_context_callback (MBTrayApp *mb_tray_app, 00317 MBTrayAppContextCB context_cb ); 00318 00331 void 00332 mb_tray_app_request_size (MBTrayApp *mb_tray_app, 00333 int width, 00334 int height ); 00335 00347 void 00348 mb_tray_app_request_offset (MBTrayApp *mb_tray_app, 00349 int offset); 00350 00358 void 00359 mb_tray_app_set_poll_timeout (MBTrayApp *mb_tray_app, 00360 struct timeval *tv ); 00361 00367 void 00368 mb_tray_app_repaint (MBTrayApp *mb_tray_app); 00369 00377 void 00378 mb_tray_app_tray_send_message (MBTrayApp *mb_tray_app, 00379 unsigned char *msg, 00380 int timeout); 00381 00388 void 00389 mb_tray_app_set_name (MBTrayApp *mb_tray_app, 00390 unsigned char *name); 00391 00398 void 00399 mb_tray_app_set_context_info (MBTrayApp *mb_tray_app, 00400 unsigned char *info); 00401 00409 void 00410 mb_tray_app_set_icon(MBTrayApp *mb_tray_app, 00411 MBPixbuf *pixbuf, 00412 MBPixbufImage *image); 00413 00422 void 00423 mb_tray_app_set_session ( MBTrayApp *mb_tray_app, 00424 Bool val ); 00425 00432 Bool 00433 mb_tray_app_get_session ( MBTrayApp *mb_tray_app ); 00434 00443 Bool 00444 mb_tray_app_get_absolute_coords (MBTrayApp *mb_tray_app, 00445 int *x, 00446 int *y ); 00447 00454 void 00455 mb_tray_app_set_user_data (MBTrayApp *mb_tray_app, 00456 void *data ); 00457 00464 void* 00465 mb_tray_app_get_user_data (MBTrayApp *mb_tray_app); 00466 00467 00468 Bool 00469 mb_tray_app_tray_is_vertical (MBTrayApp *mb_tray_app ); 00470 00478 MBPixbufImage * 00479 mb_tray_app_get_background (MBTrayApp *mb_tray_app, 00480 MBPixbuf *pixbuf); 00481 00488 char * 00489 mb_tray_app_get_theme_name (MBTrayApp *mb_tray_app); 00490 00497 long 00498 mb_tray_app_get_xevent_mask (MBTrayApp *mb_tray_app ); 00499 00507 void 00508 mb_tray_app_set_xevent_mask (MBTrayApp *mb_tray_app, long mask); 00509 00510 00517 Display* 00518 mb_tray_app_xdisplay (MBTrayApp *mb_tray_app); 00519 00526 int 00527 mb_tray_app_xscreen (MBTrayApp *mb_tray_app); 00528 00535 Window 00536 mb_tray_app_xrootwin(MBTrayApp *mb_tray_app); 00537 00544 Window 00545 mb_tray_app_xwin (MBTrayApp *mb_tray_app); 00546 00553 int 00554 mb_tray_app_width (MBTrayApp *mb_tray_app); 00555 00562 int 00563 mb_tray_app_height (MBTrayApp *mb_tray_app); 00564 00571 int 00572 mb_tray_app_offset ( MBTrayApp *mb_tray_app ) ; 00573 00581 void 00582 mb_tray_app_main_init ( MBTrayApp *mb_tray_app ); 00583 00589 void 00590 mb_tray_app_main (MBTrayApp *mb_tray_app); 00591 00597 void 00598 mb_tray_app_hide (MBTrayApp *mb_tray_app ); 00599 00605 void 00606 mb_tray_app_unhide (MBTrayApp *mb_tray_app ); 00607 00608 00614 void 00615 mb_tray_app_main_quit (MBTrayApp *mb_tray_app); 00616 00623 void 00624 mb_tray_handle_xevent (MBTrayApp *mb_tray_app, 00625 XEvent *xevent); 00626 00627 00628 00629 /* ---------- Older stuff below ----------------------------------------- */ 00630 00631 00632 int mb_tray_init(Display* dpy, Window win); 00633 00634 Window mb_tray_get_window(void); 00635 00636 void mb_tray_init_session_info(Display *d, Window win, char **argv, int argc); 00637 00638 void mb_tray_handle_event(Display *dpy, Window win, XEvent *an_event); 00639 00640 void mb_tray_send_message(Display *d, Window win, 00641 unsigned char* msg, int timeout); 00642 00643 void mb_tray_map_window (Display* dpy, Window win); 00644 00645 void 00646 mb_tray_bg_change_cb_set(MBTrayBackgroundCB bg_changed_cb, void *user_data); 00647 00648 Bool mb_tray_get_bg_col(Display *dpy, XColor *xcol); 00649 00650 void 00651 mb_tray_window_icon_set(Display *dpy, Window win_panel, MBPixbufImage *img); 00652 00653 void mb_tray_unmap_window (Display* dpy, Window win); 00654 00655 MBPixbufImage *mb_tray_get_bg_img(MBPixbuf *pb, Window win); 00656 00659 #ifdef __cplusplus 00660 } 00661 #endif 00662 00663 #endif