grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / tools / SysExplorer / enum_gfx.c
blobc1763039cbe3e122b7c1374e9f60d20ead984aa5
1 /*
2 Copyright (C) 2015, 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/graphics.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 DoMethod(hidd_tree, MUIM_NListtree_Insert, name, &msg,
48 parent, MUIV_NListtree_Insert_PrevNode_Tail, 0);
51 void gfxEnum(OOP_Object *obj, struct MUI_NListtree_TreeNode *tn)
53 OOP_Object *display = NULL;
54 struct List *displays = NULL;
56 D(bug("[SysExplorer:Gfx] %s: found '%s'\n", __PRETTY_FUNCTION__, OOP_OCLASS(obj)->ClassNode.ln_Name));
58 /* software rasterizer doesnt have an actual "sidplay" */
59 if (OOP_OCLASS(obj) == OOP_FindClass(CLID_Hidd_Gfx))
60 return;
62 OOP_GetAttr(obj, aHidd_Gfx_DisplayList, (IPTR *)&displays);
63 if (displays)
65 ForeachNode(displays, display)
67 addGgfxDisplay(display, tn);
70 else
72 OOP_GetAttr(obj, aHidd_Gfx_DisplayDefault, (IPTR *)&display);
73 if (display)
74 addGgfxDisplay(display, tn);
78 BOOL gfxValid(OOP_Object *obj, ULONG *flags)
80 if (OOP_OCLASS(obj) == OOP_FindClass(CLID_Hidd_Gfx))
82 ULONG _flags = *flags;
83 _flags &= ~ TNF_LIST;
84 *flags = _flags;
86 return TRUE;
89 BOOL gfxenum_init(void)
91 D(bug("[SysExplorer:Gfx] Initialising..\n"));
93 OOP_ObtainAttrBases(gfx_abd);
94 RegisterClassHandler(CLID_Hidd_Gfx, 60, &GfxWindow_CLASS, gfxEnum, gfxValid);
96 return TRUE;
99 ADD2INIT(gfxenum_init, 10);