7 * (C) Copyright 1998 Manuel Lemos.
8 * (C) Copyright 1996-1997 Ian J. Einman.
9 * (C) Copyright 1993-1996 Jaba Development.
10 * (C) Copyright 1993-1996 Jan van den Baard.
11 * All Rights Reserved.
14 * Revision 42.2 2004/06/16 20:16:48 verhaegs
15 * Use METHODPROTO, METHOD_END and REGFUNCPROTOn where needed.
17 * Revision 42.1 2000/05/15 19:27:02 stegerg
18 * another hundreds of REG() macro replacements in func headers/protos.
20 * Revision 42.0 2000/05/09 22:10:08 mlemos
21 * Bumped to revision 42.0 before handing BGUI to AROS team
23 * Revision 41.11 2000/05/09 19:55:03 mlemos
24 * Merged with the branch Manuel_Lemos_fixes.
26 * Revision 41.10 1998/02/25 21:13:04 mlemos
29 * Revision 1.1 1998/02/25 17:09:42 mlemos
35 #include "include/classdefs.h"
37 /// Class definitions.
39 * Object instance data.
42 ULONG sd_DisplayID
; /* Display mode ID */
43 ULONG sd_DisplayWidth
; /* Width of display in pixels */
44 ULONG sd_DisplayHeight
; /* Height of display in pixels */
45 UWORD sd_DisplayDepth
; /* Number of bit-planes of display */
46 UWORD sd_OverscanType
; /* Type of overscan of display */
47 BOOL sd_AutoScroll
; /* Display should auto-scroll? */
49 BOOL sd_InfoOpen
; /* Info window opened on exit? */
50 WORD sd_InfoLeft
; /* Last coordinates of Info window */
60 * Create a shiny new object.
62 METHOD(ScreenReqClassNew
, struct opSet
*, ops
)
67 tags
= DefTagList(BGUI_SCREENREQ_OBJECT
, ops
->ops_AttrList
);
70 * First we let the superclass create the object.
72 if ((rc
= NewSuperObject(cl
, obj
, tags
)))
75 * Setup user attributes.
77 if (AsmCoerceMethod(cl
, (Object
*)rc
, OM_SET
, tags
, NULL
) != ASLREQ_OK
)
82 AsmCoerceMethod(cl
, (Object
*)rc
, OM_DISPOSE
);
96 METHOD(ScreenReqClassDispose
, Msg
, msg
)
99 * The superclass does the rest.
101 return AsmDoSuperMethodA(cl
, obj
, msg
);
105 /// OM_SET, OM_UPDATE
107 * Change one or more of the object
110 METHOD(ScreenReqClassSetUpdate
, struct opSet
*, ops
)
112 SD
*sd
= INST_DATA(cl
, obj
);
114 struct TagItem
*tstate
= ops
->ops_AttrList
;
118 * First we let the superclass
121 rc
= AsmDoSuperMethodA(cl
, obj
, (Msg
)ops
);
123 while ((tag
= NextTagItem(&tstate
)))
128 case ASLSM_InitialDisplayID
:
129 case SCREENREQ_DisplayID
:
130 sd
->sd_DisplayID
= data
;
132 case ASLSM_InitialDisplayWidth
:
133 case SCREENREQ_DisplayWidth
:
134 sd
->sd_DisplayWidth
= data
;
136 case ASLSM_InitialDisplayHeight
:
137 case SCREENREQ_DisplayHeight
:
138 sd
->sd_DisplayHeight
= data
;
140 case ASLSM_InitialDisplayDepth
:
141 case SCREENREQ_DisplayDepth
:
142 sd
->sd_DisplayDepth
= data
;
144 case ASLSM_InitialOverscanType
:
145 case SCREENREQ_OverscanType
:
146 sd
->sd_OverscanType
= data
;
148 case ASLSM_InitialAutoScroll
:
149 case SCREENREQ_AutoScroll
:
150 sd
->sd_AutoScroll
= data
;
160 * Give one of the attributes.
162 METHOD(ScreenReqClassGet
, struct opGet
*, opg
)
164 SD
*sd
= INST_DATA(cl
, obj
);
166 IPTR
*store
= opg
->opg_Storage
;
167 Tag attr
= opg
->opg_AttrID
;
171 case ASLSM_InitialDisplayID
:
172 case SCREENREQ_DisplayID
:
173 STORE sd
->sd_DisplayID
;
175 case ASLSM_InitialDisplayWidth
:
176 case SCREENREQ_DisplayWidth
:
177 STORE sd
->sd_DisplayWidth
;
179 case ASLSM_InitialDisplayHeight
:
180 case SCREENREQ_DisplayHeight
:
181 STORE sd
->sd_DisplayHeight
;
183 case ASLSM_InitialDisplayDepth
:
184 case SCREENREQ_DisplayDepth
:
185 STORE sd
->sd_DisplayDepth
;
187 case ASLSM_InitialOverscanType
:
188 case SCREENREQ_OverscanType
:
189 STORE sd
->sd_OverscanType
;
191 case ASLSM_InitialAutoScroll
:
192 case SCREENREQ_AutoScroll
:
193 STORE sd
->sd_AutoScroll
;
196 rc
= AsmDoSuperMethodA(cl
, obj
, (Msg
)opg
);
205 * Pop up the ScreenRequester.
207 METHOD(ScreenReqClassDoRequest
, Msg
, msg
)
209 SD
*sd
= INST_DATA(cl
, obj
);
210 struct ScreenModeRequester
*sm
;
213 DoSetMethodNG(obj
, ASLSM_InitialDisplayWidth
, sd
->sd_DisplayWidth
,
214 ASLSM_InitialDisplayHeight
, sd
->sd_DisplayHeight
,
215 ASLSM_InitialDisplayDepth
, sd
->sd_DisplayDepth
,
216 ASLSM_InitialDisplayID
, sd
->sd_DisplayID
,
217 ASLSM_InitialOverscanType
, sd
->sd_OverscanType
,
218 ASLSM_InitialAutoScroll
, sd
->sd_AutoScroll
,
221 if (sd
->sd_InfoWidth
)
223 DoSetMethodNG(obj
, ASLSM_InitialInfoLeftEdge
, sd
->sd_InfoLeft
,
224 ASLSM_InitialInfoTopEdge
, sd
->sd_InfoTop
,
225 ASLSM_InitialInfoOpened
, sd
->sd_InfoOpen
,
230 * Allocate ScreenRequester structure.
232 if ((sm
= (struct ScreenModeRequester
*)AsmDoSuperMethod(cl
, obj
, ASLM_ALLOCREQUEST
)))
235 * Put up the requester.
237 if (AsmDoSuperMethod(cl
, obj
, ASLM_REQUEST
))
240 * Copy relevant info into our structure.
242 DoSetMethodNG(obj
, SCREENREQ_DisplayWidth
, sm
->sm_DisplayWidth
,
243 SCREENREQ_DisplayHeight
, sm
->sm_DisplayHeight
,
244 SCREENREQ_DisplayDepth
, sm
->sm_DisplayDepth
,
245 SCREENREQ_DisplayID
, sm
->sm_DisplayID
,
246 SCREENREQ_OverscanType
, sm
->sm_OverscanType
,
247 SCREENREQ_AutoScroll
, sm
->sm_AutoScroll
,
253 * Remember these even if the requester was cancelled.
255 DoSuperSetMethodNG(cl
, obj
, ASLREQ_Bounds
, &sm
->sm_LeftEdge
, TAG_DONE
);
257 sd
->sd_InfoOpen
= sm
->sm_InfoOpened
;
258 sd
->sd_InfoLeft
= sm
->sm_InfoLeftEdge
;
259 sd
->sd_InfoTop
= sm
->sm_InfoTopEdge
;
260 sd
->sd_InfoWidth
= sm
->sm_InfoWidth
;
261 sd
->sd_InfoHeight
= sm
->sm_InfoHeight
;
264 * Free the requester structure.
266 AsmDoSuperMethod(cl
, obj
, ASLM_FREEREQUEST
);
268 rc
= ASLREQ_ERROR_NO_REQ
;
275 /// Class initialization.
279 STATIC DPFUNC ClassFunc
[] = {
280 { OM_NEW
, ScreenReqClassNew
, },
281 { OM_SET
, ScreenReqClassSetUpdate
, },
282 { OM_UPDATE
, ScreenReqClassSetUpdate
, },
283 { OM_GET
, ScreenReqClassGet
, },
284 { OM_DISPOSE
, ScreenReqClassDispose
, },
285 { ASLM_DOREQUEST
, ScreenReqClassDoRequest
, },
290 * Simple class initialization.
292 makeproto Class
*InitScreenReqClass(void)
294 return BGUI_MakeClass(CLASS_SuperClassBGUI
, BGUI_ASLREQ_OBJECT
,
295 CLASS_ObjectSize
, sizeof(SD
),
296 CLASS_DFTable
, ClassFunc
,