Take best fitting type for available memory measurement.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31152 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-12-27 18:47:26 +00:00
parent 49a1436640
commit 9d8aca4832
8 changed files with 554 additions and 537 deletions

View File

@@ -315,7 +315,7 @@ the following can be done:
\func{bool}{wxCHECK\_VERSION\_FULL}{\param{}{major, minor, release, subrel}} \func{bool}{wxCHECK\_VERSION\_FULL}{\param{}{major, minor, release, subrel}}
Same as \helpref{wxCHECK\_VERSION}{wxcheckversion} but also checks that Same as \helpref{wxCHECK\_VERSION}{wxcheckversion} but also checks that
\texttt{wxSUBRELEASE\_NUMBER} is at least \arg{subrel}. \texttt{wxSUBRELEASE\_NUMBER} is at least \arg{subrel}.
@@ -530,7 +530,7 @@ an array reference.}
\func{long}{wxExecute}{\param{const wxString\& }{command}, \param{wxArrayString\& }{output}, \param{wxArrayString\& }{errors}, \param{int }{flags = 0}} \func{long}{wxExecute}{\param{const wxString\& }{command}, \param{wxArrayString\& }{output}, \param{wxArrayString\& }{errors}, \param{int }{flags = 0}}
\perlnote{In wxPerl this function is called \texttt{Wx::ExecuteStdoutStderr} \perlnote{In wxPerl this function is called \texttt{Wx::ExecuteStdoutStderr}
and it only takes the {\tt command} argument, and it only takes the {\tt command} argument,
and returns a 3-element list {\tt ( status, output, errors )}, where and returns a 3-element list {\tt ( status, output, errors )}, where
{\tt output} and {\tt errors} are array references.} {\tt output} and {\tt errors} are array references.}
@@ -585,7 +585,7 @@ will kill this process as well as all of its children (except those which have
started their own session). started their own session).
Finally, you may use the third overloaded version of this function to execute Finally, you may use the third overloaded version of this function to execute
a process (always synchronously, the contents of \arg{flags} is or'd with a process (always synchronously, the contents of \arg{flags} is or'd with
\texttt{wxEXEC\_SYNC}) and capture its output in the array \arg{output}. The \texttt{wxEXEC\_SYNC}) and capture its output in the array \arg{output}. The
fourth version adds the possibility to additionally capture the messages from fourth version adds the possibility to additionally capture the messages from
standard error output in the \arg{errors} array. standard error output in the \arg{errors} array.
@@ -661,7 +661,7 @@ enum wxSignal
\end{verbatim} \end{verbatim}
{\tt wxSIGNONE}, {\tt wxSIGKILL} and {\tt wxSIGTERM} have the same meaning {\tt wxSIGNONE}, {\tt wxSIGKILL} and {\tt wxSIGTERM} have the same meaning
under both Unix and Windows but all the other signals are equivalent to under both Unix and Windows but all the other signals are equivalent to
{\tt wxSIGTERM} under Windows. {\tt wxSIGTERM} under Windows.
Returns 0 on success, -1 on failure. If {\it rc} parameter is not NULL, it will Returns 0 on success, -1 on failure. If {\it rc} parameter is not NULL, it will
@@ -771,7 +771,7 @@ to create and use the critical section only when needed.
\func{}{wxCRIT\_SECT\_DECLARE}{\param{}{cs}} \func{}{wxCRIT\_SECT\_DECLARE}{\param{}{cs}}
This macro declares a (static) critical section object named {\it cs} if This macro declares a (static) critical section object named {\it cs} if
{\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$. {\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$.
@@ -780,9 +780,9 @@ This macro declares a (static) critical section object named {\it cs} if
\func{}{wxCRIT\_SECT\_DECLARE}{\param{}{cs}} \func{}{wxCRIT\_SECT\_DECLARE}{\param{}{cs}}
This macro declares a critical section object named {\it cs} if This macro declares a critical section object named {\it cs} if
{\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$. As it doesn't {\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$. As it doesn't
include the {\tt static} keyword (unlike include the {\tt static} keyword (unlike
\helpref{wxCRIT\_SECT\_DECLARE}{wxcritsectdeclare}), it can be used to declare \helpref{wxCRIT\_SECT\_DECLARE}{wxcritsectdeclare}), it can be used to declare
a class or struct member which explains its name. a class or struct member which explains its name.
@@ -792,8 +792,8 @@ a class or struct member which explains its name.
\func{}{wxCRIT\_SECT\_LOCKER}{\param{}{name}, \param{}{cs}} \func{}{wxCRIT\_SECT\_LOCKER}{\param{}{name}, \param{}{cs}}
This macro creates a \helpref{critical section lock}{wxcriticalsectionlocker} This macro creates a \helpref{critical section lock}{wxcriticalsectionlocker}
object named {\it name} and associated with the critical section {\it cs} if object named {\it name} and associated with the critical section {\it cs} if
{\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$. {\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$.
@@ -802,7 +802,7 @@ object named {\it name} and associated with the critical section {\it cs} if
\func{}{wxCRITICAL\_SECTION}{\param{}{name}} \func{}{wxCRITICAL\_SECTION}{\param{}{name}}
This macro combines \helpref{wxCRIT\_SECT\_DECLARE}{wxcritsectdeclare} and This macro combines \helpref{wxCRIT\_SECT\_DECLARE}{wxcritsectdeclare} and
\helpref{wxCRIT\_SECT\_LOCKER}{wxcritsectlocker}: it creates a static critical \helpref{wxCRIT\_SECT\_LOCKER}{wxcritsectlocker}: it creates a static critical
section object and also the lock object associated with it. Because of this, it section object and also the lock object associated with it. Because of this, it
can be only used inside a function, not at global scope. For example: can be only used inside a function, not at global scope. For example:
@@ -820,7 +820,7 @@ int IncCount()
(note that we suppose that the function is called the first time from the main (note that we suppose that the function is called the first time from the main
thread so that the critical section object is initialized correctly by the time thread so that the critical section object is initialized correctly by the time
other threads start calling it, if this is not the case this approach can other threads start calling it, if this is not the case this approach can
{\bf not} be used and the critical section must be made a global instead). {\bf not} be used and the critical section must be made a global instead).
@@ -829,7 +829,7 @@ other threads start calling it, if this is not the case this approach can
\func{}{wxENTER\_CRIT\_SECT}{\param{wxCriticalSection\& }{cs}} \func{}{wxENTER\_CRIT\_SECT}{\param{wxCriticalSection\& }{cs}}
This macro is equivalent to \helpref{cs.Enter()}{wxcriticalsectionenter} if This macro is equivalent to \helpref{cs.Enter()}{wxcriticalsectionenter} if
{\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$. {\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$.
@@ -847,7 +847,7 @@ Returns {\tt true} if this thread is the main one. Always returns {\tt true} if
\func{}{wxLEAVE\_CRIT\_SECT}{\param{wxCriticalSection\& }{cs}} \func{}{wxLEAVE\_CRIT\_SECT}{\param{wxCriticalSection\& }{cs}}
This macro is equivalent to \helpref{cs.Leave()}{wxcriticalsectionleave} if This macro is equivalent to \helpref{cs.Leave()}{wxcriticalsectionleave} if
{\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$. {\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$.
@@ -1244,7 +1244,7 @@ current computer and/or user characteristics.
\membersection{::wxGetFreeMemory}\label{wxgetfreememory} \membersection{::wxGetFreeMemory}\label{wxgetfreememory}
\func{long}{wxGetFreeMemory}{\void} \func{wxMemorySize}{wxGetFreeMemory}{\void}
Returns the amount of free memory in bytes under environments which Returns the amount of free memory in bytes under environments which
support it, and -1 if not supported. Currently, it is supported only support it, and -1 if not supported. Currently, it is supported only
@@ -1379,7 +1379,7 @@ Gets operating system version information.
\begin{twocollist}\itemsep=0pt \begin{twocollist}\itemsep=0pt
\twocolitemruled{Platform}{Return types} \twocolitemruled{Platform}{Return types}
\twocolitem{Mac OS}{Return value is wxMAC when compiled with CodeWarrior under Mac OS 8.x/9.x and Mac OS X, wxMAC\_DARWIN when compiled with the Apple Developer Tools under Mac OS X. \twocolitem{Mac OS}{Return value is wxMAC when compiled with CodeWarrior under Mac OS 8.x/9.x and Mac OS X, wxMAC\_DARWIN when compiled with the Apple Developer Tools under Mac OS X.
Both {\it major} and {\it minor} have to be looked at as hexadecimal numbers. So System 10.2.4 returns 0x10, resp 16 for {\it major} and 0x24, resp 36 for {\it minor}. } Both {\it major} and {\it minor} have to be looked at as hexadecimal numbers. So System 10.2.4 returns 0x10, resp 16 for {\it major} and 0x24, resp 36 for {\it minor}. }
\twocolitem{GTK}{Return value is wxGTK, For GTK 1.0, {\it major} is 1, {\it minor} is 0. } \twocolitem{GTK}{Return value is wxGTK, For GTK 1.0, {\it major} is 1, {\it minor} is 0. }
@@ -1572,7 +1572,7 @@ enough space.
wxT() is a macro which can be used with character and string literals (in other wxT() is a macro which can be used with character and string literals (in other
words, {\tt 'x'} or {\tt "foo"}) to automatically convert them to Unicode in words, {\tt 'x'} or {\tt "foo"}) to automatically convert them to Unicode in
Unicode build configuration. Please see the Unicode build configuration. Please see the
\helpref{Unicode overview}{unicode} for more information. \helpref{Unicode overview}{unicode} for more information.
This macro is simply returns the value passed to it without changes in ASCII This macro is simply returns the value passed to it without changes in ASCII
@@ -1591,14 +1591,14 @@ build. In fact, its definition is:
\func{const wxChar *}{wxTRANSLATE}{\param{const char *}{s}} \func{const wxChar *}{wxTRANSLATE}{\param{const char *}{s}}
This macro doesn't do anything in the program code -- it simply expands to the This macro doesn't do anything in the program code -- it simply expands to the
value of its argument (except in Unicode build where it is equivalent to value of its argument (except in Unicode build where it is equivalent to
\helpref{wxT}{wxt} which makes it unnecessary to use both wxTRANSLATE and wxT \helpref{wxT}{wxt} which makes it unnecessary to use both wxTRANSLATE and wxT
with the same string which would be really unreadable). with the same string which would be really unreadable).
However it does have a purpose and it is to mark the literal strings for the However it does have a purpose and it is to mark the literal strings for the
extraction into the message catalog created by {\tt xgettext} program. Usually extraction into the message catalog created by {\tt xgettext} program. Usually
this is achieved using \helpref{\_()}{underscore} but that macro not only marks this is achieved using \helpref{\_()}{underscore} but that macro not only marks
the string for extraction but also expands into a the string for extraction but also expands into a
\helpref{wxGetTranslation}{wxgettranslation} function call which means that it \helpref{wxGetTranslation}{wxgettranslation} function call which means that it
cannot be used in some situations, notably for static array cannot be used in some situations, notably for static array
initialization. initialization.

View File

@@ -61,6 +61,18 @@ class WXDLLIMPEXP_CORE wxPoint;
#define wxMax(a,b) (((a) > (b)) ? (a) : (b)) #define wxMax(a,b) (((a) > (b)) ? (a) : (b))
#define wxMin(a,b) (((a) < (b)) ? (a) : (b)) #define wxMin(a,b) (((a) < (b)) ? (a) : (b))
// wxGetFreeMemory can return huge amount of memory on 64-bit platforms
// define wxMemorySize according to the type which best fits your platform
#if wxUSE_LONGLONG && defined(__WIN64__)
// 64 bit Windowses have sizeof(long) only 32 bit long
// we need to use wxLongLong to express memory sizes
#define wxMemorySize wxLongLong
#else
// 64 bit UNIX has sizeof(long) = 64
// assume 32 bit platforms cannnot return more than 32bits of
#define wxMemorySize long
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// String functions (deprecated, use wxString) // String functions (deprecated, use wxString)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -283,7 +295,7 @@ wxDEPRECATED( WXDLLIMPEXP_BASE void wxUsleep(unsigned long milliseconds) );
WXDLLIMPEXP_BASE unsigned long wxGetProcessId(); WXDLLIMPEXP_BASE unsigned long wxGetProcessId();
// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX) // Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
WXDLLIMPEXP_BASE long wxGetFreeMemory(); WXDLLIMPEXP_BASE wxMemorySize wxGetFreeMemory();
// should wxApp::OnFatalException() be called? // should wxApp::OnFatalException() be called?
WXDLLIMPEXP_BASE bool wxHandleFatalExceptions(bool doit = true); WXDLLIMPEXP_BASE bool wxHandleFatalExceptions(bool doit = true);

View File

@@ -21,9 +21,9 @@
#if wxUSE_GUI #if wxUSE_GUI
#include "wx/mac/uma.h" #include "wx/mac/uma.h"
#include "wx/font.h" #include "wx/font.h"
#else #else
#include "wx/intl.h" #include "wx/intl.h"
#endif #endif
#include <ctype.h> #include <ctype.h>
@@ -260,7 +260,7 @@ bool wxGetHostName(wxChar *buf, int maxSize)
else else
buf[0] = 0 ; buf[0] = 0 ;
return TRUE; return true;
} }
// Get user ID e.g. jacs // Get user ID e.g. jacs
@@ -298,7 +298,7 @@ bool wxGetUserName(wxChar *buf, int maxSize)
else else
buf[0] = 0 ; buf[0] = 0 ;
return TRUE; return true;
} }
int wxKill(long pid, wxSignal sig , wxKillError *rc, int flags) int wxKill(long pid, wxSignal sig , wxKillError *rc, int flags)
@@ -313,7 +313,7 @@ WXDLLEXPORT bool wxGetEnv(const wxString& var, wxString *value)
return false ; return false ;
} }
// set the env var name to the given value, return TRUE on success // set the env var name to the given value, return true on success
WXDLLEXPORT bool wxSetEnv(const wxString& var, const wxChar *value) WXDLLEXPORT bool wxSetEnv(const wxString& var, const wxChar *value)
{ {
// TODO : under classic there is no environement support, under X yes // TODO : under classic there is no environement support, under X yes
@@ -326,34 +326,34 @@ WXDLLEXPORT bool wxSetEnv(const wxString& var, const wxChar *value)
bool wxShell(const wxString& command) bool wxShell(const wxString& command)
{ {
// TODO // TODO
return FALSE; return false;
} }
// Shutdown or reboot the PC // Shutdown or reboot the PC
bool wxShutdown(wxShutdownFlags wFlags) bool wxShutdown(wxShutdownFlags wFlags)
{ {
// TODO // TODO
return FALSE; return false;
} }
// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX) // Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
long wxGetFreeMemory() wxMemorySize wxGetFreeMemory()
{ {
return FreeMem() ; return (wxMemorySize)FreeMem() ;
} }
#ifndef __DARWIN__ #ifndef __DARWIN__
void wxMicroSleep(unsigned long microseconds) void wxMicroSleep(unsigned long microseconds)
{ {
AbsoluteTime wakeup = AddDurationToAbsolute( microseconds * durationMicrosecond , UpTime()); AbsoluteTime wakeup = AddDurationToAbsolute( microseconds * durationMicrosecond , UpTime());
MPDelayUntil( & wakeup); MPDelayUntil( & wakeup);
} }
void wxMilliSleep(unsigned long milliseconds) void wxMilliSleep(unsigned long milliseconds)
{ {
AbsoluteTime wakeup = AddDurationToAbsolute( milliseconds, UpTime()); AbsoluteTime wakeup = AddDurationToAbsolute( milliseconds, UpTime());
MPDelayUntil( & wakeup); MPDelayUntil( & wakeup);
} }
void wxSleep(int nSecs) void wxSleep(int nSecs)
@@ -406,7 +406,7 @@ wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo()
bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file) bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file)
{ {
// TODO // TODO
return FALSE; return false;
} }
bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file) bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file)
@@ -436,7 +436,7 @@ bool wxWriteResource(const wxString& section, const wxString& entry, int value,
bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file) bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file)
{ {
// TODO // TODO
return FALSE; return false;
} }
bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file) bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file)
@@ -447,9 +447,9 @@ bool wxGetResource(const wxString& section, const wxString& entry, float *value,
{ {
*value = (float)strtod(s, NULL); *value = (float)strtod(s, NULL);
delete[] s; delete[] s;
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& section, const wxString& entry, long *value, const wxString& file)
@@ -460,9 +460,9 @@ bool wxGetResource(const wxString& section, const wxString& entry, long *value,
{ {
*value = strtol(s, NULL, 10); *value = strtol(s, NULL, 10);
delete[] s; delete[] s;
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& section, const wxString& entry, int *value, const wxString& file)
@@ -473,9 +473,9 @@ bool wxGetResource(const wxString& section, const wxString& entry, int *value, c
{ {
*value = (int)strtol(s, NULL, 10); *value = (int)strtol(s, NULL, 10);
delete[] s; delete[] s;
return TRUE; return true;
} }
else return FALSE; else return false;
} }
#endif // wxUSE_RESOURCES #endif // wxUSE_RESOURCES
@@ -507,7 +507,7 @@ void wxEndBusyCursor()
} }
} }
// TRUE if we're between the above two calls // true if we're between the above two calls
bool wxIsBusy() bool wxIsBusy()
{ {
return (gs_wxBusyCursorCount > 0); return (gs_wxBusyCursorCount > 0);
@@ -521,7 +521,7 @@ wxString wxMacFindFolder( short vol,
OSType folderType, OSType folderType,
Boolean createFolder) Boolean createFolder)
{ {
FSRef fsRef ; FSRef fsRef ;
wxString strDir ; wxString strDir ;
if ( FSFindFolder( vol, folderType, createFolder, &fsRef) == noErr) if ( FSFindFolder( vol, folderType, createFolder, &fsRef) == noErr)
@@ -539,7 +539,7 @@ wxString wxMacFindFolder( short vol,
bool wxCheckForInterrupt(wxWindow *wnd) bool wxCheckForInterrupt(wxWindow *wnd)
{ {
// TODO // TODO
return FALSE; return false;
} }
void wxGetMousePosition( int* x, int* y ) void wxGetMousePosition( int* x, int* y )
@@ -552,10 +552,10 @@ void wxGetMousePosition( int* x, int* y )
*y = pt.v ; *y = pt.v ;
}; };
// Return TRUE if we have a colour display // Return true if we have a colour display
bool wxColourDisplay() bool wxColourDisplay()
{ {
return TRUE; return true;
} }
// Returns depth of screen // Returns depth of screen
@@ -644,7 +644,7 @@ wxChar *wxGetUserHome (const wxString& user)
bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree) bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
{ {
if ( path.empty() ) if ( path.empty() )
return FALSE; return false;
wxString p = path ; wxString p = path ;
if (p[0u] == ':' ) { if (p[0u] == ':' ) {
@@ -659,7 +659,7 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
p = p + wxT(":") ; p = p + wxT(":") ;
OSErr err = noErr ; OSErr err = noErr ;
FSRef fsRef ; FSRef fsRef ;
err = wxMacPathToFSRef( p , &fsRef ) ; err = wxMacPathToFSRef( p , &fsRef ) ;
if ( noErr == err ) if ( noErr == err )
@@ -672,14 +672,14 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
err = FSGetVInfo( vRefNum , NULL , &freeBytes , &totalBytes ) ; err = FSGetVInfo( vRefNum , NULL , &freeBytes , &totalBytes ) ;
if ( noErr == err ) if ( noErr == err )
{ {
if ( pTotal ) if ( pTotal )
*pTotal = wxLongLong( totalBytes ) ; *pTotal = wxLongLong( totalBytes ) ;
if ( pFree ) if ( pFree )
*pFree = wxLongLong( freeBytes ) ; *pFree = wxLongLong( freeBytes ) ;
} }
} }
} }
return err == noErr ; return err == noErr ;
} }
#endif // !__DARWIN__ #endif // !__DARWIN__
@@ -732,7 +732,7 @@ void wxMacWakeUp()
if ( err == noErr ) if ( err == noErr )
{ {
if ( IsEventInQueue( GetMainEventQueue() , s_wakeupEvent ) ) if ( IsEventInQueue( GetMainEventQueue() , s_wakeupEvent ) )
return ; return ;
s_wakeupEvent.SetTime(0) ; s_wakeupEvent.SetTime(0) ;
err = PostEventToQueue(GetMainEventQueue(), s_wakeupEvent, err = PostEventToQueue(GetMainEventQueue(), s_wakeupEvent,
kEventPriorityHigh); kEventPriorityHigh);
@@ -759,12 +759,12 @@ void wxMacWakeUp()
OSStatus wxMacCarbonEvent::GetParameter(EventParamName inName, EventParamType inDesiredType, UInt32 inBufferSize, void * outData) OSStatus wxMacCarbonEvent::GetParameter(EventParamName inName, EventParamType inDesiredType, UInt32 inBufferSize, void * outData)
{ {
return ::GetEventParameter( m_eventRef , inName , inDesiredType , NULL , inBufferSize , NULL , outData ) ; return ::GetEventParameter( m_eventRef , inName , inDesiredType , NULL , inBufferSize , NULL , outData ) ;
} }
OSStatus wxMacCarbonEvent::SetParameter(EventParamName inName, EventParamType inType, UInt32 inBufferSize, const void * inData) OSStatus wxMacCarbonEvent::SetParameter(EventParamName inName, EventParamType inType, UInt32 inBufferSize, const void * inData)
{ {
return ::SetEventParameter( m_eventRef , inName , inType , inBufferSize , inData ) ; return ::SetEventParameter( m_eventRef , inName , inType , inBufferSize , inData ) ;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -777,45 +777,45 @@ void wxMacControl::Dispose()
m_controlRef = NULL ; m_controlRef = NULL ;
} }
void wxMacControl::SetReference( SInt32 data ) void wxMacControl::SetReference( SInt32 data )
{ {
SetControlReference( m_controlRef , data ) ; SetControlReference( m_controlRef , data ) ;
} }
OSStatus wxMacControl::GetData(ControlPartCode inPartCode , ResType inTag , Size inBufferSize , void * inOutBuffer , Size * outActualSize ) const OSStatus wxMacControl::GetData(ControlPartCode inPartCode , ResType inTag , Size inBufferSize , void * inOutBuffer , Size * outActualSize ) const
{ {
return ::GetControlData( m_controlRef , inPartCode , inTag , inBufferSize , inOutBuffer , outActualSize ) ; return ::GetControlData( m_controlRef , inPartCode , inTag , inBufferSize , inOutBuffer , outActualSize ) ;
} }
OSStatus wxMacControl::GetDataSize(ControlPartCode inPartCode , ResType inTag , Size * outActualSize ) const OSStatus wxMacControl::GetDataSize(ControlPartCode inPartCode , ResType inTag , Size * outActualSize ) const
{ {
return ::GetControlDataSize( m_controlRef , inPartCode , inTag , outActualSize ) ; return ::GetControlDataSize( m_controlRef , inPartCode , inTag , outActualSize ) ;
} }
OSStatus wxMacControl::SetData(ControlPartCode inPartCode , ResType inTag , Size inSize , const void * inData) OSStatus wxMacControl::SetData(ControlPartCode inPartCode , ResType inTag , Size inSize , const void * inData)
{ {
return ::SetControlData( m_controlRef , inPartCode , inTag , inSize , inData ) ; return ::SetControlData( m_controlRef , inPartCode , inTag , inSize , inData ) ;
} }
OSStatus wxMacControl::SendEvent( EventRef event , OptionBits inOptions ) OSStatus wxMacControl::SendEvent( EventRef event , OptionBits inOptions )
{ {
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
return SendEventToEventTargetWithOptions( event, return SendEventToEventTargetWithOptions( event,
HIObjectGetEventTarget( (HIObjectRef) m_controlRef ), inOptions ); HIObjectGetEventTarget( (HIObjectRef) m_controlRef ), inOptions );
#else #else
#pragma unused(inOptions) #pragma unused(inOptions)
return SendEventToEventTarget(event,GetControlEventTarget( m_controlRef ) ) ; return SendEventToEventTarget(event,GetControlEventTarget( m_controlRef ) ) ;
#endif #endif
} }
OSStatus wxMacControl::SendHICommand( HICommand &command , OptionBits inOptions ) OSStatus wxMacControl::SendHICommand( HICommand &command , OptionBits inOptions )
{ {
wxMacCarbonEvent event( kEventClassCommand , kEventCommandProcess ) ; wxMacCarbonEvent event( kEventClassCommand , kEventCommandProcess ) ;
event.SetParameter<HICommand>(kEventParamDirectObject,command) ; event.SetParameter<HICommand>(kEventParamDirectObject,command) ;
return SendEvent( event , inOptions ) ; return SendEvent( event , inOptions ) ;
} }
OSStatus wxMacControl::SendHICommand( UInt32 commandID , OptionBits inOptions ) OSStatus wxMacControl::SendHICommand( UInt32 commandID , OptionBits inOptions )
{ {
HICommand command ; HICommand command ;
memset( &command, 0 , sizeof(command) ) ; memset( &command, 0 , sizeof(command) ) ;
@@ -823,7 +823,7 @@ OSStatus wxMacControl::SendHICommand( UInt32 commandID , OptionBits inOptions )
return SendHICommand( command , inOptions ) ; return SendHICommand( command , inOptions ) ;
} }
void wxMacControl::Flash( ControlPartCode part , UInt32 ticks ) void wxMacControl::Flash( ControlPartCode part , UInt32 ticks )
{ {
HiliteControl( m_controlRef , part ) ; HiliteControl( m_controlRef , part ) ;
unsigned long finalTicks ; unsigned long finalTicks ;
@@ -832,86 +832,86 @@ void wxMacControl::Flash( ControlPartCode part , UInt32 ticks )
} }
SInt32 wxMacControl::GetValue() const SInt32 wxMacControl::GetValue() const
{ {
return ::GetControl32BitValue( m_controlRef ) ; return ::GetControl32BitValue( m_controlRef ) ;
} }
SInt32 wxMacControl::GetMaximum() const SInt32 wxMacControl::GetMaximum() const
{ {
return ::GetControl32BitMaximum( m_controlRef ) ; return ::GetControl32BitMaximum( m_controlRef ) ;
} }
SInt32 wxMacControl::GetMinimum() const SInt32 wxMacControl::GetMinimum() const
{ {
return ::GetControl32BitMinimum( m_controlRef ) ; return ::GetControl32BitMinimum( m_controlRef ) ;
} }
void wxMacControl::SetValue( SInt32 v ) void wxMacControl::SetValue( SInt32 v )
{ {
::SetControl32BitValue( m_controlRef , v ) ; ::SetControl32BitValue( m_controlRef , v ) ;
} }
void wxMacControl::SetMinimum( SInt32 v ) void wxMacControl::SetMinimum( SInt32 v )
{ {
::SetControl32BitMinimum( m_controlRef , v ) ; ::SetControl32BitMinimum( m_controlRef , v ) ;
} }
void wxMacControl::SetMaximum( SInt32 v ) void wxMacControl::SetMaximum( SInt32 v )
{ {
::SetControl32BitMaximum( m_controlRef , v ) ; ::SetControl32BitMaximum( m_controlRef , v ) ;
} }
void wxMacControl::SetValueAndRange( SInt32 value , SInt32 minimum , SInt32 maximum ) void wxMacControl::SetValueAndRange( SInt32 value , SInt32 minimum , SInt32 maximum )
{ {
::SetControl32BitMinimum( m_controlRef , minimum ) ; ::SetControl32BitMinimum( m_controlRef , minimum ) ;
::SetControl32BitMaximum( m_controlRef , maximum ) ; ::SetControl32BitMaximum( m_controlRef , maximum ) ;
::SetControl32BitValue( m_controlRef , value ) ; ::SetControl32BitValue( m_controlRef , value ) ;
} }
OSStatus wxMacControl::SetFocus( ControlFocusPart focusPart ) OSStatus wxMacControl::SetFocus( ControlFocusPart focusPart )
{ {
return SetKeyboardFocus( GetControlOwner( m_controlRef ) , return SetKeyboardFocus( GetControlOwner( m_controlRef ) ,
m_controlRef , focusPart ) ; m_controlRef , focusPart ) ;
} }
bool wxMacControl::HasFocus() const bool wxMacControl::HasFocus() const
{ {
ControlRef control ; ControlRef control ;
GetKeyboardFocus( GetUserFocusWindow() , &control ) ; GetKeyboardFocus( GetUserFocusWindow() , &control ) ;
return control == m_controlRef ; return control == m_controlRef ;
} }
bool wxMacControl::NeedsFocusRect() const bool wxMacControl::NeedsFocusRect() const
{ {
return false ; return false ;
} }
void wxMacControl::VisibilityChanged(bool shown) void wxMacControl::VisibilityChanged(bool shown)
{ {
} }
void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle ) void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle )
{ {
m_font = font ; m_font = font ;
ControlFontStyleRec fontStyle; ControlFontStyleRec fontStyle;
if ( font.MacGetThemeFontID() != kThemeCurrentPortFont ) if ( font.MacGetThemeFontID() != kThemeCurrentPortFont )
{ {
switch( font.MacGetThemeFontID() ) switch( font.MacGetThemeFontID() )
{ {
case kThemeSmallSystemFont : fontStyle.font = kControlFontSmallSystemFont ; break ; case kThemeSmallSystemFont : fontStyle.font = kControlFontSmallSystemFont ; break ;
case 109 /*mini font */ : fontStyle.font = -5 ; break ; case 109 /*mini font */ : fontStyle.font = -5 ; break ;
case kThemeSystemFont : fontStyle.font = kControlFontBigSystemFont ; break ; case kThemeSystemFont : fontStyle.font = kControlFontBigSystemFont ; break ;
default : fontStyle.font = kControlFontBigSystemFont ; break ; default : fontStyle.font = kControlFontBigSystemFont ; break ;
} }
fontStyle.flags = kControlUseFontMask ; fontStyle.flags = kControlUseFontMask ;
} }
else else
{ {
fontStyle.font = font.MacGetFontNum() ; fontStyle.font = font.MacGetFontNum() ;
fontStyle.style = font.MacGetFontStyle() ; fontStyle.style = font.MacGetFontStyle() ;
fontStyle.size = font.MacGetFontSize() ; fontStyle.size = font.MacGetFontSize() ;
fontStyle.flags = kControlUseFontMask | kControlUseFaceMask | kControlUseSizeMask ; fontStyle.flags = kControlUseFontMask | kControlUseFaceMask | kControlUseSizeMask ;
} }
fontStyle.just = teJustLeft ; fontStyle.just = teJustLeft ;
fontStyle.flags |= kControlUseJustMask ; fontStyle.flags |= kControlUseJustMask ;
@@ -920,32 +920,32 @@ void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , l
else if ( ( windowStyle & wxALIGN_MASK ) & wxALIGN_RIGHT ) else if ( ( windowStyle & wxALIGN_MASK ) & wxALIGN_RIGHT )
fontStyle.just = teJustRight ; fontStyle.just = teJustRight ;
// we only should do this in case of a non-standard color, as otherwise 'disabled' controls // we only should do this in case of a non-standard color, as otherwise 'disabled' controls
// won't get grayed out by the system anymore // won't get grayed out by the system anymore
if ( foreground != *wxBLACK ) if ( foreground != *wxBLACK )
{ {
fontStyle.foreColor = MAC_WXCOLORREF(foreground.GetPixel() ) ; fontStyle.foreColor = MAC_WXCOLORREF(foreground.GetPixel() ) ;
fontStyle.flags |= kControlUseForeColorMask ; fontStyle.flags |= kControlUseForeColorMask ;
} }
::SetControlFontStyle( m_controlRef , &fontStyle ); ::SetControlFontStyle( m_controlRef , &fontStyle );
} }
void wxMacControl::SetBackground( const wxBrush &WXUNUSED(brush) ) void wxMacControl::SetBackground( const wxBrush &WXUNUSED(brush) )
{ {
// TODO // TODO
// setting up a color proc is not recommended anymore // setting up a color proc is not recommended anymore
} }
void wxMacControl::SetRange( SInt32 minimum , SInt32 maximum ) void wxMacControl::SetRange( SInt32 minimum , SInt32 maximum )
{ {
::SetControl32BitMinimum( m_controlRef , minimum ) ; ::SetControl32BitMinimum( m_controlRef , minimum ) ;
::SetControl32BitMaximum( m_controlRef , maximum ) ; ::SetControl32BitMaximum( m_controlRef , maximum ) ;
} }
short wxMacControl::HandleKey( SInt16 keyCode, SInt16 charCode, EventModifiers modifiers ) short wxMacControl::HandleKey( SInt16 keyCode, SInt16 charCode, EventModifiers modifiers )
{ {
return HandleControlKey( m_controlRef , keyCode , charCode , modifiers ) ; return HandleControlKey( m_controlRef , keyCode , charCode , modifiers ) ;
} }
@@ -965,17 +965,17 @@ SInt32 wxMacControl::GetViewSize() const
return GetControlViewSize( m_controlRef ) ; return GetControlViewSize( m_controlRef ) ;
} }
bool wxMacControl::IsVisible() const bool wxMacControl::IsVisible() const
{ {
return IsControlVisible( m_controlRef ) ; return IsControlVisible( m_controlRef ) ;
} }
void wxMacControl::SetVisibility( bool visible , bool redraw ) void wxMacControl::SetVisibility( bool visible , bool redraw )
{ {
SetControlVisibility( m_controlRef , visible , redraw ) ; SetControlVisibility( m_controlRef , visible , redraw ) ;
} }
bool wxMacControl::IsEnabled() const bool wxMacControl::IsEnabled() const
{ {
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
return IsControlEnabled( m_controlRef ) ; return IsControlEnabled( m_controlRef ) ;
@@ -984,12 +984,12 @@ bool wxMacControl::IsEnabled() const
#endif #endif
} }
bool wxMacControl::IsActive() const bool wxMacControl::IsActive() const
{ {
return IsControlActive( m_controlRef ) ; return IsControlActive( m_controlRef ) ;
} }
void wxMacControl::Enable( bool enable ) void wxMacControl::Enable( bool enable )
{ {
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
if ( enable ) if ( enable )
@@ -1004,14 +1004,14 @@ void wxMacControl::Enable( bool enable )
#endif #endif
} }
void wxMacControl::SetDrawingEnabled( bool enable ) void wxMacControl::SetDrawingEnabled( bool enable )
{ {
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
HIViewSetDrawingEnabled( m_controlRef , enable ) ; HIViewSetDrawingEnabled( m_controlRef , enable ) ;
#endif #endif
} }
bool wxMacControl::GetNeedsDisplay() const bool wxMacControl::GetNeedsDisplay() const
{ {
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
return HIViewGetNeedsDisplay( m_controlRef ) ; return HIViewGetNeedsDisplay( m_controlRef ) ;
@@ -1020,7 +1020,7 @@ bool wxMacControl::GetNeedsDisplay() const
#endif #endif
} }
void wxMacControl::SetNeedsDisplay( bool needsDisplay , RgnHandle where ) void wxMacControl::SetNeedsDisplay( bool needsDisplay , RgnHandle where )
{ {
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
if ( where != NULL ) if ( where != NULL )
@@ -1030,7 +1030,7 @@ void wxMacControl::SetNeedsDisplay( bool needsDisplay , RgnHandle where )
#endif #endif
} }
void wxMacControl::Convert( wxPoint *pt , wxMacControl *from , wxMacControl *to ) void wxMacControl::Convert( wxPoint *pt , wxMacControl *from , wxMacControl *to )
{ {
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
HIPoint hiPoint ; HIPoint hiPoint ;
@@ -1042,11 +1042,11 @@ void wxMacControl::Convert( wxPoint *pt , wxMacControl *from , wxMacControl *to
#endif #endif
} }
void wxMacControl::SetRect( Rect *r ) void wxMacControl::SetRect( Rect *r )
{ {
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
//A HIRect is actually a CGRect on OSX - which consists of two structures - //A HIRect is actually a CGRect on OSX - which consists of two structures -
//CGPoint and CGSize, which have two floats each //CGPoint and CGSize, which have two floats each
HIRect hir = { { r->left , r->top }, { r->right - r->left , r->bottom - r->top } } ; HIRect hir = { { r->left , r->top }, { r->right - r->left , r->bottom - r->top } } ;
HIViewSetFrame ( m_controlRef , &hir ) ; HIViewSetFrame ( m_controlRef , &hir ) ;
#else #else
@@ -1055,23 +1055,23 @@ void wxMacControl::SetRect( Rect *r )
} }
void wxMacControl::GetRect( Rect *r ) void wxMacControl::GetRect( Rect *r )
{ {
GetControlBounds( m_controlRef , r ) ; GetControlBounds( m_controlRef , r ) ;
} }
void wxMacControl::GetRectInWindowCoords( Rect *r ) void wxMacControl::GetRectInWindowCoords( Rect *r )
{ {
UMAGetControlBoundsInWindowCoords( m_controlRef , r ) ; UMAGetControlBoundsInWindowCoords( m_controlRef , r ) ;
} }
void wxMacControl::GetBestRect( Rect *r ) void wxMacControl::GetBestRect( Rect *r )
{ {
short baselineoffset ; short baselineoffset ;
GetBestControlRect( m_controlRef , r , &baselineoffset ) ; GetBestControlRect( m_controlRef , r , &baselineoffset ) ;
} }
void wxMacControl::SetTitle( const wxString &title ) void wxMacControl::SetTitle( const wxString &title )
{ {
wxFontEncoding encoding; wxFontEncoding encoding;
@@ -1079,7 +1079,7 @@ void wxMacControl::SetTitle( const wxString &title )
encoding = m_font.GetEncoding(); encoding = m_font.GetEncoding();
else else
encoding = wxFont::GetDefaultEncoding(); encoding = wxFont::GetDefaultEncoding();
UMASetControlTitle( m_controlRef , title , encoding ) ; UMASetControlTitle( m_controlRef , title , encoding ) ;
} }
@@ -1088,15 +1088,15 @@ void wxMacControl::GetFeatures( UInt32 * features )
GetControlFeatures( m_controlRef , features ) ; GetControlFeatures( m_controlRef , features ) ;
} }
OSStatus wxMacControl::GetRegion( ControlPartCode partCode , RgnHandle region ) OSStatus wxMacControl::GetRegion( ControlPartCode partCode , RgnHandle region )
{ {
return GetControlRegion( m_controlRef , partCode , region ) ; return GetControlRegion( m_controlRef , partCode , region ) ;
} }
OSStatus wxMacControl::SetZOrder( bool above , wxMacControl* other ) OSStatus wxMacControl::SetZOrder( bool above , wxMacControl* other )
{ {
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
return HIViewSetZOrder( m_controlRef,above ? kHIViewZOrderAbove : kHIViewZOrderBelow, return HIViewSetZOrder( m_controlRef,above ? kHIViewZOrderAbove : kHIViewZOrderBelow,
(other != NULL) ? other->m_controlRef : NULL) ; (other != NULL) ? other->m_controlRef : NULL) ;
#else #else
return 0 ; return 0 ;
@@ -1110,7 +1110,7 @@ static void InvalidateControlAndChildren( HIViewRef control )
{ {
HIViewSetNeedsDisplay( control , true ) ; HIViewSetNeedsDisplay( control , true ) ;
UInt16 childrenCount = 0 ; UInt16 childrenCount = 0 ;
OSStatus err = CountSubControls( control , &childrenCount ) ; OSStatus err = CountSubControls( control , &childrenCount ) ;
if ( err == errControlIsNotEmbedder ) if ( err == errControlIsNotEmbedder )
return ; return ;
wxASSERT_MSG( err == noErr , wxT("Unexpected error when accessing subcontrols") ) ; wxASSERT_MSG( err == noErr , wxT("Unexpected error when accessing subcontrols") ) ;
@@ -1126,14 +1126,14 @@ static void InvalidateControlAndChildren( HIViewRef control )
} }
#endif #endif
void wxMacControl::InvalidateWithChildren() void wxMacControl::InvalidateWithChildren()
{ {
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
InvalidateControlAndChildren( m_controlRef ) ; InvalidateControlAndChildren( m_controlRef ) ;
#endif #endif
} }
void wxMacControl::ScrollRect( const wxRect &r , int dx , int dy ) void wxMacControl::ScrollRect( const wxRect &r , int dx , int dy )
{ {
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
HIRect scrollarea = CGRectMake( r.x , r.y , r.width , r.height) ; HIRect scrollarea = CGRectMake( r.x , r.y , r.width , r.height) ;
@@ -1148,13 +1148,13 @@ void wxMacControl::ScrollRect( const wxRect &r , int dx , int dy )
// Databrowser // Databrowser
// //
OSStatus wxMacControl::SetSelectionFlags( DataBrowserSelectionFlags options ) OSStatus wxMacControl::SetSelectionFlags( DataBrowserSelectionFlags options )
{ {
return SetDataBrowserSelectionFlags( m_controlRef , options ) ; return SetDataBrowserSelectionFlags( m_controlRef , options ) ;
} }
OSStatus wxMacControl::AddListViewColumn( DataBrowserListViewColumnDesc *columnDesc, OSStatus wxMacControl::AddListViewColumn( DataBrowserListViewColumnDesc *columnDesc,
DataBrowserTableViewColumnIndex position ) DataBrowserTableViewColumnIndex position )
{ {
return AddDataBrowserListViewColumn( m_controlRef , columnDesc, position ) ; return AddDataBrowserListViewColumn( m_controlRef , columnDesc, position ) ;
} }
@@ -1164,7 +1164,7 @@ OSStatus wxMacControl::AutoSizeListViewColumns()
return AutoSizeDataBrowserListViewColumns(m_controlRef) ; return AutoSizeDataBrowserListViewColumns(m_controlRef) ;
} }
OSStatus wxMacControl::SetHasScrollBars( bool horiz , bool vert ) OSStatus wxMacControl::SetHasScrollBars( bool horiz , bool vert )
{ {
return SetDataBrowserHasScrollBars( m_controlRef , horiz , vert ) ; return SetDataBrowserHasScrollBars( m_controlRef , horiz , vert ) ;
} }
@@ -1174,58 +1174,58 @@ OSStatus wxMacControl::SetTableViewHiliteStyle( DataBrowserTableViewHiliteStyle
return SetDataBrowserTableViewHiliteStyle( m_controlRef , hiliteStyle ) ; return SetDataBrowserTableViewHiliteStyle( m_controlRef , hiliteStyle ) ;
} }
OSStatus wxMacControl::SetListViewHeaderBtnHeight(UInt16 height) OSStatus wxMacControl::SetListViewHeaderBtnHeight(UInt16 height)
{ {
return SetDataBrowserListViewHeaderBtnHeight( m_controlRef ,height ) ; return SetDataBrowserListViewHeaderBtnHeight( m_controlRef ,height ) ;
} }
OSStatus wxMacControl::SetCallbacks(const DataBrowserCallbacks * callbacks) OSStatus wxMacControl::SetCallbacks(const DataBrowserCallbacks * callbacks)
{ {
return SetDataBrowserCallbacks( m_controlRef , callbacks ) ; return SetDataBrowserCallbacks( m_controlRef , callbacks ) ;
} }
OSStatus wxMacControl::UpdateItems( DataBrowserItemID container, UInt32 numItems, OSStatus wxMacControl::UpdateItems( DataBrowserItemID container, UInt32 numItems,
const DataBrowserItemID* items, const DataBrowserItemID* items,
DataBrowserPropertyID preSortProperty, DataBrowserPropertyID preSortProperty,
DataBrowserPropertyID propertyID ) DataBrowserPropertyID propertyID )
{ {
return UpdateDataBrowserItems( m_controlRef , container, numItems, items, preSortProperty, propertyID ) ; return UpdateDataBrowserItems( m_controlRef , container, numItems, items, preSortProperty, propertyID ) ;
} }
bool wxMacControl::IsItemSelected( DataBrowserItemID item ) bool wxMacControl::IsItemSelected( DataBrowserItemID item )
{ {
return IsDataBrowserItemSelected( m_controlRef , item ) ; return IsDataBrowserItemSelected( m_controlRef , item ) ;
} }
OSStatus wxMacControl::AddItems( DataBrowserItemID container, UInt32 numItems, OSStatus wxMacControl::AddItems( DataBrowserItemID container, UInt32 numItems,
const DataBrowserItemID* items, const DataBrowserItemID* items,
DataBrowserPropertyID preSortProperty ) DataBrowserPropertyID preSortProperty )
{ {
return AddDataBrowserItems( m_controlRef , container, numItems, items, preSortProperty ) ; return AddDataBrowserItems( m_controlRef , container, numItems, items, preSortProperty ) ;
} }
OSStatus wxMacControl::RemoveItems( DataBrowserItemID container, UInt32 numItems, OSStatus wxMacControl::RemoveItems( DataBrowserItemID container, UInt32 numItems,
const DataBrowserItemID* items, const DataBrowserItemID* items,
DataBrowserPropertyID preSortProperty ) DataBrowserPropertyID preSortProperty )
{ {
return RemoveDataBrowserItems( m_controlRef , container, numItems, items, preSortProperty ) ; return RemoveDataBrowserItems( m_controlRef , container, numItems, items, preSortProperty ) ;
} }
OSStatus wxMacControl::RevealItem( DataBrowserItemID item, OSStatus wxMacControl::RevealItem( DataBrowserItemID item,
DataBrowserPropertyID propertyID, DataBrowserPropertyID propertyID,
DataBrowserRevealOptions options ) DataBrowserRevealOptions options )
{ {
return RevealDataBrowserItem( m_controlRef , item , propertyID , options ) ; return RevealDataBrowserItem( m_controlRef , item , propertyID , options ) ;
} }
OSStatus wxMacControl::SetSelectedItems(UInt32 numItems, OSStatus wxMacControl::SetSelectedItems(UInt32 numItems,
const DataBrowserItemID * items, const DataBrowserItemID * items,
DataBrowserSetOption operation ) DataBrowserSetOption operation )
{ {
return SetDataBrowserSelectedItems( m_controlRef , numItems , items, operation ) ; return SetDataBrowserSelectedItems( m_controlRef , numItems , items, operation ) ;
} }
OSStatus wxMacControl::GetSelectionAnchor( DataBrowserItemID * first, DataBrowserItemID * last ) OSStatus wxMacControl::GetSelectionAnchor( DataBrowserItemID * first, DataBrowserItemID * last )
{ {
return GetDataBrowserSelectionAnchor( m_controlRef , first , last ) ; return GetDataBrowserSelectionAnchor( m_controlRef , first , last ) ;
} }
@@ -1233,11 +1233,11 @@ OSStatus wxMacControl::GetSelectionAnchor( DataBrowserItemID * first, DataBrowse
// //
// Tab Control // Tab Control
// //
OSStatus wxMacControl::SetTabEnabled( SInt16 tabNo , bool enable ) OSStatus wxMacControl::SetTabEnabled( SInt16 tabNo , bool enable )
{ {
return ::SetTabEnabled( m_controlRef , tabNo , enable ) ; return ::SetTabEnabled( m_controlRef , tabNo , enable ) ;
} }
#endif // wxUSE_GUI #endif // wxUSE_GUI

View File

@@ -21,9 +21,9 @@
#if wxUSE_GUI #if wxUSE_GUI
#include "wx/mac/uma.h" #include "wx/mac/uma.h"
#include "wx/font.h" #include "wx/font.h"
#else #else
#include "wx/intl.h" #include "wx/intl.h"
#endif #endif
#include <ctype.h> #include <ctype.h>
@@ -114,7 +114,7 @@ bool wxGetHostName(wxChar *buf, int maxSize)
else else
buf[0] = 0 ; buf[0] = 0 ;
return TRUE; return true;
} }
// Get user ID e.g. jacs // Get user ID e.g. jacs
@@ -152,7 +152,7 @@ bool wxGetUserName(wxChar *buf, int maxSize)
else else
buf[0] = 0 ; buf[0] = 0 ;
return TRUE; return true;
} }
int wxKill(long pid, wxSignal sig , wxKillError *rc, int flags) int wxKill(long pid, wxSignal sig , wxKillError *rc, int flags)
@@ -167,7 +167,7 @@ WXDLLEXPORT bool wxGetEnv(const wxString& var, wxString *value)
return false ; return false ;
} }
// set the env var name to the given value, return TRUE on success // set the env var name to the given value, return true on success
WXDLLEXPORT bool wxSetEnv(const wxString& var, const wxChar *value) WXDLLEXPORT bool wxSetEnv(const wxString& var, const wxChar *value)
{ {
// TODO : under classic there is no environement support, under X yes // TODO : under classic there is no environement support, under X yes
@@ -180,20 +180,20 @@ WXDLLEXPORT bool wxSetEnv(const wxString& var, const wxChar *value)
bool wxShell(const wxString& command) bool wxShell(const wxString& command)
{ {
// TODO // TODO
return FALSE; return false;
} }
// Shutdown or reboot the PC // Shutdown or reboot the PC
bool wxShutdown(wxShutdownFlags wFlags) bool wxShutdown(wxShutdownFlags wFlags)
{ {
// TODO // TODO
return FALSE; return false;
} }
// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX) // Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
long wxGetFreeMemory() wxMemorySize wxGetFreeMemory()
{ {
return FreeMem() ; return (wxMemorySize)FreeMem() ;
} }
void wxUsleep(unsigned long milliseconds) void wxUsleep(unsigned long milliseconds)
@@ -253,7 +253,7 @@ wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo()
bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file) bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file)
{ {
// TODO // TODO
return FALSE; return false;
} }
bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file) bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file)
@@ -283,7 +283,7 @@ bool wxWriteResource(const wxString& section, const wxString& entry, int value,
bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file) bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file)
{ {
// TODO // TODO
return FALSE; return false;
} }
bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file) bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file)
@@ -294,9 +294,9 @@ bool wxGetResource(const wxString& section, const wxString& entry, float *value,
{ {
*value = (float)strtod(s, NULL); *value = (float)strtod(s, NULL);
delete[] s; delete[] s;
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& section, const wxString& entry, long *value, const wxString& file)
@@ -307,9 +307,9 @@ bool wxGetResource(const wxString& section, const wxString& entry, long *value,
{ {
*value = strtol(s, NULL, 10); *value = strtol(s, NULL, 10);
delete[] s; delete[] s;
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& section, const wxString& entry, int *value, const wxString& file)
@@ -320,9 +320,9 @@ bool wxGetResource(const wxString& section, const wxString& entry, int *value, c
{ {
*value = (int)strtol(s, NULL, 10); *value = (int)strtol(s, NULL, 10);
delete[] s; delete[] s;
return TRUE; return true;
} }
else return FALSE; else return false;
} }
#endif // wxUSE_RESOURCES #endif // wxUSE_RESOURCES
@@ -354,7 +354,7 @@ void wxEndBusyCursor()
} }
} }
// TRUE if we're between the above two calls // true if we're between the above two calls
bool wxIsBusy() bool wxIsBusy()
{ {
return (gs_wxBusyCursorCount > 0); return (gs_wxBusyCursorCount > 0);
@@ -392,7 +392,7 @@ wxString wxMacFindFolder( short vol,
bool wxCheckForInterrupt(wxWindow *wnd) bool wxCheckForInterrupt(wxWindow *wnd)
{ {
// TODO // TODO
return FALSE; return false;
} }
void wxGetMousePosition( int* x, int* y ) void wxGetMousePosition( int* x, int* y )
@@ -405,10 +405,10 @@ void wxGetMousePosition( int* x, int* y )
*y = pt.v ; *y = pt.v ;
}; };
// Return TRUE if we have a colour display // Return true if we have a colour display
bool wxColourDisplay() bool wxColourDisplay()
{ {
return TRUE; return true;
} }
// Returns depth of screen // Returns depth of screen
@@ -524,7 +524,7 @@ wxChar *wxGetUserHome (const wxString& user)
bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree) bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
{ {
if ( path.empty() ) if ( path.empty() )
return FALSE; return false;
wxString p = path ; wxString p = path ;
if (p[0u] == ':' ) { if (p[0u] == ':' ) {
@@ -578,147 +578,147 @@ wxString wxMacMakeStringFromPascal( ConstStringPtr from )
wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding)
{ {
TextEncodingBase enc = 0 ; TextEncodingBase enc = 0 ;
if ( encoding == wxFONTENCODING_DEFAULT ) if ( encoding == wxFONTENCODING_DEFAULT )
{ {
#if wxUSE_GUI #if wxUSE_GUI
encoding = wxFont::GetDefaultEncoding() ; encoding = wxFont::GetDefaultEncoding() ;
#else #else
encoding = wxLocale::GetSystemEncoding() ; encoding = wxLocale::GetSystemEncoding() ;
#endif #endif
} }
switch( encoding) switch( encoding)
{ {
case wxFONTENCODING_ISO8859_1 : case wxFONTENCODING_ISO8859_1 :
enc = kTextEncodingISOLatin1 ; enc = kTextEncodingISOLatin1 ;
break ; break ;
case wxFONTENCODING_ISO8859_2 : case wxFONTENCODING_ISO8859_2 :
enc = kTextEncodingISOLatin2; enc = kTextEncodingISOLatin2;
break ; break ;
case wxFONTENCODING_ISO8859_3 : case wxFONTENCODING_ISO8859_3 :
enc = kTextEncodingISOLatin3 ; enc = kTextEncodingISOLatin3 ;
break ; break ;
case wxFONTENCODING_ISO8859_4 : case wxFONTENCODING_ISO8859_4 :
enc = kTextEncodingISOLatin4; enc = kTextEncodingISOLatin4;
break ; break ;
case wxFONTENCODING_ISO8859_5 : case wxFONTENCODING_ISO8859_5 :
enc = kTextEncodingISOLatinCyrillic; enc = kTextEncodingISOLatinCyrillic;
break ; break ;
case wxFONTENCODING_ISO8859_6 : case wxFONTENCODING_ISO8859_6 :
enc = kTextEncodingISOLatinArabic; enc = kTextEncodingISOLatinArabic;
break ; break ;
case wxFONTENCODING_ISO8859_7 : case wxFONTENCODING_ISO8859_7 :
enc = kTextEncodingISOLatinGreek; enc = kTextEncodingISOLatinGreek;
break ; break ;
case wxFONTENCODING_ISO8859_8 : case wxFONTENCODING_ISO8859_8 :
enc = kTextEncodingISOLatinHebrew; enc = kTextEncodingISOLatinHebrew;
break ; break ;
case wxFONTENCODING_ISO8859_9 : case wxFONTENCODING_ISO8859_9 :
enc = kTextEncodingISOLatin5; enc = kTextEncodingISOLatin5;
break ; break ;
case wxFONTENCODING_ISO8859_10 : case wxFONTENCODING_ISO8859_10 :
enc = kTextEncodingISOLatin6; enc = kTextEncodingISOLatin6;
break ; break ;
case wxFONTENCODING_ISO8859_13 : case wxFONTENCODING_ISO8859_13 :
enc = kTextEncodingISOLatin7; enc = kTextEncodingISOLatin7;
break ; break ;
case wxFONTENCODING_ISO8859_14 : case wxFONTENCODING_ISO8859_14 :
enc = kTextEncodingISOLatin8; enc = kTextEncodingISOLatin8;
break ; break ;
case wxFONTENCODING_ISO8859_15 : case wxFONTENCODING_ISO8859_15 :
enc = kTextEncodingISOLatin9; enc = kTextEncodingISOLatin9;
break ; break ;
case wxFONTENCODING_KOI8 : case wxFONTENCODING_KOI8 :
enc = kTextEncodingKOI8_R; enc = kTextEncodingKOI8_R;
break ; break ;
case wxFONTENCODING_ALTERNATIVE : // MS-DOS CP866 case wxFONTENCODING_ALTERNATIVE : // MS-DOS CP866
enc = kTextEncodingDOSRussian; enc = kTextEncodingDOSRussian;
break ; break ;
/* /*
case wxFONTENCODING_BULGARIAN : case wxFONTENCODING_BULGARIAN :
enc = ; enc = ;
break ; break ;
*/ */
case wxFONTENCODING_CP437 : case wxFONTENCODING_CP437 :
enc =kTextEncodingDOSLatinUS ; enc =kTextEncodingDOSLatinUS ;
break ; break ;
case wxFONTENCODING_CP850 : case wxFONTENCODING_CP850 :
enc = kTextEncodingDOSLatin1; enc = kTextEncodingDOSLatin1;
break ; break ;
case wxFONTENCODING_CP852 : case wxFONTENCODING_CP852 :
enc = kTextEncodingDOSLatin2; enc = kTextEncodingDOSLatin2;
break ; break ;
case wxFONTENCODING_CP855 : case wxFONTENCODING_CP855 :
enc = kTextEncodingDOSCyrillic; enc = kTextEncodingDOSCyrillic;
break ; break ;
case wxFONTENCODING_CP866 : case wxFONTENCODING_CP866 :
enc =kTextEncodingDOSRussian ; enc =kTextEncodingDOSRussian ;
break ; break ;
case wxFONTENCODING_CP874 : case wxFONTENCODING_CP874 :
enc = kTextEncodingDOSThai; enc = kTextEncodingDOSThai;
break ; break ;
case wxFONTENCODING_CP932 : case wxFONTENCODING_CP932 :
enc = kTextEncodingDOSJapanese; enc = kTextEncodingDOSJapanese;
break ; break ;
case wxFONTENCODING_CP936 : case wxFONTENCODING_CP936 :
enc =kTextEncodingDOSChineseSimplif ; enc =kTextEncodingDOSChineseSimplif ;
break ; break ;
case wxFONTENCODING_CP949 : case wxFONTENCODING_CP949 :
enc = kTextEncodingDOSKorean; enc = kTextEncodingDOSKorean;
break ; break ;
case wxFONTENCODING_CP950 : case wxFONTENCODING_CP950 :
enc = kTextEncodingDOSChineseTrad; enc = kTextEncodingDOSChineseTrad;
break ; break ;
case wxFONTENCODING_CP1250 : case wxFONTENCODING_CP1250 :
enc = kTextEncodingWindowsLatin2; enc = kTextEncodingWindowsLatin2;
break ; break ;
case wxFONTENCODING_CP1251 : case wxFONTENCODING_CP1251 :
enc =kTextEncodingWindowsCyrillic ; enc =kTextEncodingWindowsCyrillic ;
break ; break ;
case wxFONTENCODING_CP1252 : case wxFONTENCODING_CP1252 :
enc =kTextEncodingWindowsLatin1 ; enc =kTextEncodingWindowsLatin1 ;
break ; break ;
case wxFONTENCODING_CP1253 : case wxFONTENCODING_CP1253 :
enc = kTextEncodingWindowsGreek; enc = kTextEncodingWindowsGreek;
break ; break ;
case wxFONTENCODING_CP1254 : case wxFONTENCODING_CP1254 :
enc = kTextEncodingWindowsLatin5; enc = kTextEncodingWindowsLatin5;
break ; break ;
case wxFONTENCODING_CP1255 : case wxFONTENCODING_CP1255 :
enc =kTextEncodingWindowsHebrew ; enc =kTextEncodingWindowsHebrew ;
break ; break ;
case wxFONTENCODING_CP1256 : case wxFONTENCODING_CP1256 :
enc =kTextEncodingWindowsArabic ; enc =kTextEncodingWindowsArabic ;
break ; break ;
case wxFONTENCODING_CP1257 : case wxFONTENCODING_CP1257 :
enc = kTextEncodingWindowsBalticRim; enc = kTextEncodingWindowsBalticRim;
break ; break ;
case wxFONTENCODING_UTF7 : case wxFONTENCODING_UTF7 :
enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicodeUTF7Format) ; enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicodeUTF7Format) ;
break ; break ;
case wxFONTENCODING_UTF8 : case wxFONTENCODING_UTF8 :
enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicodeUTF8Format) ; enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicodeUTF8Format) ;
break ; break ;
case wxFONTENCODING_EUC_JP : case wxFONTENCODING_EUC_JP :
enc = kTextEncodingEUC_JP; enc = kTextEncodingEUC_JP;
break ; break ;
case wxFONTENCODING_UTF16BE : case wxFONTENCODING_UTF16BE :
enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode16BitFormat) ; enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode16BitFormat) ;
break ; break ;
case wxFONTENCODING_UTF16LE : case wxFONTENCODING_UTF16LE :
enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode16BitFormat) ; enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode16BitFormat) ;
break ; break ;
case wxFONTENCODING_UTF32BE : case wxFONTENCODING_UTF32BE :
enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode32BitFormat) ; enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode32BitFormat) ;
break ; break ;
case wxFONTENCODING_UTF32LE : case wxFONTENCODING_UTF32LE :
enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode32BitFormat) ; enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode32BitFormat) ;
break ; break ;
case wxFONTENCODING_MACROMAN : case wxFONTENCODING_MACROMAN :
enc = kTextEncodingMacRoman ; enc = kTextEncodingMacRoman ;
@@ -839,145 +839,145 @@ wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding)
break ; break ;
case wxFONTENCODING_MACKEYBOARD : case wxFONTENCODING_MACKEYBOARD :
enc = kTextEncodingMacKeyboardGlyphs ; enc = kTextEncodingMacKeyboardGlyphs ;
break ; break ;
default : default :
// to make gcc happy // to make gcc happy
break ; break ;
} ; } ;
return enc ; return enc ;
} }
wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding) wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding)
{ {
wxFontEncoding enc = wxFONTENCODING_DEFAULT ; wxFontEncoding enc = wxFONTENCODING_DEFAULT ;
switch( encoding) switch( encoding)
{ {
case kTextEncodingISOLatin1 : case kTextEncodingISOLatin1 :
enc = wxFONTENCODING_ISO8859_1 ; enc = wxFONTENCODING_ISO8859_1 ;
break ; break ;
case kTextEncodingISOLatin2 : case kTextEncodingISOLatin2 :
enc = wxFONTENCODING_ISO8859_2; enc = wxFONTENCODING_ISO8859_2;
break ; break ;
case kTextEncodingISOLatin3 : case kTextEncodingISOLatin3 :
enc = wxFONTENCODING_ISO8859_3 ; enc = wxFONTENCODING_ISO8859_3 ;
break ; break ;
case kTextEncodingISOLatin4 : case kTextEncodingISOLatin4 :
enc = wxFONTENCODING_ISO8859_4; enc = wxFONTENCODING_ISO8859_4;
break ; break ;
case kTextEncodingISOLatinCyrillic : case kTextEncodingISOLatinCyrillic :
enc = wxFONTENCODING_ISO8859_5; enc = wxFONTENCODING_ISO8859_5;
break ; break ;
case kTextEncodingISOLatinArabic : case kTextEncodingISOLatinArabic :
enc = wxFONTENCODING_ISO8859_6; enc = wxFONTENCODING_ISO8859_6;
break ; break ;
case kTextEncodingISOLatinGreek : case kTextEncodingISOLatinGreek :
enc = wxFONTENCODING_ISO8859_7; enc = wxFONTENCODING_ISO8859_7;
break ; break ;
case kTextEncodingISOLatinHebrew : case kTextEncodingISOLatinHebrew :
enc = wxFONTENCODING_ISO8859_8; enc = wxFONTENCODING_ISO8859_8;
break ; break ;
case kTextEncodingISOLatin5 : case kTextEncodingISOLatin5 :
enc = wxFONTENCODING_ISO8859_9; enc = wxFONTENCODING_ISO8859_9;
break ; break ;
case kTextEncodingISOLatin6 : case kTextEncodingISOLatin6 :
enc = wxFONTENCODING_ISO8859_10; enc = wxFONTENCODING_ISO8859_10;
break ; break ;
case kTextEncodingISOLatin7 : case kTextEncodingISOLatin7 :
enc = wxFONTENCODING_ISO8859_13; enc = wxFONTENCODING_ISO8859_13;
break ; break ;
case kTextEncodingISOLatin8 : case kTextEncodingISOLatin8 :
enc = wxFONTENCODING_ISO8859_14; enc = wxFONTENCODING_ISO8859_14;
break ; break ;
case kTextEncodingISOLatin9 : case kTextEncodingISOLatin9 :
enc =wxFONTENCODING_ISO8859_15 ; enc =wxFONTENCODING_ISO8859_15 ;
break ; break ;
case kTextEncodingKOI8_R : case kTextEncodingKOI8_R :
enc = wxFONTENCODING_KOI8; enc = wxFONTENCODING_KOI8;
break ; break ;
/* /*
case : case :
enc = wxFONTENCODING_BULGARIAN; enc = wxFONTENCODING_BULGARIAN;
break ; break ;
*/ */
case kTextEncodingDOSLatinUS : case kTextEncodingDOSLatinUS :
enc = wxFONTENCODING_CP437; enc = wxFONTENCODING_CP437;
break ; break ;
case kTextEncodingDOSLatin1 : case kTextEncodingDOSLatin1 :
enc = wxFONTENCODING_CP850; enc = wxFONTENCODING_CP850;
break ; break ;
case kTextEncodingDOSLatin2 : case kTextEncodingDOSLatin2 :
enc =wxFONTENCODING_CP852 ; enc =wxFONTENCODING_CP852 ;
break ; break ;
case kTextEncodingDOSCyrillic : case kTextEncodingDOSCyrillic :
enc = wxFONTENCODING_CP855; enc = wxFONTENCODING_CP855;
break ; break ;
case kTextEncodingDOSRussian : case kTextEncodingDOSRussian :
enc = wxFONTENCODING_CP866; enc = wxFONTENCODING_CP866;
break ; break ;
case kTextEncodingDOSThai : case kTextEncodingDOSThai :
enc =wxFONTENCODING_CP874 ; enc =wxFONTENCODING_CP874 ;
break ; break ;
case kTextEncodingDOSJapanese : case kTextEncodingDOSJapanese :
enc = wxFONTENCODING_CP932; enc = wxFONTENCODING_CP932;
break ; break ;
case kTextEncodingDOSChineseSimplif : case kTextEncodingDOSChineseSimplif :
enc = wxFONTENCODING_CP936; enc = wxFONTENCODING_CP936;
break ; break ;
case kTextEncodingDOSKorean : case kTextEncodingDOSKorean :
enc = wxFONTENCODING_CP949; enc = wxFONTENCODING_CP949;
break ; break ;
case kTextEncodingDOSChineseTrad : case kTextEncodingDOSChineseTrad :
enc = wxFONTENCODING_CP950; enc = wxFONTENCODING_CP950;
break ; break ;
case kTextEncodingWindowsLatin2 : case kTextEncodingWindowsLatin2 :
enc = wxFONTENCODING_CP1250; enc = wxFONTENCODING_CP1250;
break ; break ;
case kTextEncodingWindowsCyrillic : case kTextEncodingWindowsCyrillic :
enc = wxFONTENCODING_CP1251; enc = wxFONTENCODING_CP1251;
break ; break ;
case kTextEncodingWindowsLatin1 : case kTextEncodingWindowsLatin1 :
enc = wxFONTENCODING_CP1252; enc = wxFONTENCODING_CP1252;
break ; break ;
case kTextEncodingWindowsGreek : case kTextEncodingWindowsGreek :
enc = wxFONTENCODING_CP1253; enc = wxFONTENCODING_CP1253;
break ; break ;
case kTextEncodingWindowsLatin5 : case kTextEncodingWindowsLatin5 :
enc = wxFONTENCODING_CP1254; enc = wxFONTENCODING_CP1254;
break ; break ;
case kTextEncodingWindowsHebrew : case kTextEncodingWindowsHebrew :
enc = wxFONTENCODING_CP1255; enc = wxFONTENCODING_CP1255;
break ; break ;
case kTextEncodingWindowsArabic : case kTextEncodingWindowsArabic :
enc = wxFONTENCODING_CP1256; enc = wxFONTENCODING_CP1256;
break ; break ;
case kTextEncodingWindowsBalticRim : case kTextEncodingWindowsBalticRim :
enc =wxFONTENCODING_CP1257 ; enc =wxFONTENCODING_CP1257 ;
break ; break ;
case kTextEncodingEUC_JP : case kTextEncodingEUC_JP :
enc = wxFONTENCODING_EUC_JP; enc = wxFONTENCODING_EUC_JP;
break ; break ;
/* /*
case wxFONTENCODING_UTF7 : case wxFONTENCODING_UTF7 :
enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicodeUTF7Format) ; enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicodeUTF7Format) ;
break ; break ;
case wxFONTENCODING_UTF8 : case wxFONTENCODING_UTF8 :
enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicodeUTF8Format) ; enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicodeUTF8Format) ;
break ; break ;
case wxFONTENCODING_UTF16BE : case wxFONTENCODING_UTF16BE :
enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode16BitFormat) ; enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode16BitFormat) ;
break ; break ;
case wxFONTENCODING_UTF16LE : case wxFONTENCODING_UTF16LE :
enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode16BitFormat) ; enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode16BitFormat) ;
break ; break ;
case wxFONTENCODING_UTF32BE : case wxFONTENCODING_UTF32BE :
enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode32BitFormat) ; enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode32BitFormat) ;
break ; break ;
case wxFONTENCODING_UTF32LE : case wxFONTENCODING_UTF32LE :
enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode32BitFormat) ; enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode32BitFormat) ;
break ; break ;
*/ */
case kTextEncodingMacRoman : case kTextEncodingMacRoman :
enc = wxFONTENCODING_MACROMAN ; enc = wxFONTENCODING_MACROMAN ;
@@ -1098,9 +1098,9 @@ wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding)
break ; break ;
case kTextEncodingMacKeyboardGlyphs : case kTextEncodingMacKeyboardGlyphs :
enc = wxFONTENCODING_MACKEYBOARD ; enc = wxFONTENCODING_MACKEYBOARD ;
break ; break ;
} ; } ;
return enc ; return enc ;
} }
#endif // wxUSE_BASE #endif // wxUSE_BASE
@@ -1117,16 +1117,16 @@ wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding)
// converts this string into a carbon foundation string with optional pc 2 mac encoding // converts this string into a carbon foundation string with optional pc 2 mac encoding
void wxMacCFStringHolder::Assign( const wxString &st , wxFontEncoding encoding ) void wxMacCFStringHolder::Assign( const wxString &st , wxFontEncoding encoding )
{ {
Release() ; Release() ;
wxString str = st ; wxString str = st ;
wxMacConvertNewlines13To10( &str ) ; wxMacConvertNewlines13To10( &str ) ;
#if wxUSE_UNICODE #if wxUSE_UNICODE
#if SIZEOF_WCHAR_T == 2 #if SIZEOF_WCHAR_T == 2
m_cfs = CFStringCreateWithCharacters( kCFAllocatorDefault, m_cfs = CFStringCreateWithCharacters( kCFAllocatorDefault,
(UniChar*)str.wc_str() , str.Len() ); (UniChar*)str.wc_str() , str.Len() );
#else #else
wxMBConvUTF16BE converter ; wxMBConvUTF16BE converter ;
size_t unicharlen = converter.WC2MB( NULL , str.wc_str() , 0 ) ; size_t unicharlen = converter.WC2MB( NULL , str.wc_str() , 0 ) ;
UniChar *unibuf = new UniChar[ unicharlen / sizeof(UniChar) + 1 ] ; UniChar *unibuf = new UniChar[ unicharlen / sizeof(UniChar) + 1 ] ;
converter.WC2MB( (char*)unibuf , str.wc_str() , unicharlen ) ; converter.WC2MB( (char*)unibuf , str.wc_str() , unicharlen ) ;
@@ -1146,18 +1146,18 @@ wxString wxMacCFStringHolder::AsString(wxFontEncoding encoding)
Size cflen = CFStringGetLength( m_cfs ) ; Size cflen = CFStringGetLength( m_cfs ) ;
size_t noChars ; size_t noChars ;
wxChar* buf = NULL ; wxChar* buf = NULL ;
#if wxUSE_UNICODE #if wxUSE_UNICODE
#if SIZEOF_WCHAR_T == 2 #if SIZEOF_WCHAR_T == 2
buf = new wxChar[ cflen + 1 ] ; buf = new wxChar[ cflen + 1 ] ;
CFStringGetCharacters( m_cfs , CFRangeMake( 0 , cflen ) , (UniChar*) buf ) ; CFStringGetCharacters( m_cfs , CFRangeMake( 0 , cflen ) , (UniChar*) buf ) ;
noChars = cflen ; noChars = cflen ;
#else #else
UniChar* unibuf = new UniChar[ cflen + 1 ] ; UniChar* unibuf = new UniChar[ cflen + 1 ] ;
CFStringGetCharacters( m_cfs , CFRangeMake( 0 , cflen ) , (UniChar*) unibuf ) ; CFStringGetCharacters( m_cfs , CFRangeMake( 0 , cflen ) , (UniChar*) unibuf ) ;
unibuf[cflen] = 0 ; unibuf[cflen] = 0 ;
wxMBConvUTF16BE converter ; wxMBConvUTF16BE converter ;
noChars = converter.MB2WC( NULL , (const char*)unibuf , 0 ) ; noChars = converter.MB2WC( NULL , (const char*)unibuf , 0 ) ;
buf = new wxChar[ noChars + 1 ] ; buf = new wxChar[ noChars + 1 ] ;
converter.MB2WC( buf , (const char*)unibuf , noChars ) ; converter.MB2WC( buf , (const char*)unibuf , noChars ) ;
delete[] unibuf ; delete[] unibuf ;
@@ -1166,7 +1166,7 @@ wxString wxMacCFStringHolder::AsString(wxFontEncoding encoding)
CFIndex cStrLen ; CFIndex cStrLen ;
CFStringGetBytes( m_cfs , CFRangeMake(0, cflen) , wxMacGetSystemEncFromFontEnc( encoding ) , CFStringGetBytes( m_cfs , CFRangeMake(0, cflen) , wxMacGetSystemEncFromFontEnc( encoding ) ,
'?' , false , NULL , 0 , &cStrLen ) ; '?' , false , NULL , 0 , &cStrLen ) ;
buf = new wxChar[ cStrLen + 1 ] ; buf = new wxChar[ cStrLen + 1 ] ;
CFStringGetBytes( m_cfs , CFRangeMake(0, cflen) , wxMacGetSystemEncFromFontEnc( encoding ) , CFStringGetBytes( m_cfs , CFRangeMake(0, cflen) , wxMacGetSystemEncFromFontEnc( encoding ) ,
'?' , false , (unsigned char*) buf , cStrLen , &cStrLen) ; '?' , false , (unsigned char*) buf , cStrLen , &cStrLen) ;
noChars = cStrLen ; noChars = cStrLen ;
@@ -1181,9 +1181,9 @@ wxString wxMacCFStringHolder::AsString(wxFontEncoding encoding)
#endif //TARGET_CARBON #endif //TARGET_CARBON
void wxMacConvertNewlines13To10( char * data ) void wxMacConvertNewlines13To10( char * data )
{ {
char * buf = data ; char * buf = data ;
while( (buf=strchr(buf,0x0d)) != NULL ) while( (buf=strchr(buf,0x0d)) != NULL )
{ {
*buf = 0x0a ; *buf = 0x0a ;
@@ -1192,8 +1192,8 @@ void wxMacConvertNewlines13To10( char * data )
} }
void wxMacConvertNewlines10To13( char * data ) void wxMacConvertNewlines10To13( char * data )
{ {
char * buf = data ; char * buf = data ;
while( (buf=strchr(buf,0x0a)) != NULL ) while( (buf=strchr(buf,0x0a)) != NULL )
{ {
*buf = 0x0d ; *buf = 0x0d ;
@@ -1201,22 +1201,22 @@ void wxMacConvertNewlines10To13( char * data )
} }
} }
void wxMacConvertNewlines13To10( wxString * data ) void wxMacConvertNewlines13To10( wxString * data )
{ {
size_t len = data->Length() ; size_t len = data->Length() ;
if ( len == 0 || wxStrchr(data->c_str(),0x0d)==NULL) if ( len == 0 || wxStrchr(data->c_str(),0x0d)==NULL)
return ; return ;
wxString temp(*data) ; wxString temp(*data) ;
wxStringBuffer buf(*data,len ) ; wxStringBuffer buf(*data,len ) ;
memcpy( buf , temp.c_str() , (len+1)*sizeof(wxChar) ) ; memcpy( buf , temp.c_str() , (len+1)*sizeof(wxChar) ) ;
wxMacConvertNewlines13To10( buf ) ; wxMacConvertNewlines13To10( buf ) ;
} }
void wxMacConvertNewlines10To13( wxString * data ) void wxMacConvertNewlines10To13( wxString * data )
{ {
size_t len = data->Length() ; size_t len = data->Length() ;
if ( data->Length() == 0 || wxStrchr(data->c_str(),0x0a)==NULL) if ( data->Length() == 0 || wxStrchr(data->c_str(),0x0a)==NULL)
@@ -1224,15 +1224,15 @@ void wxMacConvertNewlines10To13( wxString * data )
wxString temp(*data) ; wxString temp(*data) ;
wxStringBuffer buf(*data,len ) ; wxStringBuffer buf(*data,len ) ;
memcpy( buf , temp.c_str() , (len+1)*sizeof(wxChar) ) ; memcpy( buf , temp.c_str() , (len+1)*sizeof(wxChar) ) ;
wxMacConvertNewlines10To13( buf ) ; wxMacConvertNewlines10To13( buf ) ;
} }
#if wxUSE_UNICODE #if wxUSE_UNICODE
void wxMacConvertNewlines13To10( wxChar * data ) void wxMacConvertNewlines13To10( wxChar * data )
{ {
wxChar * buf = data ; wxChar * buf = data ;
while( (buf=wxStrchr(buf,0x0d)) != NULL ) while( (buf=wxStrchr(buf,0x0d)) != NULL )
{ {
*buf = 0x0a ; *buf = 0x0a ;
@@ -1241,8 +1241,8 @@ void wxMacConvertNewlines13To10( wxChar * data )
} }
void wxMacConvertNewlines10To13( wxChar * data ) void wxMacConvertNewlines10To13( wxChar * data )
{ {
wxChar * buf = data ; wxChar * buf = data ;
while( (buf=wxStrchr(buf,0x0a)) != NULL ) while( (buf=wxStrchr(buf,0x0a)) != NULL )
{ {
*buf = 0x0d ; *buf = 0x0d ;

View File

@@ -658,7 +658,7 @@ int wxKill(long pid, wxSignal sig, wxKillError *krc, int flags)
{ {
if (flags & wxKILL_CHILDREN) if (flags & wxKILL_CHILDREN)
wxKillAllChildren(pid, sig, krc); wxKillAllChildren(pid, sig, krc);
// get the process handle to operate on // get the process handle to operate on
HANDLE hProcess = ::OpenProcess(SYNCHRONIZE | HANDLE hProcess = ::OpenProcess(SYNCHRONIZE |
PROCESS_TERMINATE | PROCESS_TERMINATE |
@@ -816,24 +816,24 @@ int wxKill(long pid, wxSignal sig, wxKillError *krc, int flags)
HANDLE (WINAPI *lpfCreateToolhelp32Snapshot)(DWORD,DWORD) ; HANDLE (WINAPI *lpfCreateToolhelp32Snapshot)(DWORD,DWORD) ;
BOOL (WINAPI *lpfProcess32First)(HANDLE,LPPROCESSENTRY32) ; BOOL (WINAPI *lpfProcess32First)(HANDLE,LPPROCESSENTRY32) ;
BOOL (WINAPI *lpfProcess32Next)(HANDLE,LPPROCESSENTRY32) ; BOOL (WINAPI *lpfProcess32Next)(HANDLE,LPPROCESSENTRY32) ;
static void InitToolHelp32() static void InitToolHelp32()
{ {
static bool s_initToolHelpDone = false; static bool s_initToolHelpDone = false;
if (s_initToolHelpDone) if (s_initToolHelpDone)
return; return;
s_initToolHelpDone = true; s_initToolHelpDone = true;
lpfCreateToolhelp32Snapshot = NULL; lpfCreateToolhelp32Snapshot = NULL;
lpfProcess32First = NULL; lpfProcess32First = NULL;
lpfProcess32Next = NULL; lpfProcess32Next = NULL;
HINSTANCE hInstLib = LoadLibrary( wxT("Kernel32.DLL") ) ; HINSTANCE hInstLib = LoadLibrary( wxT("Kernel32.DLL") ) ;
if( hInstLib == NULL ) if( hInstLib == NULL )
return ; return ;
// Get procedure addresses. // Get procedure addresses.
// We are linking to these functions of Kernel32 // We are linking to these functions of Kernel32
// explicitly, because otherwise a module using // explicitly, because otherwise a module using
@@ -849,7 +849,7 @@ static void InitToolHelp32()
"CreateToolhelp32Snapshot" "CreateToolhelp32Snapshot"
#endif #endif
) ; ) ;
lpfProcess32First= lpfProcess32First=
(BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32)) (BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))
GetProcAddress( hInstLib, GetProcAddress( hInstLib,
@@ -877,14 +877,14 @@ static void InitToolHelp32()
int wxKillAllChildren(long pid, wxSignal sig, wxKillError *krc) int wxKillAllChildren(long pid, wxSignal sig, wxKillError *krc)
{ {
InitToolHelp32(); InitToolHelp32();
if (krc) if (krc)
*krc = wxKILL_OK; *krc = wxKILL_OK;
// If not implemented for this platform (e.g. NT 4.0), silently ignore // If not implemented for this platform (e.g. NT 4.0), silently ignore
if (!lpfCreateToolhelp32Snapshot || !lpfProcess32First || !lpfProcess32Next) if (!lpfCreateToolhelp32Snapshot || !lpfProcess32First || !lpfProcess32Next)
return 0; return 0;
// Take a snapshot of all processes in the system. // Take a snapshot of all processes in the system.
HANDLE hProcessSnap = lpfCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); HANDLE hProcessSnap = lpfCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hProcessSnap == INVALID_HANDLE_VALUE) { if (hProcessSnap == INVALID_HANDLE_VALUE) {
@@ -892,11 +892,11 @@ int wxKillAllChildren(long pid, wxSignal sig, wxKillError *krc)
*krc = wxKILL_ERROR; *krc = wxKILL_ERROR;
return -1; return -1;
} }
//Fill in the size of the structure before using it. //Fill in the size of the structure before using it.
PROCESSENTRY32 pe = {0}; PROCESSENTRY32 pe = {0};
pe.dwSize = sizeof(PROCESSENTRY32); pe.dwSize = sizeof(PROCESSENTRY32);
// Walk the snapshot of the processes, and for each process, // Walk the snapshot of the processes, and for each process,
// kill it if its parent is pid. // kill it if its parent is pid.
if (!lpfProcess32First(hProcessSnap, &pe)) { if (!lpfProcess32First(hProcessSnap, &pe)) {
@@ -906,15 +906,15 @@ int wxKillAllChildren(long pid, wxSignal sig, wxKillError *krc)
CloseHandle (hProcessSnap); CloseHandle (hProcessSnap);
return -1; return -1;
} }
do { do {
if (pe.th32ParentProcessID == (DWORD) pid) { if (pe.th32ParentProcessID == (DWORD) pid) {
if (wxKill(pe.th32ProcessID, sig, krc)) if (wxKill(pe.th32ProcessID, sig, krc))
return -1; return -1;
} }
} while (lpfProcess32Next (hProcessSnap, &pe)); } while (lpfProcess32Next (hProcessSnap, &pe));
return 0; return 0;
} }
@@ -1010,15 +1010,20 @@ bool wxShutdown(wxShutdownFlags wFlags)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX) // Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
long wxGetFreeMemory() wxMemorySize wxGetFreeMemory()
{ {
#if defined(__WIN32__) && !defined(__BORLANDC__) #if defined(__WIN64__)
MEMORYSTATUSEX memStatex;
statex.dwLength = sizeof (statex);
GlobalMemoryStatusEx (&statex);
return (wxMemorySize)memStatus.ullAvailPhys;
#elif defined(__WIN32__) && !defined(__BORLANDC__)
MEMORYSTATUS memStatus; MEMORYSTATUS memStatus;
memStatus.dwLength = sizeof(MEMORYSTATUS); memStatus.dwLength = sizeof(MEMORYSTATUS);
GlobalMemoryStatus(&memStatus); GlobalMemoryStatus(&memStatus);
return memStatus.dwAvailPhys; return (wxMemorySize)memStatus.dwAvailPhys;
#else #else
return (long)GetFreeSpace(0); return (wxMemorySize)GetFreeSpace(0);
#endif #endif
} }

View File

@@ -95,7 +95,7 @@ bool wxGetHostName(
wxStrncpy(zBuf, zSysname, nMaxSize - 1); wxStrncpy(zBuf, zSysname, nMaxSize - 1);
zBuf[nMaxSize] = _T('\0'); zBuf[nMaxSize] = _T('\0');
#endif #endif
return *zBuf ? TRUE : FALSE; return *zBuf ? true : false;
} }
// Get user ID e.g. jacs // Get user ID e.g. jacs
@@ -108,9 +108,9 @@ bool wxGetUserId(
long lrc; long lrc;
// UPM procs return 0 on success // UPM procs return 0 on success
lrc = U32ELOCU((unsigned char*)zBuf, (unsigned long *)&nType); lrc = U32ELOCU((unsigned char*)zBuf, (unsigned long *)&nType);
if (lrc == 0) return TRUE; if (lrc == 0) return true;
#endif #endif
return FALSE; return false;
} }
bool wxGetUserName( bool wxGetUserName(
@@ -125,7 +125,7 @@ bool wxGetUserName(
#else #else
wxStrncpy(zBuf, _T("Unknown User"), nMaxSize); wxStrncpy(zBuf, _T("Unknown User"), nMaxSize);
#endif #endif
return TRUE; return true;
} }
int wxKill( int wxKill(
@@ -201,11 +201,11 @@ bool wxShell(
bool wxShutdown(wxShutdownFlags wFlags) bool wxShutdown(wxShutdownFlags wFlags)
{ {
// TODO // TODO
return FALSE; return false;
} }
// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX) // Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
long wxGetFreeMemory() wxMemorySize wxGetFreeMemory()
{ {
void* pMemptr = NULL; void* pMemptr = NULL;
ULONG lSize; ULONG lSize;
@@ -215,8 +215,8 @@ long wxGetFreeMemory()
lMemFlags = PAG_FREE; lMemFlags = PAG_FREE;
rc = ::DosQueryMem(pMemptr, &lSize, &lMemFlags); rc = ::DosQueryMem(pMemptr, &lSize, &lMemFlags);
if (rc != 0) if (rc != 0)
return -1L; lSize = -1L;
return (long)lSize; return (wxMemorySize)lSize;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -228,14 +228,14 @@ bool wxGetEnv(const wxString& var, wxString *value)
// wxGetenv is defined as getenv() // wxGetenv is defined as getenv()
wxChar *p = wxGetenv(var); wxChar *p = wxGetenv(var);
if ( !p ) if ( !p )
return FALSE; return false;
if ( value ) if ( value )
{ {
*value = p; *value = p;
} }
return TRUE; return true;
} }
bool wxSetEnv(const wxString& variable, const wxChar *value) bool wxSetEnv(const wxString& variable, const wxChar *value)
@@ -257,7 +257,7 @@ bool wxSetEnv(const wxString& variable, const wxChar *value)
return putenv(buf) == 0; return putenv(buf) == 0;
#else // no way to set an env var #else // no way to set an env var
return FALSE; return false;
#endif #endif
} }
@@ -361,9 +361,9 @@ void wxAppTraits::TerminateGui(unsigned long ulHab)
wxToolkitInfo & wxConsoleAppTraits::GetToolkitInfo() wxToolkitInfo & wxConsoleAppTraits::GetToolkitInfo()
{ {
static wxToolkitInfo vInfo; static wxToolkitInfo vInfo;
ULONG ulSysInfo[QSV_MAX] = {0}; ULONG ulSysInfo[QSV_MAX] = {0};
APIRET ulrc; APIRET ulrc;
vInfo.name = _T("wxBase"); vInfo.name = _T("wxBase");
ulrc = ::DosQuerySysInfo( 1L ulrc = ::DosQuerySysInfo( 1L

View File

@@ -4,7 +4,7 @@
// Author: William Osborne // Author: William Osborne
// Modified by: // Modified by:
// Created: 10/13/04 // Created: 10/13/04
// RCS-ID: $Id: // RCS-ID: $Id:
// Copyright: (c) William Osborne // Copyright: (c) William Osborne
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -90,7 +90,7 @@ bool wxGetUserName(wxChar *buf, int maxSize)
wxStrncpy (buf, wxConvertMB2WX(id), maxSize - 1); wxStrncpy (buf, wxConvertMB2WX(id), maxSize - 1);
// free the buffer // free the buffer
MemPtrUnlock(id); MemPtrUnlock(id);
return true; return true;
@@ -156,7 +156,7 @@ bool wxShutdown(wxShutdownFlags wFlags)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX) // Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
long wxGetFreeMemory() wxMemorySize wxGetFreeMemory()
{ {
uint32_t freeTotal = 0; uint32_t freeTotal = 0;
uint32_t freeHeap; uint32_t freeHeap;
@@ -171,7 +171,7 @@ long wxGetFreeMemory()
freeTotal+=freeHeap; freeTotal+=freeHeap;
} }
return freeTotal; return (wxMemorySize)freeTotal;
} }
unsigned long wxGetProcessId() unsigned long wxGetProcessId()

View File

@@ -259,7 +259,7 @@ long wxExecute( const wxString& command, int flags, wxProcess *process )
wxString argument; wxString argument;
const wxChar *cptr = command.c_str(); const wxChar *cptr = command.c_str();
wxChar quotechar = wxT('\0'); // is arg quoted? wxChar quotechar = wxT('\0'); // is arg quoted?
bool escaped = FALSE; bool escaped = false;
// split the command line in arguments // split the command line in arguments
do do
@@ -278,14 +278,14 @@ long wxExecute( const wxString& command, int flags, wxProcess *process )
{ {
if ( *cptr == wxT('\\') && ! escaped ) if ( *cptr == wxT('\\') && ! escaped )
{ {
escaped = TRUE; escaped = true;
cptr++; cptr++;
continue; continue;
} }
// all other characters: // all other characters:
argument += *cptr++; argument += *cptr++;
escaped = FALSE; escaped = false;
// have we reached the end of the argument? // have we reached the end of the argument?
if ( (*cptr == quotechar && ! escaped) if ( (*cptr == quotechar && ! escaped)
@@ -348,7 +348,7 @@ bool wxShell(const wxString& command)
bool wxShell(const wxString& command, wxArrayString& output) bool wxShell(const wxString& command, wxArrayString& output)
{ {
wxCHECK_MSG( !!command, FALSE, _T("can't exec shell non interactively") ); wxCHECK_MSG( !command.empty(), false, _T("can't exec shell non interactively") );
return wxExecute(wxMakeShellCommand(command), output); return wxExecute(wxMakeShellCommand(command), output);
} }
@@ -369,7 +369,7 @@ bool wxShutdown(wxShutdownFlags wFlags)
default: default:
wxFAIL_MSG( _T("unknown wxShutdown() flag") ); wxFAIL_MSG( _T("unknown wxShutdown() flag") );
return FALSE; return false;
} }
return system(wxString::Format(_T("init %c"), level).mb_str()) == 0; return system(wxString::Format(_T("init %c"), level).mb_str()) == 0;
@@ -385,7 +385,7 @@ bool wxShutdown(wxShutdownFlags wFlags)
bool wxPipeInputStream::CanRead() const bool wxPipeInputStream::CanRead() const
{ {
if ( m_lasterror == wxSTREAM_EOF ) if ( m_lasterror == wxSTREAM_EOF )
return FALSE; return false;
// check if there is any input available // check if there is any input available
struct timeval tv; struct timeval tv;
@@ -404,7 +404,7 @@ bool wxPipeInputStream::CanRead() const
// fall through // fall through
case 0: case 0:
return FALSE; return false;
default: default:
wxFAIL_MSG(_T("unexpected select() return value")); wxFAIL_MSG(_T("unexpected select() return value"));
@@ -724,7 +724,7 @@ char *wxGetUserHome( const wxString &user )
// private use only) // private use only)
static bool wxGetHostNameInternal(wxChar *buf, int sz) static bool wxGetHostNameInternal(wxChar *buf, int sz)
{ {
wxCHECK_MSG( buf, FALSE, wxT("NULL pointer in wxGetHostNameInternal") ); wxCHECK_MSG( buf, false, wxT("NULL pointer in wxGetHostNameInternal") );
*buf = wxT('\0'); *buf = wxT('\0');
@@ -742,7 +742,7 @@ static bool wxGetHostNameInternal(wxChar *buf, int sz)
#else // no uname, no gethostname #else // no uname, no gethostname
wxFAIL_MSG(wxT("don't know host name for this machine")); wxFAIL_MSG(wxT("don't know host name for this machine"));
bool ok = FALSE; bool ok = false;
#endif // uname/gethostname #endif // uname/gethostname
if ( !ok ) if ( !ok )
@@ -785,7 +785,7 @@ bool wxGetFullHostName(wxChar *buf, int sz)
{ {
wxLogSysError(_("Cannot get the official hostname")); wxLogSysError(_("Cannot get the official hostname"));
ok = FALSE; ok = false;
} }
else else
{ {
@@ -807,10 +807,10 @@ bool wxGetUserId(wxChar *buf, int sz)
if ((who = getpwuid(getuid ())) != NULL) if ((who = getpwuid(getuid ())) != NULL)
{ {
wxStrncpy (buf, wxConvertMB2WX(who->pw_name), sz - 1); wxStrncpy (buf, wxConvertMB2WX(who->pw_name), sz - 1);
return TRUE; return true;
} }
return FALSE; return false;
} }
bool wxGetUserName(wxChar *buf, int sz) bool wxGetUserName(wxChar *buf, int sz)
@@ -829,10 +829,10 @@ bool wxGetUserName(wxChar *buf, int sz)
#else // !HAVE_PW_GECOS #else // !HAVE_PW_GECOS
wxStrncpy (buf, wxConvertMB2WX(who->pw_name), sz - 1); wxStrncpy (buf, wxConvertMB2WX(who->pw_name), sz - 1);
#endif // HAVE_PW_GECOS/!HAVE_PW_GECOS #endif // HAVE_PW_GECOS/!HAVE_PW_GECOS
return TRUE; return true;
} }
return FALSE; return false;
} }
// this function is in mac/utils.cpp for wxMac // this function is in mac/utils.cpp for wxMac
@@ -863,7 +863,7 @@ unsigned long wxGetProcessId()
return (unsigned long)getpid(); return (unsigned long)getpid();
} }
long wxGetFreeMemory() wxMemorySize wxGetFreeMemory()
{ {
#if defined(__LINUX__) #if defined(__LINUX__)
// get it from /proc/meminfo // get it from /proc/meminfo
@@ -881,10 +881,10 @@ long wxGetFreeMemory()
fclose(fp); fclose(fp);
return memFree; return (wxMemorySize)memFree;
} }
#elif defined(__SUN__) && defined(_SC_AVPHYS_PAGES) #elif defined(__SUN__) && defined(_SC_AVPHYS_PAGES)
return sysconf(_SC_AVPHYS_PAGES)*sysconf(_SC_PAGESIZE); return (wxMemorySize)(sysconf(_SC_AVPHYS_PAGES)*sysconf(_SC_PAGESIZE));
//#elif defined(__FREEBSD__) -- might use sysctl() to find it out, probably //#elif defined(__FREEBSD__) -- might use sysctl() to find it out, probably
#endif #endif
@@ -901,7 +901,7 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
{ {
wxLogSysError( wxT("Failed to get file system statistics") ); wxLogSysError( wxT("Failed to get file system statistics") );
return FALSE; return false;
} }
// under Solaris we also have to use f_frsize field instead of f_bsize // under Solaris we also have to use f_frsize field instead of f_bsize
@@ -922,9 +922,9 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
*pFree = wxLongLong(fs.f_bavail) * blockSize; *pFree = wxLongLong(fs.f_bavail) * blockSize;
} }
return TRUE; return true;
#else // !HAVE_STATFS && !HAVE_STATVFS #else // !HAVE_STATFS && !HAVE_STATVFS
return FALSE; return false;
#endif // HAVE_STATFS #endif // HAVE_STATFS
} }
@@ -937,14 +937,14 @@ bool wxGetEnv(const wxString& var, wxString *value)
// wxGetenv is defined as getenv() // wxGetenv is defined as getenv()
wxChar *p = wxGetenv(var); wxChar *p = wxGetenv(var);
if ( !p ) if ( !p )
return FALSE; return false;
if ( value ) if ( value )
{ {
*value = p; *value = p;
} }
return TRUE; return true;
} }
bool wxSetEnv(const wxString& variable, const wxChar *value) bool wxSetEnv(const wxString& variable, const wxChar *value)
@@ -994,13 +994,13 @@ extern "C" void wxFatalSignalHandler(wxTYPE_SA_HANDLER)
bool wxHandleFatalExceptions(bool doit) bool wxHandleFatalExceptions(bool doit)
{ {
// old sig handlers // old sig handlers
static bool s_savedHandlers = FALSE; static bool s_savedHandlers = false;
static struct sigaction s_handlerFPE, static struct sigaction s_handlerFPE,
s_handlerILL, s_handlerILL,
s_handlerBUS, s_handlerBUS,
s_handlerSEGV; s_handlerSEGV;
bool ok = TRUE; bool ok = true;
if ( doit && !s_savedHandlers ) if ( doit && !s_savedHandlers )
{ {
// install the signal handler // install the signal handler
@@ -1022,7 +1022,7 @@ bool wxHandleFatalExceptions(bool doit)
wxLogDebug(_T("Failed to install our signal handler.")); wxLogDebug(_T("Failed to install our signal handler."));
} }
s_savedHandlers = TRUE; s_savedHandlers = true;
} }
else if ( s_savedHandlers ) else if ( s_savedHandlers )
{ {
@@ -1036,7 +1036,7 @@ bool wxHandleFatalExceptions(bool doit)
wxLogDebug(_T("Failed to uninstall our signal handler.")); wxLogDebug(_T("Failed to uninstall our signal handler."));
} }
s_savedHandlers = FALSE; s_savedHandlers = false;
} }
//else: nothing to do //else: nothing to do