Always have fallback element colors; Remove annotations from native method as there...
[SquirrelJME.git] / nanocoat / lib / scritchui / scritchList.c
blobc04bab67f75481522f1373c66a9dba31323429a1
1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // -------------------------------------------------------------------------*/
10 #include <string.h>
12 #include "lib/scritchui/scritchuiTypes.h"
13 #include "lib/scritchui/core/core.h"
14 #include "sjme/alloc.h"
15 #include "lib/scritchui/core/coreGeneric.h"
17 static sjme_errorCode sjme_scritchui_core_listNewWrap(
18 sjme_attrInNotNull sjme_scritchui inState,
19 sjme_attrInNotNull sjme_scritchui_uiList inList,
20 sjme_attrInNotNull const sjme_scritchui_impl_initParamList* init)
22 if (inState == NULL || inList == NULL || init == NULL)
23 return SJME_ERROR_NULL_ARGUMENTS;
25 /* Set list type. */
26 inList->choice.type = init->type;
28 /* Final forward. */
29 return inState->impl->listNew(inState, inList, init);
32 sjme_errorCode sjme_scritchui_core_listNew(
33 sjme_attrInNotNull sjme_scritchui inState,
34 sjme_attrInOutNotNull sjme_scritchui_uiList* outList,
35 sjme_attrInValue sjme_scritchui_choiceType inChoiceType)
37 sjme_scritchui_impl_initParamList init;
39 if (inState == NULL || outList == NULL)
40 return SJME_ERROR_NULL_ARGUMENTS;
42 if (inChoiceType < 0 || inChoiceType >= SJME_SCRITCHUI_NUM_CHOICE_TYPES)
43 return SJME_ERROR_INVALID_ARGUMENT;
45 if (inState->impl->listNew == NULL)
46 return sjme_error_notImplemented(0);
48 /* Setup initialization data. */
49 memset(&init, 0, sizeof(init));
50 init.type = inChoiceType;
52 /* Use generic function. */
53 return sjme_scritchui_coreGeneric_componentNew(inState,
54 (sjme_scritchui_uiComponent*)outList,
55 sizeof(**outList),
56 SJME_SCRITCHUI_TYPE_LIST,
57 (sjme_scritchui_coreGeneric_componentNewImplFunc)
58 sjme_scritchui_core_listNewWrap,
59 &init);