Move more stuff into base for wxMac so that two level namespace dylibs

can be used on OS X.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23557 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-09-13 00:03:18 +00:00
parent 439484990e
commit 2dbc444a19
15 changed files with 1519 additions and 1413 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -109,10 +109,14 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/mac/mimetmac.cpp
src/unix/baseunix.cpp
src/mac/utilsexc.cpp
src/mac/thread.cpp
src/mac/macnotfy.cpp
src/mac/morefilex/MoreFilesX.c
</set>
<set var="BASE_AND_GUI_MAC_SRC" hints="files">
src/mac/utils.cpp
src/mac/uma.cpp
</set>
<set var="BASE_MAC_HDR" hints="files">
@@ -1546,13 +1550,11 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/mac/gdiobj.cpp
src/mac/icon.cpp
src/mac/listbox.cpp
src/mac/macnotfy.cpp
src/mac/mdi.cpp
src/mac/menu.cpp
src/mac/menuitem.cpp
src/mac/metafile.cpp
src/mac/minifram.cpp
src/mac/morefilex/MoreFilesX.c
src/mac/msgdlg.cpp
src/mac/notebmac.cpp
src/mac/palette.cpp
@@ -1575,12 +1577,10 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/mac/stattext.cpp
src/mac/tabctrl.cpp
src/mac/textctrl.cpp
src/mac/thread.cpp
src/mac/timer.cpp
src/mac/toolbar.cpp
src/mac/tooltip.cpp
src/mac/toplevel.cpp
src/mac/uma.cpp
src/mac/window.cpp
<!-- Generic implementations used by wxMac: -->
src/generic/caret.cpp

View File

@@ -291,6 +291,12 @@ public:
int argc;
wxChar **argv;
#ifdef __WXMAC__
// This is needed in the wxAppConsole class because it is refereced from
// the wxBase library
static bool s_macDefaultEncodingIsPC ;
#endif
protected:
// the function which creates the traits object when GetTraits() needs it
// for the first time

View File

@@ -43,7 +43,7 @@ bool WXDLLEXPORT wxYield();
class WXDLLEXPORT wxApp: public wxAppBase
{
DECLARE_DYNAMIC_CLASS(wxApp)
wxApp();
virtual ~wxApp() {}
@@ -57,10 +57,10 @@ class WXDLLEXPORT wxApp: public wxAppBase
virtual bool Yield(bool onlyIfNeeded = FALSE);
virtual void WakeUpIdle();
virtual void SetPrintMode(int mode) { m_printMode = mode; }
virtual int GetPrintMode() const { return m_printMode; }
#if wxUSE_GUI
// setting up all MacOS Specific Event-Handlers etc
virtual bool OnInitGui();
@@ -69,11 +69,11 @@ class WXDLLEXPORT wxApp: public wxAppBase
void OnIdle(wxIdleEvent& event);
void OnEndSession(wxCloseEvent& event);
void OnQueryEndSession(wxCloseEvent& event);
// Windows only, but for compatibility...
inline void SetAuto3D(bool flag) { m_auto3D = flag; }
inline bool GetAuto3D() const { return m_auto3D; }
protected:
bool m_showOnInit;
int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
@@ -84,7 +84,7 @@ public:
// Implementation
virtual bool Initialize(int& argc, wxChar **argv);
virtual void CleanUp();
bool IsExiting() { return !m_keepGoing ; }
#if TARGET_CARBON
// the installed application event handler
@@ -100,9 +100,9 @@ public:
static int s_lastMouseDown ; // 0 = none , 1 = left , 2 = right
static WXHRGN s_macCursorRgn ;
static long s_lastModifiers ;
int m_nCmdShow;
private:
bool m_keepGoing ;
@@ -114,7 +114,6 @@ private:
WXEVENTREF m_macCurrentEvent ;
public:
static bool s_macDefaultEncodingIsPC ;
static bool s_macSupportPCMenuShortcuts ;
static long s_macAboutMenuItemId ;
static long s_macPreferencesMenuItemId ;
@@ -135,12 +134,12 @@ public:
WXHRGN m_macCursorRgn ;
WXHRGN m_macSleepRgn ;
WXHRGN m_macHelpRgn ;
virtual void MacSuspend( bool convertClipboard ) ;
virtual void MacResume( bool convertClipboard ) ;
virtual void MacConvertPrivateToPublicScrap() ;
virtual void MacConvertPublicToPrivateScrap() ;
void MacDoOneEvent() ;
WXEVENTREF MacGetCurrentEvent() { return m_macCurrentEvent ; }
void MacHandleOneEvent( WXEVENTREF ev ) ;
@@ -158,12 +157,12 @@ public:
virtual void MacHandleKeyDownEvent( WXEVENTREF ev ) ;
virtual void MacHandleKeyUpEvent( WXEVENTREF ev ) ;
virtual void MacHandleHighLevelEvent( WXEVENTREF ev ) ;
#else
virtual void MacHandleMouseMovedEvent( wxInt32 x , wxInt32 y ,wxUint32 modifiers , long timestamp ) ;
#endif
void MacHandleMenuCommand( wxUint32 command ) ;
void MacHandleMenuCommand( wxUint32 command ) ;
bool MacSendKeyDownEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey ) ;
bool MacSendKeyUpEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey ) ;
@@ -171,7 +170,7 @@ public:
virtual short MacHandleAEPDoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
virtual short MacHandleAEOApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
virtual short MacHandleAEQuit(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
// in response of an open-document apple event
virtual void MacOpenFile(const wxString &fileName) ;
// in response of a print-document apple event
@@ -191,8 +190,8 @@ public:
// opaque pointer for CFragInitBlock
static void OpenSharedLibraryResource(const void *) ;
static void CloseSharedLibraryResource() ;
private:
private:
short m_currentRefNum ;
} ;

View File

@@ -4,7 +4,7 @@
// Author: Stefan Csomor
// Modified by:
// Created: 03/02/99
// RCS-ID: $Id:
// RCS-ID: $Id:
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@@ -22,13 +22,17 @@ long UMAGetAppearanceVersion() ;
bool UMAHasWindowManager() ;
long UMAGetWindowManagerAttr() ;
bool UMAHasAquaLayout() ;
bool UMASystemIsInitialized() ;
void UMASetSystemIsInitialized(bool val);
// process manager
long UMAGetProcessMode() ;
bool UMAGetProcessModeDoesActivateOnFGSwitch() ;
#if wxUSE_GUI
// menu manager
MenuRef UMANewMenu( SInt16 id , const wxString& title ) ;
@@ -121,6 +125,8 @@ OSStatus UMAPutScrap( Size size , OSType type , void *data ) ;
// calls not in carbon
#endif
#define GetWindowUpdateRgn( inWindow , updateRgn ) GetWindowRegion( inWindow , kWindowUpdateRgn, updateRgn )
#define GetWindowUpdateRgn( inWindow , updateRgn ) GetWindowRegion( inWindow , kWindowUpdateRgn, updateRgn )
#endif // wxUSE_GUI
#endif

View File

@@ -93,6 +93,10 @@ wxAppConsole *wxAppConsole::ms_appInstance = NULL;
wxAppInitializerFunction wxAppConsole::ms_appInitFn = NULL;
#ifdef __WXMAC__
bool wxAppConsole::s_macDefaultEncodingIsPC = true ;
#endif
// ============================================================================
// wxAppConsole implementation
// ============================================================================
@@ -371,10 +375,10 @@ bool wxAppConsole::CheckBuildOptions(const char *optionsSignature,
wxString prog = wxString::FromAscii(optionsSignature);
wxString progName = wxString::FromAscii(componentName);
wxString msg;
msg.Printf(_T("Mismatch between the program and library build versions detected.\nThe library used %s,\nand %s used %s."),
lib.c_str(), progName.c_str(), prog.c_str());
wxLogFatalError(msg);
// normally wxLogFatalError doesn't return
@@ -456,7 +460,7 @@ void wxConsoleAppTraitsBase::RemoveFromPendingDelete(wxObject * WXUNUSED(object)
{
// nothing to do
}
#if wxUSE_SOCKETS
GSocketGUIFunctionsTable* wxConsoleAppTraitsBase::GetSocketGUIFunctionsTable()
{
@@ -533,7 +537,7 @@ void wxAssert(int cond,
const wxChar *szFile,
int nLine,
const wxChar *szCond,
const wxChar *szMsg)
const wxChar *szMsg)
{
if ( !cond )
wxOnAssert(szFile, nLine, szCond, szMsg);

View File

@@ -104,7 +104,6 @@ long wxApp::sm_lastMessageTime = 0;
long wxApp::s_lastModifiers = 0 ;
bool wxApp::s_macDefaultEncodingIsPC = true ;
bool wxApp::s_macSupportPCMenuShortcuts = true ;
long wxApp::s_macAboutMenuItemId = wxID_ABOUT ;
long wxApp::s_macPreferencesMenuItemId = wxID_PREFERENCES ;
@@ -1561,7 +1560,7 @@ void wxApp::MacHandleMouseDownEvent( WXEVENTREF evr )
{
// Activate window first
::SelectWindow( window ) ;
// Send event later
if ( win )
win->MacMouseDown( ev , windowPart ) ;
@@ -2177,7 +2176,7 @@ void wxApp::MacHandleMouseMovedEvent(wxInt32 x , wxInt32 y ,wxUint32 modifiers ,
event.m_controlDown = modifiers & controlKey;
event.m_altDown = modifiers & optionKey;
event.m_metaDown = modifiers & cmdKey;
event.m_x = x;
event.m_y = y;
event.m_timeStamp = timestamp;

View File

@@ -104,7 +104,6 @@ long wxApp::sm_lastMessageTime = 0;
long wxApp::s_lastModifiers = 0 ;
bool wxApp::s_macDefaultEncodingIsPC = true ;
bool wxApp::s_macSupportPCMenuShortcuts = true ;
long wxApp::s_macAboutMenuItemId = wxID_ABOUT ;
long wxApp::s_macPreferencesMenuItemId = wxID_PREFERENCES ;
@@ -1561,7 +1560,7 @@ void wxApp::MacHandleMouseDownEvent( WXEVENTREF evr )
{
// Activate window first
::SelectWindow( window ) ;
// Send event later
if ( win )
win->MacMouseDown( ev , windowPart ) ;
@@ -2177,7 +2176,7 @@ void wxApp::MacHandleMouseMovedEvent(wxInt32 x , wxInt32 y ,wxUint32 modifiers ,
event.m_controlDown = modifiers & controlKey;
event.m_altDown = modifiers & optionKey;
event.m_metaDown = modifiers & cmdKey;
event.m_x = x;
event.m_y = y;
event.m_timeStamp = timestamp;

View File

@@ -37,10 +37,12 @@
#ifdef __WXMAC__
#include <Threads.h>
#include "wx/mac/uma.h"
#include "wx/mac/macnotfy.h"
#endif
#define INFINITE 0xFFFFFFFF
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
@@ -257,12 +259,12 @@ public:
}
bool IsOk() const { return m_mutex.IsOk() ; }
wxCondError Wait()
{
return WaitTimeout(0xFFFFFFFF );
}
wxCondError WaitTimeout(unsigned long msectimeout)
{
wxMacStCritical critical ;
@@ -300,7 +302,7 @@ public:
{
wxMacStCritical critical ;
return wxCOND_NO_ERROR;
}
}
wxArrayLong m_waiters ;
wxInt32 m_excessSignals ;
@@ -844,7 +846,7 @@ bool wxThreadModule::OnInit()
#endif
if ( !hasThreadManager )
{
wxMessageBox( wxT("Error") , wxT("Thread Support is not available on this System") , wxOK ) ;
wxLogSysError( wxT("Thread Support is not available on this System") );
return FALSE ;
}

View File

@@ -10,6 +10,9 @@
/////////////////////////////////////////////////////////////////////////////
#include "wx/defs.h"
#if wxUSE_GUI
#include "wx/dc.h"
#include <MacTextEditor.h>
@@ -30,6 +33,7 @@
#endif
#include "wx/mac/uma.h"
// since we have decided that we only support 8.6 upwards we are
// checking for these minimum requirements in the startup code of
// the application so all wxWindows code can safely assume that appearance 1.1
@@ -40,7 +44,6 @@ static bool sUMAHasAppearance = false ;
static long sUMAAppearanceVersion = 0 ;
static long sUMASystemVersion = 0 ;
static bool sUMAHasAquaLayout = false ;
static bool sUMASystemInitialized = false ;
extern int gAGABackgroundColor ;
bool UMAHasAppearance() { return sUMAHasAppearance ; }
@@ -53,7 +56,7 @@ static long sUMAWindowManagerAttr = 0 ;
bool UMAHasWindowManager() { return sUMAHasWindowManager ; }
long UMAGetWindowManagerAttr() { return sUMAWindowManagerAttr ; }
bool UMAHasAquaLayout() { return sUMAHasAquaLayout ; }
bool UMASystemIsInitialized() { return sUMASystemInitialized ; }
void UMACleanupToolbox()
{
@@ -158,7 +161,7 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
}
sUMASystemInitialized = true ;
UMASetSystemIsInitialized(true);
}
@@ -295,7 +298,7 @@ void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEn
// for some reasons this must be 0 right now
// everything else leads to just the first function key item
// to be selected. Thanks to Ryan Wilcox for finding out.
macKey = 0 ;
macKey = 0 ;
glyph = kMenuF1Glyph + ( key - WXK_F1 ) ;
if ( key >= WXK_F13 )
glyph += 13 ;
@@ -777,3 +780,21 @@ OSStatus UMAPutScrap( Size size , OSType type , void *data )
return err ;
}
#endif // wxUSE_GUI
#if wxUSE_BASE
static bool sUMASystemInitialized = false ;
bool UMASystemIsInitialized()
{
return sUMASystemInitialized ;
}
void UMASetSystemIsInitialized(bool val)
{
sUMASystemInitialized = val;
}
#endif // wxUSE_BASE

View File

@@ -359,6 +359,10 @@ bool wxIsBusy()
return (gs_wxBusyCursorCount > 0);
}
#endif // wxUSE_GUI
#if wxUSE_BASE
wxString wxMacFindFolder( short vol,
OSType folderType,
Boolean createFolder)
@@ -378,6 +382,10 @@ wxString wxMacFindFolder( short vol,
return strDir ;
}
#endif // wxUSE_BASE
#if wxUSE_GUI
// Check whether this window wants to process messages, e.g. Stop button
// in long calculations.
bool wxCheckForInterrupt(wxWindow *wnd)
@@ -534,10 +542,6 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
}
#endif // !__DARWIN__
#endif // wxUSE_BASE
#if wxUSE_GUI
//---------------------------------------------------------------------------
// wxMac Specific utility functions
//---------------------------------------------------------------------------
@@ -691,6 +695,7 @@ wxWCharBuffer wxMacStringToWString( const wxString &from )
return result ;
}
wxString wxMacMakeStringFromCString( const char * from , int len )
{
OSStatus status = noErr ;
@@ -771,6 +776,11 @@ wxString wxMacMakeStringFromPascal( ConstStringPtr from )
return wxMacMakeStringFromCString( (char*) &from[1] , from[0] ) ;
}
#endif // wxUSE_BASE
#if wxUSE_GUI
//
// CFStringRefs (Carbon only)
//

View File

@@ -37,10 +37,12 @@
#ifdef __WXMAC__
#include <Threads.h>
#include "wx/mac/uma.h"
#include "wx/mac/macnotfy.h"
#endif
#define INFINITE 0xFFFFFFFF
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
@@ -257,12 +259,12 @@ public:
}
bool IsOk() const { return m_mutex.IsOk() ; }
wxCondError Wait()
{
return WaitTimeout(0xFFFFFFFF );
}
wxCondError WaitTimeout(unsigned long msectimeout)
{
wxMacStCritical critical ;
@@ -300,7 +302,7 @@ public:
{
wxMacStCritical critical ;
return wxCOND_NO_ERROR;
}
}
wxArrayLong m_waiters ;
wxInt32 m_excessSignals ;
@@ -844,7 +846,7 @@ bool wxThreadModule::OnInit()
#endif
if ( !hasThreadManager )
{
wxMessageBox( wxT("Error") , wxT("Thread Support is not available on this System") , wxOK ) ;
wxLogSysError( wxT("Thread Support is not available on this System") );
return FALSE ;
}

View File

@@ -10,6 +10,9 @@
/////////////////////////////////////////////////////////////////////////////
#include "wx/defs.h"
#if wxUSE_GUI
#include "wx/dc.h"
#include <MacTextEditor.h>
@@ -30,6 +33,7 @@
#endif
#include "wx/mac/uma.h"
// since we have decided that we only support 8.6 upwards we are
// checking for these minimum requirements in the startup code of
// the application so all wxWindows code can safely assume that appearance 1.1
@@ -40,7 +44,6 @@ static bool sUMAHasAppearance = false ;
static long sUMAAppearanceVersion = 0 ;
static long sUMASystemVersion = 0 ;
static bool sUMAHasAquaLayout = false ;
static bool sUMASystemInitialized = false ;
extern int gAGABackgroundColor ;
bool UMAHasAppearance() { return sUMAHasAppearance ; }
@@ -53,7 +56,7 @@ static long sUMAWindowManagerAttr = 0 ;
bool UMAHasWindowManager() { return sUMAHasWindowManager ; }
long UMAGetWindowManagerAttr() { return sUMAWindowManagerAttr ; }
bool UMAHasAquaLayout() { return sUMAHasAquaLayout ; }
bool UMASystemIsInitialized() { return sUMASystemInitialized ; }
void UMACleanupToolbox()
{
@@ -158,7 +161,7 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
}
sUMASystemInitialized = true ;
UMASetSystemIsInitialized(true);
}
@@ -295,7 +298,7 @@ void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEn
// for some reasons this must be 0 right now
// everything else leads to just the first function key item
// to be selected. Thanks to Ryan Wilcox for finding out.
macKey = 0 ;
macKey = 0 ;
glyph = kMenuF1Glyph + ( key - WXK_F1 ) ;
if ( key >= WXK_F13 )
glyph += 13 ;
@@ -777,3 +780,21 @@ OSStatus UMAPutScrap( Size size , OSType type , void *data )
return err ;
}
#endif // wxUSE_GUI
#if wxUSE_BASE
static bool sUMASystemInitialized = false ;
bool UMASystemIsInitialized()
{
return sUMASystemInitialized ;
}
void UMASetSystemIsInitialized(bool val)
{
sUMASystemInitialized = val;
}
#endif // wxUSE_BASE

View File

@@ -359,6 +359,10 @@ bool wxIsBusy()
return (gs_wxBusyCursorCount > 0);
}
#endif // wxUSE_GUI
#if wxUSE_BASE
wxString wxMacFindFolder( short vol,
OSType folderType,
Boolean createFolder)
@@ -378,6 +382,10 @@ wxString wxMacFindFolder( short vol,
return strDir ;
}
#endif // wxUSE_BASE
#if wxUSE_GUI
// Check whether this window wants to process messages, e.g. Stop button
// in long calculations.
bool wxCheckForInterrupt(wxWindow *wnd)
@@ -534,10 +542,6 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
}
#endif // !__DARWIN__
#endif // wxUSE_BASE
#if wxUSE_GUI
//---------------------------------------------------------------------------
// wxMac Specific utility functions
//---------------------------------------------------------------------------
@@ -691,6 +695,7 @@ wxWCharBuffer wxMacStringToWString( const wxString &from )
return result ;
}
wxString wxMacMakeStringFromCString( const char * from , int len )
{
OSStatus status = noErr ;
@@ -771,6 +776,11 @@ wxString wxMacMakeStringFromPascal( ConstStringPtr from )
return wxMacMakeStringFromCString( (char*) &from[1] , from[0] ) ;
}
#endif // wxUSE_BASE
#if wxUSE_GUI
//
// CFStringRefs (Carbon only)
//

View File

@@ -1166,6 +1166,9 @@ int wxGUIAppTraits::WaitForChild(wxExecuteData& execData)
}
}
#endif // wxUSE_GUI
#if wxUSE_BASE
void wxHandleProcessTermination(wxEndProcessData *proc_data)
{
// notify user about termination if required
@@ -1186,5 +1189,5 @@ void wxHandleProcessTermination(wxEndProcessData *proc_data)
}
}
#endif // wxUSE_GUI
#endif // wxUSE_BASE