Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
6021 leency 1
//CODED by Veliant, Leency, Nable, Pavelyakov. GNU GPL licence.
2
 
5598 pavelyakov 3
#ifndef INCLUDE_KOLIBRI_H
5582 pavelyakov 4
#define INCLUDE_KOLIBRI_H
5576 pavelyakov 5
 
5676 pavelyakov 6
#pragma option OST
7
#pragma option ON
8
#pragma option cri-
9
#pragma option -CPA
10
#initallvar 0
11
#jumptomain FALSE
12
 
3067 leency 13
#startaddress 0
5676 pavelyakov 14
 
3067 leency 15
#code32 TRUE
5676 pavelyakov 16
 
3067 leency 17
char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
18
dword  os_version   = 0x00000001;
5648 pavelyakov 19
dword  start_addr   = #______INIT______;
20
dword  final_addr   = #______STOP______+32;
3363 leency 21
dword  alloc_mem    = MEMSIZE;
22
dword  x86esp_reg   = MEMSIZE;
3067 leency 23
dword  I_Param      = #param;
24
dword  I_Path       = #program_path;
25
char param[4096];
26
char program_path[4096];
27
 
6651 leency 28
#define bool      int
5883 pavelyakov 29
 
3363 leency 30
#define NULL      0
31
#define OLD      -1
32
#define true      1
33
#define false     0
34
 
6039 leency 35
//Process Events
4536 leency 36
#define evReDraw  1
37
#define evKey     2
38
#define evButton  3
6978 leency 39
#define evExit    4
5576 pavelyakov 40
#define evDesktop 5
3067 leency 41
#define evMouse   6
5576 pavelyakov 42
#define evIPC     7
4536 leency 43
#define evNetwork 8
5576 pavelyakov 44
#define evDebug   9
3067 leency 45
 
6978 leency 46
//Event mask bits for function 40
7031 leency 47
#define EVM_REDRAW                1b
48
#define EVM_KEY                  10b
49
#define EVM_BUTTON              100b
50
#define EVM_EXIT               1000b
51
#define EVM_BACKGROUND        10000b
52
#define EVM_MOUSE            100000b
53
#define EVM_IPC             1000000b
54
#define EVM_STACK          10000000b
55
#define EVM_DEBUG         100000000b
56
#define EVM_STACK2       1000000000b
6978 leency 57
#define EVM_MOUSE_FILTER  0x80000000
58
#define EVM_CURSOR_FILTER 0x40000000
59
 
3067 leency 60
//Button options
61
#define BT_DEL      0x80000000
62
#define BT_HIDE     0x40000000
63
#define BT_NOFRAME  0x20000000
64
 
65
//-------------------------------------------------------------------------
66
 
5674 pavelyakov 67
#include "../lib/system.h"
68
#include "../lib/mouse.h"
6285 leency 69
#include "../lib/keyboard.h"
5674 pavelyakov 70
 
6751 leency 71
inline fastcall dword calc(EAX) { return EAX; }
6742 leency 72
 
5477 leency 73
:struct raw_image {
74
	dword w, h, data;
75
};
76
 
3067 leency 77
//------------------------------------------------------------------------------
5582 pavelyakov 78
:dword wait_event_code;
3067 leency 79
inline fastcall dword WaitEvent()
80
{
81
	$mov eax,10
82
	$int 0x40
5576 pavelyakov 83
	wait_event_code = EAX;
5591 pavelyakov 84
	//if(wait_event_code==evMouse) MOUSE.get();
85
	//return wait_event_code;
3067 leency 86
}
87
 
88
inline fastcall dword CheckEvent()
89
{
90
	$mov eax,11
91
	$int 0x40
92
}
93
 
5576 pavelyakov 94
inline fastcall dword WaitEventTimeout(EBX)
3067 leency 95
{
96
	$mov eax,23
97
	$int 0x40
98
}
99
 
6978 leency 100
inline fastcall dword SetEventMask(EBX)
3067 leency 101
{
102
	$mov eax,40
103
	$int 0x40
104
}
105
 
106
 
5576 pavelyakov 107
inline fastcall pause(EBX)
3067 leency 108
{
109
	$mov eax, 5
110
	$int 0x40
111
}
112
 
113
inline fastcall word GetButtonID()
114
{
115
	$mov eax,17
116
	$int  0x40
117
	$shr eax,8
118
}
119
 
120
inline fastcall dword GetFreeRAM()
121
{
122
	$mov eax, 18
123
	$mov ebx, 16
124
	$int 0x40
6980 leency 125
	//return eax = free RAM in Kb
3067 leency 126
}
127
 
6791 leency 128
inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà
3067 leency 129
{
130
	$mov eax, 68
131
	$mov ebx, 16
132
	$int 0x40
6791 leency 133
	//return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà
3067 leency 134
}
135
 
6791 leency 136
inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó
3067 leency 137
{
138
	$mov eax, 68
139
	$mov ebx, 17
140
	$int 0x40
6791 leency 141
	//return eax = îïðåäåëÿåòñÿ äðàéâåðîì
3067 leency 142
}
143
 
144
struct proc_info
145
{
146
	#define SelfInfo -1
147
	dword	use_cpu;
148
	word	pos_in_stack,num_slot,rezerv1;
4137 leency 149
	unsigned char name[11];
3067 leency 150
	char	rezerv2;
151
	dword	adress,use_memory,ID,left,top,width,height;
152
	word	status_slot,rezerv3;
153
	dword	work_left,work_top,work_width,work_height;
154
	char	status_window;
3107 leency 155
	dword   cwidth,cheight;
156
	byte    reserved[1024-71-8];
3067 leency 157
};
158
 
5576 pavelyakov 159
inline fastcall void GetProcessInfo(EBX, ECX)
3067 leency 160
{
161
	$mov eax,9;
162
	$int  0x40
3107 leency 163
	DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth
7051 leency 164
	DSDWORD[EBX+75] = DSDWORD[EBX+46] - skin_height - 4; //set cheight
3067 leency 165
}
166
 
167
inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y
168
{
169
	$mov eax,34
170
	$int 0x40
171
}
172
 
173
inline fastcall int GetProcessSlot( ECX)
174
{
175
	EAX = 18;
176
	EBX = 21;
177
	$int 0x40
178
}
179
 
180
inline fastcall int GetActiveProcess()
181
{
182
	EAX = 18;
183
	EBX = 7;
184
	$int 0x40
185
}
186
 
4081 leency 187
:int CheckActiveProcess(int Form_ID)
188
{
4166 leency 189
	int id9=GetProcessSlot(Form_ID);
190
	if (id9==GetActiveProcess()) return 1;
4081 leency 191
	return 0;
192
}
193
 
3114 leency 194
inline fastcall void ActivateWindow( ECX)
195
{
196
	EAX = 18;
197
	EBX = 3;
198
	$int 0x40
199
}
200
 
5421 leency 201
inline fastcall int MinimizeWindow()
202
{
203
	EAX = 18;
204
	EBX = 10;
205
	$int 0x40
206
}
207
 
5576 pavelyakov 208
inline fastcall int CreateThread(ECX,EDX)
3067 leency 209
{
210
	$mov eax,51
211
	$mov ebx,1
212
	$int 0x40
213
}
214
 
215
inline fastcall void SwitchToAnotherThread()
216
{
217
	$mov eax,68
218
	$mov ebx,1
219
	$int 0x40
220
}
221
 
3458 leency 222
inline fastcall int SendWindowMessage( ECX, EDX)