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.9 2004/06/16 20:16:48 verhaegs
15 * Use METHODPROTO, METHOD_END and REGFUNCPROTOn where needed.
17 * Revision 42.8 2003/01/18 19:09:58 chodorowski
18 * Instead of using the _AROS or __AROS preprocessor symbols, use __AROS__.
20 * Revision 42.7 2000/08/09 11:45:57 chodorowski
21 * Removed a lot of #ifdefs that disabled the AROS_LIB* macros when not building on AROS. This is now handled in contrib/bgui/include/bgui_compilerspecific.h.
23 * Revision 42.6 2000/08/08 14:08:00 chodorowski
24 * Minor fixes to make BGUI compile on Amiga.
26 * Revision 42.5 2000/07/09 03:05:07 bergers
27 * Makes the gadgets compilable.
29 * Revision 42.4 2000/06/01 01:41:37 bergers
30 * Only 2 linker problems left: stch_l & stcu_d. Somebody might want to replace them (embraced by #ifdef __AROS__), please.
32 * Revision 42.3 2000/05/29 00:40:24 bergers
33 * Update to compile with AROS now. Should also still compile with SASC etc since I only made changes that test the define __AROS__. The compilation is still very noisy but it does the trick for the main directory. Maybe members of the BGUI team should also have a look at the compiler warnings because some could also cause problems on other systems... (Comparison always TRUE due to datatype (or something like that)). And please compile it on an Amiga to see whether it still works... Thanks.
35 * Revision 42.2 2000/05/15 19:27:01 stegerg
36 * another hundreds of REG() macro replacements in func headers/protos.
38 * Revision 42.1 2000/05/14 23:32:47 stegerg
39 * changed over 200 function headers which all use register
40 * parameters (oh boy ...), because the simple REG() macro
41 * doesn't work with AROS. And there are still hundreds
42 * of headers left to be fixed :(
44 * Many of these functions would also work with stack
45 * params, but since i have fixed every single one
46 * I encountered up to now, I guess will have to do
47 * the same for the rest.
49 * Revision 42.0 2000/05/09 22:09:23 mlemos
50 * Bumped to revision 42.0 before handing BGUI to AROS team
52 * Revision 41.11 2000/05/09 19:54:33 mlemos
53 * Merged with the branch Manuel_Lemos_fixes.
55 * Revision 41.10.2.11 2000/05/04 04:39:06 mlemos
56 * Added the entries to the now built-in supported bar and layout group gadget
59 * Revision 41.10.2.10 1999/08/17 19:11:24 mlemos
60 * Prevented base class from being replaced by an external library.
62 * Revision 41.10.2.9 1999/07/31 01:56:02 mlemos
63 * Added code to keep track of created objects.
65 * Revision 41.10.2.8 1999/07/29 00:43:47 mlemos
66 * Ensured that external library classes can only be freed if they get marked
69 * Revision 41.10.2.7 1999/07/28 23:17:11 mlemos
70 * Allowed the library to be expunged if there no remainining classes with
71 * open subclasses but without any objects to be disposed.
73 * Revision 41.10.2.6 1999/07/28 16:38:05 mlemos
74 * Added code to detect class object leaks in FreeClasses.
75 * Made FreeClasses iterate until the number of classes subclasses that remain
76 * to be freed does not change.
78 * Revision 41.10.2.5 1999/07/18 02:58:03 mlemos
79 * Fixed problem of BGUI_CallHookPkt using the stack frame to store local
80 * variables that were pointing to the wrong address after EnsureStack was
83 * Revision 41.10.2.4 1999/07/03 15:16:54 mlemos
84 * Added the function BGUI_CallHookPkt.
85 * Replaced the calls to CallHookPkt to BGUI_CallHookPkt.
87 * Revision 41.10.2.3 1999/05/31 00:45:03 mlemos
88 * Added the TreeView gadget to the list of internally supported gadgets.
90 * Revision 41.10.2.2 1998/10/12 01:26:56 mlemos
91 * Made the ARexx be initialized internally whenever is needed.
93 * Revision 41.10.2.1 1998/03/02 23:51:17 mlemos
94 * Switched vector allocation functions calls to BGUI allocation functions.
96 * Revision 41.10 1998/02/25 21:12:26 mlemos
99 * Revision 1.1 1998/02/25 17:08:50 mlemos
105 #include "include/classdefs.h"
108 * Internal lock housekeeping.
111 struct Requester wl_IDCMPLock
; /* Requester lock. */
112 struct Window
*wl_Locked
; /* Locked window. */
113 UWORD wl_MinWidth
, wl_MinHeight
; /* Current sizes. */
114 UWORD wl_MaxWidth
, wl_MaxHeight
; /* " " */
120 static ULONG object_serial_number
=1;
122 struct ObjectTracking
124 struct ObjectTracking
*Next
;
131 static struct ObjectTracking
*tracked_objects
=NULL
;
133 makeproto ULONG
TrackNewObject(Object
*object
,struct TagItem
*tags
)
135 struct ObjectTracking
*track
;
137 if((track
=BGUI_AllocPoolMem(sizeof(*track
)))==NULL
)
139 track
->Object
=object
;
141 track
->SerialNumber
=object_serial_number
++;
142 track
->Next
=tracked_objects
;
143 tracked_objects
=track
;
145 return(track
->SerialNumber
);
148 makeproto BOOL
TrackDisposedObject(Object
*object
)
150 struct ObjectTracking
**track
,*found
;
153 for(track
= &tracked_objects
;(found
= *track
) && (*track
)->Object
!=object
;track
= &(*track
)->Next
);
157 BGUI_FreePoolMem(found
);
160 bug("*** Could not track disposed object %lX\n",object
);
162 return((BOOL
)(found
!=NULL
));
166 static void DumpTrackedObjects(void)
169 while(tracked_objects
)
171 struct ObjectTracking
*track
;
173 track
= tracked_objects
;
174 tracked_objects
=track
->Next
;
175 bug("*** Object %lX leaked! Serial number %lu\n",track
->Object
,track
->SerialNumber
);
176 BGUI_FreePoolMem(track
);
184 * Table for class init stuff.
188 Class
*(*cd_InitFunc
)(void);
191 struct BGUIClassBase
*cd_ClassBase
;
192 struct TagItem
*cd_DefTags
;
194 BOOL cd_LibraryClass
;
197 STATIC CLASSDEF Classes
[] =
199 { NULL
, InitGroupNodeClass
, BGUI_GROUP_NODE
, NULL
, NULL
, FALSE
, FALSE
},
201 { NULL
, InitDGMClass
, BGUI_DGM_OBJECT
, NULL
, NULL
, FALSE
, FALSE
},
202 { NULL
, InitRootClass
, BGUI_ROOT_OBJECT
, NULL
, NULL
, FALSE
, FALSE
},
207 { NULL
, InitTextClass
, BGUI_TEXT_GRAPHIC
, NULL
, NULL
, FALSE
, FALSE
},
212 { NULL
, InitImageClass
, BGUI_IMAGE_OBJECT
, NULL
, NULL
, FALSE
, FALSE
},
213 { NULL
, InitFrameClass
, BGUI_FRAME_IMAGE
, "images/bgui_frame.image", NULL
, FALSE
, FALSE
},
214 { NULL
, InitLabelClass
, BGUI_LABEL_IMAGE
, "images/bgui_label.image", NULL
, FALSE
, FALSE
},
215 { NULL
, InitVectorClass
, BGUI_VECTOR_IMAGE
, "images/bgui_vector.image", NULL
, FALSE
, FALSE
},
216 { NULL
, InitSystemClass
, BGUI_SYSTEM_IMAGE
, "images/bgui_system.image", NULL
, FALSE
, FALSE
},
221 { NULL
, InitGadgetClass
, BGUI_GADGET_OBJECT
, NULL
, NULL
, FALSE
, FALSE
},
222 { NULL
, InitBaseClass
, BGUI_BASE_GADGET
, NULL
, NULL
, FALSE
, FALSE
},
223 { NULL
, InitButtonClass
, BGUI_BUTTON_GADGET
, "gadgets/bgui_button.gadget", NULL
, FALSE
, FALSE
},
224 { NULL
, InitGroupClass
, BGUI_GROUP_GADGET
, "gadgets/bgui_group.gadget", NULL
, FALSE
, FALSE
},
225 { NULL
, InitCycleClass
, BGUI_CYCLE_GADGET
, "gadgets/bgui_cycle.gadget", NULL
, FALSE
, FALSE
},
226 { NULL
, InitCheckBoxClass
, BGUI_CHECKBOX_GADGET
, "gadgets/bgui_checkbox.gadget", NULL
, FALSE
, FALSE
},
227 { NULL
, InitInfoClass
, BGUI_INFO_GADGET
, "gadgets/bgui_info.gadget", NULL
, FALSE
, FALSE
},
228 { NULL
, InitStringClass
, BGUI_STRING_GADGET
, "gadgets/bgui_string.gadget", NULL
, FALSE
, FALSE
},
229 { NULL
, InitPropClass
, BGUI_PROP_GADGET
, "gadgets/bgui_prop.gadget", NULL
, FALSE
, FALSE
},
230 { NULL
, InitIndicatorClass
, BGUI_INDICATOR_GADGET
, "gadgets/bgui_indicator.gadget", NULL
, FALSE
, FALSE
},
231 { NULL
, InitProgressClass
, BGUI_PROGRESS_GADGET
, "gadgets/bgui_progress.gadget", NULL
, FALSE
, FALSE
},
232 { NULL
, InitSliderClass
, BGUI_SLIDER_GADGET
, "gadgets/bgui_slider.gadget", NULL
, FALSE
, FALSE
},
233 { NULL
, InitPageClass
, BGUI_PAGE_GADGET
, "gadgets/bgui_page.gadget", NULL
, FALSE
, FALSE
},
234 { NULL
, InitMxClass
, BGUI_MX_GADGET
, "gadgets/bgui_mx.gadget", NULL
, FALSE
, FALSE
},
235 { NULL
, InitListClass
, BGUI_LISTVIEW_GADGET
, "gadgets/bgui_listview.gadget", NULL
, FALSE
, FALSE
},
236 { NULL
, InitExtClass
, BGUI_EXTERNAL_GADGET
, "gadgets/bgui_external.gadget", NULL
, FALSE
, FALSE
},
237 { NULL
, InitSepClass
, BGUI_SEPARATOR_GADGET
, "gadgets/bgui_separator.gadget", NULL
, FALSE
, FALSE
},
238 { NULL
, InitRadioButtonClass
, BGUI_RADIOBUTTON_GADGET
, "gadgets/bgui_radiobutton.gadget", NULL
, FALSE
, FALSE
},
239 { NULL
, InitAreaClass
, BGUI_AREA_GADGET
, "gadgets/bgui_area.gadget", NULL
, FALSE
, FALSE
},
240 { NULL
, InitViewClass
, BGUI_VIEW_GADGET
, "gadgets/bgui_view.gadget", NULL
, FALSE
, FALSE
},
241 { NULL
, NULL
, BGUI_PALETTE_GADGET
, "gadgets/bgui_palette.gadget", NULL
, FALSE
, FALSE
},
242 { NULL
, NULL
, BGUI_POPBUTTON_GADGET
, "gadgets/bgui_popbutton.gadget", NULL
, FALSE
, FALSE
},
243 { NULL
, NULL
, BGUI_TREEVIEW_GADGET
, "gadgets/bgui_treeview.gadget", NULL
, FALSE
, FALSE
},
244 { NULL
, NULL
, BGUI_BAR_GADGET
, "gadgets/bgui_bar.gadget", NULL
, FALSE
, FALSE
},
245 { NULL
, NULL
, BGUI_LAYOUTGROUP_GADGET
, "gadgets/bgui_layoutgroup.gadget", NULL
, FALSE
, FALSE
},
250 { NULL
, InitWindowClass
, BGUI_WINDOW_OBJECT
, "bgui_window.class", NULL
, FALSE
, FALSE
},
251 { NULL
, InitCxClass
, BGUI_COMMODITY_OBJECT
, "bgui_commodity.class", NULL
, FALSE
, FALSE
},
252 { NULL
, InitAslReqClass
, BGUI_ASLREQ_OBJECT
, "bgui_aslreq.class", NULL
, FALSE
, FALSE
},
253 { NULL
, InitFileReqClass
, BGUI_FILEREQ_OBJECT
, "bgui_filereq.class", NULL
, FALSE
, FALSE
},
254 { NULL
, InitFontReqClass
, BGUI_FONTREQ_OBJECT
, "bgui_fontreq.class", NULL
, FALSE
, FALSE
},
255 { NULL
, InitScreenReqClass
, BGUI_SCREENREQ_OBJECT
, "bgui_screenreq.class", NULL
, FALSE
, FALSE
},
258 /* AREXX is not yet supported on AROS */
260 { NULL
, InitArexxClass
, BGUI_AREXX_OBJECT
, "bgui_arexx.class", NULL
, FALSE
, FALSE
},
262 { NULL
, InitSpacingClass
, BGUI_SPACING_OBJECT
, NULL
, NULL
, FALSE
, FALSE
},
264 { NULL
, NULL
, (UWORD
)~0, NULL
}
268 * Free the classes. Returns FALSE if one of the classes
271 makeproto BOOL
FreeClasses(void)
275 ULONG subclasses
,last_subclasses
=0,opened_classes
;
280 opened_classes
=subclasses
=0;
281 for (cd
= Classes
; cd
->cd_ClassID
!= (UWORD
)~0; cd
++)
283 if(last_subclasses
==0)
284 cd
->cd_Leaking
=FALSE
;
287 if (cd
->cd_LibraryClass
)
291 CloseLibrary((struct Library
*)cd
->cd_ClassBase
);
292 cd
->cd_ClassBase
= NULL
;
300 * Return FALSE if one or more fail to free.
302 if (!BGUI_FreeClass(cd
->cd_Storage
))
305 if(cd
->cd_Storage
->cl_SubclassCount
)
307 subclasses
+=cd
->cd_Storage
->cl_SubclassCount
;
308 if(cd
->cd_Storage
->cl_ObjectCount
)
316 D(bug("*** Object leak of class %lu: Class %lX, Object count %lu\n",cd
->cd_ClassID
,cd
->cd_Storage
,cd
->cd_Storage
->cl_ObjectCount
));
321 cd
->cd_Storage
= NULL
;
325 cd
->cd_LibraryClass
=FALSE
;
327 if(last_subclasses
==subclasses
)
329 last_subclasses
=subclasses
;
334 if(opened_classes
==0)
336 for (cd
= Classes
; cd
->cd_ClassID
!= (UWORD
)~0; cd
++)
337 cd
->cd_Storage
= NULL
;
339 DumpTrackedObjects();
345 D(bug("Opened classes %lu\n",opened_classes
));
352 makeproto
void MarkFreedClass(Class
*cl
)
357 for (cd
= Classes
; cd
->cd_ClassID
!= (UWORD
)~0; cd
++)
359 if(cl
==cd
->cd_Storage
)
361 cd
->cd_Storage
= NULL
;
370 * Obtain a class pointer. This routine will only fail if you pass it
371 * a non-existing class ID, or the class fails to initialize.
375 AROS_LH1(Class
*, BGUI_GetClassPtr
,
376 AROS_LHA(ULONG
, classID
, D0
),
377 struct Library
*, BGUIBase
, 5, BGUI
)
379 makeproto SAVEDS ASM Class
*BGUI_GetClassPtr( REG(d0
) ULONG classID
)
388 for (cd
= Classes
; cd
->cd_ClassID
!= (UWORD
)~0; cd
++)
390 if (classID
== (UWORD
)cd
->cd_ClassID
)
392 if (!(cl
= cd
->cd_Storage
))
394 if (cd
->cd_ClassFile
)
396 if ((cd
->cd_ClassBase
= (struct BGUIClassBase
*)OpenLibrary(cd
->cd_ClassFile
, 0)))
399 * Get the class pointer.
401 cl
= cd
->cd_ClassBase
->bcb_Class
;
402 cd
->cd_LibraryClass
=TRUE
;
405 if (!cl
&& cd
->cd_InitFunc
)
408 * Call the initialization routine.
410 cl
= (cd
->cd_InitFunc
)();
422 #if defined(__AROS__) && defined(NO_LINEAR_VARARGS)
424 * Var-args stub for BGUI_NewObjectA().
426 * This is a little complicated on NO_LINEAR_VARARGS architectures,
427 * since BGUI puts ((GROUP_Member,obj) ... (TAG_END,0)) sequences
428 * in its arguments to BGUI_NewObject, so we can't use the
429 * standard AROS_SLOWSTACKTAGS_* family.
431 makeproto Object
*BGUI_NewObject(ULONG classID
, Tag tag1
, ...)
434 int gm_depth
= 0, len
= 0;
438 struct TagItem
*tags
;
443 /* Determine the va list length, skipping GROUP_Member tagsets */
444 for (tag
= tag1
; gm_depth
>= 0; tag
= va_arg(va
, IPTR
) ) {
445 data
= va_arg(va
, IPTR
);
463 tags
= AllocMem(sizeof(tags
[0])*len
, MEMF_ANY
);
467 for (i
= 0; i
< len
; i
++) {
468 tags
[i
].ti_Tag
= tag
;
469 tags
[i
].ti_Data
= va_arg(vc
, IPTR
);
471 tag
= va_arg(vc
, IPTR
);
474 rc
= BGUI_NewObjectA(classID
, tags
);
475 FreeMem(tags
, sizeof(tags
[0])*len
);
483 * Var-args stub for BGUI_NewObjectA().
485 makeproto Object
*BGUI_NewObject(ULONG classID
, Tag tag1
, ...)
487 return BGUI_NewObjectA(classID
, (struct TagItem
*)&tag1
);
492 * Create an object from a class.
496 AROS_LH2(Object
*, BGUI_NewObjectA
,
497 AROS_LHA(ULONG
, classID
, D0
),
498 AROS_LHA(struct TagItem
*, attr
, A0
),
499 struct Library
*, BGUIBase
, 6, BGUI
)
501 makeproto SAVEDS ASM Object
*BGUI_NewObjectA( REG(d0
) ULONG classID
, REG(a0
) struct TagItem
*attr
)
509 if ((cl
= BGUI_GetClassPtr(classID
)))
510 obj
= NewObjectA(cl
, NULL
, attr
);
522 AROS_LH5(struct BitMap
*, BGUI_AllocBitMap
,
523 AROS_LHA(ULONG
, width
, D0
),
524 AROS_LHA(ULONG
, height
, D1
),
525 AROS_LHA(ULONG
, depth
, D2
),
526 AROS_LHA(ULONG
, flags
, D3
),
527 AROS_LHA(struct BitMap
*, fr
, A0
),
528 struct Library
*, BGUIBase
, 14, BGUI
)
530 makeproto SAVEDS ASM
struct BitMap
*BGUI_AllocBitMap( REG(d0
) ULONG width
, REG(d1
) ULONG height
, REG(d2
) ULONG depth
,
531 REG(d3
) ULONG flags
, REG(a0
) struct BitMap
*fr
)
537 return AllocBitMap(width
, height
, depth
, flags
| BMF_MINPLANES
, fr
);
539 struct BitMap
*bm
= NULL
;
544 * Use the system routine if
545 * we are running OS 3.0 or better.
548 return AllocBitMap(width
, height
, depth
, flags
| BMF_MINPLANES
, fr
);
551 * Not OS 3.0 or better?
552 * Make the bitmap ourselves.
554 if ((b
= (ULONG
*)BGUI_AllocPoolMem(sizeof(struct BitMap
) + sizeof(ULONG
))))
557 bm
= (struct BitMap
*)(b
+ 1);
558 InitBitMap(bm
, depth
, width
, height
);
560 flags
= flags
& BMF_CLEAR
? MEMF_CHIP
: MEMF_CHIP
| MEMF_CLEAR
;
561 rassize
= RASSIZE(width
, height
);
566 for (i
= 0; i
< depth
; i
++)
568 if (!(bm
->Planes
[i
] = AllocVec(rassize
, flags
)))
586 AROS_LH1(VOID
, BGUI_FreeBitMap
,
587 AROS_LHA(struct BitMap
*, bm
, A0
),
588 struct Library
*, BGUIBase
, 15, BGUI
)
590 makeproto SAVEDS ASM VOID
BGUI_FreeBitMap( REG(a0
) struct BitMap
*bm
)
600 ULONG
*b
= ((ULONG
*)bm
) - 1;
607 * Wait for the blitter.
612 * Under OS 3.0 we call the system routine.
616 for (i
= bm
->Depth
- 1; i
>= 0; --i
)
621 if ((p
= bm
->Planes
[i
])) FreeVec(p
);
624 * Free the structure.
639 * Allocate a rastport with bitmap.
643 AROS_LH4(struct RastPort
*, BGUI_CreateRPortBitMap
,
644 AROS_LHA(struct RastPort
*, source
, A0
),
645 AROS_LHA(ULONG
, width
, D0
),
646 AROS_LHA(ULONG
, height
, D1
),
647 AROS_LHA(ULONG
, depth
, D2
),
648 struct Library
*, BGUIBase
, 16, BGUI
)
650 makeproto SAVEDS ASM
struct RastPort
*BGUI_CreateRPortBitMap( REG(a0
) struct RastPort
*source
,
651 REG(d0
) ULONG width
, REG(d1
) ULONG height
, REG(d2
) ULONG depth
)
657 struct Layer_Info
*li
;
660 * Allocate a rastport structure.
662 if ((rp
= (struct RastPort
*)BGUI_AllocPoolMem(sizeof(struct RastPort
))))
665 * If we have a source rastport we
666 * copy it. Otherwise we initialize
669 if (source
) *rp
= *source
;
670 else InitRastPort(rp
);
672 if (!depth
&& source
) depth
= FGetDepth(source
);
677 if ((rp
->BitMap
= BGUI_AllocBitMap(width
, height
, depth
, BMF_CLEAR
, source
? source
->BitMap
: NULL
)))
684 if ((li
= NewLayerInfo()))
686 if ((rp
->Layer
= CreateUpfrontLayer(li
, rp
->BitMap
, 0, 0, width
- 1, height
- 1, 0, NULL
)))
689 * Mark it as a buffered rastport.
691 // rp->RP_User = ID_BFRP;
698 DisposeLayerInfo(li
);
703 BGUI_FreeBitMap(rp
->BitMap
);
708 BGUI_FreePoolMem(rp
);
716 * Free a buffer rastport and bitmap.
720 AROS_LH1(VOID
, BGUI_FreeRPortBitMap
,
721 AROS_LHA(struct RastPort
*, rp
, A0
),
722 struct Library
*, BGUIBase
, 17, BGUI
)
724 makeproto SAVEDS ASM VOID
BGUI_FreeRPortBitMap( REG(a0
) struct RastPort
*rp
)
729 struct Layer
*l
= rp
->Layer
;
730 struct Layer_Info
*li
= l
->LayerInfo
;
735 InstallClipRegion(l
, NULL
);
739 * Free the layerinfo.
741 DisposeLayerInfo(li
);
746 BGUI_FreeBitMap(rp
->BitMap
);
751 BGUI_FreePoolMem(rp
);
757 * Show AmigaGuide file.
761 AROS_LH4(BOOL
, BGUI_Help
,
762 AROS_LHA(struct Window
*, win
, A0
),
763 AROS_LHA(UBYTE
*, file
, A1
),
764 AROS_LHA(UBYTE
*, node
, A2
),
765 AROS_LHA(ULONG
, line
, D0
),
766 struct Library
*, BGUIBase
, 8, BGUI
)
768 makeproto SAVEDS ASM BOOL
BGUI_Help( REG(a0
) struct Window
*win
, REG(a1
) UBYTE
*file
, REG(a2
) UBYTE
*node
, REG(d0
) ULONG line
)
773 struct NewAmigaGuide nag
= { };
776 * Initialize structure.
778 nag
.nag_Name
= ( STRPTR
)file
;
779 nag
.nag_Node
= ( STRPTR
)node
;
781 nag
.nag_Screen
= win
? win
->WScreen
: NULL
;
786 return( DisplayAGuideInfo( &nag
, TAG_END
));
793 * Set or clear the busy pointer.
795 STATIC ASM VOID
Busy(REG(a0
) struct Window
*win
, REG(d0
) BOOL set
)
799 if (set
) SetWindowPointer(win
, WA_BusyPointer
, TRUE
, WA_PointerDelay
, TRUE
, TAG_END
);
800 else SetWindowPointer(win
, TAG_END
);
805 * Must be in chip memory (busy pointer on OS 2.04 machines).
807 static __chip UWORD BusyPointer
[] =
809 0x0000, 0x0000, 0x0400, 0x07c0, 0x0000, 0x07c0, 0x0100, 0x0380,
810 0x0000, 0x07e0, 0x07c0, 0x1ff8, 0x1FF0, 0x3FEC, 0x3FF8, 0x7FDE,
811 0x3FF8, 0x7FBE, 0x7FFC, 0xFF7F, 0x7EFC, 0xFFFF, 0x7FFC, 0xFFFF,
812 0x3FF8, 0x7FFE, 0x3FF8, 0x7FFE, 0x1FF0, 0x3FFC, 0x07C0, 0x1FF8,
813 0x0000, 0x07E0, 0x0000, 0x0000
818 if (set
) SetWindowPointer(win
, WA_BusyPointer
, TRUE
, WA_PointerDelay
, TRUE
, TAG_END
);
819 else SetWindowPointer(win
, TAG_END
);
823 if (set
) SetPointer(win
, BusyPointer
, 16, 16, -6, 0 );
824 else ClearPointer(win
);
835 AROS_LH1(APTR
, BGUI_LockWindow
,
836 AROS_LHA(struct Window
*, win
, A0
),
837 struct Library
*, BGUIBase
, 9, BGUI
)
839 makeproto SAVEDS ASM APTR
BGUI_LockWindow( REG(a0
) struct Window
*win
)
847 * Allocate lock structure.
849 if (( wl
= ( WINDOWLOCK
* )BGUI_AllocPoolMem( sizeof( WINDOWLOCK
)))) {
851 * Initialize structure.
856 * Copy current min/max sizes.
858 *IBOX( &wl
->wl_MinWidth
) = *IBOX( &win
->MinWidth
);
861 * Setup and open requester.
863 InitRequester( &wl
->wl_IDCMPLock
);
864 Request( &wl
->wl_IDCMPLock
, win
);
874 WindowLimits( win
, win
->Width
, win
->Height
, win
->Width
, win
->Height
);
887 AROS_LH1(VOID
, BGUI_UnlockWindow
,
888 AROS_LHA(APTR
, lock
, A0
),
889 struct Library
*, BGUIBase
, 10, BGUI
)
891 makeproto SAVEDS ASM VOID
BGUI_UnlockWindow( REG(a0
) APTR lock
)
896 WINDOWLOCK
*wl
= ( WINDOWLOCK
* )lock
;
899 * A NULL lock is safe.
905 WindowLimits( wl
->wl_Locked
, wl
->wl_MinWidth
, wl
->wl_MinHeight
, wl
->wl_MaxWidth
, wl
->wl_MaxHeight
);
910 EndRequest( &wl
->wl_IDCMPLock
, wl
->wl_Locked
);
913 * Clear busy pointer.
915 Busy( wl
->wl_Locked
, FALSE
);
920 BGUI_FreePoolMem( wl
);
928 AROS_LH2(CONST_STRPTR
, BGUI_GetLocaleStr
,
929 AROS_LHA(struct bguiLocale
*, bl
, A0
),
930 AROS_LHA(ULONG
, id
, D0
),
931 struct Library
*, BGUIBase
, 20, BGUI
)
933 makeproto SAVEDS ASM STRPTR
BGUI_GetLocaleStr( REG(a0
) struct bguiLocale
*bl
, REG(d0
) ULONG id
)
938 CONST_STRPTR str
= NULL
;
940 struct bguiLocaleStr bls
;
944 if (bl
->bl_LocaleStrHook
)
947 str
= (STRPTR
)BGUI_CallHookPkt(bl
->bl_LocaleStrHook
, (void *)bl
, (void *)&bls
);
951 if (LocaleBase
) str
= GetLocaleStr(bl
->bl_Locale
, id
);
961 AROS_LH3(CONST_STRPTR
, BGUI_GetCatalogStr
,
962 AROS_LHA(struct bguiLocale
*, bl
, A0
),
963 AROS_LHA(ULONG
, id
, D0
),
964 AROS_LHA(CONST_STRPTR
, str
, A1
),
965 struct Library
*, BGUIBase
, 21, BGUI
)
967 makeproto SAVEDS ASM CONST_STRPTR
BGUI_GetCatalogStr( REG(a0
) struct bguiLocale
*bl
, REG(d0
) ULONG id
, REG(a1
) CONST_STRPTR str
)
972 struct bguiCatalogStr bcs
;
976 if (bl
->bl_CatalogStrHook
)
979 bcs
.bcs_DefaultString
= str
;
980 str
= (STRPTR
)BGUI_CallHookPkt(bl
->bl_CatalogStrHook
, (void *)bl
, (void *)&bcs
);
984 if (LocaleBase
) str
= GetCatalogStr(bl
->bl_Catalog
, id
, str
);
999 static IPTR
CallHookWithStack(struct CallHookData
*call_hook_data
)
1001 register APTR stack
;
1002 register IPTR result
;
1004 stack
=EnsureStack();
1005 result
=CallHookPkt(call_hook_data
->Hook
,call_hook_data
->Object
,call_hook_data
->Message
);
1011 makeproto SAVEDS ASM IPTR
BGUI_CallHookPkt(REG(a0
) struct Hook
*hook
,REG(a2
) APTR object
,REG(a1
) APTR message
)
1013 struct CallHookData call_hook_data
;
1015 call_hook_data
.Hook
=hook
;
1016 call_hook_data
.Object
=object
;
1017 call_hook_data
.Message
=message
;
1018 return(CallHookWithStack(&call_hook_data
));