在做怦怦交易的客户端碰到的结构体问题
typedef enum ITEMTYPE
{
NoneItem = 0,//空类型的Item
LeftItem = 1,//聊天公告我的
TopItem = 2,//专栏本子资源
CenterItem = 3 //中间的显示消息
} ItemType;
typedef enum INDEX
{
Index_LiaoTianItem = 0,
Index_GongGaoItem = 1,
Index_WoDeItem = 3,
Index_ZhuangLangItem = 4,
Index_BenZiItem = 5,
Index_ZiYuangItem = 6,
Index_DisplayItem = 7,
Index_DisplayItem1 = 8,
Index_DisplayItem2 = 9,
Index_DisplayItem3 = 10,
Index_DisplayItem4 = 11,
Index_DisplayItem5 = 12
}Index;
typedef struct TEXT_STRUCT
{
char * text; //项目中的文字
int x,y; // item中文字的位置
int width,height; //项目区域中文字占的大小
} Text_Struct;
typedef struct IMAGE_STRUCT
{
char * imagePath; // item中图片的路径
int x,y; // item中图片的位置
int width,height; //项目中图片的宽高
} Image_Struct;
//定义传入实例item的参数结构体
typedef struct ITEMARGUMENT
{
Index index; // item的索引
ItemType type; // item的类型
int x,y; // item的坐标
int width,height; // item的大小
// char * PicturePath; //图片的路径
// char *文本; // CenterItem显示的文字
Text_Struct * Text;
Image_Struct *图像;
} ItemArguments;
我是这样申请的,感觉不专业,嗯。凑全着用
ItemArguments * MyItemArguments = NULL ;
Text_Struct * aa =(Text_Struct *) malloc (sizeof (Text_Struct ));
Image_Struct * bb =(Image_Struct *) malloc (sizeof (Image_Struct ));
MyItemArguments =(ItemArguments *) malloc (sizeof (ItemArguments ));
MyItemArguments - > Text = aa ;
MyItemArguments - > Image = bb ;