2 Copyright © 2011, The AROS Development Team. All rights reserved.
6 #define MUIMASTER_YES_INLINE_STDARG
9 #include <libraries/mui.h>
10 #include <exec/rawfmt.h>
12 #include <proto/alib.h>
13 #include <proto/exec.h>
14 #include <proto/graphics.h>
15 #include <proto/utility.h>
16 #include <proto/intuition.h>
17 #include <zune/customclasses.h>
21 #include "smattributes.h"
23 struct ScreenModeAttributes_DATA
31 Object
* objMaximumColors
;
35 Object
*ScreenModeAttributes__OM_NEW(Class
*CLASS
, Object
*self
, struct opSet
*message
)
37 struct ScreenModeAttributes_DATA
*data
;
38 Object
* objVisibleW
, * objVisibleH
, * objMinimumW
, * objMinimumH
,
39 * objMaximumW
, * objMaximumH
, * objMaximumColors
;
44 self
= (Object
*)DoSuperNewTags
47 MUIA_Group_Horiz
, TRUE
,
49 Child
, (IPTR
)ColGroup(4),
50 Child
, (IPTR
)LLabel1(_(MSG_VISIBLE_SIZE
)),
51 Child
, (IPTR
)(objVisibleW
= (Object
*)Label1("16368")),
52 Child
, (IPTR
)Label1("x"),
53 Child
, (IPTR
)(objVisibleH
= (Object
*)Label1("16384")),
55 Child
, (IPTR
)LLabel1(_(MSG_MINIMUM_SIZE
)),
56 Child
, (IPTR
)(objMinimumW
= (Object
*)Label1("16368")),
57 Child
, (IPTR
)Label1("x"),
58 Child
, (IPTR
)(objMinimumH
= (Object
*)Label1("16368")),
60 Child
, (IPTR
)LLabel1(_(MSG_MAXIMUM_SIZE
)),
61 Child
, (IPTR
)(objMaximumW
= (Object
*)Label1("16368")),
62 Child
, (IPTR
)Label1("x"),
63 Child
, (IPTR
)(objMaximumH
= (Object
*)Label1("16368")),
65 Child
, (IPTR
)LLabel1(_(MSG_MAXIMUM_COLORS
)),
66 Child
, (IPTR
)(objMaximumColors
= (Object
*)LLabel1("16777216")),
67 Child
, (IPTR
)RectangleObject
, End
,
68 Child
, (IPTR
)RectangleObject
, End
,
72 Child
, (IPTR
)RectangleObject
, End
,
76 TAG_MORE
, (IPTR
)message
->ops_AttrList
82 D(bug("[smattributes] Created ScreenModeAttributes object 0x%p\n", self
));
83 data
= INST_DATA(CLASS
, self
);
85 data
->objVisibleW
= objVisibleW
;
86 data
->objVisibleH
= objVisibleH
;
87 data
->objMinimumW
= objMinimumW
;
88 data
->objMinimumH
= objMinimumH
;
89 data
->objMaximumW
= objMaximumW
;
90 data
->objMaximumH
= objMaximumH
;
91 data
->objMaximumColors
= objMaximumColors
;
93 id
= GetTagData(MUIA_ScreenModeAttributes_DisplayID
, INVALID_ID
, message
->ops_AttrList
);
94 D(bug("[smattributes] Setting initial ModeID 0x%08lX\n", id
));
95 set(self
, MUIA_ScreenModeAttributes_DisplayID
, id
);
100 CoerceMethod(CLASS
, self
, OM_DISPOSE
);
104 IPTR
ScreenModeAttributes__OM_SET(Class
*CLASS
, Object
*self
, struct opSet
*message
)
106 struct ScreenModeAttributes_DATA
*data
= INST_DATA(CLASS
, self
);
107 struct TagItem
*tags
;
111 DB2(bug("[smattributes] OM_SET called\n"));
112 for (tags
= message
->ops_AttrList
; (tag
= NextTagItem(&tags
)); )
116 case MUIA_ScreenModeAttributes_DisplayID
:
118 struct DimensionInfo dim
;
120 D(bug("[smattributes] Set DisplayID = 0x%08lx\n", tag
->ti_Data
));
122 if (GetDisplayInfoData(NULL
, (UBYTE
*)&dim
, sizeof(dim
), DTAG_DIMS
, tag
->ti_Data
))
127 val
= dim
.Nominal
.MaxX
- dim
.Nominal
.MinX
+ 1;
128 RawDoFmt("%ld", (RAWARG
)&val
, RAWFMTFUNC_STRING
, buffer
);
129 set(data
->objVisibleW
, MUIA_Text_Contents
, buffer
);
130 val
= dim
.Nominal
.MaxY
- dim
.Nominal
.MinY
+ 1;
131 RawDoFmt("%ld", (RAWARG
)&val
, RAWFMTFUNC_STRING
, buffer
);
132 set(data
->objVisibleH
, MUIA_Text_Contents
, buffer
);
134 RawDoFmt("%d", (RAWARG
)&dim
.MinRasterWidth
, RAWFMTFUNC_STRING
, buffer
);
135 set(data
->objMinimumW
, MUIA_Text_Contents
, buffer
);
136 RawDoFmt("%d", (RAWARG
)&dim
.MinRasterHeight
, RAWFMTFUNC_STRING
, buffer
);
137 set(data
->objMinimumH
, MUIA_Text_Contents
, buffer
);
139 RawDoFmt("%d", (RAWARG
)&dim
.MaxRasterWidth
, RAWFMTFUNC_STRING
, buffer
);
140 set(data
->objMaximumW
, MUIA_Text_Contents
, buffer
);
141 RawDoFmt("%d", (RAWARG
)&dim
.MaxRasterHeight
, RAWFMTFUNC_STRING
, buffer
);
142 set(data
->objMaximumH
, MUIA_Text_Contents
, buffer
);
144 val
= 1 << (dim
.MaxDepth
> 24 ? 24 : dim
.MaxDepth
);
145 RawDoFmt("%ld", (RAWARG
)&val
, RAWFMTFUNC_STRING
, buffer
);
146 set(data
->objMaximumColors
, MUIA_Text_Contents
, buffer
);
149 SetAttrs(self
, MUIA_Disabled
, tag
->ti_Data
== INVALID_ID
, TAG_DONE
);
156 DB2(bug("[smattributes] Calling OM_SET() on superclass\n"));
157 ret
= DoSuperMethodA(CLASS
, self
, (Msg
)message
);
158 DB2(bug("[smattributes] OM_SET() on superclass returned %ld\n", ret
));
164 ScreenModeAttributes
, NULL
, MUIC_Group
, NULL
,
165 OM_NEW
, struct opSet
*,
166 OM_SET
, struct opSet
*