Subversion Repositories Kolibri OS

Rev

Rev 7484 | Rev 7486 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1805 yogev_ezra 1
typedef unsigned __int32 Dword;
2
typedef unsigned __int16 Word;
3
typedef unsigned __int8 Byte;
4
//typedef unsigned __int32 size_t;
5
 
6
#define NULL 0
7
 
8
#define MAX_PATH				256
9
 
10
#define FO_READ					0
11
#define FO_WRITE				2
12
 
7484 leency 13
//Process Events
1805 yogev_ezra 14
#define EM_WINDOW_REDRAW		1
15
#define EM_KEY_PRESS			2
7484 leency 16
#define EM_BUTTON_CLICK			3
17
#define EM_APP_CLOSE			4
18
#define EM_DRAW_BACKGROUND		5
19
#define EM_MOUSE_EVENT			6
20
#define EM_IPC					7
21
#define EM_NETWORK				8
22
#define EM_DEBUG				9
1805 yogev_ezra 23
 
24
#define KM_CHARS				0
25
#define KM_SCANS				1
26
 
27
#define WRS_BEGIN				1
28
#define WRS_END					2
29
 
30
#define PROCESS_ID_SELF			-1
31
 
7484 leency 32
//Event mask bits for function 40
7485 leency 33
#define EVM_REDRAW                0b1
34
#define EVM_KEY                  0b10
35
#define EVM_BUTTON              0b100
36
#define EVM_EXIT               0b1000
37
#define EVM_BACKGROUND        0b10000
38
#define EVM_MOUSE            0b100000
39
#define EVM_IPC             0b1000000
40
#define EVM_STACK          0b10000000
41
#define EVM_DEBUG         0b100000000
42
#define EVM_STACK2       0b1000000000
43
#define EVM_MOUSE_FILTER   0x80000000
44
#define EVM_CURSOR_FILTER  0x40000000
7484 leency 45
 
46
//Button options
47
#define BT_DEL      0x80000000
48
#define BT_HIDE     0x40000000
49
#define BT_NOFRAME  0x20000000
50
 
1805 yogev_ezra 51
#define abs(a) (a<0?0-a:a)
52
 
53
 
54
struct kosFileInfo
55
{
56
	Dword rwMode;
57
	Dword OffsetLow;
58
	Dword OffsetHigh;
59
	Dword dataCount;
60
	Byte *bufferPtr;
61
	char fileURL[MAX_PATH];
62
};
63
 
64
 
65
struct RGB
66
{
67
	Byte b;
68
	Byte g;
69
	Byte r;
70
	//
71
	RGB() {};
72
	//
73
	RGB( Dword value )
74
	{
75
		r = value >> 16;
76
		g = value >> 8;
77
		b = value;
78
	};
79
	//
80
	bool operator != ( RGB &another )
81
	{
82
		return this->b != another.b || this->g != another.g || this->r != another.r;
83
	};
84
	//
85
	bool operator == ( RGB &another )
86
	{
87
		return this->b == another.b && this->g == another.g && this->r == another.r;
88
	};
89
};
90
 
91
 
92
union sProcessInfo
93
{
94
	Byte rawData[1024];
95
	struct
96
	{
97
		Dword cpu_usage;
98
		Word window_stack_position;
99
		Word window_stack_value;
100
		Word reserved1;
101
		char process_name[12];
102
		Dword memory_start;
103
		Dword used_memory;
104
		Dword PID;
105
		Dword x_start;
106
		Dword y_start;
107
		Dword x_size;
108
		Dword y_size;
109
		Word slot_state;
110
	} processInfo;
111
};
112
 
5114 clevermous 113
#ifndef AUTOBUILD
1805 yogev_ezra 114
//
115
extern char *kosExePath;
5114 clevermous 116
#endif
1805 yogev_ezra 117
 
118
//
119
void crtStartUp();
120
//
121
int __cdecl _purecall();
122
//
123
int __cdecl atexit( void (__cdecl *func )( void ));
124
//
125
void rtlSrand( Dword seed );
126
Dword rtlRand( void );
127
//
128
char * __cdecl strcpy( char *target, const char *source );
129
int __cdecl strlen( const char *line );
130
char * __cdecl strrchr( const char * string, int c );
131
//
132
void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
133
//
134
void memset( Byte *dst, Byte filler, Dword count );
135
//
136
void sprintf( char *Str, char* Format, ... );
137
//
138
Dword rtlInterlockedExchange( Dword *target, Dword value );
139
// функция -1 завершения процесса
140
void kos_ExitApp();
141
// функция 0
142
void kos_DefineAndDrawWindow(
143
	Word x, Word y,
144
	Word sizeX, Word sizeY,
145
	Byte mainAreaType, Dword mainAreaColour,
146
	Byte headerType, Dword headerColour,
147
	Dword borderColour
148
	);
149
// функция 1 поставить точку
150
void kos_PutPixel( Dword x, Dword y, Dword colour );
151
// функция 2 получить код нажатой клавиши
152
bool kos_GetKey( Byte &keyCode );
153
// функция 3 получить время
154
Dword kos_GetSystemClock();
155
// функция 4
156
void kos_WriteTextToWindow(
157
	Word x, Word y,
158
	Byte fontType,
159
	Dword textColour,
160
	char *textPtr,
161
	Dword textLen
162
	);
163
// функция 7 нарисовать изображение
164
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
165
// функция 8 определить кнопку
166
void kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
167
// функция 5 пауза, в сотых долях секунды
168
void kos_Pause( Dword value );
169
// функция 9 информация о процессе
170
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
171
// функция 10
172
Dword kos_WaitForEvent();
173
// функция 11
174
Dword kos_CheckForEvent();
175
// функция 12
176
void kos_WindowRedrawStatus( Dword status );
177
// функция 13 нарисовать прямоугольник
178
void kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
179
// функция 17
180
bool kos_GetButtonID( Dword &buttonID );
181
// функция 23
182
Dword kos_WaitForEvent( Dword timeOut );
183
// функция 26.9 получить значение счётчика времени
184
Dword kos_GetTime();
185
//
186
enum eNumberBase
187
{
188
	nbDecimal = 0,
189
	nbHex,
190
	nbBin
191
};
192
// функция 37 получение информации о состоянии "мыши"
193
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
194
// функция 37.1 получение координат "мыши" относительно окна
195
void kos_GetMouseWindowXY( int & cursorX, int & cursorY );
196
// функция 37.2 получение информации о нажатых кнопки "мыши"
197
void kos_GetMouseButtonsState( Dword & buttons );
198
// функция 37.4 загрузка курсора "мыши"
199
Dword * kos_LoadMouseCursor( Dword * cursor, Dword loadstate );
200
// функция 37.5 установка курсора "мыши"
201
Dword * kos_SetMouseCursor( Dword * handle );
202
// функция 37.6 удаление курсора "мыши"
203
void kos_DeleteMouseCursor( Dword * handle );
204
// функция 38 нарисовать полосу
205
void kos_DrawLine( Word x1, Word y1, Word x2, Word y2, Dword colour );
206
// функция 40 установить маску событий
207
void kos_SetMaskForEvents( Dword mask );
208
// функция 47 вывести в окно приложения число
209
void kos_DisplayNumberToWindow(
210
   Dword value,
211
   Dword digitsNum,
212
   Word x,
213
   Word y,
214
   Dword colour,
215
   eNumberBase nBase = nbDecimal,
216
   bool valueIsPointer = false
217
   );
218
// функция 47 вывести в окно приложения число c фоном
219
void kos_DisplayNumberToWindowBg(
220
   Dword value,
221
   Dword digitsNum,
222
   Word x,
223
   Word y,
224
   Dword colour,
225
   Dword bgcolour,
226
   eNumberBase nBase = nbDecimal,
227
   bool valueIsPointer = false
228
   );
7482 leency 229
// 48.4 get windows title bar height
230
Dword kos_GetSkinHeight();
1805 yogev_ezra 231
// функция 58 доступ к файловой системе
232
Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
233
// функция 63
234
void kos_DebugOutChar( char ccc );
235
//
236
void rtlDebugOutString( char *str );
237
// функция 64 изменить параметры окна, параметр == -1 не меняется
238
void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
239
// функция 67 изменение количества памяти, выделенной для программы
240
bool kos_ApplicationMemoryResize( Dword targetSize );
241
// функция 66 режим получения данных от клавиатуры
242
void kos_SetKeyboardDataMode( Dword mode );
243
 
244
//
245
void kos_Main();