Archeus 0.0.0
A C library and game engine that focuses on documentation
Loading...
Searching...
No Matches
view.c File Reference
#include "arc/console/view.h"
#include "key.h"
#include "arc/console/element.h"
#include "arc/std/bool.h"
#include "arc/std/errno.h"
#include "arc/std/vector.h"
#include "arc/std/string.h"
#include <locale.h>
#include <ncurses.h>
#include <stdlib.h>

Go to the source code of this file.

Data Structures

struct  ARC_ConsoleView
 

Functions

void ARC_ConsoleView_Create (ARC_ConsoleView **view, ARC_Rect bounds)
 creates ARC_ConsoleView type
 
void ARC_ConsoleView_Destroy (ARC_ConsoleView *ncurses)
 destroys ARC_ConsoleView type
 
void ARC_ConsoleView_AddElement (ARC_ConsoleView *view, ARC_ConsoleElement *element)
 adds an ARC_ConsoleElement to the ARC_ConsoleView type
 
void ARC_ConsoleView_RemoveElement (ARC_ConsoleView *view, uint32_t index)
 
void ARC_ConsoleView_Clear (ARC_ConsoleView *view)
 
void ARC_ConsoleView_RenderCharAt (ARC_ConsoleView *view, char character, ARC_Point pos)
 
void ARC_ConsoleView_RenderWCharAt (ARC_ConsoleView *view, wchar_t character, ARC_Point pos)
 
void ARC_ConsoleView_RenderKeyAt (ARC_ConsoleView *view, ARC_ConsoleKey key, ARC_Point pos)
 
void ARC_ConsoleView_RenderUint32At (ARC_ConsoleView *view, uint32_t uint32, ARC_Point pos)
 
void ARC_ConsoleView_RenderStringAt (ARC_ConsoleView *view, ARC_String *text, ARC_Point pos)
 
void ARC_ConsoleView_RenderCStringWithStrlenAt (ARC_ConsoleView *view, char *cstr, ARC_Point pos)
 
void ARC_ConsoleView_RenderRect (ARC_ConsoleView *view, ARC_Rect bounds)
 
void ARC_ConsoleView_RenderElements (ARC_ConsoleView *view)
 
ARC_Rect ARC_ConsoleView_GetBounds (ARC_ConsoleView *view)
 gets the bounds of an ARC_ConsoleView
 
ARC_ConsoleElementARC_ConsoleView_GetElement (ARC_ConsoleView *view, uint32_t index)
 adds an ARC_ConsoleElement to the ARC_ConsoleView type
 
char ARC_ConsoleView_GetChar (ARC_ConsoleView *view)
 gets a char from the view
 
char ARC_ConsoleView_GetCharAt (ARC_ConsoleView *view, ARC_Point pos)
 gets a char from the view at a position
 
ARC_ConsoleKey ARC_ConsoleView_GetConsoleKeyAt (ARC_ConsoleView *view, ARC_Point pos)
 gets a console key from the view at a position
 
ARC_ConsoleKeyARC_ConsoleView_GetCreateConsoleKeyAt (ARC_ConsoleView *view, ARC_Point pos)
 gets and creates a console key from the view at a position
 
ARC_StringARC_ConsoleView_GetStringInput (ARC_ConsoleView *view, ARC_Point pos, ARC_ConsoleView_OverrideCharInputFn *overrideCharInputFn, void *userdata)
 gets a ARC_String from the view at a position
 
void ARC_ConsoleView_SetCursorVisibility (ARC_ConsoleView *view, uint8_t visibility)
 sets a visibility of the cursor with an ARC_ConsoleView
 
void ARC_ConsoleView_SetBorder (ARC_ConsoleView *view, uint32_t border)
 sets a border on the ARC_ConsoleView
 
void ARC_ConsoleView_SetAttribute (ARC_ConsoleView *view, uint32_t attribute)
 sets a border on the ARC_ConsoleView
 

Variables

uint8_t arc_ncurses_win_size = 0
 

Function Documentation

◆ ARC_ConsoleView_AddElement()

void ARC_ConsoleView_AddElement ( ARC_ConsoleView * view,
ARC_ConsoleElement * element )

adds an ARC_ConsoleElement to the ARC_ConsoleView type

Note
the elements position will be based on the ARC_ConsoleView which might mess up how it looks
Parameters
view
elment

Definition at line 76 of file view.c.

76 {
77 ARC_Vector_Add(view->elements, (void *)element);
78}
ARC_Vector * elements
Definition view.c:20
void ARC_Vector_Add(ARC_Vector *vector, void *data)
adds an item to an ARC_Vector
Definition vector.c:70

References ARC_Vector_Add(), and ARC_ConsoleView::elements.

◆ ARC_ConsoleView_Clear()

void ARC_ConsoleView_Clear ( ARC_ConsoleView * view)
Parameters
view
index

Definition at line 84 of file view.c.

84 {
85 wclear(view->window);
86 wrefresh(view->window);
87}
WINDOW * window
Definition view.c:16

References ARC_ConsoleView::window.

◆ ARC_ConsoleView_Create()

void ARC_ConsoleView_Create ( ARC_ConsoleView ** view,
ARC_Rect bounds )

creates ARC_ConsoleView type

Parameters
viewARC_ConsoleView to create
boundsthe bounds of the window, if bounds.w == 0 or bounds.h == 0, bounds will take up the entire screen

Definition at line 23 of file view.c.

23 {
24 if(arc_ncurses_win_size == ~(uint8_t)0){
26 ARC_DEBUG_ERR("ARC_NCurses_Create(ncurses), max num of ARC_NCurses have been created, consider making arc_ncurses_win_size a uint32_t to increase the max");
27 *view = NULL;
28 return;
29 }
30
31 //if this is the first ncurses, init ncurses
32 if(arc_ncurses_win_size == 0){
33 setlocale(LC_ALL, "");
34 initscr();
35 //start_color();
36 cbreak();
37 keypad(stdscr, TRUE);
38 refresh();
39 }
40
41 *view = (ARC_ConsoleView *)malloc(sizeof(ARC_ConsoleView));
42
43 ARC_Rect viewBounds = { 0, 0, COLS, LINES };
44 if(bounds.w != 0 && bounds.h != 0){
45 viewBounds = bounds;
46 }
47
48 (*view)->window = newwin(viewBounds.h, viewBounds.w, viewBounds.y, viewBounds.x);
49 (*view)->bounds = viewBounds;
50
51 keypad((*view)->window, TRUE);
52
53 noecho();
54 (*view)->echo = false;
55
56 ARC_Vector_Create(&(*view)->elements);
57
58 wrefresh((*view)->window);
59
61}
uint8_t arc_ncurses_win_size
Definition view.c:13
int32_t arc_errno
Definition errno.c:5
#define ARC_ERRNO_OVERFLOW
Definition errno.h:10
int32_t x
Definition rectangle.h:13
int32_t w
Definition rectangle.h:15
int32_t y
Definition rectangle.h:14
int32_t h
Definition rectangle.h:16
void ARC_Vector_Create(ARC_Vector **vector, ARC_Vector_CompareDataFn *compareDataFn, ARC_Vector_DestroyDataFn *destroyDataFn)
creates an ARC_Vector which is an "expandable" array
Definition vector.c:31

References arc_errno, ARC_ERRNO_OVERFLOW, arc_ncurses_win_size, ARC_Vector_Create(), ARC_Rect::h, ARC_Rect::w, ARC_Rect::x, and ARC_Rect::y.

◆ ARC_ConsoleView_Destroy()

void ARC_ConsoleView_Destroy ( ARC_ConsoleView * view)

destroys ARC_ConsoleView type

Parameters
viewARC_ConsoleView to destroy

Definition at line 63 of file view.c.

63 {
65
67
68 delwin(ncurses->window);
69 free(ncurses);
70
71 if(arc_ncurses_win_size == 0){
72 endwin();
73 }
74}
void ARC_Vector_Destroy(ARC_Vector *vector)
destroys an ARC_Vector
Definition vector.c:54

References arc_ncurses_win_size, ARC_Vector_Destroy(), ARC_ConsoleView::elements, and ARC_ConsoleView::window.

◆ ARC_ConsoleView_GetBounds()

ARC_Rect ARC_ConsoleView_GetBounds ( ARC_ConsoleView * view)

gets the bounds of an ARC_ConsoleView

Parameters
viewARC_ConsoleView to get bounds from
Returns
the bounds of the ARC_ConsoleView

Definition at line 147 of file view.c.

147 {
148 return view->bounds;
149}
ARC_Rect bounds
Definition view.c:17

References ARC_ConsoleView::bounds.

Referenced by ARC_ConsoleBuffer_Render(), and ARC_ConsoleBuffer_RenderSection().

◆ ARC_ConsoleView_GetChar()

char ARC_ConsoleView_GetChar ( ARC_ConsoleView * view)

gets a char from the view

Note
use ARC_ConsoleView_GetInt32At if you want to check for direction key or special character input
Parameters
viewthe ARC_ConsoleView to get the char from

Definition at line 155 of file view.c.

155 {
156 return wgetch(view->window);
157}

References ARC_ConsoleView::window.

◆ ARC_ConsoleView_GetCharAt()

char ARC_ConsoleView_GetCharAt ( ARC_ConsoleView * view,
ARC_Point pos )

gets a char from the view at a position

Note
use ARC_ConsoleView_GetInt32At if you want to check for direction key or special character input
Parameters
viewthe ARC_ConsoleView to get the char from
posthe positiion to get the char at

Definition at line 159 of file view.c.

159 {
160 return mvwgetch(view->window, pos.y, pos.x);
161}
int32_t y
Definition point.h:12
int32_t x
Definition point.h:11

References ARC_ConsoleView::window, ARC_Point::x, and ARC_Point::y.

◆ ARC_ConsoleView_GetConsoleKeyAt()

ARC_ConsoleKey ARC_ConsoleView_GetConsoleKeyAt ( ARC_ConsoleView * view,
ARC_Point pos )

gets a console key from the view at a position

Note
you most likely do not want to use this function outside of a backend as ARC_ConsoleKey is defined within the console backend
Parameters
viewthe ARC_ConsoleView to get the console key from
posthe positiion to get the console key at
Returns
a console key

Definition at line 163 of file view.c.

163 {
164 return (ARC_ConsoleKey){ mvwgetch(view->window, pos.y, pos.x) };
165}

References ARC_ConsoleView::window, ARC_Point::x, and ARC_Point::y.

Referenced by ARC_ConsoleView_GetStringInput().

◆ ARC_ConsoleView_GetCreateConsoleKeyAt()

ARC_ConsoleKey * ARC_ConsoleView_GetCreateConsoleKeyAt ( ARC_ConsoleView * view,
ARC_Point pos )

gets and creates a console key from the view at a position

Note
the given ARC_ConsoleKey needs to be destroyed
use ARC_ConsoleView_GetConsoleKeyAt if you want to check for keyboard or special character input
Parameters
viewthe ARC_ConsoleView to get the console key from
posthe positiion to get the console key at
Returns
a console key

Definition at line 167 of file view.c.

167 {
168 ARC_ConsoleKey *key;
169 ARC_ConsoleKey_Create(&key, NULL);
170 key->key = mvwgetch(view->window, pos.y, pos.x);
171 return key;
172}
void ARC_ConsoleKey_Create(ARC_ConsoleKey **consoleKey, ARC_ConsoleKey_Key *key)
Definition key.c:7
int32_t key
Definition key.h:12

References ARC_ConsoleKey_Create(), ARC_ConsoleKeyType::key, ARC_ConsoleView::window, ARC_Point::x, and ARC_Point::y.

◆ ARC_ConsoleView_GetElement()

ARC_ConsoleElement * ARC_ConsoleView_GetElement ( ARC_ConsoleView * view,
uint32_t index )

adds an ARC_ConsoleElement to the ARC_ConsoleView type

Note
the elements position will be based on the ARC_ConsoleView which might mess up how it looks
Parameters
view
index

Definition at line 151 of file view.c.

151 {
152 return (ARC_ConsoleElement *)ARC_Vector_Get(view->elements, index);
153}
void * ARC_Vector_Get(ARC_Vector *vector, uint32_t index)
gets an item from an ARC_Vector at a position index
Definition vector.c:153

References ARC_Vector_Get(), and ARC_ConsoleView::elements.

◆ ARC_ConsoleView_GetStringInput()

ARC_String * ARC_ConsoleView_GetStringInput ( ARC_ConsoleView * view,
ARC_Point pos,
ARC_ConsoleView_OverrideCharInputFn * overrideCharInputFn,
void * userdata )

gets a ARC_String from the view at a position

Parameters
viewthe ARC_ConsoleView to get the string from
posthe positiion to get the string at
overrideCharInputFna function to allow overriding what happens when inputing chars, can be NULL
userdatadata that a user can pass to use within the overrideCharInputFn

Definition at line 174 of file view.c.

174 {
175 noecho();
176
177 uint32_t cstringSize = view->bounds.w - pos.x;
178 char cstring[view->bounds.w - pos.x];
179
181 uint32_t index = 0;
182 while(temp.key != '\n'){
183 //store the last size to be able to clear efficeintly
184 uint32_t lastSize = index;
185
186 //if override function exists and it overrode the current char
187 if(overrideCharInputFn != NULL && (*overrideCharInputFn)(&temp, cstring, &index, cstringSize, userdata)){
188 for(uint32_t i = 0; i < lastSize; i++){
189 ARC_ConsoleView_RenderCharAt(view, ' ', (ARC_Point){ pos.x + i, pos.y });
190 }
191
192 for(uint32_t i = 0; i < index; i++){
193 ARC_ConsoleView_RenderCharAt(view, cstring[i], (ARC_Point){ pos.x + i, pos.y });
194 }
195
196 temp = ARC_ConsoleView_GetConsoleKeyAt(view, (ARC_Point){ pos.x + index, pos.y });
197 continue;
198 }
199
200 if(temp.key == KEY_BACKSPACE || temp.key == KEY_DC || temp.key == 127){
201 if(index == 0){
202 temp = ARC_ConsoleView_GetConsoleKeyAt(view, (ARC_Point){ pos.x + index, pos.y });
203 continue;
204 }
205
206 index--;
207 ARC_ConsoleView_RenderCharAt(view, ' ', (ARC_Point){ pos.x + index, pos.y });
208 cstring[index] = '\0';
209 temp = ARC_ConsoleView_GetConsoleKeyAt(view, (ARC_Point){ pos.x + index, pos.y });
210 continue;
211 }
212
213 if(index < (view->bounds.w - 1) - pos.x){
214 ARC_ConsoleView_RenderCharAt(view, (char)(temp.key), (ARC_Point){ pos.x + index, pos.y });
215 cstring[index] = (char)(temp.key);
216 index++;
217 }
218
219 temp = ARC_ConsoleView_GetConsoleKeyAt(view, (ARC_Point){ pos.x + index, pos.y });
220 }
221
222 if(view->echo){
223 echo();
224 }
225
226 if(index == 0){
227 return NULL;
228 }
229
230 ARC_String *string;
231 ARC_String_Create(&string, cstring, index);
232 return string;
233}
void ARC_ConsoleView_RenderCharAt(ARC_ConsoleView *view, char character, ARC_Point pos)
Definition view.c:89
ARC_ConsoleKey ARC_ConsoleView_GetConsoleKeyAt(ARC_ConsoleView *view, ARC_Point pos)
gets a console key from the view at a position
Definition view.c:163
void ARC_String_Create(ARC_String **string, char *data, uint64_t length)
creates ARC_String type
Definition string.c:9
ARC_Bool echo
Definition view.c:18
substring position within a string
Definition string.h:14

References ARC_ConsoleView_GetConsoleKeyAt(), ARC_ConsoleView_RenderCharAt(), ARC_String_Create(), ARC_ConsoleView::bounds, ARC_ConsoleView::echo, ARC_ConsoleKeyType::key, ARC_Rect::w, ARC_Point::x, and ARC_Point::y.

◆ ARC_ConsoleView_RemoveElement()

void ARC_ConsoleView_RemoveElement ( ARC_ConsoleView * view,
uint32_t index )
Parameters
view
index

Definition at line 80 of file view.c.

80 {
81 ARC_Vector_RemoveIndex(view->elements, index);
82}
void ARC_Vector_RemoveIndex(ARC_Vector *vector, uint32_t index)
removes an item from an ARC_Vector at an index
Definition vector.c:110

References ARC_Vector_RemoveIndex(), and ARC_ConsoleView::elements.

◆ ARC_ConsoleView_RenderCharAt()

void ARC_ConsoleView_RenderCharAt ( ARC_ConsoleView * view,
char character,
ARC_Point pos )
Parameters
view
character
pos

Definition at line 89 of file view.c.

89 {
90 mvwprintw(view->window, pos.y, pos.x, "%c", character);
91 wrefresh(view->window);
92}

References ARC_ConsoleView::window, ARC_Point::x, and ARC_Point::y.

Referenced by ARC_ConsoleView_GetStringInput().

◆ ARC_ConsoleView_RenderCStringWithStrlenAt()

void ARC_ConsoleView_RenderCStringWithStrlenAt ( ARC_ConsoleView * view,
char * cstr,
ARC_Point pos )
Parameters
view
text
pos

Definition at line 114 of file view.c.

114 {
115 mvwprintw(view->window, pos.y, pos.x, "%s", cstr);
116 wrefresh(view->window);
117}

References ARC_ConsoleView::window, ARC_Point::x, and ARC_Point::y.

◆ ARC_ConsoleView_RenderElements()

void ARC_ConsoleView_RenderElements ( ARC_ConsoleView * view)
Parameters
view

Definition at line 139 of file view.c.

139 {
140 for(uint32_t i = 0; i < ARC_Vector_Size(view->elements); i++){
142 element->renderFn(view, element);
143 wrefresh(view->window);
144 }
145}
ARC_ConsoleElement_RenderFn renderFn
Definition element.h:34

References ARC_Vector_Get(), ARC_ConsoleView::elements, ARC_ConsoleElement::renderFn, and ARC_ConsoleView::window.

◆ ARC_ConsoleView_RenderKeyAt()

void ARC_ConsoleView_RenderKeyAt ( ARC_ConsoleView * view,
ARC_ConsoleKey key,
ARC_Point pos )
Parameters
view
key
pos

Definition at line 99 of file view.c.

99 {
100 mvwprintw(view->window, pos.y, pos.x, "%c", (char)key.key);
101 wrefresh(view->window);
102}

References ARC_ConsoleKeyType::key, ARC_ConsoleView::window, ARC_Point::x, and ARC_Point::y.

◆ ARC_ConsoleView_RenderRect()

void ARC_ConsoleView_RenderRect ( ARC_ConsoleView * view,
ARC_Rect bounds )
Parameters
view
bounds

Definition at line 119 of file view.c.

119 {
120 //render corners
121 ARC_ConsoleView_RenderWCharAt(view, L'┌', (ARC_Point){ bounds.x, bounds.y });
122 ARC_ConsoleView_RenderWCharAt(view, L'└', (ARC_Point){ bounds.x, (bounds.h - 1) + bounds.y });
123 ARC_ConsoleView_RenderWCharAt(view, L'┐', (ARC_Point){ (bounds.w - 1) + bounds.x, bounds.y });
124 ARC_ConsoleView_RenderWCharAt(view, L'┘', (ARC_Point){ (bounds.w - 1) + bounds.x, (bounds.h - 1) + bounds.y });
125
126 //render virticle lines
127 for(int32_t x = 1; x < bounds.w - 1; x++){
128 ARC_ConsoleView_RenderWCharAt(view, L'─', (ARC_Point){ bounds.x + x, bounds.y });
129 ARC_ConsoleView_RenderWCharAt(view, L'─', (ARC_Point){ bounds.x + x, (bounds.h - 1) + bounds.y });
130 }
131
132 //render horizontal lines
133 for(int32_t y = 1; y < bounds.h - 1; y++){
134 ARC_ConsoleView_RenderWCharAt(view, L'│', (ARC_Point){ bounds.x, bounds.y + y });
135 ARC_ConsoleView_RenderWCharAt(view, L'│', (ARC_Point){ (bounds.w - 1) + bounds.x, bounds.y + y });
136 }
137}
void ARC_ConsoleView_RenderWCharAt(ARC_ConsoleView *view, wchar_t character, ARC_Point pos)
Definition view.c:94

References ARC_ConsoleView_RenderWCharAt(), ARC_Rect::h, ARC_Rect::w, ARC_Rect::x, and ARC_Rect::y.

◆ ARC_ConsoleView_RenderStringAt()

void ARC_ConsoleView_RenderStringAt ( ARC_ConsoleView * view,
ARC_String * text,
ARC_Point pos )
Parameters
view
text
pos

Definition at line 109 of file view.c.

109 {
110 mvwprintw(view->window, pos.y, pos.x, "%s", text->data);
111 wrefresh(view->window);
112}
char * data
Definition string.h:15

References ARC_String::data, ARC_ConsoleView::window, ARC_Point::x, and ARC_Point::y.

Referenced by ARC_ConsoleBuffer_Render(), ARC_ConsoleBuffer_RenderSection(), and ARC_ConsoleElement_DefaultRenderFn().

◆ ARC_ConsoleView_RenderUint32At()

void ARC_ConsoleView_RenderUint32At ( ARC_ConsoleView * view,
uint32_t uint32,
ARC_Point pos )
Parameters
view
uint32
pos

Definition at line 104 of file view.c.

104 {
105 mvwprintw(view->window, pos.y, pos.x, "%d", uint32);
106 wrefresh(view->window);
107}

References ARC_ConsoleView::window, ARC_Point::x, and ARC_Point::y.

◆ ARC_ConsoleView_RenderWCharAt()

void ARC_ConsoleView_RenderWCharAt ( ARC_ConsoleView * view,
wchar_t character,
ARC_Point pos )
Parameters
view
character
pos

Definition at line 94 of file view.c.

94 {
95 mvwprintw(view->window, pos.y, pos.x, "%lc", character);
96 wrefresh(view->window);
97}

References ARC_ConsoleView::window, ARC_Point::x, and ARC_Point::y.

Referenced by ARC_ConsoleView_RenderRect().

◆ ARC_ConsoleView_SetAttribute()

void ARC_ConsoleView_SetAttribute ( ARC_ConsoleView * view,
uint32_t attribute )

sets a border on the ARC_ConsoleView

Parameters
viewARC_ConsoleView to set border to
borderThe border to set

Definition at line 259 of file view.c.

259 {
260 switch(attribute){
262 wattroff(view->window, A_REVERSE);
263 break;
265 wattron(view->window, A_REVERSE);
266 break;
267 }
268}
#define ARC_CONSOLE_VIEW_ATTRIBUTE_REVERSE
Definition view.h:253
#define ARC_CONSOLE_VIEW_ATTRIBUTE_NONE
border options
Definition view.h:252

References ARC_CONSOLE_VIEW_ATTRIBUTE_NONE, ARC_CONSOLE_VIEW_ATTRIBUTE_REVERSE, and ARC_ConsoleView::window.

Referenced by ARC_ConsoleElement_DefaultRenderFn().

◆ ARC_ConsoleView_SetBorder()

void ARC_ConsoleView_SetBorder ( ARC_ConsoleView * view,
uint32_t border )

sets a border on the ARC_ConsoleView

Parameters
viewARC_ConsoleView to set border to
borderThe border to set

Definition at line 246 of file view.c.

246 {
247 switch(border){
249 wborder(view->window, ' ', ' ', ' ',' ',' ',' ',' ',' ');
250 break;
252 box(view->window, 0, 0);
253 break;
254 }
255
256 wrefresh(view->window);
257}
#define ARC_CONSOLE_VIEW_BORDER_NONE
border options
Definition view.h:238
#define ARC_CONSOLE_VIEW_BORDER_DEFAULT
Definition view.h:239

References ARC_CONSOLE_VIEW_BORDER_DEFAULT, ARC_CONSOLE_VIEW_BORDER_NONE, and ARC_ConsoleView::window.

◆ ARC_ConsoleView_SetCursorVisibility()

void ARC_ConsoleView_SetCursorVisibility ( ARC_ConsoleView * view,
uint8_t visibility )

sets a visibility of the cursor with an ARC_ConsoleView

Parameters
viewARC_ConsoleView to set mouse visibility
visibilitythe visibility to set

Definition at line 235 of file view.c.

235 {
236 switch(visibility){
238 curs_set(0);
239 break;
241 curs_set(1);
242 break;
243 }
244}
#define ARC_CONSOLE_VIEW_CURSOR_HIDDEN
mouse options
Definition view.h:224
#define ARC_CONSOLE_VIEW_CURSOR_VISIBLE
Definition view.h:225

References ARC_CONSOLE_VIEW_CURSOR_HIDDEN, and ARC_CONSOLE_VIEW_CURSOR_VISIBLE.

Variable Documentation

◆ arc_ncurses_win_size

uint8_t arc_ncurses_win_size = 0

Definition at line 13 of file view.c.

Referenced by ARC_ConsoleView_Create(), and ARC_ConsoleView_Destroy().