*** empty log message ***

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4097 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster
1999-10-21 05:13:26 +00:00
parent d37acbdf1c
commit 1be7f92adb
3 changed files with 441 additions and 313 deletions

View File

@@ -15,9 +15,6 @@
#ifndef _WX_CLIPBRD_H_ #ifndef _WX_CLIPBRD_H_
#define _WX_CLIPBRD_H_ #define _WX_CLIPBRD_H_
#include "wx/defs.h"
#include "wx/setup.h"
#if wxUSE_CLIPBOARD #if wxUSE_CLIPBOARD
#include "wx/list.h" #include "wx/list.h"
@@ -83,28 +80,16 @@ public:
// clears wxTheClipboard and the system's clipboard if possible // clears wxTheClipboard and the system's clipboard if possible
virtual void Clear(); virtual void Clear();
/// X11 has two clipboards which get selected by this call. Empty on MSW. // flushes the clipboard: this means that the data which is currently on
// clipboard will stay available even after the application exits (possibly
// eating memory), otherwise the clipboard will be emptied on exit
virtual bool Flush();
// X11 has two clipboards which get selected by this call. Empty on MSW.
void UsePrimarySelection( bool WXUNUSED(primary) = FALSE ) { } void UsePrimarySelection( bool WXUNUSED(primary) = FALSE ) { }
}; private:
bool m_clearOnExit;
// The global clipboard object
WXDLLEXPORT_DATA(extern wxClipboard*) wxTheClipboard;
//-----------------------------------------------------------------------------
// wxClipboardModule: module responsible for initializing the global clipboard
// object
//-----------------------------------------------------------------------------
class wxClipboardModule : public wxModule
{
DECLARE_DYNAMIC_CLASS(wxClipboardModule)
public:
wxClipboardModule() { }
bool OnInit();
void OnExit();
}; };
#endif // wxUSE_CLIPBOARD #endif // wxUSE_CLIPBOARD

View File

@@ -134,160 +134,202 @@ NONESSENTIALOBJS= \
..\generic\$D\fontdlgg.obj ..\generic\$D\fontdlgg.obj
COMMONOBJS = \ COMMONOBJS = \
..\common\$D\appcmn.obj \
..\common\$D\choiccmn.obj \
..\common\$D\cmndata.obj \ ..\common\$D\cmndata.obj \
..\common\$D\config.obj \ ..\common\$D\config.obj \
..\common\$D\ctrlcmn.obj \
..\common\$D\date.obj \
..\common\$D\datastrm.obj \
..\common\$D\dcbase.obj \ ..\common\$D\dcbase.obj \
..\common\$D\db.obj \ ..\common\$D\db.obj \
..\common\$D\dbtable.obj \ ..\common\$D\dbtable.obj \
..\common\$D\dlgcmn.obj \
..\common\$D\docmdi.obj \
..\common\$D\docview.obj \ ..\common\$D\docview.obj \
..\common\$D\docmdi.obj \ ..\common\$D\docmdi.obj \
..\common\$D\dynarray.obj \ ..\common\$D\dynarray.obj \
..\common\$D\dynlib.obj \ ..\common\$D\dynlib.obj \
..\common\$D\event.obj \ ..\common\$D\event.obj \
..\common\$D\extended.obj \
..\common\$D\ffile.obj \
..\common\$D\file.obj \ ..\common\$D\file.obj \
..\common\$D\filefn.obj \
..\common\$D\fileconf.obj \ ..\common\$D\fileconf.obj \
..\common\$D\filefn.obj \
..\common\$D\filesys.obj \
..\common\$D\fontcmn.obj \
..\common\$D\framecmn.obj \ ..\common\$D\framecmn.obj \
..\common\$D\fs_inet.obj \
..\common\$D\fs_zip.obj \
..\common\$D\ftp.obj \ ..\common\$D\ftp.obj \
..\common\$D\gdicmn.obj \ ..\common\$D\gdicmn.obj \
..\common\$D\image.obj \ ..\common\$D\gifdecod.obj \
..\common\$D\hash.obj \
..\common\$D\helpbase.obj \
..\common\$D\http.obj \
..\common\$D\imagall.obj \
..\common\$D\imagbmp.obj \ ..\common\$D\imagbmp.obj \
..\common\$D\imagjpeg.obj \ ..\common\$D\image.obj \
..\common\$D\imagpng.obj \
..\common\$D\imaggif.obj \ ..\common\$D\imaggif.obj \
..\common\$D\imagjpeg.obj \
..\common\$D\imagpcx.obj \
..\common\$D\imagpng.obj \
..\common\$D\imagpnm.obj \
..\common\$D\init.obj \
..\common\$D\intl.obj \ ..\common\$D\intl.obj \
..\common\$D\ipcbase.obj \ ..\common\$D\ipcbase.obj \
..\common\$D\helpbase.obj \
..\common\$D\layout.obj \ ..\common\$D\layout.obj \
..\common\$D\list.obj \
..\common\$D\log.obj \ ..\common\$D\log.obj \
..\common\$D\longlong.obj \
..\common\$D\matrix.obj \
..\common\$D\memory.obj \ ..\common\$D\memory.obj \
..\common\$D\mimetype.obj \ ..\common\$D\mimetype.obj \
..\common\$D\module.obj \ ..\common\$D\module.obj \
..\common\$D\odbc.obj \ ..\common\$D\mstream.obj \
..\common\$D\object.obj \ ..\common\$D\object.obj \
..\common\$D\prntbase.obj \ ..\common\$D\objstrm.obj \
..\common\$D\resource.obj \ ..\common\$D\odbc.obj \
..\common\$D\tbarbase.obj \
..\common\$D\tbarsmpl.obj \
..\common\$D\textfile.obj \
..\common\$D\timercmn.obj \
..\common\$D\utilscmn.obj \
..\common\$D\validate.obj \
..\common\$D\valgen.obj \
..\common\$D\valtext.obj \
..\common\$D\date.obj \
..\common\$D\hash.obj \
..\common\$D\list.obj \
..\common\$D\paper.obj \ ..\common\$D\paper.obj \
..\common\$D\string.obj \ ..\common\$D\prntbase.obj \
..\common\$D\socket.obj \ ..\common\$D\process.obj \
..\common\$D\protocol.obj \
..\common\$D\resourc2.obj \
..\common\$D\resource.obj \
..\common\$D\sckaddr.obj \ ..\common\$D\sckaddr.obj \
..\common\$D\sckfile.obj \ ..\common\$D\sckfile.obj \
..\common\$D\sckipc.obj \ ..\common\$D\sckipc.obj \
..\common\$D\sckstrm.obj \ ..\common\$D\sckstrm.obj \
..\common\$D\url.obj \ ..\common\$D\serbase.obj \
..\common\$D\http.obj \ ..\common\$D\sizer.obj \
..\common\$D\protocol.obj \ ..\common\$D\socket.obj \
..\common\$D\strconv.obj \
..\common\$D\stream.obj \
..\common\$D\string.obj \
..\common\$D\tbarbase.obj \
..\common\$D\tbarsmpl.obj \
..\common\$D\textfile.obj \
..\common\$D\textsmpl.obj \
..\common\$D\textcmn.obj \
..\common\$D\textfile.obj \
..\common\$D\time.obj \ ..\common\$D\time.obj \
..\common\$D\timercmn.obj \
..\common\$D\tokenzr.obj \ ..\common\$D\tokenzr.obj \
..\common\$D\txtstrm.obj \
..\common\$D\unzip.obj \
..\common\$D\url.obj \
..\common\$D\utilscmn.obj \
..\common\$D\valgen.obj \
..\common\$D\validate.obj \
..\common\$D\valtext.obj \
..\common\$D\variant.obj \
..\common\$D\wfstream.obj \
..\common\$D\wincmn.obj \
..\common\$D\wxchar.obj \
..\common\$D\wxexpr.obj \ ..\common\$D\wxexpr.obj \
..\common\$D\y_tab.obj \ ..\common\$D\y_tab.obj \
..\common\$D\extended.obj \ ..\common\$D\zipstrm.obj \
..\common\$D\process.obj \ ..\common\$D\zstream.obj
..\common\$D\wfstream.obj \
..\common\$D\mstream.obj \
..\common\$D\zstream.obj \
..\common\$D\stream.obj \
..\common\$D\datstrm.obj \
..\common\$D\objstrm.obj \
..\common\$D\variant.obj \
..\common\$D\dlgcmn.obj \
..\common\$D\wincmn.obj \
..\common\$D\txtstrm.obj \
..\common\$D\wxchar.obj \
..\common\$D\unzip.obj \
..\common\$D\filesys.obj \
..\common\$D\fs_inet.obj \
..\common\$D\fs_zip.obj
COMLIBOBJS1 = \ COMLIBOBJS1 = \
appcmn.obj \
choiccmn.obj \
cmndata.obj \ cmndata.obj \
config.obj \ config.obj \
ctrlcmn.obj \
date.obj \
datastrm.obj \
dcbase.obj \ dcbase.obj \
db.obj \ db.obj \
dbtable.obj \ dbtable.obj \
dlgcmn.obj \
docmdi.obj \
docview.obj \ docview.obj \
docmdi.obj \ docmdi.obj \
dynarray.obj \ dynarray.obj \
dynlib.obj \ dynlib.obj \
event.obj \ event.obj \
extended.obj \
ffile.obj \
file.obj \ file.obj \
filefn.obj \
fileconf.obj \ fileconf.obj \
filefn.obj \
filesys.obj \
fontcmn.obj \
framecmn.obj \ framecmn.obj \
fs_inet.obj \
fs_zip.obj \
ftp.obj \ ftp.obj \
gdicmn.obj \ gdicmn.obj \
image.obj \ gifdecod.obj \
hash.obj \
helpbase.obj \
http.obj \
imagall.obj \
imagbmp.obj \ imagbmp.obj \
imagjpeg.obj \ image.obj \
imagpng.obj \
imaggif.obj \ imaggif.obj \
imagjpeg.obj \
imagpcx.obj \
imagpng.obj \
imagpnm.obj \
init.obj \
intl.obj \ intl.obj \
ipcbase.obj \ ipcbase.obj \
helpbase.obj \ layout.obj
layout.obj \
COMLIBOBJS2 = \
list.obj \
log.obj \ log.obj \
longlong.obj \
matrix.obj \
memory.obj \ memory.obj \
mimetype.obj \ mimetype.obj \
module.obj \ module.obj \
odbc.obj \ mstream.obj \
object.obj \ object.obj \
objstrm.obj \
odbc.obj \
paper.obj \
prntbase.obj \ prntbase.obj \
process.obj \
protocol.obj \
resourc2.obj \
resource.obj \ resource.obj \
tbarbase.obj \
tbarsmpl.obj \
textfile.obj \
timercmn.obj \
utilscmn.obj \
validate.obj \
valgen.obj \
valtext.obj \
date.obj \
hash.obj \
list.obj \
paper.obj
COMLIBOBJS2 = \
string.obj \
socket.obj \
sckaddr.obj \ sckaddr.obj \
sckfile.obj \ sckfile.obj \
sckipc.obj \ sckipc.obj \
sckstrm.obj \ sckstrm.obj \
url.obj \ serbase.obj \
http.obj \ sizer.obj \
protocol.obj \ socket.obj \
strconv.obj \
stream.obj \
string.obj \
tbarbase.obj \
tbarsmpl.obj \
textfile.obj \
textsmpl.obj \
textcmn.obj \
textfile.obj \
time.obj \ time.obj \
timercmn.obj \
tokenzr.obj \ tokenzr.obj \
txtstrm.obj \
unzip.obj \
url.obj \
utilscmn.obj \
valgen.obj \
validate.obj \
valtext.obj \
variant.obj \
wfstream.obj \
wincmn.obj \
wxchar.obj \
wxexpr.obj \ wxexpr.obj \
y_tab.obj \ y_tab.obj \
extended.obj \ zipstrm.obj \
process.obj \
wfstream.obj \
mstream.obj \
zstream.obj \ zstream.obj \
stream.obj \
datstrm.obj \
objstrm.obj \
variant.obj \
dlgcmn.obj \
wincmn.obj \
txtstrm.obj \
wxchar.obj \
unzip.obj \
filesys.obj \
fs_inet.obj \
fs_zip.obj
OS2OBJS = \ OS2OBJS = \
..\os2\$D\accel.obj \ ..\os2\$D\accel.obj \
@@ -492,83 +534,104 @@ $(HTMLDIR)\$D:
md $(HTMLDIR)\$D md $(HTMLDIR)\$D
$(COMLIBOBJS1): $(COMLIBOBJS1):
copy ..\common\$D\appcmn.obj
copy ..\common\$D\choiccmn.obj
copy ..\common\$D\cmndata.obj copy ..\common\$D\cmndata.obj
copy ..\common\$D\config.obj copy ..\common\$D\config.obj
copy ..\common\$D\ctrlcmn.obj
copy ..\common\$D\date.obj
copy ..\common\$D\datastrm.obj
copy ..\common\$D\dcbase.obj copy ..\common\$D\dcbase.obj
copy ..\common\$D\db.obj copy ..\common\$D\db.obj
copy ..\common\$D\dbtable.obj copy ..\common\$D\dbtable.obj
copy ..\common\$D\dlgcmn.obj
copy ..\common\$D\docmdi.obj
copy ..\common\$D\docview.obj copy ..\common\$D\docview.obj
copy ..\common\$D\docmdi.obj copy ..\common\$D\docmdi.obj
copy ..\common\$D\dynarray.obj copy ..\common\$D\dynarray.obj
copy ..\common\$D\dynlib.obj copy ..\common\$D\dynlib.obj
copy ..\common\$D\event.obj copy ..\common\$D\event.obj
copy ..\common\$D\extended.obj
copy ..\common\$D\ffile.obj
copy ..\common\$D\file.obj copy ..\common\$D\file.obj
copy ..\common\$D\filefn.obj
copy ..\common\$D\fileconf.obj copy ..\common\$D\fileconf.obj
copy ..\common\$D\filefn.obj
copy ..\common\$D\filesys.obj
copy ..\common\$D\fontcmn.obj
copy ..\common\$D\framecmn.obj copy ..\common\$D\framecmn.obj
copy ..\common\$D\fs_inet.obj
copy ..\common\$D\fs_zip.obj
copy ..\common\$D\ftp.obj copy ..\common\$D\ftp.obj
copy ..\common\$D\gdicmn.obj copy ..\common\$D\gdicmn.obj
copy ..\common\$D\image.obj copy ..\common\$D\gifdecod.obj
copy ..\common\$D\hash.obj
copy ..\common\$D\helpbase.obj
copy ..\common\$D\http.obj
copy ..\common\$D\imagall.obj
copy ..\common\$D\imagbmp.obj copy ..\common\$D\imagbmp.obj
copy ..\common\$D\imagjpeg.obj copy ..\common\$D\image.obj
copy ..\common\$D\imagpng.obj
copy ..\common\$D\imaggif.obj copy ..\common\$D\imaggif.obj
copy ..\common\$D\imagjpeg.obj
copy ..\common\$D\imagpcx.obj
copy ..\common\$D\imagpng.obj
copy ..\common\$D\imagpnm.obj
copy ..\common\$D\init.obj
copy ..\common\$D\intl.obj copy ..\common\$D\intl.obj
copy ..\common\$D\ipcbase.obj copy ..\common\$D\ipcbase.obj
copy ..\common\$D\helpbase.obj
copy ..\common\$D\layout.obj copy ..\common\$D\layout.obj
$(COMLIBOBJS2):
copy ..\common\$D\list.obj
copy ..\common\$D\log.obj copy ..\common\$D\log.obj
copy ..\common\$D\longlong.obj
copy ..\common\$D\matrix.obj
copy ..\common\$D\memory.obj copy ..\common\$D\memory.obj
copy ..\common\$D\mimetype.obj copy ..\common\$D\mimetype.obj
copy ..\common\$D\module.obj copy ..\common\$D\module.obj
copy ..\common\$D\odbc.obj copy ..\common\$D\mstream.obj
copy ..\common\$D\object.obj copy ..\common\$D\object.obj
copy ..\common\$D\prntbase.obj copy ..\common\$D\objstrm.obj
copy ..\common\$D\resource.obj copy ..\common\$D\odbc.obj
copy ..\common\$D\tbarbase.obj
copy ..\common\$D\tbarsmpl.obj
copy ..\common\$D\textfile.obj
copy ..\common\$D\timercmn.obj
copy ..\common\$D\utilscmn.obj
copy ..\common\$D\validate.obj
copy ..\common\$D\valgen.obj
copy ..\common\$D\valtext.obj
copy ..\common\$D\date.obj
copy ..\common\$D\hash.obj
copy ..\common\$D\list.obj
copy ..\common\$D\paper.obj copy ..\common\$D\paper.obj
copy ..\common\$D\prntbase.obj
$(COMLIBOBJS2): copy ..\common\$D\process.obj
copy ..\common\$D\string.obj copy ..\common\$D\protocol.obj
copy ..\common\$D\socket.obj copy ..\common\$D\resourc2.obj
copy ..\common\$D\resource.obj
copy ..\common\$D\sckaddr.obj copy ..\common\$D\sckaddr.obj
copy ..\common\$D\sckfile.obj copy ..\common\$D\sckfile.obj
copy ..\common\$D\sckipc.obj copy ..\common\$D\sckipc.obj
copy ..\common\$D\sckstrm.obj copy ..\common\$D\sckstrm.obj
copy ..\common\$D\url.obj copy ..\common\$D\serbase.obj
copy ..\common\$D\http.obj copy ..\common\$D\sizer.obj
copy ..\common\$D\protocol.obj copy ..\common\$D\socket.obj
copy ..\common\$D\strconv.obj
copy ..\common\$D\stream.obj
copy ..\common\$D\string.obj
copy ..\common\$D\tbarbase.obj
copy ..\common\$D\tbarsmpl.obj
copy ..\common\$D\textfile.obj
copy ..\common\$D\textsmpl.obj
copy ..\common\$D\textcmn.obj
copy ..\common\$D\textfile.obj
copy ..\common\$D\time.obj copy ..\common\$D\time.obj
copy ..\common\$D\timercmn.obj
copy ..\common\$D\tokenzr.obj copy ..\common\$D\tokenzr.obj
copy ..\common\$D\txtstrm.obj
copy ..\common\$D\unzip.obj
copy ..\common\$D\url.obj
copy ..\common\$D\utilscmn.obj
copy ..\common\$D\valgen.obj
copy ..\common\$D\validate.obj
copy ..\common\$D\valtext.obj
copy ..\common\$D\variant.obj
copy ..\common\$D\wfstream.obj
copy ..\common\$D\wincmn.obj
copy ..\common\$D\wxchar.obj
copy ..\common\$D\wxexpr.obj copy ..\common\$D\wxexpr.obj
copy ..\common\$D\y_tab.obj copy ..\common\$D\y_tab.obj
copy ..\common\$D\extended.obj copy ..\common\$D\zipstrm.obj
copy ..\common\$D\process.obj
copy ..\common\$D\wfstream.obj
copy ..\common\$D\mstream.obj
copy ..\common\$D\zstream.obj copy ..\common\$D\zstream.obj
copy ..\common\$D\stream.obj
copy ..\common\$D\datstrm.obj
copy ..\common\$D\objstrm.obj
copy ..\common\$D\variant.obj
copy ..\common\$D\dlgcmn.obj
copy ..\common\$D\wincmn.obj
copy ..\common\$D\txtstrm.obj
copy ..\common\$D\wxchar.obj
copy ..\common\$D\unzip.obj
copy ..\common\$D\filesys.obj
copy ..\common\$D\fs_inet.obj
copy ..\common\$D\fs_zip.obj
$(GENLIBOBJS): $(GENLIBOBJS):
copy ..\generic\$D\caret.obj copy ..\generic\$D\caret.obj

View File

@@ -336,39 +336,64 @@ bool wxWriteResource(
); );
} }
bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file) bool wxWriteResource(
const wxString& rSection
, const wxString& rEntry
, long lValue
, const wxString& rFile
)
{ {
wxChar buf[50]; wxChar zBuf[50];
wxSprintf(buf, "%ld", value);
return wxWriteResource(section, entry, buf, file); wxSprintf(zBuf, "%ld", lValue);
return wxWriteResource( rSection
,rEntry
,zBuf
,rFile
);
} }
bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file) bool wxWriteResource(
const wxString& rSection
, const wxString& rEntry
, int lValue
, const wxString& rFile
)
{ {
wxChar buf[50]; wxChar zBuf[50];
wxSprintf(buf, "%d", value);
return wxWriteResource(section, entry, buf, file); wxSprintf(zBuf, "%d", lValue);
return wxWriteResource( rSection
,rEntry
,zBuf
,rFile
);
} }
bool wxGetResource(const wxString& section, const wxString& entry, wxChar **value, const wxString& file) bool wxGetResource(
const wxString& rSection
, const wxString& rEntry
, wxChar** ppValue
, const wxString& rFile
)
{ {
HAB hab; HAB hab;
HINI hIni; HINI hIni;
static const wxChar defunkt[] = _T("$$default"); static const wxChar zDefunkt[] = _T("$$default");
if (file != "") if (rFile != "")
{ {
hIni = ::PrfOpenProfile(hab, (PSZ)WXSTRINGCAST file); hIni = ::PrfOpenProfile(hab, (PSZ)WXSTRINGCAST rFile);
if (hIni != 0L) if (hIni != 0L)
{ {
ULONG n = ::PrfQueryProfileString( hIni ULONG n = ::PrfQueryProfileString( hIni
,(PSZ)WXSTRINGCAST section ,(PSZ)WXSTRINGCAST rSection
,(PSZ)WXSTRINGCAST entry ,(PSZ)WXSTRINGCAST rEntry
,(PSZ)defunkt ,(PSZ)zDefunkt
,(void*)wxBuffer ,(void*)wxBuffer
,1000 ,1000
); );
if (n == 0L || wxStrcmp(wxBuffer, defunkt) == 0) if (n == 0L || wxStrcmp(wxBuffer, zDefunkt) == 0)
return FALSE; return FALSE;
} }
else else
@@ -377,55 +402,85 @@ bool wxGetResource(const wxString& section, const wxString& entry, wxChar **valu
else else
{ {
ULONG n = ::PrfQueryProfileString( HINI_PROFILE ULONG n = ::PrfQueryProfileString( HINI_PROFILE
,(PSZ)WXSTRINGCAST section ,(PSZ)WXSTRINGCAST rSection
,(PSZ)WXSTRINGCAST entry ,(PSZ)WXSTRINGCAST rEntry
,(PSZ)defunkt ,(PSZ)zDefunkt
,(void*)wxBuffer ,(void*)wxBuffer
,1000 ,1000
); );
if (n == 0L || wxStrcmp(wxBuffer, defunkt) == 0) if (n == 0L || wxStrcmp(wxBuffer, zDefunkt) == 0)
return FALSE; return FALSE;
} }
if (*value) if (*ppValue)
delete[] (*value); delete[] (*ppValue);
*value = copystring(wxBuffer); *ppValue = copystring(wxBuffer);
return TRUE; return TRUE;
} }
bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file) bool wxGetResource(
const wxString& rSection
, const wxString& rEntry
, float* pValue
, const wxString& rFile
)
{ {
wxChar *s = NULL; wxChar* zStr = NULL;
bool succ = wxGetResource(section, entry, (wxChar **)&s, file); bool bSucc = wxGetResource( rSection
if (succ) ,rEntry
,(wxChar **)&zStr
,rFile
);
if (bSucc)
{ {
*value = (float)wxStrtod(s, NULL); *pValue = (float)wxStrtod(zStr, NULL);
delete[] s; delete[] zStr;
return TRUE; return TRUE;
} }
else return FALSE; else return FALSE;
} }
bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file) bool wxGetResource(
const wxString& rSection
, const wxString& rEntry
, long* pValue
, const wxString& rFile
)
{ {
wxChar *s = NULL; wxChar* zStr = NULL;
bool succ = wxGetResource(section, entry, (wxChar **)&s, file); bool bSucc = wxGetResource( rSection
if (succ) ,rEntry
,(wxChar **)&zStr
,rFile
);
if (bSucc)
{ {
*value = wxStrtol(s, NULL, 10); *pValue = wxStrtol(zStr, NULL, 10);
delete[] s; delete[] zStr;
return TRUE; return TRUE;
} }
else return FALSE; else return FALSE;
} }
bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file) bool wxGetResource(
const wxString& rSection
, const wxString& rEntry
, int* pValue
, const wxString& rFile
)
{ {
wxChar *s = NULL; wxChar* zStr = NULL;
bool succ = wxGetResource(section, entry, (wxChar **)&s, file); bool bSucc = wxGetResource( rSection
if (succ) ,rEntry
,(wxChar **)&zStr
,rFile
);
if (bSucc)
{ {
*value = (int)wxStrtol(s, NULL, 10); *pValue = (int)wxStrtol(zStr, NULL, 10);
delete[] s; delete[] zStr;
return TRUE; return TRUE;
} }
else return FALSE; else return FALSE;
@@ -441,11 +496,13 @@ HCURSOR gs_wxBusyCursorOld = 0; // old cursor
static int gs_wxBusyCursorCount = 0; static int gs_wxBusyCursorCount = 0;
// Set the cursor to the busy cursor for all windows // Set the cursor to the busy cursor for all windows
void wxBeginBusyCursor(wxCursor *cursor) void wxBeginBusyCursor(
wxCursor* pCursor
)
{ {
if ( gs_wxBusyCursorCount++ == 0 ) if ( gs_wxBusyCursorCount++ == 0 )
{ {
gs_wxBusyCursor = (HCURSOR)cursor->GetHCURSOR(); gs_wxBusyCursor = (HCURSOR)pCursor->GetHCURSOR();
::WinSetPointer(HWND_DESKTOP, (HPOINTER)gs_wxBusyCursor); ::WinSetPointer(HWND_DESKTOP, (HPOINTER)gs_wxBusyCursor);
} }
//else: nothing to do, already set //else: nothing to do, already set
@@ -454,8 +511,9 @@ void wxBeginBusyCursor(wxCursor *cursor)
// Restore cursor to normal // Restore cursor to normal
void wxEndBusyCursor() void wxEndBusyCursor()
{ {
wxCHECK_RET( gs_wxBusyCursorCount > 0, wxCHECK_RET( gs_wxBusyCursorCount > 0
_T("no matching wxBeginBusyCursor() for wxEndBusyCursor()")); ,_T("no matching wxBeginBusyCursor() for wxEndBusyCursor()")
);
if (--gs_wxBusyCursorCount == 0) if (--gs_wxBusyCursorCount == 0)
{ {
@@ -471,9 +529,11 @@ bool wxIsBusy()
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
const wxChar* wxGetHomeDir(wxString *pstr) const wxChar* wxGetHomeDir(
wxString* pStr
)
{ {
wxString& strDir = *pstr; wxString& rStrDir = *pStr;
// OS/2 has no idea about home, // OS/2 has no idea about home,
// so use the working directory instead? // so use the working directory instead?
@@ -483,39 +543,46 @@ const wxChar* wxGetHomeDir(wxString *pstr)
# define MAX_PATH 256 # define MAX_PATH 256
#endif #endif
char zDirName[256];
ULONG ulDirLen;
char DirName[256]; ::DosQueryCurrentDir(0, zDirName, &ulDirLen);
ULONG DirLen; rStrDir = zDirName;
return rStrDir.c_str();
::DosQueryCurrentDir( 0, DirName, &DirLen);
strDir = DirName;
return strDir.c_str();
} }
// Hack for OS/2 // Hack for OS/2
wxChar *wxGetUserHome (const wxString& user) wxChar* wxGetUserHome (
const wxString& rUser
)
{ {
wxChar *home; wxChar* zHome;
wxString user1(user); wxString sUser1(rUser);
if (user1 != _T("")) { if (sUser1 != _T(""))
wxChar tmp[64];
if (wxGetUserId(tmp, sizeof(tmp)/sizeof(char))) {
// Guests belong in the temp dir
if (wxStricmp(tmp, _T("annonymous")) == 0) {
if ((home = wxGetenv(_T("TMP"))) != NULL ||
(home = wxGetenv(_T("TMPDIR"))) != NULL ||
(home = wxGetenv(_T("TEMP"))) != NULL)
return *home ? home : (wxChar*)_T("\\");
}
if (wxStricmp(tmp, WXSTRINGCAST user1) == 0)
user1 = _T("");
}
}
if (user1 == _T(""))
if ((home = wxGetenv(_T("HOME"))) != NULL)
{ {
wxStrcpy(wxBuffer, home); wxChar zTmp[64];
if (wxGetUserId( zTmp
,sizeof(zTmp)/sizeof(char)
))
{
// Guests belong in the temp dir
if (wxStricmp(zTmp, _T("annonymous")) == 0)
{
if ((zHome = wxGetenv(_T("TMP"))) != NULL ||
(zHome = wxGetenv(_T("TMPDIR"))) != NULL ||
(zHome = wxGetenv(_T("TEMP"))) != NULL)
return *zHome ? zHome : (wxChar*)_T("\\");
}
if (wxStricmp(zTmp, WXSTRINGCAST sUser1) == 0)
sUser1 = _T("");
}
}
if (sUser1 == _T(""))
if ((zHome = wxGetenv(_T("HOME"))) != NULL)
{
wxStrcpy(wxBuffer, zHome);
Unix2DosFilename(wxBuffer); Unix2DosFilename(wxBuffer);
return wxBuffer; return wxBuffer;
} }
@@ -524,130 +591,143 @@ wxChar *wxGetUserHome (const wxString& user)
// Check whether this window wants to process messages, e.g. Stop button // Check whether this window wants to process messages, e.g. Stop button
// in long calculations. // in long calculations.
bool wxCheckForInterrupt(wxWindow *wnd) bool wxCheckForInterrupt(
wxWindow* pWnd
)
{ {
if(wnd){ if(pWnd)
QMSG msg; {
QMSG vMsg;
HAB hab; HAB hab;
HWND hwndFilter; HWND hwndFilter;
HWND hwndWin= (HWND) pWnd->GetHWND();
HWND win= (HWND) wnd->GetHWND(); while(::WinPeekMsg(hab, &vMsg, hwndFilter, 0, 0, PM_REMOVE))
while(::WinPeekMsg(hab,&msg,hwndFilter,0,0,PM_REMOVE))
{ {
::WinDispatchMsg( hab, &msg ); ::WinDispatchMsg(hab, &vMsg);
} }
return TRUE;//*** temporary? return TRUE;//*** temporary?
} }
else{ else
wxFAIL_MSG(_T("wnd==NULL !!!")); {
wxFAIL_MSG(_T("pWnd==NULL !!!"));
return FALSE;//*** temporary? return FALSE;//*** temporary?
} }
} }
void wxGetMousePosition( int* x, int* y ) void wxGetMousePosition(
int* pX
, int* pY
)
{ {
POINTL pt; POINTL vPt;
::WinQueryPointerPos( HWND_DESKTOP, & pt );
*x = pt.x; ::WinQueryPointerPos(HWND_DESKTOP, &vPt);
*y = pt.y; *pX = vPt.x;
*pY = vPt.y;
}; };
// Return TRUE if we have a colour display // Return TRUE if we have a colour display
bool wxColourDisplay() bool wxColourDisplay()
{ {
bool flag; HPS hpsScreen;
// TODO: use DosQueryDevCaps to figure it out HDC hdcScreen;
return flag; LONG lColors;
hpsScreen = ::WinGetScreenPS(HWND_DESKTOP);
hdcScreen = ::GpiQueryDevice(hpsScreen);
::DevQueryCaps(hdcScreen, CAPS_COLORS, 1L, &lColors);
return(lColors > 1L);
} }
// Returns depth of screen // Returns depth of screen
int wxDisplayDepth() int wxDisplayDepth()
{ {
HDC hDc = ::WinOpenWindowDC((HWND)NULL); HPS hpsScreen;
long lArray[CAPS_COLOR_BITCOUNT]; HDC hdcScreen;
int nPlanes; LONG lPlanes;
int nBitsPerPixel; LONG lBitsPerPixel;
int nDepth; LONG nDepth;
if(DevQueryCaps( hDc hpsScreen = ::WinGetScreenPS(HWND_DESKTOP);
,CAPS_FAMILY hdcScreen = ::GpiQueryDevice(hpsScreen);
,CAPS_COLOR_BITCOUNT ::DevQueryCaps(hdcScreen, CAPS_COLOR_PLANES, 1L, &lPlanes);
,lArray ::DevQueryCaps(hdcScreen, CAPS_COLOR_BITCOUNT, 1L, &lBitsPerPixel);
))
{ nDepth = (int)(lPlanes * lBitsPerPixel);
nPlanes = (int)lArray[CAPS_COLOR_PLANES]; DevCloseDC(hdcScreen);
nBitsPerPixel = (int)lArray[CAPS_COLOR_BITCOUNT];
nDepth = nPlanes * nBitsPerPixel;
}
DevCloseDC(hDc);
return (nDepth); return (nDepth);
} }
// Get size of display // Get size of display
void wxDisplaySize(int *width, int *height) void wxDisplaySize(
int* pWidth
, int* pHeight
)
{ {
HDC hDc = ::WinOpenWindowDC((HWND)NULL); HPS hpsScreen;
long lArray[CAPS_HEIGHT]; HDC hdcScreen;
if(DevQueryCaps( hDc hpsScreen = ::WinGetScreenPS(HWND_DESKTOP);
,CAPS_FAMILY hdcScreen = ::GpiQueryDevice(hpsScreen);
,CAPS_HEIGHT ::DevQueryCaps(hdcScreen, CAPS_WIDTH, 1L, (PLONG)pWidth);
,lArray ::DevQueryCaps(hdcScreen, CAPS_HEIGHT, 1L, (PLONG)pHeight);
)) DevCloseDC(hdcScreen);
{
*width = (int)lArray[CAPS_WIDTH];
*height = (int)lArray[CAPS_HEIGHT];
}
DevCloseDC(hDc);
} }
bool wxDirExists(const wxString& dir) bool wxDirExists(
const wxString& rDir
)
{ {
// TODO: Control program file stuff return (::DosSetCurrentDir(WXSTRINGCAST rDir));
return TRUE;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// window information functions // window information functions
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
wxString WXDLLEXPORT wxGetWindowText(WXHWND hWnd) wxString WXDLLEXPORT wxGetWindowText(
WXHWND hWnd
)
{ {
wxString str; wxString vStr;
long len = ::WinQueryWindowTextLength((HWND)hWnd) + 1; long lLen = ::WinQueryWindowTextLength((HWND)hWnd) + 1;
::WinQueryWindowText((HWND)hWnd, len, str.GetWriteBuf((int)len));
str.UngetWriteBuf();
return str; ::WinQueryWindowText((HWND)hWnd, lLen, vStr.GetWriteBuf((int)lLen));
vStr.UngetWriteBuf();
return vStr;
} }
wxString WXDLLEXPORT wxGetWindowClass(WXHWND hWnd) wxString WXDLLEXPORT wxGetWindowClass(
WXHWND hWnd
)
{ {
wxString str; wxString vStr;
int nLen = 256; // some starting value
int len = 256; // some starting value
for ( ;; ) for ( ;; )
{ {
int count = ::WinQueryClassName((HWND)hWnd, len, str.GetWriteBuf(len)); int nCount = ::WinQueryClassName((HWND)hWnd, nLen, vStr.GetWriteBuf(nLen));
str.UngetWriteBuf(); vStr.UngetWriteBuf();
if ( count == len ) if (nCount == nLen )
{ {
// the class name might have been truncated, retry with larger // the class name might have been truncated, retry with larger
// buffer // buffer
len *= 2; nLen *= 2;
} }
else else
{ {
break; break;
} }
} }
return str; return vStr;
} }
WXWORD WXDLLEXPORT wxGetWindowId(WXHWND hWnd) WXWORD WXDLLEXPORT wxGetWindowId(
WXHWND hWnd
)
{ {
return ::WinQueryWindowUShort((HWND)hWnd, QWS_ID); return ::WinQueryWindowUShort((HWND)hWnd, QWS_ID);
} }