1 /* 2 Ming, an SWF output library 3 Copyright (C) 2001 Opaque Industries - http://www.opaque.net/ 4 5 This library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public 7 License as published by the Free Software Foundation; either 8 version 2.1 of the License, or (at your option) any later version. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with this library; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 */ 19 20 /* character.h 21 * 22 * $Id$ 23 * 24 * Notice: This header file contains declarations of functions and types that 25 * are just used internally. All library functions and types that are supposed 26 * to be publicly accessable are defined in ./src/ming.h. 27 */ 28 29 #ifndef SWF_CHARACTER_H_INCLUDED 30 #define SWF_CHARACTER_H_INCLUDED 31 32 #include "ming.h" 33 #include "block.h" 34 #include "rect.h" 35 36 extern int SWF_gNumCharacters; 37 38 39 #define CHARACTER(c) ((SWFCharacter)(c)) 40 #define CHARACTERID(c) (((SWFCharacter)(c))->id) 41 42 43 /* characters are things that can be placed on the stage- 44 shapes, text, sprites.. */ 45 46 struct SWFCharacter_s 47 { 48 struct SWFBlock_s block; 49 50 int id; 51 SWFRect bounds; 52 53 /* some characters depend on others- e.g., a shape may need a jpeg for 54 a fill or some text needs a font.. we keep track of these dependencies 55 so that we write them in the right order, regardless of when/if the user 56 adds them to the movie */ 57 58 int nDependencies; 59 SWFCharacter *dependencies; 60 61 /* We shouldn't allow users to modify characters after they've been added 62 to a container- movie, sprite, or button. */ 63 64 BOOL isFinished; 65 }; 66 67 68 /* initialize character values to something sane */ 69 70 void SWFCharacterInit(SWFCharacter character); 71 72 73 /* destroy this character */ 74 75 void destroySWFCharacter(SWFCharacter character); 76 77 78 /* marks the given block as a dependency of the character- that is, 79 we should define the block before defining the character */ 80 81 void 82 SWFCharacter_addDependency(SWFCharacter character, SWFCharacter dependency); 83 84 85 /* returns the character's dependency list */ 86 87 BOOL 88 SWFCharacter_getDependencies(SWFCharacter character, 89 SWFCharacter** depsPtr, int* nDepsPtr); 90 91 92 /* returns the scaled (i.e., in twips) width of the character */ 93 94 int 95 SWFCharacter_getScaledWidth(SWFCharacter character); 96 97 98 /* returns the scaled (i.e., in twips) height of the character */ 99 100 int 101 SWFCharacter_getScaledHeight(SWFCharacter character); 102 103 104 /* returns the character's SWFRect bounds object */ 105 106 SWFRect 107 SWFCharacter_getBounds(SWFCharacter character); 108 109 110 /* returns TRUE if the given block is a character type, else FALSE */ 111 112 BOOL 113 SWFBlock_isCharacter(SWFBlock block); 114 115 116 /* notify the character that it's been added to a container */ 117 118 void 119 SWFCharacter_setFinished(SWFCharacter character); 120 121 122 /* returns TRUE if the character has been added to a container */ 123 124 BOOL 125 SWFCharacter_isFinished(SWFCharacter character); 126 127 #endif /* SWF_CHARACTER_H_INCLUDED */ 128