wip layout correction.
[AROS.git] / workbench / tools / SysExplorer / enum_gfx.c
blob1371f5fc1313dfd23f6e9cfc47cc5d3980ea9859
1 /*
2 Copyright (C) 2015-2017, The AROS Development Team.
3 $Id$
4 */
6 #define DEBUG 1
7 #include <aros/debug.h>
9 #include <proto/alib.h>
10 #include <proto/dos.h>
11 #include <proto/exec.h>
12 #include <proto/muimaster.h>
13 #include <proto/oop.h>
14 #include <proto/utility.h>
15 #include <proto/intuition.h>
17 #include <mui/NListtree_mcc.h>
18 #include <mui/NListview_mcc.h>
19 #include <utility/tagitem.h>
20 #include <utility/hooks.h>
22 #include <hidd/gfx.h>
24 #include "locale.h"
25 #include "classes.h"
26 #include "enums.h"
28 OOP_AttrBase HiddGfxAttrBase;
30 const struct OOP_ABDescr gfx_abd[] =
32 {IID_Hidd_Gfx, &HiddGfxAttrBase},
33 {NULL , NULL }
36 static void addGgfxDisplay(OOP_Object *obj, struct MUI_NListtree_TreeNode *parent)
38 struct InsertObjectMsg msg =
40 .obj = obj,
41 .winClass = MonitorWindow_CLASS
43 CONST_STRPTR name;
45 OOP_GetAttr(obj, aHidd_Name, (IPTR *)&name);
47 sysExplGlobalCount++;
48 DoMethod(hidd_tree, MUIM_NListtree_Insert, name, &msg,
49 parent, MUIV_NListtree_Insert_PrevNode_Tail, 0);
52 void gfxEnum(OOP_Object *obj, struct MUI_NListtree_TreeNode *tn)
54 OOP_Object *display = NULL;
55 struct List *displays = NULL;
57 D(bug("[SysExplorer:Gfx] %s: found '%s'\n", __PRETTY_FUNCTION__, OOP_OCLASS(obj)->ClassNode.ln_Name));
59 /* software rasterizer doesnt have an actual "sidplay" */
60 if (OOP_OCLASS(obj) == OOP_FindClass(CLID_Hidd_Gfx))
61 return;
63 OOP_GetAttr(obj, aHidd_Gfx_DisplayList, (IPTR *)&displays);
64 if (displays)
66 ForeachNode(displays, display)
68 addGgfxDisplay(display, tn);
71 else
73 OOP_GetAttr(obj, aHidd_Gfx_DisplayDefault, (IPTR *)&display);
74 if (display)
75 addGgfxDisplay(display, tn);
79 BOOL gfxValid(OOP_Object *obj, ULONG *flags)
81 if (OOP_OCLASS(obj) == OOP_FindClass(CLID_Hidd_Gfx))
83 ULONG _flags = *flags;
84 _flags &= ~ TNF_LIST;
85 *flags = _flags;
87 return TRUE;
90 BOOL gfxenum_init(void)
92 D(bug("[SysExplorer:Gfx] Initialising..\n"));
94 OOP_ObtainAttrBases(gfx_abd);
95 RegisterClassHandler(CLID_Hidd_Gfx, 60, &GfxWindow_CLASS, gfxEnum, gfxValid);
97 return TRUE;
100 ADD2INIT(gfxenum_init, 10);