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 * Win32 ScritchUI Implementation internals.
16 #ifndef SQUIRRELJME_WIN32INTERN_H
17 #define SQUIRRELJME_WIN32INTERN_H
21 #ifndef SJME_CXX_IS_EXTERNED
22 #define SJME_CXX_IS_EXTERNED
23 #define SJME_CXX_SQUIRRELJME_WIN32INTERN_H
26 #endif /* #ifdef SJME_CXX_IS_EXTERNED */
27 #endif /* #ifdef __cplusplus */
29 /*--------------------------------------------------------------------------*/
32 * Calls @c GetLastError() and translates the error code.
34 * @param inState The input state.
35 * @param ifOkay The value to return if there is no error.
36 * @return The last error code as a SquirrelJME error.
39 typedef sjme_errorCode (*sjme_scritchui_win32_intern_getLastErrorFunc
)(
40 sjme_attrInNotNull sjme_scritchui inState
,
41 sjme_attrInValue sjme_errorCode ifOkay
);
44 * Recovers the component that belongs to a @c HWND .
46 * @param inState The input state.
47 * @param hWnd The window to get the component from, if this is
48 * the value @c NULL then @c outComponent will be set to @c NULL .
49 * @param outComponent The resultant component.
50 * @return Any resultant error, if any.
53 typedef sjme_errorCode (*sjme_scritchui_win32_intern_recoverComponentFunc
)(
54 sjme_attrInNotNull sjme_scritchui inState
,
55 sjme_attrInNullable HWND hWnd
,
56 sjme_attrOutNullable sjme_scritchui_uiComponent
* outComponent
);
59 * Internal window procedure handler.
61 * @param inState The ScritchUI state.
62 * @param hWnd The window that generated the message.
63 * @param message The message type.
64 * @param wParam The upper value.
65 * @param lParam The lower value.
66 * @param lResult Option value where lresult goes.
67 * @return Any resultant error, if any.
70 typedef sjme_errorCode (*sjme_scritchui_win32_intern_windowProcFunc
)(
71 sjme_attrInNotNull sjme_scritchui inState
,
72 sjme_attrInNullable HWND hWnd
,
73 sjme_attrInValue UINT message
,
74 sjme_attrInValue WPARAM wParam
,
75 sjme_attrInValue LPARAM lParam
,
76 sjme_attrOutNullable LRESULT
* lResult
);
78 struct sjme_scritchui_implInternFunctions
80 /** Translates the last error code to SquirrelJME errors. */
81 sjme_scritchui_win32_intern_getLastErrorFunc getLastError
;
83 /** Recovers the component that belongs to a @c HWND . */
84 sjme_scritchui_win32_intern_recoverComponentFunc recoverComponent
;
86 /** Window process handling. */
87 sjme_scritchui_win32_intern_windowProcFunc windowProc
;
89 /** Direct Win32 window processor. */
90 void* windowProcWin32
;
93 sjme_errorCode
sjme_scritchui_win32_intern_getLastError(
94 sjme_attrInNotNull sjme_scritchui inState
,
95 sjme_attrInValue sjme_errorCode ifOkay
);
97 sjme_errorCode
sjme_scritchui_win32_intern_recoverComponent(
98 sjme_attrInNotNull sjme_scritchui inState
,
99 sjme_attrInNullable HWND hWnd
,
100 sjme_attrOutNullable sjme_scritchui_uiComponent
* outComponent
);
102 sjme_errorCode
sjme_scritchui_win32_intern_windowProc(
103 sjme_attrInNotNull sjme_scritchui inState
,
104 sjme_attrInNullable HWND hWnd
,
105 sjme_attrInValue UINT message
,
106 sjme_attrInValue WPARAM wParam
,
107 sjme_attrInValue LPARAM lParam
,
108 sjme_attrOutNullable LRESULT
* lResult
);
110 /*--------------------------------------------------------------------------*/
114 #ifdef SJME_CXX_SQUIRRELJME_WIN32INTERN_H
116 #undef SJME_CXX_SQUIRRELJME_WIN32INTERN_H
117 #undef SJME_CXX_IS_EXTERNED
118 #endif /* #ifdef SJME_CXX_SQUIRRELJME_WIN32INTERN_H */
119 #endif /* #ifdef __cplusplus */
121 #endif /* SQUIRRELJME_WIN32INTERN_H */