Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
990 barsuk 1
 
2
3
 
4
typedef unsigned __int16 Word;
5
typedef unsigned __int8 Byte;
6
//typedef unsigned __int32 size_t;
7
8
 
9
10
 
11
12
 
13
#define FO_WRITE				2
14
15
 
7498 leency 16
#define EM_WINDOW_REDRAW		1
990 barsuk 17
#define EM_KEY_PRESS			2
18
#define EM_BUTTON_CLICK			3
7498 leency 19
#define EM_APP_CLOSE			4
20
#define EM_DRAW_BACKGROUND		5
21
#define EM_MOUSE_EVENT			6
22
#define EM_IPC					7
23
#define EM_NETWORK				8
24
#define EM_DEBUG				9
25
990 barsuk 26
 
7498 leency 27
#define EVM_REDRAW        1
28
#define EVM_KEY           2
29
#define EVM_BUTTON        4
30
#define EVM_EXIT          8
31
#define EVM_BACKGROUND    16
32
#define EVM_MOUSE         32
33
#define EVM_IPC           64
34
#define EVM_STACK         128
35
#define EVM_DEBUG         256
36
#define EVM_STACK2        512
37
#define EVM_MOUSE_FILTER  0x80000000
38
#define EVM_CURSOR_FILTER 0x40000000
39
40
 
41
#define BT_DEL      0x80000000
42
#define BT_HIDE     0x40000000
43
#define BT_NOFRAME  0x20000000
44
#define BT_NODRAW   BT_HIDE+BT_NOFRAME
45
46
 
990 barsuk 47
#define KM_SCANS				1
48
49
 
50
#define WRS_END					2
51
52
 
53
54
 
55
56
 
1764 clevermous 57
extern "C" double __cdecl asin(double x);
58
extern "C" double __cdecl floor(double x);
59
extern "C" double __cdecl round(double x);
60
#pragma function(acos,asin)
990 barsuk 61
#if _MSC_VER > 1200
62
#pragma function(floor)
63
#endif
64
65
 
66
 
67
{
68
	Dword rwMode;
69
	Dword OffsetLow;
70
	char* OffsetHigh;
7504 leency 71
	Dword dataCount;
990 barsuk 72
	Byte *bufferPtr;
73
	char fileURL[MAX_PATH];
74
};
75
76
 
77
 
7504 leency 78
	Dword nonset1;
79
	Dword nonset2;
80
	Dword work_dark;
81
	Dword work_light;
82
	Dword window_title;
83
	Dword work;
84
	Dword work_button;
85
	Dword work_button_text;
86
	Dword work_text;
87
	Dword work_graph;
88
};
89
90
 
91
 
990 barsuk 92
{
93
	Byte b;
94
	Byte g;
95
	Byte r;
96
	//
97
	RGB() {};
98
	//
99
	RGB( Dword value )
100
	{
101
		r = (Byte)(value >> 16);
102
		g = (Byte)(value >> 8);
103
		b = (Byte)value;
104
	};
105
	//
106
	bool operator != ( RGB &another )
107
	{
108
		return this->b != another.b || this->g != another.g || this->r != another.r;
109
	};
110
	//
111
	bool operator == ( RGB &another )
112
	{
113
		return this->b == another.b && this->g == another.g && this->r == another.r;
114
	};
115
};
116
117
 
118
 
2753 clevermous 119
union sProcessInfo
990 barsuk 120
{
121
	Byte rawData[1024];
122
	struct
123
	{
124
		Dword cpu_usage;
125
		Word window_stack_position;
126
		Word window_slot; //slot
7498 leency 127
		Word reserved1;
990 barsuk 128
		char process_name[12];
129
		Dword memory_start;
130
		Dword used_memory;
131
		Dword PID;
132
		Dword x_start;
133
		Dword y_start;
134
		Dword width;
7498 leency 135
		Dword height;
136
		Word slot_state;
990 barsuk 137
		Word reserved3;
7498 leency 138
		Dword work_left;
139
		Dword work_top;
140
		Dword work_width;
141
		Dword work_height;
142
		char status_window;
143
		Dword cwidth;
144
		Dword cheight;
145
	} processInfo;
990 barsuk 146
};
147
#pragma pack(pop)
2753 clevermous 148
990 barsuk 149
 
1764 clevermous 150
//
990 barsuk 151
extern char *kosExePath;
152
#endif
1764 clevermous 153
990 barsuk 154
 
155
void crtStartUp();
156
//
157
int __cdecl _purecall();
158
//
159
int __cdecl atexit( void (__cdecl *func )( void ));
160
//
161
void rtlSrand( Dword seed );
162
Dword rtlRand( void );
163
//
164
char * __cdecl strcpy( char *target, const char *source );
165
int __cdecl strlen( const char *line );
166
char * __cdecl strrchr( const char * string, int c );
167
//
7500 leency 168
// if you have trouble here look at old SVN revisions for alternatives
169
void memcpy( void *dst, const void *src, size_t bytesCount );
1764 clevermous 170
void memset( Byte *dst, Byte filler, Dword count );
171
//
7500 leency 172
void sprintf( char *Str, char* Format, ... );
990 barsuk 173
//
174
Dword rtlInterlockedExchange( Dword *target, Dword value );
175
// function -1 завершения процесса
7503 leency 176
void kos_ExitApp();
990 barsuk 177
// function 0
7503 leency 178
void kos_DefineAndDrawWindow(
990 barsuk 179
	Word x, Word y,
180
	Word sizeX, Word sizeY,
181
	Byte mainAreaType, Dword mainAreaColour,
182
	Byte headerType, Dword headerColour,
183
	Dword borderColour
184
	);
185
// function 1 поставить точку
7503 leency 186
void kos_PutPixel( Dword x, Dword y, Dword colour );
990 barsuk 187
// function 2 получить код нажатой клавиши
7503 leency 188
bool kos_GetKey( Byte &keyCode );
990 barsuk 189
// function 3 получить время
7503 leency 190
Dword kos_GetSystemClock();
990 barsuk 191
// function 4
7503 leency 192
void __declspec(noinline) kos_WriteTextToWindow(
1764 clevermous 193
	Word x, Word y,
990 barsuk 194
	Byte fontType,
195
	Dword textColour,
196
	char *textPtr,
197
	Dword textLen
198
	);
199
// function 7 нарисовать изображение
7503 leency 200
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
990 barsuk 201
// function 8 определить кнопку
7503 leency 202
void __declspec(noinline) kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
1764 clevermous 203
//
7503 leency 204
void __declspec(noinline) kos_UnsaveDefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
205
// function 5 пауза, в сотых долях секунды
206
void kos_Pause( Dword value );
990 barsuk 207
// function 9 - информация о процессе
7503 leency 208
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
990 barsuk 209
// function 10
7503 leency 210
Dword kos_WaitForEvent();
990 barsuk 211
// function 11
7503 leency 212
Dword kos_CheckForEvent();
990 barsuk 213
// function 12
7503 leency 214
void kos_WindowRedrawStatus( Dword status );
990 barsuk 215
// function 13 нарисовать полосу
7503 leency 216
void __declspec(noinline) kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
1764 clevermous 217
// function 17
7503 leency 218
bool kos_GetButtonID( Dword &buttonID );
990 barsuk 219
// function 23
7503 leency 220
Dword kos_WaitForEventTimeout( Dword timeOut );
2750 leency 221
//
990 barsuk 222
enum eNumberBase
223
{
224
	nbDecimal = 0,
225
	nbHex,
226
	nbBin
227
};
228
// получение информации о состоянии "мыши" function 37
7503 leency 229
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
990 barsuk 230
// function 38
7503 leency 231
void kos_DrawLine( Word x1, Word y1, Word x2, Word y2, Dword colour, Dword invert );
232
// function 40 установить маску событий
233
void kos_SetMaskForEvents( Dword mask );
990 barsuk 234
// function 47 вывести в окно приложения число
7503 leency 235
void kos_DisplayNumberToWindow(
990 barsuk 236
   Dword value,
237
   Dword digitsNum,
238
   Word x,
239
   Word y,
240
   Dword colour,
241
   eNumberBase nBase = nbDecimal,
242
   bool valueIsPointer = false
243
   );
244
// 48.3: get system colors
7504 leency 245
bool kos_GetSystemColors( kosSysColors *sc );
246
// function 63
7503 leency 247
void kos_DebugOutChar( char ccc );
990 barsuk 248
//
249
void rtlDebugOutString( char *str );
250
//
7503 leency 251
void kos_DebugValue(char *str, int n);
252
// function 64 изменить параметры окна, параметр == -1 не меняется
253
void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
990 barsuk 254
// function 67 изменение количества памяти, выделенной для программы
7503 leency 255
bool kos_ApplicationMemoryResize( Dword targetSize );
990 barsuk 256
// function 66 режим получения данных от клавиатуры
7503 leency 257
void kos_SetKeyboardDataMode( Dword mode );
990 barsuk 258
// 68.11: init heap
7504 leency 259
void kos_InitHeap();
990 barsuk 260
// function 70 доступ к файловой системе
7504 leency 261
Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
262
// 70.7: run Kolibri application with param
263
int kos_AppRun(char* app_path, char* param);
264
//
990 barsuk 265
void kos_Main();
266