Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

bctheme.h

Go to the documentation of this file.
00001 #ifndef BCTHEME_H
00002 #define BCTHEME_H
00003 
00004 #include "arraylist.h"
00005 #include "bcresources.inc"
00006 #include "bcwindowbase.inc"
00007 #include "vframe.inc"
00008 #include <stdarg.h>
00009 
00010 class BC_ThemeSet;
00011 
00012 
00013 
00014 
00015 class BC_Theme
00016 {
00017 public:
00018         BC_Theme();
00019         virtual ~BC_Theme();
00020 
00021 // Set pointer to binary object containing images and contents.
00022 // Immediately loads the contents from the object.
00023         void set_data(unsigned char *ptr);
00024 
00025 // Compose widgets using standard images.
00026 // The arguments are copied into new VFrames for a new image set.
00027 // The image set is put in the image table only if the title is nonzero.
00028         VFrame** new_button(char *overlay_path, 
00029                 char *up_path, 
00030                 char *hi_path, 
00031                 char *dn_path,
00032                 char *title = 0);
00033         VFrame** new_button4(char *overlay_path, 
00034                 char *up_path, 
00035                 char *hi_path, 
00036                 char *dn_path,
00037                 char *disabled_path,
00038                 char *title = 0);
00039         VFrame** new_button(char *overlay_path,
00040                 VFrame *up,
00041                 VFrame *hi,
00042                 VFrame *dn,
00043                 char *title = 0);
00044         VFrame** new_toggle(char *overlay_path,
00045                 char *up_path,
00046                 char *hi_path,
00047                 char *checked_path,
00048                 char *dn_path,
00049                 char *checkedhi_path,
00050                 char *title = 0);
00051         VFrame** new_toggle(char *overlay_path,
00052                 VFrame *up,
00053                 VFrame *hi,
00054                 VFrame *checked,
00055                 VFrame *dn,
00056                 VFrame *checkedhi,
00057                 char *title = 0);
00058 
00059 
00060 // The two main routines for creating images are new_image_set and new_image.
00061 // If the title already exists in the table, the existing entry is returned.
00062 // These create image sets which are stored in the set table.
00063 // Takes comma delimited char* pointers to filenames.
00064         VFrame** new_image_set(char *title, int total, va_list *args);
00065         VFrame** new_image_set(char *title, int total, ...);
00066         VFrame** new_image_set(int total, ...);
00067 // Creates an image set from VFrame pointers.
00068 // The images are considered not references and deleted with the image set.
00069 // If the title already exists, the existing entry is deleted and overridden.
00070         VFrame** new_image_set_images(char *title, int total, ...);
00071 
00072 // Decompresses image and puts on images table before returning it.
00073         VFrame* new_image(char *title, char *path);
00074         VFrame* new_image(char *path);
00075 
00076 
00077 // These retrieve images based on case sensitive title
00078         VFrame* get_image(char *title, int use_default = 1);
00079         VFrame** get_image_set(char *title, int use_default = 1);
00080         BC_ThemeSet* get_image_set_object(char *title);
00081 
00082 // Loads compressed data into temporary
00083         unsigned char* get_image_data(char *title);
00084 
00085 // Verify all images have been used after initialization.
00086         void check_used();
00087 
00088         void dump();
00089         BC_Resources* get_resources();
00090 
00091 private:
00092         void overlay(VFrame *dst, VFrame *src, int in_x1 = -1, int in_x2 = -1, int shift = 0);
00093         void init_contents();
00094 
00095 
00096 
00097 // Decompressed image storage.
00098 // Sets of images.
00099         ArrayList<BC_ThemeSet*> image_sets;
00100 
00101 // Compressed images are loaded in here.
00102         char *data_ptr;
00103         char *contents_ptr;
00104         ArrayList<char*> contents;
00105         ArrayList<unsigned char*> pointers;
00106         ArrayList<int> used;
00107         char *last_image;
00108         unsigned char *last_pointer;
00109 };
00110 
00111 class BC_ThemeSet
00112 {
00113 public:
00114 // Set is_reference if the images are going to be created by new_image
00115         BC_ThemeSet(int total, int is_reference, char *title);
00116         ~BC_ThemeSet();
00117 
00118         VFrame **data;
00119         char *title;
00120         int total;
00121         int is_reference;
00122 };
00123 
00124 
00125 
00126 #endif

Generated on Sun Jan 8 13:26:33 2006 for Guicast-svn by  doxygen 1.4.4