46 #ifndef __D4D_CONSOLE_H
47 #define __D4D_CONSOLE_H
62 #ifndef D4D_CNSL_F_DEFAULT
63 #define D4D_CNSL_F_DEFAULT (D4D_OBJECT_F_VISIBLE | D4D_OBJECT_F_ENABLED | D4D_OBJECT_F_FOCUSRECT | D4D_OBJECT_F_TOUCHENABLE | D4D_OBJECT_F_TABSTOP | D4D_OBJECT_F_MOUSE_NORMAL | D4D_OBJECT_F_BEVEL_DENTED)
68 #ifndef D4D_CNSL_F_SCRLBRS_DEFAULT
69 #define D4D_CNSL_F_SCRLBRS_DEFAULT (D4D_OBJECT_F_ENABLED | D4D_OBJECT_F_TOUCHENABLE | D4D_OBJECT_F_FASTTOUCH | D4D_OBJECT_F_FOCUSRECT | D4D_OBJECT_F_MOUSE_NORMAL | D4D_OBJECT_F_BEVEL_RAISED)
74 #ifndef D4D_CNSL_TXT_PRTY_DEFAULT
75 #define D4D_CNSL_TXT_PRTY_DEFAULT (D4D_ALIGN_H_LEFT_MASK | D4D_ALIGN_V_CENTER_MASK)
80 #ifndef D4D_CNSL_FNT_PRTY_DEFAULT
81 #define D4D_CNSL_FNT_PRTY_DEFAULT ( 0 )
86 #ifndef D4D_CNSL_CURSOR_HEIGHT
87 #define D4D_CNSL_CURSOR_HEIGHT ( 1 )
92 #ifndef D4D_CNSL_STD_TAB_SIZE
93 #define D4D_CNSL_STD_TAB_SIZE ( 8 )
98 #ifndef D4D_CNSL_SCRLBR_WIDTH
99 #define D4D_CNSL_SCRLBR_WIDTH ( 20 )
104 #ifndef D4D_CNSL_SCRLBR_STEP_V
105 #define D4D_CNSL_SCRLBR_STEP_V ( 2 )
110 #ifndef D4D_CNSL_SCRLBR_STEP_H
111 #define D4D_CNSL_SCRLBR_STEP_H ( 8 )
116 #ifndef D4D_CNSL_CURSOR_BLINK_TICK_COUNTER
117 #define D4D_CNSL_CURSOR_BLINK_TICK_COUNTER ( 10 )
124 #define D4D_CNSL_FLAGS_CHECKLINE (0x01)
125 #define D4D_CNSL_FLAGS_REDRAWALL (0x02)
126 #define D4D_CNSL_FLAGS_REDRAWLINE (0x04)
127 #define D4D_CNSL_FLAGS_REDRAWCURSOR (0x10)
128 #define D4D_CNSL_FLAGS_CURSORSTATE (0x20)
151 #define D4D_LIST_BOX_CHILD_SCROLL_BAR_HOR_IX 1
152 #define D4D_LIST_BOX_CHILD_SCROLL_BAR_VER_IX 2
159 #define D4D_GET_CONSOLE(pObj) ((D4D_CONSOLE*)((pObj)->pParam))
160 #define D4D_GET_CONSOLE_DATA(pObj) (D4D_GET_CONSOLE(pObj)->pData)
161 #define D4D_GET_LIST_BOX_SCROLL_BAR_HOR(pObj) ((D4D_OBJECT*)((pObj)->pRelations[D4D_LIST_BOX_CHILD_SCROLL_BAR_HOR_IX]))
162 #define D4D_GET_LIST_BOX_SCROLL_BAR_VER(pObj) ((D4D_OBJECT*)((pObj)->pRelations[D4D_LIST_BOX_CHILD_SCROLL_BAR_VER_IX]))
195 #define _D4D_DECLARE_CONSOLE(type, name, x, y, cx, cy, radius, pMargin, pParent, line_cnt, char_cnt, tabSize, flags, pScheme, fontId, pUser, pOnUsrMsg) \
196 static D4D_CNSL_DATA name##_data = { 0, {0, 0}, 0, 0, 0};\
197 static D4D_TCHAR name##_txtArray[line_cnt][char_cnt + 1];\
198 extern type D4D_OBJECT name##_scrollBarHor;\
199 extern type D4D_OBJECT name##_scrollBarVer;\
200 static const D4D_OBJECT * const name##_relations[] = {pParent, &name##_scrollBarHor, &name##_scrollBarVer, NULL};\
201 static type D4D_CONSOLE name##_params = \
203 (D4D_TCHAR*)&name##_txtArray[0][0], \
204 { char_cnt, line_cnt }, \
210 D4D_DECLARE_OBJECT(type, name, x, y, cx, cy, radius, pMargin, name##_relations, pOnUsrMsg, &d4d_consoleSysFunc, &(name##_params), ((flags) | D4D_OBJECT_F_TIMETICK), pUser, pScheme)\
212 static const D4D_OBJECT* const name##_scrollBarsRelations[] = {&name, NULL};\
214 _D4D_DECLARE_SCROLL_BAR(type, name##_scrollBarHor, D4D_BORDER_WIDTH(flags), (D4D_COOR)(cy - 2*D4D_BORDER_WIDTH(flags) - D4D_CNSL_SCRLBR_WIDTH + 1), (D4D_COOR)(cx - D4D_CNSL_SCRLBR_WIDTH - 2 * D4D_BORDER_WIDTH(flags)), D4D_CNSL_SCRLBR_WIDTH, \
215 radius, NULL, name##_scrollBarsRelations, D4D_CNSL_F_SCRLBRS_DEFAULT, pScheme, (void*)&name, D4D_CnslScrollBarsFeedBack, NULL) \
217 _D4D_DECLARE_SCROLL_BAR(type, name##_scrollBarVer, (D4D_COOR)(cx - D4D_CNSL_SCRLBR_WIDTH - 2 * D4D_BORDER_WIDTH(flags) + 1), D4D_BORDER_WIDTH(flags), D4D_LIST_BOX_SCRLBR_WIDTH, (D4D_COOR)(cy - D4D_LIST_BOX_SCRLBR_WIDTH - 2*D4D_BEVEL_WIDTH),\
218 radius, NULL, name##_scrollBarsRelations, D4D_CNSL_F_SCRLBRS_DEFAULT, pScheme, (void*)&name, D4D_CnslScrollBarsFeedBack, NULL)
241 #define D4D_DECLARE_CONSOLE(name, x, y, cx, cy, line_cnt, char_cnt, tabSize, flags, pScheme, fontId, pUser, pOnUsrMsg) \
242 _D4D_DECLARE_CONSOLE(D4D_CONST, name, x, y, cx, cy, 0, (D4D_MARGIN*)&d4d_marginDefault, NULL, line_cnt, char_cnt, tabSize, flags, pScheme, fontId, pUser, pOnUsrMsg)
260 #define D4D_DECLARE_STD_CONSOLE(name, x, y, cx, cy, line_cnt, char_cnt, fontId) \
261 D4D_DECLARE_CONSOLE(name, x, y, cx, cy, line_cnt, char_cnt, D4D_CNSL_STD_TAB_SIZE, D4D_CNSL_F_DEFAULT, NULL, fontId, NULL, NULL)
285 #define D4D_DECLARE_RCONSOLE(name, x, y, cx, cy, radius, line_cnt, char_cnt, tabSize, flags, pScheme, fontId, pUser, pOnUsrMsg) \
286 _D4D_DECLARE_CONSOLE(D4D_CONST, name, x, y, cx, cy, radius, (D4D_MARGIN*)&d4d_marginDefault, NULL, line_cnt, char_cnt, tabSize, flags, pScheme, fontId, pUser, pOnUsrMsg)
305 #define D4D_DECLARE_STD_RCONSOLE(name, x, y, cx, cy, radius, line_cnt, char_cnt, fontId) \
306 D4D_DECLARE_RCONSOLE(name, x, y, cx, cy, radius, line_cnt, char_cnt, D4D_CNSL_STD_TAB_SIZE, D4D_CNSL_F_DEFAULT, NULL, fontId, NULL, NULL)
313 #define D4D_DECLARE_CONSOLE_INRAM(name, x, y, cx, cy, line_cnt, char_cnt, tabSize, flags, pScheme, fontId, pUser, pOnUsrMsg) \
314 _D4D_DECLARE_CONSOLE(D4D_NO_CONST, name, x, y, cx, cy, 0, (D4D_MARGIN*)&d4d_marginDefault, NULL, line_cnt, char_cnt, tabSize, flags, pScheme, fontId, pUser, pOnUsrMsg)
319 #define D4D_DECLARE_STD_CONSOLE_INRAM(name, x, y, cx, cy, line_cnt, char_cnt, fontId) \
320 D4D_DECLARE_CONSOLE_INRAM(name, x, y, cx, cy, line_cnt, char_cnt, D4D_CNSL_STD_TAB_SIZE, D4D_CNSL_F_DEFAULT, NULL, fontId, NULL, NULL)
326 #define D4D_DECLARE_RCONSOLE_INRAM(name, x, y, cx, cy, radius, line_cnt, char_cnt, tabSize, flags, pScheme, fontId, pUser, pOnUsrMsg) \
327 _D4D_DECLARE_CONSOLE(D4D_NO_CONST, name, x, y, cx, cy, radius, (D4D_MARGIN*)&d4d_marginDefault, NULL, line_cnt, char_cnt, tabSize, flags, pScheme, fontId, pUser, pOnUsrMsg)
332 #define D4D_DECLARE_STD_RCONSOLE_INRAM(name, x, y, cx, cy, radius, line_cnt, char_cnt, fontId) \
333 D4D_DECLARE_RCONSOLE_INRAM(name, x, y, cx, cy, radius, line_cnt, char_cnt, D4D_CNSL_STD_TAB_SIZE, D4D_CNSL_F_DEFAULT, NULL, fontId, NULL, NULL)
D4D_WCHAR D4D_TCHAR
Type definition of eGUI character (it depends on UNICODE setting if this is D4D_CHAR or D4D_WCHAR)...
void D4D_CnslEnsureVisible(D4D_OBJECT_PTR pObj)
The function update automatically the scroll bars to ensure visible position of cursor.
Type definition of eGUI point structure.
void D4D_CnslSetScrollBarPosition(D4D_OBJECT_PTR pObj, D4D_INDEX hor, D4D_INDEX ver)
The function move the scroll bars on to new position if it's applicable.
void D4D_CnslGoToXY(D4D_OBJECT_PTR pObj, D4D_POINT newPosition)
The function move cursor on new position if possible.
void D4D_CnslClearLine(D4D_OBJECT_PTR pObj, D4D_INDEX line)
The function clear one line in console.
D4D_POINT D4D_CnslGetCursor(D4D_OBJECT_PTR pObj)
The function returns the cursor position.
Byte D4D_COOR
Type definition of eGUI coordination variables.
unsigned char Byte
Type definition of Byte (unsigned 8-bit).
D4D_FONT_PROPERTIES fnt_properties
LWord D4D_INDEX
Type definition of eGUI general index variables.
The object main structure type definition.
void D4D_CnslClearAll(D4D_OBJECT_PTR pObj)
The function clear whole console data.
The object system function needed for each object - this is part of D4D_OBJECT main structure...
D4D_POINT D4D_CnslGetScrollBarPosition(D4D_OBJECT_PTR pObj)
The function returns the scroll bars position.
LWord D4D_BOOL
Type definition of eGUI boolean.
Type definition of eGUI size structure.
const D4D_OBJECT_SYS_FUNCTION d4d_consoleSysFunc
D4D_BOOL D4D_CnslPutString(D4D_OBJECT_PTR pObj, D4D_TCHAR *pText)
The function puts string on cursor position and updates cursor.
void D4D_CnslScrollBarsFeedBack(D4D_OBJECT *pThis, D4D_INDEX old_position, D4D_INDEX new_position)
struct D4D_CNSL_DATA_S D4D_CNSL_DATA
D4D_BOOL D4D_CnslPutChar(D4D_OBJECT_PTR pObj, D4D_TCHAR ch)
The function puts one char on cursor position and updates cursor.