4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "arraylist.h"
26 #include "bcresources.inc"
27 #include "bcwindowbase.inc"
40 BC_ImageData(char *nm, unsigned char *dp) {
41 name = nm; data = dp; used = 0;
52 // Set pointer to binary object containing images and contents.
53 // Immediately loads the contents from the object.
54 void set_data(unsigned char *ptr);
56 // Compose widgets using standard images.
57 // The arguments are copied into new VFrames for a new image set.
58 // The image set is put in the image table only if the title is nonzero.
59 VFrame** new_button(const char *overlay_path,
64 VFrame** new_button4(const char *overlay_path,
68 const char *disabled_path,
70 VFrame** new_button(const char *overlay_path,
75 VFrame** new_toggle(const char *overlay_path,
78 const char *checked_path,
80 const char *checkedhi_path,
82 VFrame** new_toggle(const char *overlay_path,
91 // The two main routines for creating images are new_image_set and new_image.
92 // If the title already exists in the table, the existing entry is returned.
93 // These create image sets which are stored in the set table.
94 // Takes comma delimited char* pointers to filenames.
95 VFrame** new_image_set(const char *title, int total, va_list *args);
96 VFrame** new_image_set(const char *title, int total, ...);
97 VFrame** new_image_set(int total, ...);
98 // Creates an image set from VFrame pointers.
99 // The images are considered not references and deleted with the image set.
100 // If the title already exists, the existing entry is deleted and overridden.
101 VFrame** new_image_set_images(const char *title, int total, ...);
103 // Decompresses image and puts on images table before returning it.
104 VFrame* new_image(const char *title, const char *path);
105 VFrame* new_image(const char *path);
107 VFrame* new_image1(const char *title, const char *path);
110 // These retrieve images based on case sensitive title
111 VFrame* get_image(const char *title, int use_default = 1);
112 VFrame** get_image_set(const char *title, int use_default = 1);
113 BC_ThemeSet* get_image_set_object(const char *title);
115 // Loads compressed data into temporary
116 unsigned char* get_image_data(const char *title, int log_errs=1);
118 // Verify all images have been used after initialization.
120 void sort_image_sets();
123 BC_Resources* get_resources();
126 void overlay(VFrame *dst, VFrame *src, int in_x1 = -1, int in_x2 = -1, int shift = 0);
127 void init_contents();
131 // Decompressed image storage.
133 ArrayList<BC_ThemeSet*> image_sets;
134 BC_ThemeSet *last_image_set;
135 int image_sets_start;
136 static int image_set_cmpr(const void *ap, const void *bp);
137 void add_image_set(BC_ThemeSet *image_set);
139 // Compressed images are loaded in here.
140 ArrayList<int> data_items;
141 ArrayList<BC_ImageData *> images;
142 BC_ImageData *last_image_data;
143 static int images_cmpr(const void *ap, const void *bp);
149 // Set is_reference if the images are going to be created by new_image
150 BC_ThemeSet(int total, int is_reference, const char *title);