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
);
113 struct TagItem
*tstate
= ops
->ops_AttrList
, *tag
;
117 * First we let the superclass
120 rc
= AsmDoSuperMethodA(cl
, obj
, (Msg
)ops
);
122 while (tag
= NextTagItem(&tstate
))
127 case ASLSM_InitialDisplayID
:
128 case SCREENREQ_DisplayID
:
129 sd
->sd_DisplayID
= data
;
131 case ASLSM_InitialDisplayWidth
:
132 case SCREENREQ_DisplayWidth
:
133 sd
->sd_DisplayWidth
= data
;
135 case ASLSM_InitialDisplayHeight
:
136 case SCREENREQ_DisplayHeight
:
137 sd
->sd_DisplayHeight
= data
;
139 case ASLSM_InitialDisplayDepth
:
140 case SCREENREQ_DisplayDepth
:
141 sd
->sd_DisplayDepth
= data
;
143 case ASLSM_InitialOverscanType
:
144 case SCREENREQ_OverscanType
:
145 sd
->sd_OverscanType
= data
;
147 case ASLSM_InitialAutoScroll
:
148 case SCREENREQ_AutoScroll
:
149 sd
->sd_AutoScroll
= data
;
159 * Give one of the attributes.
161 METHOD(ScreenReqClassGet
, struct opGet
*, opg
)
163 SD
*sd
= INST_DATA(cl
, obj
);
164 ULONG rc
= 1, *store
= opg
->opg_Storage
, attr
= opg
->opg_AttrID
;
168 case ASLSM_InitialDisplayID
:
169 case SCREENREQ_DisplayID
:
170 STORE sd
->sd_DisplayID
;
172 case ASLSM_InitialDisplayWidth
:
173 case SCREENREQ_DisplayWidth
:
174 STORE sd
->sd_DisplayWidth
;
176 case ASLSM_InitialDisplayHeight
:
177 case SCREENREQ_DisplayHeight
:
178 STORE sd
->sd_DisplayHeight
;
180 case ASLSM_InitialDisplayDepth
:
181 case SCREENREQ_DisplayDepth
:
182 STORE sd
->sd_DisplayDepth
;
184 case ASLSM_InitialOverscanType
:
185 case SCREENREQ_OverscanType
:
186 STORE sd
->sd_OverscanType
;
188 case ASLSM_InitialAutoScroll
:
189 case SCREENREQ_AutoScroll
:
190 STORE sd
->sd_AutoScroll
;
193 rc
= AsmDoSuperMethodA(cl
, obj
, (Msg
)opg
);
202 * Pop up the ScreenRequester.
204 METHOD(ScreenReqClassDoRequest
, Msg
, msg
)
206 SD
*sd
= INST_DATA(cl
, obj
);
207 struct ScreenModeRequester
*sm
;
210 DoSetMethodNG(obj
, ASLSM_InitialDisplayWidth
, sd
->sd_DisplayWidth
,
211 ASLSM_InitialDisplayHeight
, sd
->sd_DisplayHeight
,
212 ASLSM_InitialDisplayDepth
, sd
->sd_DisplayDepth
,
213 ASLSM_InitialDisplayID
, sd
->sd_DisplayID
,
214 ASLSM_InitialOverscanType
, sd
->sd_OverscanType
,
215 ASLSM_InitialAutoScroll
, sd
->sd_AutoScroll
,
218 if (sd
->sd_InfoWidth
)
220 DoSetMethodNG(obj
, ASLSM_InitialInfoLeftEdge
, sd
->sd_InfoLeft
,
221 ASLSM_InitialInfoTopEdge
, sd
->sd_InfoTop
,
222 ASLSM_InitialInfoOpened
, sd
->sd_InfoOpen
,
227 * Allocate ScreenRequester structure.
229 if (sm
= (struct ScreenModeRequester
*)AsmDoSuperMethod(cl
, obj
, ASLM_ALLOCREQUEST
))
232 * Put up the requester.
234 if (AsmDoSuperMethod(cl
, obj
, ASLM_REQUEST
))
237 * Copy relevant info into our structure.
239 DoSetMethodNG(obj
, SCREENREQ_DisplayWidth
, sm
->sm_DisplayWidth
,
240 SCREENREQ_DisplayHeight
, sm
->sm_DisplayHeight
,
241 SCREENREQ_DisplayDepth
, sm
->sm_DisplayDepth
,
242 SCREENREQ_DisplayID
, sm
->sm_DisplayID
,
243 SCREENREQ_OverscanType
, sm
->sm_OverscanType
,
244 SCREENREQ_AutoScroll
, sm
->sm_AutoScroll
,
250 * Remember these even if the requester was cancelled.
252 DoSuperSetMethodNG(cl
, obj
, ASLREQ_Bounds
, &sm
->sm_LeftEdge
, TAG_DONE
);
254 sd
->sd_InfoOpen
= sm
->sm_InfoOpened
;
255 sd
->sd_InfoLeft
= sm
->sm_InfoLeftEdge
;
256 sd
->sd_InfoTop
= sm
->sm_InfoTopEdge
;
257 sd
->sd_InfoWidth
= sm
->sm_InfoWidth
;
258 sd
->sd_InfoHeight
= sm
->sm_InfoHeight
;
261 * Free the requester structure.
263 AsmDoSuperMethod(cl
, obj
, ASLM_FREEREQUEST
);
265 rc
= ASLREQ_ERROR_NO_REQ
;
272 /// Class initialization.
276 STATIC DPFUNC ClassFunc
[] = {
277 OM_NEW
, (FUNCPTR
)ScreenReqClassNew
,
278 OM_SET
, (FUNCPTR
)ScreenReqClassSetUpdate
,
279 OM_UPDATE
, (FUNCPTR
)ScreenReqClassSetUpdate
,
280 OM_GET
, (FUNCPTR
)ScreenReqClassGet
,
281 OM_DISPOSE
, (FUNCPTR
)ScreenReqClassDispose
,
282 ASLM_DOREQUEST
, (FUNCPTR
)ScreenReqClassDoRequest
,
287 * Simple class initialization.
289 makeproto Class
*InitScreenReqClass(void)
291 return BGUI_MakeClass(CLASS_SuperClassBGUI
, BGUI_ASLREQ_OBJECT
,
292 CLASS_ObjectSize
, sizeof(SD
),
293 CLASS_DFTable
, ClassFunc
,