muimaster.library: Area class will not eat wheel movement messages
[AROS.git] / workbench / libs / popupmenu / pmimages.c
blob8406c144557c64976fd0d6a9a5fe56c24daf03d0
1 //
2 // Popup Menu Images
3 // ©1996-1997 Henrik Isaksson
4 //
6 #include <exec/types.h>
7 #include <intuition/intuition.h>
8 #include <cybergraphx/cybergraphics.h>
9 #include <proto/cybergraphics.h>
10 #include "pmpriv.h"
12 extern BOOL V40Gfx;
14 UBYTE chip arrowData[9*2] =
16 0x80,0x00,0xC0,0x00,0xE0,0x00,0xF0,0x00,0xF8,0x00,0xF0,0x00,0xE0,0x00,0xC0,0x00,
17 0x80,0x00
20 struct Image arrow =
22 0, 0, /* LeftEdge, TopEdge */
23 5, 9, 1, /* Width, Height, Depth */
24 (void *)arrowData, /* ImageData */
25 0x0001, 0x0000, /* PlanePick, PlaneOnOff */
26 NULL /* NextImage */
29 struct Image *MakeSysImage(struct PM_Root *p, ULONG image, ULONG ist)
31 struct Image *img=NULL;
32 /* struct DrawInfo dri;
33 UWORD TP[MAX_PENS];
35 CopyMem(p->DrawInfo,&dri,sizeof(struct DrawInfo));
36 if(dri.dri_Version>=2) {
37 if(ist==IST_INACTIVE) {
38 TP[SHINEPEN] = p->DrawInfo->dri_Pens[SHINEPEN];
39 TP[SHADOWPEN]=PM_Pens_Get(PMPEN_SHADOW);
40 TP[BACKGROUNDPEN]=PM_Pens_Get(PMPEN_BG);
41 TP[FILLPEN]=PM_Pens_Get(PMPEN_ACTIVEBG);
42 TP[BARBLOCKPEN]=TP[BACKGROUNDPEN];
43 TP[BARDETAILPEN]=PM_Pens_Get(PMPEN_TEXT);
44 } else {
45 TP[SHINEPEN]=PM_Pens_Get(PMPEN_SHINE);
46 TP[SHADOWPEN]=PM_Pens_Get(PMPEN_SHADOW);
47 TP[BACKGROUNDPEN]=PM_Pens_Get(PMPEN_ACTIVEBG);
48 TP[FILLPEN]=PM_Pens_Get(PMPEN_BG);
49 TP[BARBLOCKPEN]=TP[BACKGROUNDPEN];
50 TP[BARDETAILPEN]=PM_Pens_Get(PMPEN_ACTIVETEXT);
52 dri.dri_Pens=TP;
53 }*/
55 img = NewObject(NULL, SYSICLASS,
56 //SYSIA_DrawInfo, &dri,
57 SYSIA_DrawInfo, p->DrawInfo,
58 SYSIA_Size, SYSISIZE_HIRES,
59 SYSIA_Which, image,
60 IA_Left, 0,
61 IA_Top, 0,
62 //IA_BGPen, 0,
63 //IA_FGPen, TP[BARDETAILPEN],
64 //IA_Width, p->MenuFont->tf_YSize,
65 //IA_Height, p->MenuFont->tf_YSize,
66 TAG_DONE);
69 return img;
72 void PM_Image_Allocate(struct PM_Root *p)
74 int i;
76 for(i = 0; i < PMIMG_LAST; i++)
77 p->MenuImages[i] = 0;
79 p->MenuImages[PMIMG_AMIGAKEY] = MakeSysImage(p, AMIGAKEY, 0);
80 p->MenuImages[PMIMG_CHECKMARK] = MakeSysImage(p, MENUCHECK, 0);
81 p->MenuImages[PMIMG_EXCLUDE] = MakeSysImage(p, MENUCHECK, 0);
82 p->MenuImages[PMIMG_SUBMENU] = &arrow; //MakeSysImage(p, RIGHTIMAGE, 0);
85 void PM_Image_Free(struct PM_Root *p)
87 if(p->MenuImages[PMIMG_AMIGAKEY])
88 DisposeObject(p->MenuImages[PMIMG_AMIGAKEY]);
89 if(p->MenuImages[PMIMG_CHECKMARK])
90 DisposeObject(p->MenuImages[PMIMG_CHECKMARK]);
91 if(p->MenuImages[PMIMG_EXCLUDE])
92 DisposeObject(p->MenuImages[PMIMG_EXCLUDE]);
93 /*if(p->MenuImages[PMIMG_SUBMENU])
94 DisposeObject(p->MenuImages[PMIMG_SUBMENU]); */
97 struct PrefsImage *PM_Image_Get(ULONG type, struct PopupMenu *item)
99 return NULL;
102 UWORD PM_Image_Draw(struct PM_Window *w, ULONG type, WORD l, struct DrawInfo *dri, ULONG state, struct PopupMenu *item)
104 #if 1
105 /* TODO: Check this code that is trying to get rid of global p */
106 struct PM_Root *p = w->p;
107 #endif
109 if(p->MenuImages[type]) {
110 int y = item->Top + item->Height/2 - p->MenuImages[type]->Height/2;
111 if(l < 0) l += item->Left + item->Width - p->MenuImages[type]->Width;
112 DrawImageState(w->RPort, p->MenuImages[type], l, y, state, dri);
113 return p->MenuImages[type]->Width;
115 return 0;
118 UWORD PM_Image_Height(struct PM_Root *p, ULONG type, struct PopupMenu *item)
120 if(p->MenuImages[type])
121 return p->MenuImages[type]->Height;
122 return 0;
125 UWORD PM_Image_Width(struct PM_Root *p, ULONG type, struct PopupMenu *item)
127 if(p->MenuImages[type])
128 return p->MenuImages[type]->Width;
129 return 0;