00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _IMAGE_CREATE_H_
00022 #define _IMAGE_CREATE_H_
00023
00024
00025
00026 #include <vector>
00027 using std::vector;
00028
00029
00030
00031 #include <stdint.h>
00032 #include <gtk/gtk.h>
00033
00044 class ImageCreate
00045 {
00046 public:
00047 virtual ~ImageCreate() {}
00048 virtual char *GetDescription( ) const = 0;
00049 virtual void CreatePAL( bool is_pal ) { }
00050 virtual void CreateFrame( uint8_t *pixels, int width, int height, double position, double frame_delta ) = 0;
00051 virtual int GetNumberOfFrames( ) = 0;
00052 virtual bool IsUsable( ) { return true; }
00053 };
00054
00071 class GDKImageCreate : public ImageCreate
00072 {
00073 public:
00074 virtual ~GDKImageCreate() {}
00075 virtual void AttachWidgets( GtkBin *bin ) { }
00076 virtual void DetachWidgets( GtkBin *bin ) { }
00077 virtual void InterpretWidgets( GtkBin *bin ) { }
00078 };
00079
00093 class GDKAudioImport : public GDKImageCreate
00094 {
00095 public:
00096 virtual ~GDKAudioImport() {}
00097 virtual void CreateAudio( int16_t **buffer, short int *channels, int *frequency, int *samples ) = 0;
00098 };
00099
00106 class GDKImageCreateAdapter : public GDKImageCreate
00107 {
00108 private:
00109 ImageCreate *creator;
00110
00111 public:
00112 GDKImageCreateAdapter( ImageCreate *creator ) { this->creator = creator; }
00113 virtual ~GDKImageCreateAdapter( ) { delete creator; }
00114 void AttachWidgets( GtkBin *bin ) { }
00115 void DetachWidgets( GtkBin *bin ) { }
00116 void InterpretWidgets( GtkBin *bin ) { }
00117 char *GetDescription( ) const { return this->creator->GetDescription( ); }
00118 void CreateFrame( uint8_t *pixels, int width, int height, double position, double frame_delta )
00119 {
00120 return this->creator->CreateFrame( pixels, width, height, position, frame_delta );
00121 }
00122 };
00123
00134 class GDKImageCreateRepository
00135 {
00136 private:
00137 vector <GDKImageCreate *> creators;
00138 GDKImageCreate *selected_creator;
00139 GtkOptionMenu *menu;
00140 GtkBin *container;
00141 public:
00142 GDKImageCreateRepository();
00143 ~GDKImageCreateRepository();
00144 void Register( GDKImageCreate *creator );
00145 void Initialise( GtkOptionMenu *menu, GtkBin *container );
00146 GDKImageCreate *Get( ) const;
00147 void SelectionChange( );
00148 };
00149
00150 #endif