Subversion Repositories Kolibri OS

Rev

Rev 7486 | 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
7486 leency 33
#define EVM_REDRAW        1
34
#define EVM_KEY           2
35
#define EVM_BUTTON        4
36
#define EVM_EXIT          8
37
#define EVM_BACKGROUND    16
38
#define EVM_MOUSE         32
39
#define EVM_IPC           64
40
#define EVM_STACK         128
41
#define EVM_DEBUG         256
42
#define EVM_STACK2        512
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 );
7494 leency 139
// function -1 завершения процесса
1805 yogev_ezra 140
void kos_ExitApp();
7494 leency 141
// function 0
1805 yogev_ezra 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
	);
7494 leency 149
// function 1 поставить точку
1805 yogev_ezra 150
void kos_PutPixel( Dword x, Dword y, Dword colour );
7494 leency 151
// function 2 получить код нажатой клавиши
1805 yogev_ezra 152
bool kos_GetKey( Byte &keyCode );
7494 leency 153
// function 3 получить время
1805 yogev_ezra 154
Dword kos_GetSystemClock();
7494 leency 155
// function 4
1805 yogev_ezra 156
void kos_WriteTextToWindow(
157
	Word x, Word y,
158
	Byte fontType,
159
	Dword textColour,
160
	char *textPtr,
161
	Dword textLen
162
	);
7494 leency 163
//
164
void kos_WriteTextWithBg(
165
	Word x, Word y,
166
	Byte fontType,
167
	Dword textColour,
168
	Dword bgcolour,
169
	char *textPtr,
170
	Dword textLen
171
	);
172
// function 7 нарисовать изображение
1805 yogev_ezra 173
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
7494 leency 174
// function 8 определить кнопку
1805 yogev_ezra 175
void kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
7494 leency 176
// function 5 пауза, в сотых долях секунды
1805 yogev_ezra 177
void kos_Pause( Dword value );
7494 leency 178
// function 9 информация о процессе
1805 yogev_ezra 179
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
7494 leency 180
// function 10
1805 yogev_ezra 181
Dword kos_WaitForEvent();
7494 leency 182
// function 11
1805 yogev_ezra 183
Dword kos_CheckForEvent();
7494 leency 184
// function 12
1805 yogev_ezra 185
void kos_WindowRedrawStatus( Dword status );
7494 leency 186
// function 13 нарисовать прямоугольник
1805 yogev_ezra 187
void kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
7494 leency 188
// function 17
1805 yogev_ezra 189
bool kos_GetButtonID( Dword &buttonID );
7494 leency 190
// function 23
1805 yogev_ezra 191
Dword kos_WaitForEvent( Dword timeOut );
7494 leency 192
// function 26.9 получить значение счётчика времени
1805 yogev_ezra 193
Dword kos_GetTime();
194
//
195
enum eNumberBase
196
{
197
	nbDecimal = 0,
198
	nbHex,
199
	nbBin
200
};
7494 leency 201
// function 37 получение информации о состоянии "мыши"
1805 yogev_ezra 202
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
7494 leency 203
// function 37.1 получение координат "мыши" относительно окна
1805 yogev_ezra 204
void kos_GetMouseWindowXY( int & cursorX, int & cursorY );
7494 leency 205
// function 37.2 получение информации о нажатых кнопки "мыши"
1805 yogev_ezra 206
void kos_GetMouseButtonsState( Dword & buttons );
7494 leency 207
// function 37.4 загрузка курсора "мыши"
1805 yogev_ezra 208
Dword * kos_LoadMouseCursor( Dword * cursor, Dword loadstate );
7494 leency 209
// function 37.5 установка курсора "мыши"
1805 yogev_ezra 210
Dword * kos_SetMouseCursor( Dword * handle );
7494 leency 211
// function 37.6 удаление курсора "мыши"
1805 yogev_ezra 212
void kos_DeleteMouseCursor( Dword * handle );
7494 leency 213
// function 38 нарисовать полосу
1805 yogev_ezra 214
void kos_DrawLine( Word x1, Word y1, Word x2, Word y2, Dword colour );
7494 leency 215
// function 40 установить маску событий
1805 yogev_ezra 216
void kos_SetMaskForEvents( Dword mask );
7494 leency 217
// function 47 вывести в окно приложения число
1805 yogev_ezra 218
void kos_DisplayNumberToWindow(
219
   Dword value,
220
   Dword digitsNum,
221
   Word x,
222
   Word y,
223
   Dword colour,
224
   eNumberBase nBase = nbDecimal,
225
   bool valueIsPointer = false
226
   );
7494 leency 227
// function 47 вывести в окно приложения число c фоном
1805 yogev_ezra 228
void kos_DisplayNumberToWindowBg(
229
   Dword value,
230
   Dword digitsNum,
231
   Word x,
232
   Word y,
233
   Dword colour,
234
   Dword bgcolour,
235
   eNumberBase nBase = nbDecimal,
236
   bool valueIsPointer = false
237
   );
7494 leency 238
// function 48.4 get windows title bar height
7482 leency 239
Dword kos_GetSkinHeight();
7494 leency 240
// function 58 доступ к файловой системе
1805 yogev_ezra 241
Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
7494 leency 242
// function 63
1805 yogev_ezra 243
void kos_DebugOutChar( char ccc );
244
//
245
void rtlDebugOutString( char *str );
7494 leency 246
//
247
void kos_DebugNumber(signed int n);
248
//
249
// function 64 изменить параметры окна, параметр == -1 не меняется
1805 yogev_ezra 250
void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
7494 leency 251
// function 67 изменение количества памяти, выделенной для программы
1805 yogev_ezra 252
bool kos_ApplicationMemoryResize( Dword targetSize );
7494 leency 253
// function 66 режим получения данных от клавиатуры
1805 yogev_ezra 254
void kos_SetKeyboardDataMode( Dword mode );
255
 
256
//
257
void kos_Main();