3 // ©1996-1997 Henrik Isaksson
6 #include <exec/types.h>
7 #include <intuition/intuition.h>
8 #include <cybergraphx/cybergraphics.h>
9 #include <proto/cybergraphics.h>
14 UBYTE chip arrowData
[9*2] =
16 0x80,0x00,0xC0,0x00,0xE0,0x00,0xF0,0x00,0xF8,0x00,0xF0,0x00,0xE0,0x00,0xC0,0x00,
22 0, 0, /* LeftEdge, TopEdge */
23 5, 9, 1, /* Width, Height, Depth */
24 (void *)arrowData
, /* ImageData */
25 0x0001, 0x0000, /* PlanePick, PlaneOnOff */
29 struct Image
*MakeSysImage(struct PM_Root
*p
, ULONG image
, ULONG ist
)
31 struct Image
*img
=NULL
;
32 /* struct DrawInfo dri;
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);
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);
55 img
= NewObject(NULL
, SYSICLASS
,
56 //SYSIA_DrawInfo, &dri,
57 SYSIA_DrawInfo
, p
->DrawInfo
,
58 SYSIA_Size
, SYSISIZE_HIRES
,
63 //IA_FGPen, TP[BARDETAILPEN],
64 //IA_Width, p->MenuFont->tf_YSize,
65 //IA_Height, p->MenuFont->tf_YSize,
72 void PM_Image_Allocate(struct PM_Root
*p
)
76 for(i
= 0; i
< PMIMG_LAST
; i
++)
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
)
102 UWORD
PM_Image_Draw(struct PM_Window
*w
, ULONG type
, WORD l
, struct DrawInfo
*dri
, ULONG state
, struct PopupMenu
*item
)
105 /* TODO: Check this code that is trying to get rid of global p */
106 struct PM_Root
*p
= w
->p
;
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
;
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
;
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
;