Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

phX11Util.h

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------
00002     Phission : 
00003         Realtime Vision Processing System
00004     
00005     Copyright (C) 2003-2006 Philip D.S. Thoren (pthoren@cs.uml.edu)
00006     University of Massachusetts at Lowell,
00007     Laboratory for Artificial Intelligence and Robotics
00008     
00009     This file is part of Phission.
00010 
00011     Phission is free software; you can redistribute it and/or modify
00012     it under the terms of the GNU Lesser General Public License as published by
00013     the Free Software Foundation; either version 2 of the License, or
00014     (at your option) any later version.
00015 
00016     Phission is distributed in the hope that it will be useful,
00017     but WITHOUT ANY WARRANTY; without even the implied warranty of
00018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019     GNU Lesser General Public License for more details.
00020 
00021     You should have received a copy of the GNU Lesser General Public License
00022     along with Phission; if not, write to the Free Software
00023     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024 
00025  ---------------------------------------------------------------------------*/
00026 #ifndef _PHX11UTIL_H
00027 #define _PHX11UTIL_H
00028 
00029 /* ------------------------------------------------------------------------- *
00030  * Coding of the Xlib stuff wouldn't be possible without the following 
00031  * resources found on the web:
00032  * 
00033  * http://larson.student.utwente.nl/~larson/frekko/tutorial1.html
00034  * http://larson.student.utwente.nl/~larson/frekko/tutorial2.html
00035  *
00036  * http://users.actcom.co.il/~choo/lupg/tutorials/xlib-programming/xlib-programming.html
00037  *
00038  * http://www.xmission.com/~georgeps/Xlib/Xlib_JPEG_Tutorial-4.html
00039  *
00040  * http://www.libsdl.org/
00041  * ------------------------------------------------------------------------- */
00042 
00043 /* ------------------------------------------------------------------------- */
00044 class phImage;
00045 
00046 /* ------------------------------------------------------------------------- */
00055 #ifdef __cplusplus
00056 extern "C" 
00057 {
00058 #endif
00059 
00060 #include <phStandard.h>
00061 
00062 /* .) Defined constants */
00063     
00064 #define phX11Window_NORESIZE 1
00065 #define phX11UtilValidFormats phImageRGB24 | \
00066                               phImageRGBA32 | \
00067                               phImageBGRA32
00068 #define phX11Window_SHOW 1
00069 #define phX11Window_HIDE 2
00070 
00071 #define phSTRUCTURE_NAME   "structure"
00072 #define phWAKEUP_NAME      "wakeup"
00073 #define phREDRAW_NAME      "redraw"
00074 #define phUPDATE_NAME      "update"
00075 #define phMOVE_NAME        "move"
00076 #define phRESIZE_NAME      "resize"
00077 #define phMINSIZE_NAME     "minsize"
00078 #define phVISIBLE_NAME     "visiblilty"
00079 
00080 #define phX11Window_USEREVENT_COUNT 7
00081 #define phX11Window_EVENT_COUNT (phX11Window_USEREVENT_COUNT + 1)
00082 #define phWAKEUP_INDEX   0
00083 #define phREDRAW_INDEX   1
00084 #define phUPDATE_INDEX   2
00085 #define phMOVE_INDEX     3
00086 #define phRESIZE_INDEX   4
00087 #define phMINSIZE_INDEX  5
00088 #define phVISIBLE_INDEX  6
00089 #define phSTRUCTURE_INDEX 7
00090 
00091 /* ------------------------------------------------------------------------- */
00092 typedef struct phX11SizeInfo_t
00093 {
00094     int w;
00095     int h;
00096 
00097 } phX11SizeInfo;
00098 /* ------------------------------------------------------------------------- */
00099 typedef struct phX11LocationInfo_t
00100 {
00101     int32_t x;
00102     int32_t y;
00103 
00104 } phX11LocationInfo;
00105 
00106 /* ------------------------------------------------------------------------- */
00107 typedef struct phX11WindowInfo_t    *phX11WindowInfo;
00108 typedef struct phX11ImageInfo_t     *phX11ImageInfo;
00109 typedef struct phX11EventAtom_t     *phX11EventAtom;
00110 typedef struct phX11EventInfo_t     *phX11EventInfo;
00111 
00112 /* ------------------------------------------------------------------------- */
00113 /* phX11EventAtom Utility functions */
00118 int phX11EventAtom_Create        ( const char      *name,
00119                                    phX11EventAtom  event_atom_class,
00120                                    phX11WindowInfo window,
00121                                    phX11EventAtom  *pevent_atom );
00122 int phX11EventAtom_Delete        ( phX11EventAtom  *pevent_atom );
00123 int phX11EventAtom_Equal         ( phX11EventAtom event_atom,
00124                                    phX11EventInfo event  );
00125 int phX11EventAtom_BelongsToClass( phX11EventAtom event_atom,
00126                                    phX11EventInfo event );
00127 
00128 /* ------------------------------------------------------------------------- */
00129 /* phWindowInfo functions */
00134 int phX11Window_Create      ( phX11SizeInfo     size,
00135                               phX11LocationInfo location,
00136                               unsigned long     border,
00137                               char              *title,
00138                               phX11WindowInfo   *window     );
00139 int phX11Window_Delete      ( phX11WindowInfo   *window     );
00140 
00141 int phX11Window_SendRedraw  ( phX11WindowInfo   window      );
00142 int phX11Window_SendUpdate  ( phX11WindowInfo   window      );
00143 int phX11Window_SendVisible ( phX11WindowInfo   window,
00144                               int32_t           show        );
00145 int phX11Window_SendResize  ( phX11WindowInfo   window,
00146                               uint32_t          width,
00147                               uint32_t          height      );
00148 int phX11Window_SendMove    ( phX11WindowInfo   window,
00149                               int32_t           x,
00150                               int32_t           y           );
00151 int phX11Window_SendMinSize( phX11WindowInfo    window,
00152                              uint32_t           min_width,
00153                              uint32_t           min_height  );
00154 int phX11Window_SendWakeup  ( phX11WindowInfo   window      );
00155 
00156 int phX11Window_IsOpen      ( phX11WindowInfo   window      );
00157 int phX11Window_IsVisible   ( phX11WindowInfo   window      );
00158 int phX11Window_Show        ( phX11WindowInfo   window      );
00159 int phX11Window_Hide        ( phX11WindowInfo   window      );
00160 
00161 int phX11Window_SetTitle    ( phX11WindowInfo   window,
00162                               const char        *title      );
00163 int phX11Window_Resize      ( phX11WindowInfo   window,
00164                               uint32_t          width,
00165                               uint32_t          height      );
00166 int phX11Window_GetSize     ( phX11WindowInfo   window,
00167                               uint32_t          *width,
00168                               uint32_t          *height     );
00169 int phX11Window_SetMinSize  ( phX11WindowInfo   window,
00170                               uint32_t          min_width,
00171                               uint32_t          min_height  );
00172 int phX11Window_GetMinSize  ( phX11WindowInfo   window,
00173                               uint32_t          *min_width,
00174                               uint32_t          *min_height );
00175 int phX11Window_SetMaxSize  ( phX11WindowInfo   window,
00176                               uint32_t          max_width,
00177                               uint32_t          max_height  );
00178 int phX11Window_GetMaxSize  ( phX11WindowInfo   window,
00179                               uint32_t          *max_width,
00180                               uint32_t          *max_height );
00181 int phX11Window_SetSizeLimits   ( phX11WindowInfo   window,
00182                                   uint32_t          min_width,
00183                                   uint32_t          min_height,
00184                                   uint32_t          max_width,
00185                                   uint32_t          max_height  );
00186 int phX11Window_GetSizeLimits   ( phX11WindowInfo   window,
00187                                   uint32_t          *min_width,
00188                                   uint32_t          *min_height,
00189                                   uint32_t          *max_width,
00190                                   uint32_t          *max_height  ); 
00191 int phX11Window_Move            ( phX11WindowInfo   window,
00192                                   int32_t          x,
00193                                   int32_t          y );
00194 int phX11Window_TranslateRootCoords ( phX11WindowInfo window,
00195                                       int32_t          x,
00196                                       int32_t          y,
00197                                       int32_t          *tx,
00198                                       int32_t          *ty );
00199 
00200 /* SetLocation doesn't move window, it merely sets the location values */
00201 int phX11Window_SetLocation     ( phX11WindowInfo   window,
00202                                   int32_t          x,
00203                                   int32_t          y );
00204 int phX11Window_GetLocation     ( phX11WindowInfo   window,
00205                                   int32_t          *x,
00206                                   int32_t          *y );
00207 /* Retreive an event atom from the window to compare to 
00208  * received events */
00209 phX11EventAtom phX11Window_GetEventAtom(  phX11WindowInfo window,
00210                                           const char *name );
00211 
00212 /* ------------------------------------------------------------------------- */
00213 /* phX11ImageInfo functions */
00218 int phX11Image_Create       ( phX11WindowInfo   window,
00219                               phX11ImageInfo    *image          );
00220 int phX11Image_Resize       ( phX11ImageInfo    image_buffer,
00221                               uint32_t          width,
00222                               uint32_t          height          );
00223 int phX11Image_GetSize      ( phX11ImageInfo    image_buffer,
00224                               uint32_t          *width,
00225                               uint32_t          *height     );
00226 int phX11Image_Delete       ( phX11WindowInfo   window,
00227                               phX11ImageInfo    *image_buffer   );
00228 int phX11Image_Put          ( phX11WindowInfo   window,
00229                               phX11ImageInfo    image_buffer,
00230                               phImage           *image          );
00231 
00232 /* ------------------------------------------------------------------------- */
00233 /* Event functions */
00238 phX11EventInfo  phX11EventInfo_Create();
00239 void            phX11EventInfo_Destroy( phX11EventInfo event );
00240     
00241 void phX11Flush                  ( phX11WindowInfo window   );
00242 int  phX11Pending                ( phX11WindowInfo window   );
00243 void phX11NextEvent              ( phX11WindowInfo window,
00244                                    phX11EventInfo  event    );
00245 int phX11FlushToRecent_BaseWindow( phX11WindowInfo window,
00246                                    int             event_id,
00247                                    phX11EventInfo  event    );
00248 int phX11FlushToRecent_ImageWindow(phX11WindowInfo window,
00249                                    int             event_id,
00250                                    phX11EventInfo  event    );
00251 int  phX11Event_FromBaseWindow   ( phX11WindowInfo window,
00252                                    phX11EventInfo  event    );
00253 int  phX11Event_FromImageWindow  ( phX11WindowInfo window,
00254                                    phX11EventInfo  event    );
00255 int  phX11Event_GetType          ( phX11EventInfo  event    );
00256 void phX11Event_GetXConfigureInfo( phX11EventInfo  event,
00257                                    uint32_t        *w,
00258                                    uint32_t        *h,
00259                                    int32_t         *x,
00260                                    int32_t         *y,
00261                                    int32_t         *send_event );
00262 void phX11Event_GetXClientInfo   ( phX11EventInfo  e,
00263                                    int             *format,
00264                                    long            *l_0,
00265                                    long            *l_1,
00266                                    long            *l_2 );
00267 int64_t phX11KeycodeToKeysym     ( phX11WindowInfo window,
00268                                    phX11EventInfo  event   );
00269 
00270 uint32_t    phX11Window_GetBaseEventMask    ( phX11WindowInfo window);
00271 uint32_t    phX11Window_GetImageEventMask   ( phX11WindowInfo window);
00272 int         phX11Window_GetDeleteCmdID      ( phX11WindowInfo window);
00273     
00274 
00275 #ifdef __cplusplus
00276 } /* extern "C" { */
00277 #endif
00278  /* end \addtogroup X11Utility */ /* end \addtogroup Display */
00281 
00282 #endif /* _PHX11UTIL_H */




Copyright (C) 2002 - 2007 Philip D.S. Thoren ( pthoren@users.sourceforge.net )
University Of Massachusetts at Lowell
Robotics Lab
SourceForge.net Logo

Generated on Sat Jun 16 02:44:03 2007 for phission by  doxygen 1.4.4