Subversion Repositories Kolibri OS

Rev

Rev 7486 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  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.  
  13. //Process Events
  14. #define EM_WINDOW_REDRAW                1
  15. #define EM_KEY_PRESS                    2
  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
  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.  
  32. //Event mask bits for function 40
  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
  45.  
  46. //Button options
  47. #define BT_DEL      0x80000000
  48. #define BT_HIDE     0x40000000
  49. #define BT_NOFRAME  0x20000000
  50.  
  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.  
  113. #ifndef AUTOBUILD
  114. //
  115. extern char *kosExePath;
  116. #endif
  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. // function -1 çàâåðøåíèÿ ïðîöåññà
  140. void kos_ExitApp();
  141. // function 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. // function 1 ïîñòàâèòü òî÷êó
  150. void kos_PutPixel( Dword x, Dword y, Dword colour );
  151. // function 2 ïîëó÷èòü êîä íàæàòîé êëàâèøè
  152. bool kos_GetKey( Byte &keyCode );
  153. // function 3 ïîëó÷èòü âðåìÿ
  154. Dword kos_GetSystemClock();
  155. // function 4
  156. void kos_WriteTextToWindow(
  157.         Word x, Word y,
  158.         Byte fontType,
  159.         Dword textColour,
  160.         char *textPtr,
  161.         Dword textLen
  162.         );
  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 íàðèñîâàòü èçîáðàæåíèå
  173. void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
  174. // function 8 îïðåäåëèòü êíîïêó
  175. void kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
  176. // function 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
  177. void kos_Pause( Dword value );
  178. // function 9 èíôîðìàöèÿ î ïðîöåññå
  179. Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
  180. // function 10
  181. Dword kos_WaitForEvent();
  182. // function 11
  183. Dword kos_CheckForEvent();
  184. // function 12
  185. void kos_WindowRedrawStatus( Dword status );
  186. // function 13 íàðèñîâàòü ïðÿìîóãîëüíèê
  187. void kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
  188. // function 17
  189. bool kos_GetButtonID( Dword &buttonID );
  190. // function 23
  191. Dword kos_WaitForEvent( Dword timeOut );
  192. // function 26.9 ïîëó÷èòü çíà÷åíèå ñ÷¸ò÷èêà âðåìåíè
  193. Dword kos_GetTime();
  194. //
  195. enum eNumberBase
  196. {
  197.         nbDecimal = 0,
  198.         nbHex,
  199.         nbBin
  200. };
  201. // function 37 ïîëó÷åíèå èíôîðìàöèè î ñîñòîÿíèè "ìûøè"
  202. void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
  203. // function 37.1 ïîëó÷åíèå êîîðäèíàò "ìûøè" îòíîñèòåëüíî îêíà
  204. void kos_GetMouseWindowXY( int & cursorX, int & cursorY );
  205. // function 37.2 ïîëó÷åíèå èíôîðìàöèè î íàæàòûõ êíîïêè "ìûøè"
  206. void kos_GetMouseButtonsState( Dword & buttons );
  207. // function 37.4 çàãðóçêà êóðñîðà "ìûøè"
  208. Dword * kos_LoadMouseCursor( Dword * cursor, Dword loadstate );
  209. // function 37.5 óñòàíîâêà êóðñîðà "ìûøè"
  210. Dword * kos_SetMouseCursor( Dword * handle );
  211. // function 37.6 óäàëåíèå êóðñîðà "ìûøè"
  212. void kos_DeleteMouseCursor( Dword * handle );
  213. // function 38 íàðèñîâàòü ïîëîñó
  214. void kos_DrawLine( Word x1, Word y1, Word x2, Word y2, Dword colour );
  215. // function 40 óñòàíîâèòü ìàñêó ñîáûòèé
  216. void kos_SetMaskForEvents( Dword mask );
  217. // function 47 âûâåñòè â îêíî ïðèëîæåíèÿ ÷èñëî
  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.    );
  227. // function 47 âûâåñòè â îêíî ïðèëîæåíèÿ ÷èñëî c ôîíîì
  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.    );
  238. // function 48.4 get windows title bar height
  239. Dword kos_GetSkinHeight();
  240. // function 58 äîñòóï ê ôàéëîâîé ñèñòåìå
  241. Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
  242. // function 63
  243. void kos_DebugOutChar( char ccc );
  244. //
  245. void rtlDebugOutString( char *str );
  246. //
  247. void kos_DebugNumber(signed int n);
  248. //
  249. // function 64 èçìåíèòü ïàðàìåòðû îêíà, ïàðàìåòð == -1 íå ìåíÿåòñÿ
  250. void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
  251. // function 67 èçìåíåíèå êîëè÷åñòâà ïàìÿòè, âûäåëåííîé äëÿ ïðîãðàììû
  252. bool kos_ApplicationMemoryResize( Dword targetSize );
  253. // function 66 ðåæèì ïîëó÷åíèÿ äàííûõ îò êëàâèàòóðû
  254. void kos_SetKeyboardDataMode( Dword mode );
  255.  
  256. //
  257. void kos_Main();
  258.