1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
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 // -------------------------------------------------------------------------*/
11 * Generic core functions.
16 #ifndef SQUIRRELJME_COREGENERIC_H
17 #define SQUIRRELJME_COREGENERIC_H
19 #include "lib/scritchui/scritchui.h"
20 #include "lib/scritchui/scritchuiTypes.h"
24 #ifndef SJME_CXX_IS_EXTERNED
25 #define SJME_CXX_IS_EXTERNED
26 #define SJME_CXX_SQUIRRELJME_COREGENERIC_H
29 #endif /* #ifdef SJME_CXX_IS_EXTERNED */
30 #endif /* #ifdef __cplusplus */
32 /*--------------------------------------------------------------------------*/
35 * Base function for common initialization logic.
37 * @param inState The input state.
38 * @param inCommon The common item to be initialized.
39 * @param inData Any data to use for initialization.
40 * @return Any resultant error, if any.
43 typedef sjme_errorCode (*sjme_scritchui_coreGeneric_commonNewImplFunc
)(
44 sjme_attrInNotNull sjme_scritchui inState
,
45 sjme_attrInNotNull sjme_scritchui_uiCommon inCommon
,
46 sjme_attrInNullable sjme_pointer inData
);
49 * Base function for component initialization logic.
51 * @param inState The input state.
52 * @param inCommon The component item to be initialized.
53 * @param inData Any data to use for initialization.
54 * @return Any resultant error, if any.
57 typedef sjme_errorCode (*sjme_scritchui_coreGeneric_componentNewImplFunc
)(
58 sjme_attrInNotNull sjme_scritchui inState
,
59 sjme_attrInNotNull sjme_scritchui_uiComponent inComponent
,
60 sjme_attrInNullable sjme_pointer inData
);
63 * Basic core common initialization logic.
65 * @param inState The input state.
66 * @param outCommon The resultant common.
67 * @param outCommonSize The size of the resultant common.
68 * @param uiType The UI type to initialize.
69 * @param implNew The implementation new for this type.
70 * @param inData Any data to pass to @c implNew .
71 * @return Any resultant error, if any.
74 sjme_errorCode
sjme_scritchui_coreGeneric_commonNew(
75 sjme_attrInNotNull sjme_scritchui inState
,
76 sjme_attrInOutNotNull sjme_scritchui_uiCommon
* outCommon
,
77 sjme_attrInPositiveNonZero sjme_jint outCommonSize
,
78 sjme_attrInRange(0, SJME_NUM_SCRITCHUI_UI_TYPES
)
79 sjme_scritchui_uiType uiType
,
80 sjme_attrInNotNull sjme_scritchui_coreGeneric_commonNewImplFunc implNew
,
81 sjme_attrInNullable sjme_pointer inData
);
84 * Basic core component initialization logic.
86 * @param inState The input state.
87 * @param outComponent The resultant component.
88 * @param outComponentSize The size of the resultant component.
89 * @param uiType The UI type to initialize.
90 * @param implNew The implementation new for this type.
91 * @param inData Any data to pass to @c implNew .
92 * @return Any resultant error, if any.
95 sjme_errorCode
sjme_scritchui_coreGeneric_componentNew(
96 sjme_attrInNotNull sjme_scritchui inState
,
97 sjme_attrInOutNotNull sjme_scritchui_uiComponent
* outComponent
,
98 sjme_attrInPositiveNonZero sjme_jint outComponentSize
,
99 sjme_attrInRange(0, SJME_NUM_SCRITCHUI_UI_TYPES
)
100 sjme_scritchui_uiType uiType
,
101 sjme_attrInNotNull sjme_scritchui_coreGeneric_componentNewImplFunc implNew
,
102 sjme_attrInNullable sjme_pointer inData
);
104 /*--------------------------------------------------------------------------*/
108 #ifdef SJME_CXX_SQUIRRELJME_COREGENERIC_H
110 #undef SJME_CXX_SQUIRRELJME_COREGENERIC_H
111 #undef SJME_CXX_IS_EXTERNED
112 #endif /* #ifdef SJME_CXX_SQUIRRELJME_COREGENERIC_H */
113 #endif /* #ifdef __cplusplus */
115 #endif /* SQUIRRELJME_COREGENERIC_H */