2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
6 #include "icon_intern.h"
8 /*****************************************************************************
11 #include <proto/icon.h>
13 AROS_LH5(BOOL
, GetIconRectangleA
,
16 AROS_LHA(struct RastPort
*, rp
, A0
),
17 AROS_LHA(struct DiskObject
*, icon
, A1
),
18 AROS_LHA(STRPTR
, label
, A2
),
19 AROS_LHA(struct Rectangle
*, rectangle
, A3
),
20 AROS_LHA(struct TagItem
*, tags
, A4
),
22 struct IconBase
*, IconBase
, 28, Icon
)
28 rp - reference RastPort (for font)
29 icon - icon to be queried
31 rectangle - resulting size
37 Only very limited implemented.
49 *****************************************************************************/
53 struct NativeIcon
*nativeicon
;
56 struct Rectangle rect
= { 0, 0, 0, 0};
58 isFrameless
= GetTagData(ICONDRAWA_Frameless
, FALSE
, tags
);
59 isBorderless
= GetTagData(ICONDRAWA_Borderless
, FALSE
, tags
);
62 rect
= LB(IconBase
)->ib_EmbossRectangle
;
71 nativeicon
= GetNativeIcon(icon
, LB(IconBase
));
72 if (nativeicon
&& nativeicon
->ni_Screen
)
74 rectangle
->MinX
= rect
.MinX
+ 0;
75 rectangle
->MinY
= rect
.MinY
+ 0;
76 rectangle
->MaxX
= rect
.MaxX
+ nativeicon
->ni_Width
- 1;
77 rectangle
->MaxY
= rect
.MaxY
+ nativeicon
->ni_Height
- 1;
80 rectangle
->MinX
= rect
.MinX
+ 0;
81 rectangle
->MinY
= rect
.MinY
+ 0;
82 rectangle
->MaxX
= rect
.MaxX
+ icon
->do_Gadget
.Width
- 1;
83 rectangle
->MaxY
= rect
.MaxY
+ icon
->do_Gadget
.Height
- 1;
87 struct TextExtent extent
;
88 LONG txtlen
= strlen(label
);
90 if (txtlen
> IconBase
->ib_MaxNameLength
)
91 txtlen
= IconBase
->ib_MaxNameLength
;
93 TextExtent(rp
, label
, txtlen
, &extent
);
95 rectangle
->MaxY
+= extent
.te_Height
;
97 if (extent
.te_Width
> (rectangle
->MaxX
+1))
98 rectangle
->MaxX
= extent
.te_Width
- 1;
104 } /* GetIconRectangle */