Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 22893d3

Browse files
Add a dummy clipboard implementation for Emscripten
1 parent a92a749 commit 22893d3

File tree

3 files changed

+163
-0
lines changed

3 files changed

+163
-0
lines changed

engine/engine-sources.gypi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,13 +564,15 @@
564564
'src/socket_resolve.cpp',
565565

566566
'src/clipboard.h',
567+
'src/em-clipboard.h',
567568
'src/lnx-clipboard.h',
568569
'src/mac-clipboard.h',
569570
'src/mblandroid-clipboard.h',
570571
'src/mbliphone-clipboard.h',
571572
'src/raw-clipboard.h',
572573
'src/w32-clipboard.h',
573574
'src/clipboard.cpp',
575+
'src/em-clipboard.cpp',
574576
'src/lnx-clipboard.cpp',
575577
'src/mac-clipboard.mm',
576578
'src/mblandroid-clipboard.cpp',

engine/src/em-clipboard.cpp

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/* Copyright (C) 2015 LiveCode Ltd.
2+
3+
This file is part of LiveCode.
4+
5+
LiveCode is free software; you can redistribute it and/or modify it under
6+
the terms of the GNU General Public License v3 as published by the Free
7+
Software Foundation.
8+
9+
LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
10+
WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
16+
17+
18+
19+
#include "em-clipboard.h"
20+
21+
22+
MCRawClipboard* MCRawClipboard::CreateSystemClipboard()
23+
{
24+
return new MCEmscriptenRawClipboard;
25+
}
26+
27+
MCRawClipboard* MCRawClipboard::CreateSystemSelectionClipboard()
28+
{
29+
return new MCEmscriptenRawClipboard;
30+
}
31+
32+
MCRawClipboard* MCRawClipboard::CreateSystemDragboard()
33+
{
34+
return new MCEmscriptenRawClipboard;
35+
}
36+
37+
38+
uindex_t MCEmscriptenRawClipboard::GetItemCount() const
39+
{
40+
return 0;
41+
}
42+
43+
const MCRawClipboardItem* MCEmscriptenRawClipboard::GetItemAtIndex(uindex_t p_index) const
44+
{
45+
return NULL;
46+
}
47+
48+
MCRawClipboardItem* MCEmscriptenRawClipboard::GetItemAtIndex(uindex_t p_index)
49+
{
50+
return NULL;
51+
}
52+
53+
void MCEmscriptenRawClipboard::Clear()
54+
{
55+
;
56+
}
57+
58+
bool MCEmscriptenRawClipboard::IsOwned() const
59+
{
60+
return false;
61+
}
62+
63+
bool MCEmscriptenRawClipboard::IsExternalData() const
64+
{
65+
return false;
66+
}
67+
68+
MCRawClipboardItem* MCEmscriptenRawClipboard::CreateNewItem()
69+
{
70+
return NULL;
71+
}
72+
73+
bool MCEmscriptenRawClipboard::AddItem(MCRawClipboardItem* p_item)
74+
{
75+
return false;
76+
}
77+
78+
bool MCEmscriptenRawClipboard::PushUpdates()
79+
{
80+
return false;
81+
}
82+
83+
bool MCEmscriptenRawClipboard::PullUpdates()
84+
{
85+
return false;
86+
}
87+
88+
bool MCEmscriptenRawClipboard::FlushData()
89+
{
90+
return false;
91+
}
92+
93+
uindex_t MCEmscriptenRawClipboard::GetMaximumItemCount() const
94+
{
95+
return 1;
96+
}
97+
98+
MCStringRef MCEmscriptenRawClipboard::GetKnownTypeString(MCRawClipboardKnownType p_type) const
99+
{
100+
return NULL;
101+
}
102+
103+
MCDataRef MCEmscriptenRawClipboard::EncodeFileListForTransfer(MCStringRef p_file_list) const
104+
{
105+
return NULL;
106+
}
107+
108+
MCStringRef MCEmscriptenRawClipboard::DecodeTransferredFileList(MCDataRef p_data) const
109+
{
110+
return NULL;
111+
}

engine/src/em-clipboard.h

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/* Copyright (C) 2015 LiveCode Ltd.
2+
3+
This file is part of LiveCode.
4+
5+
LiveCode is free software; you can redistribute it and/or modify it under
6+
the terms of the GNU General Public License v3 as published by the Free
7+
Software Foundation.
8+
9+
LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
10+
WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
16+
17+
18+
#ifndef EMSCRIPTEN_CLIPBOARD_H
19+
#define EMSCRIPTEN_CLIPBOARD_H
20+
21+
22+
#include "raw-clipboard.h"
23+
#include "foundation-auto.h"
24+
25+
26+
class MCEmscriptenRawClipboard :
27+
public MCRawClipboard
28+
{
29+
public:
30+
31+
// Inherited from MCRawClipboard
32+
virtual uindex_t GetItemCount() const;
33+
virtual const MCRawClipboardItem* GetItemAtIndex(uindex_t p_index) const;
34+
virtual MCRawClipboardItem* GetItemAtIndex(uindex_t p_index);
35+
virtual void Clear();
36+
virtual bool IsOwned() const;
37+
virtual bool IsExternalData() const;
38+
virtual MCRawClipboardItem* CreateNewItem();
39+
virtual bool AddItem(MCRawClipboardItem* p_item);
40+
virtual bool PushUpdates();
41+
virtual bool PullUpdates();
42+
virtual bool FlushData();
43+
virtual uindex_t GetMaximumItemCount() const;
44+
virtual MCStringRef GetKnownTypeString(MCRawClipboardKnownType p_type) const;
45+
virtual MCDataRef EncodeFileListForTransfer(MCStringRef p_file_list) const;
46+
virtual MCStringRef DecodeTransferredFileList(MCDataRef p_data) const;
47+
};
48+
49+
50+
#endif /* ifndef EMSCRIPTEN_CLIPBOARD_H */

0 commit comments

Comments
 (0)