Main Page | Namespace List | Class Hierarchy | Data Structures | File List | Data Fields | Globals

sdsdl.h

Go to the documentation of this file.
00001 //--- < SDSDL.H > ---------------| ViewGraph - A Flexible Graph view Framework |
00002 //
00003 // Base SDL wrapper for ViewGraph
00004 //
00005 // Note: SDL supports monochrome cursors
00006 // only.
00007 //
00008 // $Author: botik32 $
00009 // $Revision: 1.4 $
00010 // $Date: 2004/05/03 21:02:01 $
00011 //-----------------------------------------------------------------------------/
00012 
00013 #ifndef SDSDL_H
00014 #define SDSDL_H
00015 
00016 #include <SDL/SDL.h>
00017 #include <SDL/SDL_mouse.h>
00018 #include <cZUI/drivers/surfacedriver.h>
00019 #include <cZUI/drivers/image.h>
00020 
00021 class SDLSurfaceCursor : public SurfaceCursor
00022 {
00023 protected:
00024         SDL_Cursor *cursor;
00025 public:
00026         SDLSurfaceCursor( char **img );
00027         ~SDLSurfaceCursor();
00028 
00029         friend int main( int, char* [] );
00030         friend class SDLSurfaceDriver;
00031 };
00032 
00033 class SDLImage : public Image
00034 {
00035 protected:
00036         SDL_Surface *srf;
00037 public:
00038         static const char* type;
00039 
00040         SDLImage( SDL_Surface* );
00041         SDLImage( Image *, double mag );
00042         const char* get_type( void );
00043         void* get_data( void );
00044         void get_dimensions( int& w, int& h );
00045         int get_bpp( void );
00046 
00047         // conversion to 565 format
00048         Image* convert_to_565( void );
00049         ~SDLImage();
00050 };
00051 
00052 class SDLSurfaceDriver;
00053 
00054 typedef void (*pcursorfunc)( SDLSurfaceDriver *, SurfaceCursor* );
00055 
00056 class SDLSurfaceDriver : public SurfaceDriver
00057 {
00058 protected:
00059         SDLSurfaceCursor *cursor;
00060         SDL_Surface *srf;
00061         pcursorfunc setcursor_notif;
00062 public:
00063 
00064         virtual void repaint( void );
00065         virtual void repaint_rect( int, int, int, int );
00066 
00067         virtual void setcursor( SurfaceCursor * );
00068         virtual SurfaceCursor* getcursor( void );
00069         virtual void showcursor( bool );
00070         
00071         virtual void enqueue_event( Event * );
00072         virtual void get_mousepos( int&, int& );
00073         virtual msbutton get_mousestate( void );
00074         
00075         virtual Image* load_image( const char * );
00076         virtual void put_image( Image*, int destx, int desty, 
00077                         int imgx=0, int imgy=0, int w=0, int h=0 );
00078         Image* create_scaled_image( Image *, double mgf );
00079 
00080         /// Passive (memory) surfaces cannot set the cursor.
00081         /// Use this function to delegate cursor changes to
00082         /// a surface in control.
00083         void delegate_cursor_set( pcursorfunc );
00084 
00085         SDLSurfaceDriver( int, int, SDL_Surface *s=0 );
00086         virtual ~SDLSurfaceDriver();
00087         
00088 };
00089 
00090 #endif
00091 

Generated on Wed Jun 23 18:47:21 2004 for cZUI by doxygen 1.3.5