1
0
kolibrios/programs/cmm/lib/clipboard.h
Kirill Lipatov (Leency) 90b630f05f full refactoring of CMM/lib/clipboard.h, ability to copy link URL in WebView, small improvements in clipview and app_plus
git-svn-id: svn://kolibrios.org@7037 a494cfbc-eb01-0410-851d-a64ba20cac60
2017-10-01 11:57:00 +00:00

85 lines
1.9 KiB
C

#ifndef INCLUDE_CLIPBOARD_H
#define INCLUDE_CLIPBOARD_H
#print "[include <clipboard.h>]\n"
#ifndef INCLUDE_KOLIBRI_H
#include "../lib/kolibri.h"
#endif
#ifndef INCLUDE_FILESYSTEM_H
#include "../lib/file_system.h"
#endif
//===================================================//
// //
// Kolibri Clipboard System Functions //
// //
//===================================================//
#define SLOT_DATA_TYPE_TEXT 0
#define SLOT_DATA_TYPE_TEXT_BLOCK 1
#define SLOT_DATA_TYPE_IMAGE 2
#define SLOT_DATA_TYPE_RAW 3
inline fastcall dword Clipboard__GetSlotCount()
{
$mov eax, 54
$mov ebx, 0
$int 0x40
}
inline fastcall dword Clipboard__GetSlotData( ECX) //ECX = slot number
{
$mov eax, 54
$mov ebx, 1
$int 0x40
}
inline fastcall dword Clipboard__SetSlotData( ECX, EDX) //ECX = data size, EDX - pointer to data
{
$mov eax, 54
$mov ebx, 2
$int 0x40
}
inline fastcall dword Clipboard__DeleteLastSlot()
{
$mov eax, 54
$mov ebx, 3
$int 0x40
}
inline fastcall dword Clipboard__ResetBlockingBuffer()
{
$mov eax, 54
$mov ebx, 4
$int 0x40
}
//===================================================//
// //
// Some useful patterns //
// //
//===================================================//
:void Clipboard__CopyText(dword _text)
{
int size_buf;
dword buff_data;
size_buf = strlen(_text) + 12;
buff_data = malloc(size_buf);
ESDWORD[buff_data] = size_buf;
ESDWORD[buff_data+4] = SLOT_DATA_TYPE_TEXT;
ESDWORD[buff_data+8] = 1; //encoding 0=UTF, 1=866, 2=1251
strcpy(buff_data+12, _text);
Clipboard__SetSlotData(size_buf, buff_data);
if (EAX!=0) notify("'Error while copying to clipboard!'E");
buff_data = free(buff_data);
}
#endif