projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixing osx_carbon
[wxWidgets.git]
/
src
/
os2
/
clipbrd.cpp
diff --git
a/src/os2/clipbrd.cpp
b/src/os2/clipbrd.cpp
index b0a54e5f2431057d4efb2645ba0e7d69deb570e2..3803c01f09e30f94ed426692b71f2aca8714dd3a 100644
(file)
--- a/
src/os2/clipbrd.cpp
+++ b/
src/os2/clipbrd.cpp
@@
-1,5
+1,5
@@
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// Name: clipbrd.cpp
+// Name:
src/os2/
clipbrd.cpp
// Purpose: Clipboard functionality
// Author: David Webster
// Modified by:
// Purpose: Clipboard functionality
// Author: David Webster
// Modified by:
@@
-12,12
+12,10
@@
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
-#ifndef WX_PRECOMP
- #include "wx/setup.h"
-#endif
-
#if wxUSE_CLIPBOARD
#if wxUSE_CLIPBOARD
+#include "wx/clipbrd.h"
+
#ifndef WX_PRECOMP
#include "wx/object.h"
#include "wx/event.h"
#ifndef WX_PRECOMP
#include "wx/object.h"
#include "wx/event.h"
@@
-26,30
+24,20
@@
#include "wx/bitmap.h"
#include "wx/utils.h"
#include "wx/intl.h"
#include "wx/bitmap.h"
#include "wx/utils.h"
#include "wx/intl.h"
+ #include "wx/log.h"
+ #include "wx/dataobj.h"
#endif
#if wxUSE_METAFILE
#include "wx/metafile.h"
#endif
#endif
#if wxUSE_METAFILE
#include "wx/metafile.h"
#endif
-#include "wx/log.h"
-#include "wx/clipbrd.h"
-
#include <string.h>
#include <string.h>
-#define INCL_DOS
-#define INCL_PM
-#include <os2.h>
-
#include "wx/os2/private.h"
// wxDataObject is tied to OLE/drag and drop implementation,
// therefore so is wxClipboard :-(
#include "wx/os2/private.h"
// wxDataObject is tied to OLE/drag and drop implementation,
// therefore so is wxClipboard :-(
-#if wxUSE_DRAG_AND_DROP
- #include "wx/dataobj.h"
-
- static bool wxSetClipboardData(wxDataObject *data);
-#endif
// ===========================================================================
// implementation
// ===========================================================================
// implementation
@@
-59,11
+47,11
@@
// old-style clipboard functions using Windows API
// ---------------------------------------------------------------------------
// old-style clipboard functions using Windows API
// ---------------------------------------------------------------------------
-static bool gs_wxClipboardIsOpen =
FALSE
;
+static bool gs_wxClipboardIsOpen =
false
;
bool wxOpenClipboard()
{
bool wxOpenClipboard()
{
- wxCHECK_MSG( !gs_wxClipboardIsOpen,
TRUE
, wxT("clipboard already opened.") );
+ wxCHECK_MSG( !gs_wxClipboardIsOpen,
true
, wxT("clipboard already opened.") );
// TODO:
/*
wxWindow *win = wxTheApp->GetTopWindow();
// TODO:
/*
wxWindow *win = wxTheApp->GetTopWindow();
@@
-72,35
+60,37
@@
bool wxOpenClipboard()
gs_wxClipboardIsOpen = ::OpenClipboard((HWND)win->GetHWND()) != 0;
if ( !gs_wxClipboardIsOpen )
gs_wxClipboardIsOpen = ::OpenClipboard((HWND)win->GetHWND()) != 0;
if ( !gs_wxClipboardIsOpen )
+ {
wxLogSysError(_("Failed to open the clipboard."));
wxLogSysError(_("Failed to open the clipboard."));
+ }
return gs_wxClipboardIsOpen;
}
else
{
return gs_wxClipboardIsOpen;
}
else
{
- wxLogDebug(wxT("Can
not open clipboard without a main window."));
+ wxLogDebug(wxT("Cannot open clipboard without a main window."));
- return
FALSE
;
+ return
false
;
}
*/
}
*/
- return
FALSE
;
+ return
false
;
}
bool wxCloseClipboard()
{
}
bool wxCloseClipboard()
{
- wxCHECK_MSG( gs_wxClipboardIsOpen,
FALSE
, wxT("clipboard is not opened") );
+ wxCHECK_MSG( gs_wxClipboardIsOpen,
false
, wxT("clipboard is not opened") );
// TODO:
/*
// TODO:
/*
- gs_wxClipboardIsOpen =
FALSE
;
+ gs_wxClipboardIsOpen =
false
;
if ( ::CloseClipboard() == 0 )
{
wxLogSysError(_("Failed to close the clipboard."));
if ( ::CloseClipboard() == 0 )
{
wxLogSysError(_("Failed to close the clipboard."));
- return
FALSE
;
+ return
false
;
}
*/
}
*/
- return
TRUE
;
+ return
true
;
}
bool wxEmptyClipboard()
}
bool wxEmptyClipboard()
@@
-111,10
+101,10
@@
bool wxEmptyClipboard()
{
wxLogSysError(_("Failed to empty the clipboard."));
{
wxLogSysError(_("Failed to empty the clipboard."));
- return
FALSE
;
+ return
false
;
}
*/
}
*/
- return
TRUE
;
+ return
true
;
}
bool wxIsClipboardOpened()
}
bool wxIsClipboardOpened()
@@
-122,12
+112,13
@@
bool wxIsClipboardOpened()
return gs_wxClipboardIsOpen;
}
return gs_wxClipboardIsOpen;
}
-bool wxIsClipboardFormatAvailable(wxDataFormat
dataFormat
)
+bool wxIsClipboardFormatAvailable(wxDataFormat
WXUNUSED(dataFormat)
)
{
// TODO: return ::IsClipboardFormatAvailable(dataFormat) != 0;
{
// TODO: return ::IsClipboardFormatAvailable(dataFormat) != 0;
- return
FALSE
;
+ return
false
;
}
}
+#if 0
#if wxUSE_DRAG_AND_DROP
static bool wxSetClipboardData(wxDataObject *data)
{
#if wxUSE_DRAG_AND_DROP
static bool wxSetClipboardData(wxDataObject *data)
{
@@
-140,7
+131,7
@@
static bool wxSetClipboardData(wxDataObject *data)
wxLogSysError(_("Failed to allocate %dKb of memory for clipboard "
"transfer."), size / 1024);
wxLogSysError(_("Failed to allocate %dKb of memory for clipboard "
"transfer."), size / 1024);
- return
FALSE
;
+ return
false
;
}
LPVOID lpGlobalMemory = ::GlobalLock(hGlobal);
}
LPVOID lpGlobalMemory = ::GlobalLock(hGlobal);
@@
-155,16
+146,17
@@
static bool wxSetClipboardData(wxDataObject *data)
wxLogSysError(_("Failed to set clipboard data in format %s"),
wxDataObject::GetFormatName(format));
wxLogSysError(_("Failed to set clipboard data in format %s"),
wxDataObject::GetFormatName(format));
- return
FALSE
;
+ return
false
;
}
*/
}
*/
- return
TRUE
;
+ return
true
;
}
#endif // wxUSE_DRAG_AND_DROP
}
#endif // wxUSE_DRAG_AND_DROP
+#endif
-bool wxSetClipboardData(wxDataFormat
dataFormat
,
- const void *
data
,
- int
width, int height
)
+bool wxSetClipboardData(wxDataFormat
WXUNUSED(dataFormat)
,
+ const void *
WXUNUSED(data)
,
+ int
WXUNUSED(width), int WXUNUSED(height)
)
{
// TODO:
/*
{
// TODO:
/*
@@
-187,7
+179,7
@@
bool wxSetClipboardData(wxDataFormat dataFormat,
SelectObject(hdcSrc, old);
DeleteDC(hdcMem);
DeleteDC(hdcSrc);
SelectObject(hdcSrc, old);
DeleteDC(hdcMem);
DeleteDC(hdcSrc);
- return
FALSE
;
+ return
false
;
}
HBITMAP old1 = (HBITMAP) SelectObject(hdcMem, hBitmap);
}
HBITMAP old1 = (HBITMAP) SelectObject(hdcMem, hBitmap);
@@
-244,7
+236,7
@@
bool wxSetClipboardData(wxDataFormat dataFormat,
default:
{
wxLogError(_("Unsupported clipboard format."));
default:
{
wxLogError(_("Unsupported clipboard format."));
- return
FALSE
;
+ return
false
;
}
case wxDF_OEMTEXT:
}
case wxDF_OEMTEXT:
@@
-277,15
+269,15
@@
bool wxSetClipboardData(wxDataFormat dataFormat,
{
wxLogSysError(_("Failed to set clipboard data."));
{
wxLogSysError(_("Failed to set clipboard data."));
- return
FALSE
;
+ return
false
;
}
*/
}
*/
- return
TRUE
;
+ return
true
;
}
}
-void *wxGetClipboardData(wxDataFormat
dataFormat, long *len
)
+void *wxGetClipboardData(wxDataFormat
WXUNUSED(dataFormat), long *WXUNUSED(len)
)
{
{
-
void *retval = NULL;
+
//
void *retval = NULL;
// TODO:
/*
switch ( dataFormat )
// TODO:
/*
switch ( dataFormat )
@@
-331,7
+323,7
@@
void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
wxBM->SetWidth(bm.bmWidth);
wxBM->SetHeight(bm.bmHeight);
wxBM->SetDepth(bm.bmPlanes);
wxBM->SetWidth(bm.bmWidth);
wxBM->SetHeight(bm.bmHeight);
wxBM->SetDepth(bm.bmPlanes);
- wxBM->SetOk(
TRUE
);
+ wxBM->SetOk(
true
);
retval = wxBM;
break;
}
retval = wxBM;
break;
}
@@
-344,7
+336,7
@@
void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
case wxDF_DIB:
{
wxLogError(_("Unsupported clipboard format."));
case wxDF_DIB:
{
wxLogError(_("Unsupported clipboard format."));
- return
FALSE
;
+ return
NULL
;
}
case wxDF_OEMTEXT:
}
case wxDF_OEMTEXT:
@@
-416,15
+408,15
@@
wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat)
return dataFormat;
}
return dataFormat;
}
-int wxRegisterClipboardFormat(wxChar *
formatName
)
+int wxRegisterClipboardFormat(wxChar *
WXUNUSED(formatName)
)
{
// TODO: return ::RegisterClipboardFormat(formatName);
return 0;
}
{
// TODO: return ::RegisterClipboardFormat(formatName);
return 0;
}
-bool wxGetClipboardFormatName(wxDataFormat
dataFormat
,
- wxChar *
formatName
,
- int
maxCount
)
+bool wxGetClipboardFormatName(wxDataFormat
WXUNUSED(dataFormat)
,
+ wxChar *
WXUNUSED(formatName)
,
+ int
WXUNUSED(maxCount)
)
{
// TODO: return ::GetClipboardFormatName((int)dataFormat, formatName, maxCount) > 0;
return 0;
{
// TODO: return ::GetClipboardFormatName((int)dataFormat, formatName, maxCount) > 0;
return 0;
@@
-436,8
+428,6
@@
bool wxGetClipboardFormatName(wxDataFormat dataFormat,
IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject)
-wxClipboard* wxTheClipboard = (wxClipboard *)NULL;
-
wxClipboard::wxClipboard()
{
}
wxClipboard::wxClipboard()
{
}
@@
-454,7
+444,7
@@
void wxClipboard::Clear()
bool wxClipboard::Flush()
{
// TODO:
bool wxClipboard::Flush()
{
// TODO:
- return
FALSE
;
+ return
false
;
}
bool wxClipboard::Open()
}
bool wxClipboard::Open()
@@
-467,7
+457,7
@@
bool wxClipboard::IsOpened() const
return wxIsClipboardOpened();
}
return wxIsClipboardOpened();
}
-bool wxClipboard::SetData( wxDataObject *
data
)
+bool wxClipboard::SetData( wxDataObject *
WXUNUSED(data)
)
{
(void)wxEmptyClipboard();
// TODO:
{
(void)wxEmptyClipboard();
// TODO:
@@
-475,19
+465,19
@@
bool wxClipboard::SetData( wxDataObject *data )
if ( data )
return AddData(data);
else
if ( data )
return AddData(data);
else
- return
TRUE
;
+ return
true
;
*/
*/
- return
TRUE
;
+ return
true
;
}
bool wxClipboard::AddData( wxDataObject *data )
{
}
bool wxClipboard::AddData( wxDataObject *data )
{
- wxCHECK_MSG( data,
FALSE
, wxT("data is invalid") );
+ wxCHECK_MSG( data,
false
, wxT("data is invalid") );
#if wxUSE_DRAG_AND_DROP
#if wxUSE_DRAG_AND_DROP
- wxCHECK_MSG( wxIsClipboardOpened(),
FALSE
, wxT("clipboard not open") );
+ wxCHECK_MSG( wxIsClipboardOpened(),
false
, wxT("clipboard not open") );
-// wxDataFormat format = data->GetFormat();
+// wxDataFormat format = data->Get
Preferred
Format();
// TODO:
/*
switch ( format )
// TODO:
/*
switch ( format )
@@
-505,7
+495,7
@@
bool wxClipboard::AddData( wxDataObject *data )
{
wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data;
wxBitmap bitmap(bitmapDataObject->GetBitmap());
{
wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data;
wxBitmap bitmap(bitmapDataObject->GetBitmap());
- return wxSetClipboardData(data->GetFormat(), &bitmap);
+ return wxSetClipboardData(data->Get
Preferred
Format(), &bitmap);
}
#if wxUSE_METAFILE
}
#if wxUSE_METAFILE
@@
-525,7
+515,9
@@
bool wxClipboard::AddData( wxDataObject *data )
}
#else // !wxUSE_DRAG_AND_DROP
*/
}
#else // !wxUSE_DRAG_AND_DROP
*/
- return FALSE;
+ return false;
+#else
+ return false;
#endif // wxUSE_DRAG_AND_DROP/!wxUSE_DRAG_AND_DROP
}
#endif // wxUSE_DRAG_AND_DROP/!wxUSE_DRAG_AND_DROP
}
@@
-534,17
+526,17
@@
void wxClipboard::Close()
wxCloseClipboard();
}
wxCloseClipboard();
}
-bool wxClipboard::IsSupported(
wxDataFormat
format )
+bool wxClipboard::IsSupported(
const wxDataFormat&
format )
{
return wxIsClipboardFormatAvailable(format);
}
{
return wxIsClipboardFormatAvailable(format);
}
-bool wxClipboard::GetData( wxDataObject
*data
)
+bool wxClipboard::GetData( wxDataObject
& WXUNUSED(data)
)
{
{
- wxCHECK_MSG( wxIsClipboardOpened(),
FALSE
, wxT("clipboard not open") );
+ wxCHECK_MSG( wxIsClipboardOpened(),
false
, wxT("clipboard not open") );
#if wxUSE_DRAG_AND_DROP
#if wxUSE_DRAG_AND_DROP
-// wxDataFormat format = data
->Get
Format();
+// wxDataFormat format = data
.GetPreferred
Format();
// TODO:
/*
switch ( format )
// TODO:
/*
switch ( format )
@@
-552,45
+544,45
@@
bool wxClipboard::GetData( wxDataObject *data )
case wxDF_TEXT:
case wxDF_OEMTEXT:
{
case wxDF_TEXT:
case wxDF_OEMTEXT:
{
- wxTextDataObject
* textDataObject = (wxTextDataObject*
) data;
+ wxTextDataObject
& textDataObject = (wxTextDataObject&
) data;
char* s = (char*) wxGetClipboardData(format);
if ( s )
{
char* s = (char*) wxGetClipboardData(format);
if ( s )
{
- textDataObject
->
SetText(s);
+ textDataObject
.
SetText(s);
delete[] s;
delete[] s;
- return
TRUE
;
+ return
true
;
}
else
}
else
- return
FALSE
;
+ return
false
;
}
case wxDF_BITMAP:
case wxDF_DIB:
{
}
case wxDF_BITMAP:
case wxDF_DIB:
{
- wxBitmapDataObject
* bitmapDataObject = (wxBitmapDataObject *
)data;
- wxBitmap* bitmap = (wxBitmap *)wxGetClipboardData(data->GetFormat());
+ wxBitmapDataObject
& bitmapDataObject = (wxBitmapDataObject &
)data;
+ wxBitmap* bitmap = (wxBitmap *)wxGetClipboardData(data->Get
Preferred
Format());
if (bitmap)
{
if (bitmap)
{
- bitmapDataObject
->
SetBitmap(* bitmap);
+ bitmapDataObject
.
SetBitmap(* bitmap);
delete bitmap;
delete bitmap;
- return
TRUE
;
+ return
true
;
}
else
}
else
- return
FALSE
;
+ return
false
;
}
#if wxUSE_METAFILE
case wxDF_METAFILE:
{
}
#if wxUSE_METAFILE
case wxDF_METAFILE:
{
- wxMetafileDataObject
* metaFileDataObject = (wxMetafileDataObject *
)data;
+ wxMetafileDataObject
& metaFileDataObject = (wxMetafileDataObject &
)data;
wxMetafile* metaFile = (wxMetafile *)wxGetClipboardData(wxDF_METAFILE);
if (metaFile)
{
wxMetafile* metaFile = (wxMetafile *)wxGetClipboardData(wxDF_METAFILE);
if (metaFile)
{
- metaFileDataObject
->
SetMetafile(*metaFile);
+ metaFileDataObject
.
SetMetafile(*metaFile);
delete metaFile;
delete metaFile;
- return
TRUE
;
+ return
true
;
}
else
}
else
- return
FALSE
;
+ return
false
;
}
#endif
default:
}
#endif
default:
@@
-599,23
+591,22
@@
bool wxClipboard::GetData( wxDataObject *data )
void *buf = wxGetClipboardData(format, &len);
if ( buf )
{
void *buf = wxGetClipboardData(format, &len);
if ( buf )
{
- // FIXME this is for testing only!
!
- ((wxPrivateDataObject
*)data)->
SetData(buf, len);
+ // FIXME this is for testing only!
+ ((wxPrivateDataObject
&)data).
SetData(buf, len);
free(buf);
free(buf);
- return
TRUE
;
+ return
true
;
}
}
}
}
- return
FALSE
;
+ return
false
;
}
#else
*/
}
#else
*/
- return FALSE;
+ return false;
+#else
+ return false;
#endif
}
#endif
}
-#else
- #error "Please turn wxUSE_CLIPBOARD on to compile this file."
#endif // wxUSE_CLIPBOARD
#endif // wxUSE_CLIPBOARD
-