]> git.saurik.com Git - wxWidgets.git/commitdiff
merge with latest sources
authorStefan Csomor <csomor@advancedconcepts.ch>
Wed, 9 Aug 2000 10:10:14 +0000 (10:10 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Wed, 9 Aug 2000 10:10:14 +0000 (10:10 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7985 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

176 files changed:
src/mac/accel.cpp
src/mac/aga.cpp
src/mac/app.cpp
src/mac/bitmap.cpp
src/mac/bmpbuttn.cpp
src/mac/brush.cpp
src/mac/button.cpp
src/mac/carbon/accel.cpp
src/mac/carbon/aga.cpp
src/mac/carbon/app.cpp
src/mac/carbon/bitmap.cpp
src/mac/carbon/bmpbuttn.cpp
src/mac/carbon/brush.cpp
src/mac/carbon/button.cpp
src/mac/carbon/checkbox.cpp
src/mac/carbon/checklst.cpp
src/mac/carbon/choice.cpp
src/mac/carbon/clipbrd.cpp
src/mac/carbon/colordlg.cpp
src/mac/carbon/colour.cpp
src/mac/carbon/combobox.cpp
src/mac/carbon/control.cpp
src/mac/carbon/cursor.cpp
src/mac/carbon/data.cpp
src/mac/carbon/dataobj.cpp
src/mac/carbon/dc.cpp
src/mac/carbon/dcclient.cpp
src/mac/carbon/dcmemory.cpp
src/mac/carbon/dcprint.cpp
src/mac/carbon/dcscreen.cpp
src/mac/carbon/dialog.cpp
src/mac/carbon/dir.cpp
src/mac/carbon/dirdlg.cpp
src/mac/carbon/dnd.cpp
src/mac/carbon/filedlg.cpp
src/mac/carbon/font.cpp
src/mac/carbon/fontdlg.cpp
src/mac/carbon/fontutil.cpp
src/mac/carbon/frame.cpp
src/mac/carbon/gauge.cpp
src/mac/carbon/gdiobj.cpp
src/mac/carbon/helpxxxx.cpp
src/mac/carbon/icon.cpp
src/mac/carbon/imaglist.cpp
src/mac/carbon/listbox.cpp
src/mac/carbon/listctrl.cpp
src/mac/carbon/mdi.cpp
src/mac/carbon/menu.cpp
src/mac/carbon/menuitem.cpp
src/mac/carbon/metafile.cpp
src/mac/carbon/minifram.cpp
src/mac/carbon/msgdlg.cpp
src/mac/carbon/palette.cpp
src/mac/carbon/pen.cpp
src/mac/carbon/printdlg.cpp
src/mac/carbon/printmac.cpp
src/mac/carbon/radiobox.cpp
src/mac/carbon/radiobut.cpp
src/mac/carbon/region.cpp
src/mac/carbon/scrolbar.cpp
src/mac/carbon/settings.cpp
src/mac/carbon/slider.cpp
src/mac/carbon/spinbutt.cpp
src/mac/carbon/statbmp.cpp
src/mac/carbon/statbox.cpp
src/mac/carbon/stattext.cpp
src/mac/carbon/tabctrl.cpp
src/mac/carbon/textctrl.cpp
src/mac/carbon/timer.cpp
src/mac/carbon/toolbar.cpp
src/mac/carbon/treectrl.cpp
src/mac/carbon/uma.cpp
src/mac/carbon/utils.cpp
src/mac/carbon/window.cpp
src/mac/checkbox.cpp
src/mac/checklst.cpp
src/mac/choice.cpp
src/mac/clipbrd.cpp
src/mac/colordlg.cpp
src/mac/colour.cpp
src/mac/combobox.cpp
src/mac/control.cpp
src/mac/cursor.cpp
src/mac/data.cpp
src/mac/dataobj.cpp
src/mac/dc.cpp
src/mac/dcclient.cpp
src/mac/dcmemory.cpp
src/mac/dcprint.cpp
src/mac/dcscreen.cpp
src/mac/dialog.cpp
src/mac/dir.cpp
src/mac/dirdlg.cpp
src/mac/dnd.cpp
src/mac/filedlg.cpp
src/mac/font.cpp
src/mac/fontdlg.cpp
src/mac/fontutil.cpp
src/mac/frame.cpp
src/mac/gauge.cpp
src/mac/gdiobj.cpp
src/mac/helpxxxx.cpp
src/mac/icon.cpp
src/mac/imaglist.cpp
src/mac/ldef/extldef.h
src/mac/listbox.cpp
src/mac/listctrl.cpp
src/mac/mdi.cpp
src/mac/menu.cpp
src/mac/menuitem.cpp
src/mac/metafile.cpp
src/mac/minifram.cpp
src/mac/morefile/Director.cpp
src/mac/morefile/Director.h
src/mac/morefile/FSpCompa.cpp
src/mac/morefile/FSpCompa.h
src/mac/morefile/FileCopy.cpp
src/mac/morefile/FileCopy.h
src/mac/morefile/FullPath.cpp
src/mac/morefile/FullPath.h
src/mac/morefile/IterateD.cpp
src/mac/morefile/IterateD.h
src/mac/morefile/MoreDesk.cpp
src/mac/morefile/MoreDesk.h
src/mac/morefile/MoreExtr.cpp
src/mac/morefile/MoreExtr.h
src/mac/morefile/MoreFile.cpp
src/mac/morefile/MoreFile.h
src/mac/morefile/Optim.h
src/mac/msgdlg.cpp
src/mac/palette.cpp
src/mac/pen.cpp
src/mac/printdlg.cpp
src/mac/printmac.cpp
src/mac/radiobox.cpp
src/mac/radiobut.cpp
src/mac/region.cpp
src/mac/scrolbar.cpp
src/mac/settings.cpp
src/mac/slider.cpp
src/mac/spinbutt.cpp
src/mac/statbmp.cpp
src/mac/statbox.cpp
src/mac/stattext.cpp
src/mac/tabctrl.cpp
src/mac/textctrl.cpp
src/mac/timer.cpp
src/mac/toolbar.cpp
src/mac/treectrl.cpp
src/mac/uma.cpp
src/mac/utils.cpp
src/mac/window.cpp
src/mac/xpm/Attrib.c
src/mac/xpm/CrBufFrI.c
src/mac/xpm/CrDatFrI.c
src/mac/xpm/CrIFrBuf.c
src/mac/xpm/CrIFrDat.c
src/mac/xpm/Image.c
src/mac/xpm/Info.c
src/mac/xpm/RdFToBuf.c
src/mac/xpm/RdFToDat.c
src/mac/xpm/RdFToI.c
src/mac/xpm/WrFFrBuf.c
src/mac/xpm/WrFFrDat.c
src/mac/xpm/WrFFrI.c
src/mac/xpm/create.c
src/mac/xpm/data.c
src/mac/xpm/hashtab.c
src/mac/xpm/macx.c
src/mac/xpm/misc.c
src/mac/xpm/parse.c
src/mac/xpm/rgb.c
src/mac/xpm/rgbtab.h
src/mac/xpm/scan.c
src/mac/xpm/simx.c
src/mac/xpm/simx.h

index f8796e111a18c8818e43fc86349a269e76f7f7cc..b0b8734d55b0d9702e88b40033d0e8bdb876d48b 100644 (file)
@@ -17,7 +17,9 @@
 #include "wx/accel.h"
 #include "wx/string.h"
 
 #include "wx/accel.h"
 #include "wx/string.h"
 
+#if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject)
 IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject)
+#endif
 
 class WXDLLEXPORT wxAcceleratorRefData: public wxObjectRefData
 {
 
 class WXDLLEXPORT wxAcceleratorRefData: public wxObjectRefData
 {
index 40abb5cbb9df489b2d467a9b76388da0abac3398..6b14ecd9c048993c208b2913bd57cc076bd755d1 100644 (file)
@@ -1,3 +1,5 @@
+#if !TARGET_CARBON
+
 #include <wx/mac/uma.h>
 #include <wx/mac/aga.h>
 #include <extcdef.h>
 #include <wx/mac/uma.h>
 #include <wx/mac/aga.h>
 #include <extcdef.h>
@@ -600,6 +602,10 @@ void AGADeactivateControl( ControlHandle inControl )
                        }
                }
        }
                        }
                }
        }
+       else
+       {
+               ::HiliteControl( inControl , 255 ) ;
+       }
 }
 
 void AGAActivateControl( ControlHandle inControl ) 
 }
 
 void AGAActivateControl( ControlHandle inControl ) 
@@ -615,6 +621,10 @@ void AGAActivateControl( ControlHandle inControl )
                        }
                }
        }
                        }
                }
        }
+       else
+       {
+               ::HiliteControl( inControl , 0 ) ;
+       }
 }
 
 OSErr AGASetKeyboardFocus                              (WindowPtr                              inWindow,
 }
 
 OSErr AGASetKeyboardFocus                              (WindowPtr                              inWindow,
@@ -718,6 +728,7 @@ void DisposeExtCDEFInfo( ControlHandle theControl)
                        DisposeHandle( info->children ) ;
                        info->children = NULL ;
                        free( (void*) (**theControl).contrlRfCon ) ;
                        DisposeHandle( info->children ) ;
                        info->children = NULL ;
                        free( (void*) (**theControl).contrlRfCon ) ;
+                       (**theControl).contrlRfCon = NULL ;
                }
        }
 }
                }
        }
 }
@@ -922,51 +933,6 @@ void AGASetFontStyle( ControlFontStyleRec *fontstyle )
                ::RGBBackColor( &fontstyle->backColor ) ;
 } ;
 
                ::RGBBackColor( &fontstyle->backColor ) ;
 } ;
 
-class AGAPortHelper 
-{
-public :
-       AGAPortHelper() 
-       {
-               GetPenState( &oldPenState ) ;
-               GetBackColor( &oldBackColor ) ;
-               GetForeColor( &oldForeColor ) ;
-
-               GetPort( &port ) ;
-               clip = NewRgn() ;
-               GetClip( clip );
-               font = port->txFont;
-               size = port->txSize;
-               style = port->txFace;
-               mode = port->txMode;    
-
-       }
-       ~AGAPortHelper()
-       {
-                       SetPort( port ) ;
-                       SetClip( clip ) ;
-                       DisposeRgn( clip ) ;
-                       RGBForeColor(&oldForeColor);
-                       RGBBackColor(&oldBackColor);
-                       SetPenState(&oldPenState);                              
-
-                       TextFont( font );
-                       TextSize( size );
-                       TextFace( style );
-                       TextMode( mode );
-       }
-
-private :
-                               GrafPtr                 port ;
-                               PenState                oldPenState ;
-                               RGBColor                oldForeColor ;
-                               RGBColor                oldBackColor ;
-                               RgnHandle               clip ;
-                               short                           font ;
-                               short                           size ;
-                               short                           style ;
-                               short                   mode ;
-} ;
-
 pascal SInt32 AGAProgressBarDefProc (SInt16 procID, ControlHandle theControl, ControlDefProcMessage message, SInt32 param)
 {      
        switch( message )
 pascal SInt32 AGAProgressBarDefProc (SInt16 procID, ControlHandle theControl, ControlDefProcMessage message, SInt32 param)
 {      
        switch( message )
@@ -1079,7 +1045,7 @@ pascal SInt32 AGABevelButtonDefProc (SInt16 procID, ControlHandle theControl, Co
                                        return 0 ;
                                        
                                {
                                        return 0 ;
                                        
                                {
-                                       AGAPortHelper help() ;
+                                       AGAPortHelper help((**theControl).contrlOwner) ;
                                        AGASetFontStyle( &info->fontStyle ) ;
                                        Boolean mRadioBehavior = false ;
                                        
                                        AGASetFontStyle( &info->fontStyle ) ;
                                        Boolean mRadioBehavior = false ;
                                        
@@ -1219,7 +1185,7 @@ pascal SInt32 AGAButtonDefProc (SInt16 procID, ControlHandle theControl, Control
                                        return 0 ;
                                        
                                {
                                        return 0 ;
                                        
                                {
-                                       AGAPortHelper help() ;
+                                       AGAPortHelper help((**theControl).contrlOwner) ;
                                        AGASetFontStyle( &info->fontStyle ) ;
                                        Boolean mRadioBehavior = false ;
                                        
                                        AGASetFontStyle( &info->fontStyle ) ;
                                        Boolean mRadioBehavior = false ;
                                        
@@ -1456,7 +1422,7 @@ pascal SInt32 AGACheckBoxDefProc (SInt16 procID, ControlHandle theControl, Contr
                                                return 0 ;
                                                
                                        {
                                                return 0 ;
                                                
                                        {
-                                               AGAPortHelper help() ;
+                                               AGAPortHelper help((**theControl).contrlOwner) ;
                                                Rect frame =  (**theControl).contrlRect ;
                                                Boolean hasColor = true;
                                                Boolean disabled = (*theControl)->contrlHilite == 255 ;
                                                Rect frame =  (**theControl).contrlRect ;
                                                Boolean hasColor = true;
                                                Boolean disabled = (*theControl)->contrlHilite == 255 ;
@@ -1844,7 +1810,7 @@ pascal SInt32 AGAStaticGroupBoxTextDefProc (SInt16 procID, ControlHandle theCont
                                {
                                        bool disabled = false ;
                                        bool hasColor = true ;
                                {
                                        bool disabled = false ;
                                        bool hasColor = true ;
-                                       AGAPortHelper help() ;
+                                       AGAPortHelper help((**theControl).contrlOwner) ;
                                        AGASetFontStyle( &info->fontStyle ) ;
                                        FontInfo fi ;
                                        ::GetFontInfo( &fi ) ;
                                        AGASetFontStyle( &info->fontStyle ) ;
                                        FontInfo fi ;
                                        ::GetFontInfo( &fi ) ;
@@ -1930,7 +1896,7 @@ pascal SInt32 AGAStaticTextDefProc (SInt16 procID, ControlHandle theControl, Con
                                        return 0 ;
                                        
                                {
                                        return 0 ;
                                        
                                {
-                                       AGAPortHelper help() ;
+                                       AGAPortHelper help((**theControl).contrlOwner) ;
                                        AGASetFontStyle( &info->fontStyle ) ;
                                        int x = (**theControl).contrlRect.left ;
                                        int y = (**theControl).contrlRect.top ;
                                        AGASetFontStyle( &info->fontStyle ) ;
                                        int x = (**theControl).contrlRect.left ;
                                        int y = (**theControl).contrlRect.top ;
@@ -2125,7 +2091,7 @@ pascal SInt32 AGAEditTextDefProc (SInt16 procID, ControlHandle theControl, Contr
        {
                case initCntl :
                        {
        {
                case initCntl :
                        {
-                               AGAPortHelper help() ;
+                               AGAPortHelper help((**theControl).contrlOwner) ;
                                SetPort( (**theControl).contrlOwner ) ;
                                ::TextFont( kFontIDGeneva ) ; 
                                ::TextSize( 10 ) ;
                                SetPort( (**theControl).contrlOwner ) ;
                                ::TextFont( kFontIDGeneva ) ; 
                                ::TextSize( 10 ) ;
@@ -2147,7 +2113,7 @@ pascal SInt32 AGAEditTextDefProc (SInt16 procID, ControlHandle theControl, Contr
                        break ;
                case drawCntl :
                        {
                        break ;
                case drawCntl :
                        {
-                               AGAPortHelper help() ;
+                               AGAPortHelper help((**theControl).contrlOwner) ;
                                AGASetFontStyle( &info->fontStyle ) ;
                                SetPort( (**theControl).contrlOwner ) ;
                                RGBBackColor( &gAGARamp[ kAGAWhite ] ) ;
                                AGASetFontStyle( &info->fontStyle ) ;
                                SetPort( (**theControl).contrlOwner ) ;
                                RGBBackColor( &gAGARamp[ kAGAWhite ] ) ;
@@ -2254,9 +2220,8 @@ pascal SInt32 AGAEditTextDefProc (SInt16 procID, ControlHandle theControl, Contr
                        break ;
                case kControlMsgKeyDown :
                        {
                        break ;
                case kControlMsgKeyDown :
                        {
-                               AGAPortHelper help() ;
+                               AGAPortHelper help( (**theControl).contrlOwner ) ;
                                AGASetFontStyle( &info->fontStyle ) ;
                                AGASetFontStyle( &info->fontStyle ) ;
-                               SetPort( (**theControl).contrlOwner ) ;
                                RGBBackColor( &gAGARamp[ kAGAWhite ] ) ;
                                RGBForeColor( &gAGARamp[ kAGABlack ] ) ;
                                ControlKeyDownRec * rec = (ControlKeyDownRec*) param ;
                                RGBBackColor( &gAGARamp[ kAGAWhite ] ) ;
                                RGBForeColor( &gAGARamp[ kAGABlack ] ) ;
                                ControlKeyDownRec * rec = (ControlKeyDownRec*) param ;
@@ -2364,7 +2329,7 @@ pascal SInt32 AGAListControlDefProc (SInt16 procID, ControlHandle theControl, Co
                        break ;
                case drawCntl :
                        {
                        break ;
                case drawCntl :
                        {
-                               AGAPortHelper help() ;
+                               AGAPortHelper help((**theControl).contrlOwner) ;
                                AGASetFontStyle( &info->fontStyle ) ;
                                RGBBackColor( &gAGARamp[ kAGAWhite ] ) ;
                                EraseRect( &(**theControl).contrlRect ) ;
                                AGASetFontStyle( &info->fontStyle ) ;
                                RGBBackColor( &gAGARamp[ kAGAWhite ] ) ;
                                EraseRect( &(**theControl).contrlRect ) ;
@@ -2578,4 +2543,78 @@ void                     AGASetThemeWindowBackground             (WindowRef                              inWindow,
        SetPort( port ) ;
 }
 
        SetPort( port ) ;
 }
 
+void AGAApplyThemeBackground(ThemeBackgroundKind       inKind,
+                                                                const Rect *                   bounds,
+                                                                ThemeDrawState                 inState,
+                                                                SInt16                                 inDepth,
+                                                                Boolean                                inColorDev) 
+{
+}
+
+#endif
+AGAPortHelper::AGAPortHelper( GrafPtr newport) 
+{
+       GetPort( &port ) ;
+       SetPort( newport ) ;
+//     wxASSERT( newport->portRect.left == 0 && newport->portRect.top == 0 ) ; 
+       GetPenState( &oldPenState ) ;
+       GetBackColor( &oldBackColor ) ;
+       GetForeColor( &oldForeColor ) ;
+
+       clip = NewRgn() ;
+       GetClip( clip );
+       font = GetPortTextFont( newport);
+       size = GetPortTextSize( newport);
+       style = GetPortTextFace( newport);
+       mode = GetPortTextMode( newport);       
+       nport = newport ;
+
+}
+AGAPortHelper::AGAPortHelper()
+{
+       clip = NULL ;
+}
+void AGAPortHelper::Setup( GrafPtr newport )
+{
+       GetPort( &port ) ;
+       SetPort( newport ) ;
+//     wxASSERT( newport->portRect.left == 0 && newport->portRect.top == 0 ) ; 
+       GetPenState( &oldPenState ) ;
+       GetBackColor( &oldBackColor ) ;
+       GetForeColor( &oldForeColor ) ;
+
+       clip = NewRgn() ;
+       GetClip( clip );
+       font = GetPortTextFont( newport);
+       size = GetPortTextSize( newport);
+       style = GetPortTextFace( newport);
+       mode = GetPortTextMode( newport);       
+       nport = newport ;
+}
+void AGAPortHelper::Clear()
+{
+       if ( clip )
+       {
+               DisposeRgn( clip ) ;
+               clip = NULL ;
+       }
+}
+AGAPortHelper::~AGAPortHelper()
+{
+       if ( clip )
+       {
+               SetPort( nport ) ;
+               SetClip( clip ) ;
+               DisposeRgn( clip ) ;
+               RGBForeColor(&oldForeColor);
+               RGBBackColor(&oldBackColor);
+               SetPenState(&oldPenState);                              
+
+               TextFont( font );
+               TextSize( size );
+               TextFace( style );
+               TextMode( mode );
+               SetPort( port ) ;
+       }
+}
 
 
index d5bb4c82d188b089dd992d65a076b4d0473353c1..a11ff6db93eae87862f233e9e8d1d6f236e8cd3c 100644 (file)
@@ -28,7 +28,7 @@
 #include "wx/log.h"
 #include "wx/module.h"
 #include "wx/memory.h"
 #include "wx/log.h"
 #include "wx/module.h"
 #include "wx/memory.h"
-
+#include "wx/tooltip.h"
 #if wxUSE_WX_RESOURCES
 #include "wx/resource.h"
 #endif
 #if wxUSE_WX_RESOURCES
 #include "wx/resource.h"
 #endif
 #include "apprsrc.h"
 
 #include <wx/mac/uma.h>
 #include "apprsrc.h"
 
 #include <wx/mac/uma.h>
+#include <wx/mac/macnotfy.h>
+
+#if wxUSE_SOCKETS
+#include <OpenTransport.h>
+#include <OpenTptInternet.h>
+#endif
 
 extern char *wxBuffer;
 extern wxList wxPendingDelete;
 
 extern char *wxBuffer;
 extern wxList wxPendingDelete;
@@ -52,10 +58,14 @@ extern wxList *wxWinMacControlList;
 
 wxApp *wxTheApp = NULL;
 
 
 wxApp *wxTheApp = NULL;
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
 BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
     EVT_IDLE(wxApp::OnIdle)
 IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
 BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
     EVT_IDLE(wxApp::OnIdle)
+        EVT_END_SESSION(wxApp::OnEndSession)
+        EVT_QUERY_END_SESSION(wxApp::OnQueryEndSession)
 END_EVENT_TABLE()
 END_EVENT_TABLE()
+#endif
 
 
 const short    kMacMinHeap = (29 * 1024) ;
 
 
 const short    kMacMinHeap = (29 * 1024) ;
@@ -76,25 +86,25 @@ bool wxApp::s_macSupportPCMenuShortcuts = true ;
 long wxApp::s_macAboutMenuItemId = wxID_ABOUT ;
 wxString wxApp::s_macHelpMenuTitleName = "&Help" ;
 
 long wxApp::s_macAboutMenuItemId = wxID_ABOUT ;
 wxString wxApp::s_macHelpMenuTitleName = "&Help" ;
 
-OSErr AEHandleODoc( AppleEvent *event , AppleEvent *reply , long refcon )
+pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , unsigned long refcon )
 {
        wxApp* app = (wxApp*) refcon ;
        return wxTheApp->MacHandleAEODoc( event , reply) ;
 }
 
 {
        wxApp* app = (wxApp*) refcon ;
        return wxTheApp->MacHandleAEODoc( event , reply) ;
 }
 
-OSErr AEHandleOApp( AppleEvent *event , AppleEvent *reply , long refcon )
+pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , unsigned long refcon )
 {
        wxApp* app = (wxApp*) refcon ;
        return wxTheApp->MacHandleAEOApp( event , reply ) ;
 }
 
 {
        wxApp* app = (wxApp*) refcon ;
        return wxTheApp->MacHandleAEOApp( event , reply ) ;
 }
 
-OSErr AEHandlePDoc( AppleEvent *event , AppleEvent *reply , long refcon )
+pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , unsigned long refcon )
 {
        wxApp* app = (wxApp*) refcon ;
        return wxTheApp->MacHandleAEPDoc( event , reply ) ;
 }
 
 {
        wxApp* app = (wxApp*) refcon ;
        return wxTheApp->MacHandleAEPDoc( event , reply ) ;
 }
 
-OSErr AEHandleQuit( AppleEvent *event , AppleEvent *reply , long refcon )
+pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , unsigned long refcon )
 {
        wxApp* app = (wxApp*) refcon ;
        return wxTheApp->MacHandleAEQuit( event , reply) ;
 {
        wxApp* app = (wxApp*) refcon ;
        return wxTheApp->MacHandleAEQuit( event , reply) ;
@@ -133,14 +143,14 @@ OSErr wxApp::MacHandleAEQuit(AppleEvent *event , AppleEvent *reply)
        return noErr ;
 }
 
        return noErr ;
 }
 
-char StringMac[] =     "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+char StringMac[] =     "\x0d\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
                                        "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
                                        "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xae\xaf"
                                        "\xb1\xb4\xb5\xb6\xbb\xbc\xbe\xbf"
                                        "\xc0\xc1\xc2\xc4\xc7\xc8\xc9\xcb\xcc\xcd\xce\xcf"
                                        "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd8\xca\xdb" ;
 
                                        "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
                                        "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xae\xaf"
                                        "\xb1\xb4\xb5\xb6\xbb\xbc\xbe\xbf"
                                        "\xc0\xc1\xc2\xc4\xc7\xc8\xc9\xcb\xcc\xcd\xce\xcf"
                                        "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd8\xca\xdb" ;
 
-char StringANSI[] = "\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8"
+char StringANSI[] = "\x0a\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8"
                                        "\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC"
                                        "\x86\xBA\xA2\xA3\xA7\x95\xB6\xDF\xAE\xA9\x99\xB4\xA8\xC6\xD8"
                                        "\xB1\xA5\xB5\xF0\xAA\xBA\xE6\xF8"
                                        "\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC"
                                        "\x86\xBA\xA2\xA3\xA7\x95\xB6\xDF\xAE\xA9\x99\xB4\xA8\xC6\xD8"
                                        "\xB1\xA5\xB5\xF0\xAA\xBA\xE6\xF8"
@@ -321,9 +331,6 @@ bool wxApp::Initialize()
        AEInstallEventHandler( kCoreEventClass , kAEOpenApplication , NewAEEventHandlerProc(AEHandleOApp) , (long) wxTheApp , FALSE ) ;
        AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments , NewAEEventHandlerProc(AEHandlePDoc) , (long) wxTheApp , FALSE ) ;
        AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , NewAEEventHandlerProc(AEHandleQuit) , (long) wxTheApp  , FALSE ) ;
        AEInstallEventHandler( kCoreEventClass , kAEOpenApplication , NewAEEventHandlerProc(AEHandleOApp) , (long) wxTheApp , FALSE ) ;
        AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments , NewAEEventHandlerProc(AEHandlePDoc) , (long) wxTheApp , FALSE ) ;
        AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , NewAEEventHandlerProc(AEHandleQuit) , (long) wxTheApp  , FALSE ) ;
-#if 0
-       GUSISetup(GUSIwithInternetSockets);
-#endif
 
 
   // test the minimal configuration necessary
 
 
   // test the minimal configuration necessary
@@ -378,7 +385,7 @@ bool wxApp::Initialize()
   }
 
 #if __option(profile)
   }
 
 #if __option(profile)
-       ProfilerInit( collectDetailed, bestTimeBase , 20000 , 30 ) ;
+       ProfilerInit( collectDetailed, bestTimeBase , 20000 , 40 ) ;
 #endif
 
   // now avoid exceptions thrown for new (bad_alloc)
 #endif
 
   // now avoid exceptions thrown for new (bad_alloc)
@@ -393,17 +400,15 @@ bool wxApp::Initialize()
   wxBuffer = new char[BUFSIZ + 512];
 #endif
 
   wxBuffer = new char[BUFSIZ + 512];
 #endif
 
-/* No longer used
-#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
+  wxClassInfo::InitializeClasses();
 
 
-  streambuf* sBuf = new wxDebugStreamBuf;
-  ostream* oStr = new ostream(sBuf) ;
-  wxDebugContext::SetStream(oStr, sBuf);
+#if wxUSE_RESOURCES
+//    wxGetResource(wxT("wxWindows"), wxT("OsVersion"), &wxOsVersion);
 #endif
 #endif
-*/
-
-  wxClassInfo::InitializeClasses();
 
 
+#if wxUSE_THREADS
+    wxPendingEventsLocker = new wxCriticalSection;
+#endif
   wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
   wxTheColourDatabase->Initialize();
 
   wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
   wxTheColourDatabase->Initialize();
 
@@ -423,13 +428,29 @@ bool wxApp::Initialize()
   wxWinMacWindowList = new wxList(wxKEY_INTEGER);
   wxWinMacControlList = new wxList(wxKEY_INTEGER);
 
   wxWinMacWindowList = new wxList(wxKEY_INTEGER);
   wxWinMacControlList = new wxList(wxKEY_INTEGER);
 
-       UMAShowArrowCursor() ;
+  wxMacCreateNotifierTable() ;
 
 
+  UMAShowArrowCursor() ;
+  
   return TRUE;
 }
 
 void wxApp::CleanUp()
 {
   return TRUE;
 }
 
 void wxApp::CleanUp()
 {
+#if wxUSE_LOG
+    // flush the logged messages if any and install a 'safer' log target: the
+    // default one (wxLogGui) can't be used after the resources are freed just
+    // below and the user suppliedo ne might be even more unsafe (using any
+    // wxWindows GUI function is unsafe starting from now)
+    wxLog::DontCreateOnDemand();
+
+    // this will flush the old messages if any
+    delete wxLog::SetActiveTarget(new wxLogStderr);
+#endif // wxUSE_LOG
+
+    // One last chance for pending objects to be cleaned up
+    wxTheApp->DeletePendingObjects();
+
   wxModule::CleanUpModules();
 
 #if wxUSE_WX_RESOURCES
   wxModule::CleanUpModules();
 
 #if wxUSE_WX_RESOURCES
@@ -438,19 +459,8 @@ void wxApp::CleanUp()
 
   wxDeleteStockObjects() ;
 
 
   wxDeleteStockObjects() ;
 
-  // Destroy all GDI lists, etc.
-
-  delete wxTheBrushList;
-  wxTheBrushList = NULL;
-
-  delete wxThePenList;
-  wxThePenList = NULL;
-
-  delete wxTheFontList;
-  wxTheFontList = NULL;
-
-  delete wxTheBitmapList;
-  wxTheBitmapList = NULL;
+    // Destroy all GDI lists, etc.
+    wxDeleteStockLists();
 
   delete wxTheColourDatabase;
   wxTheColourDatabase = NULL;
 
   delete wxTheColourDatabase;
   wxTheColourDatabase = NULL;
@@ -460,9 +470,17 @@ void wxApp::CleanUp()
   delete[] wxBuffer;
   wxBuffer = NULL;
 
   delete[] wxBuffer;
   wxBuffer = NULL;
 
+  wxMacDestroyNotifierTable() ;
   if (wxWinMacWindowList)
     delete wxWinMacWindowList ;
 
   if (wxWinMacWindowList)
     delete wxWinMacWindowList ;
 
+    delete wxPendingEvents;
+#if wxUSE_THREADS
+    delete wxPendingEventsLocker;
+    // If we don't do the following, we get an apparent memory leak.
+    ((wxEvtHandler&) wxDefaultValidator).ClearEventLocker();
+#endif
+
   wxClassInfo::CleanUpClasses();
 
 #if __option(profile)
   wxClassInfo::CleanUpClasses();
 
 #if __option(profile)
@@ -474,33 +492,33 @@ void wxApp::CleanUp()
   wxTheApp = NULL;
 
 #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
   wxTheApp = NULL;
 
 #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
-  // At this point we want to check if there are any memory
-  // blocks that aren't part of the wxDebugContext itself,
-  // as a special case. Then when dumping we need to ignore
-  // wxDebugContext, too.
-  if (wxDebugContext::CountObjectsLeft() > 0)
-  {
-    wxTrace("There were memory leaks.\n");
-    wxDebugContext::Dump();
-    wxDebugContext::PrintStatistics();
-  }
-//  wxDebugContext::SetStream(NULL, NULL);
+    // At this point we want to check if there are any memory
+    // blocks that aren't part of the wxDebugContext itself,
+    // as a special case. Then when dumping we need to ignore
+    // wxDebugContext, too.
+    if (wxDebugContext::CountObjectsLeft(TRUE) > 0)
+    {
+        wxLogDebug(wxT("There were memory leaks."));
+        wxDebugContext::Dump();
+        wxDebugContext::PrintStatistics();
+    }
+    //  wxDebugContext::SetStream(NULL, NULL);
 #endif
 
 #endif
 
-  // do it as the very last thing because everything else can log messages
-  wxLog::DontCreateOnDemand();
-  // do it as the very last thing because everything else can log messages
-  delete wxLog::SetActiveTarget(NULL);
+#if wxUSE_LOG
+    // do it as the very last thing because everything else can log messages
+    delete wxLog::SetActiveTarget(NULL);
+#endif // wxUSE_LOG
 
 
-       ::PrClose() ;
        if (s_macCursorRgn)
                ::DisposeRgn(s_macCursorRgn);
        if (s_macCursorRgn)
                ::DisposeRgn(s_macCursorRgn);
+
        #if 0
                TerminateAE() ;
        #endif
 }
 
        #if 0
                TerminateAE() ;
        #endif
 }
 
-int wxEntry( int argc, char *argv[] )
+int wxEntry( int argc, char *argv[] , bool enterLoop )
 {
 #ifdef __MWERKS__
 #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
 {
 #ifdef __MWERKS__
 #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
@@ -513,27 +531,24 @@ int wxEntry( int argc, char *argv[] )
     wxDebugContext::SetCheckpoint();
 #endif
 #endif
     wxDebugContext::SetCheckpoint();
 #endif
 #endif
-  if (!wxApp::Initialize())
-    return FALSE;
-  if (!wxTheApp)
-  {
-    if (!wxApp::GetInitializerFunction())
+    if (!wxApp::Initialize())
+        return 0;
+   // create the application object or ensure that one already exists
+    if (!wxTheApp)
     {
     {
-      printf( "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" );
-      return 0;
-    };
+        // The app may have declared a global application object, but we recommend
+        // the IMPLEMENT_APP macro is used instead, which sets an initializer
+        // function for delayed, dynamic app object construction.
+        wxCHECK_MSG( wxApp::GetInitializerFunction(), 0,
+                     wxT("No initializer - use IMPLEMENT_APP macro.") );
 
 
-       wxTheApp = (wxApp*) (* wxApp::GetInitializerFunction()) ();
-  };
+        wxTheApp = (wxApp*) (*wxApp::GetInitializerFunction()) ();
+    }
 
 
-  if (!wxTheApp)
-  {
-    printf( "wxWindows error: wxTheApp == NULL\n" );
-    return 0;
-  };
+    wxCHECK_MSG( wxTheApp, 0, wxT("You have to define an instance of wxApp!") );
 
 #ifdef __WXMAC__
 
 #ifdef __WXMAC__
-  argc = 1 ; // currently we don't support files as parameters
+  argc = 0 ; // currently we don't support files as parameters
 #endif
 
   wxTheApp->argc = argc;
 #endif
 
   wxTheApp->argc = argc;
@@ -549,42 +564,58 @@ int wxEntry( int argc, char *argv[] )
   // into wxTopLevelWindows by getting created
   // in OnInit().
 
   // into wxTopLevelWindows by getting created
   // in OnInit().
 
-  if (!wxTheApp->OnInit()) return 0;
-
   int retValue = 0;
 
   int retValue = 0;
 
-  if (wxTheApp->Initialized()) retValue = wxTheApp->OnRun();
-
-  if (wxTheApp->GetTopWindow())
-  {
-    delete wxTheApp->GetTopWindow();
-    wxTheApp->SetTopWindow(NULL);
-  }
-
-  wxTheApp->DeletePendingObjects();
-
-  wxTheApp->OnExit();
-
-  wxApp::CleanUp();
+       if ( wxTheApp->OnInit() )
+       {
+           if ( enterLoop )
+           {
+               retValue = wxTheApp->OnRun();
+           }
+           else
+               // We want to initialize, but not run or exit immediately.
+               return 1;
+       }
+       //else: app initialization failed, so we skipped OnRun()
 
 
-  return retValue;
+       wxWindow *topWindow = wxTheApp->GetTopWindow();
+       if ( topWindow )
+       {
+           // Forcibly delete the window.
+           if ( topWindow->IsKindOf(CLASSINFO(wxFrame)) ||
+                   topWindow->IsKindOf(CLASSINFO(wxDialog)) )
+           {
+               topWindow->Close(TRUE);
+               wxTheApp->DeletePendingObjects();
+           }
+           else
+           {
+               delete topWindow;
+               wxTheApp->SetTopWindow(NULL);
+           }
+       }
+       
+       wxTheApp->OnExit();
+       
+       wxApp::CleanUp();
+       
+       return retValue;
 };
 
 // Static member initialization
 };
 
 // Static member initialization
-wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
+wxAppInitializerFunction wxAppBase::m_appInitFn = (wxAppInitializerFunction) NULL;
 
 wxApp::wxApp()
 {
   m_topWindow = NULL;
   wxTheApp = this;
 
 wxApp::wxApp()
 {
   m_topWindow = NULL;
   wxTheApp = this;
-  m_className = "";
+
   m_wantDebugOutput = TRUE ;
   m_wantDebugOutput = TRUE ;
-  m_appName = "";
+
   argc = 0;
   argv = NULL;
 
   m_printMode = wxPRINT_WINDOWS;
   argc = 0;
   argv = NULL;
 
   m_printMode = wxPRINT_WINDOWS;
-
   m_exitOnFrameDelete = TRUE;
   m_auto3D = TRUE;
 }
   m_exitOnFrameDelete = TRUE;
   m_auto3D = TRUE;
 }
@@ -640,13 +671,14 @@ void wxApp::Dispatch()
 
 void wxApp::OnIdle(wxIdleEvent& event)
 {
 
 void wxApp::OnIdle(wxIdleEvent& event)
 {
-  static bool inOnIdle = FALSE;
+   static bool s_inOnIdle = FALSE;
 
 
-  // Avoid recursion (via ProcessEvent default case)
-  if (inOnIdle)
-    return;
+    // Avoid recursion (via ProcessEvent default case)
+    if ( s_inOnIdle )
+        return;
 
 
-  inOnIdle = TRUE;
+
+  s_inOnIdle = TRUE;
 
   // 'Garbage' collection of windows deleted with Close().
   DeletePendingObjects();
 
   // 'Garbage' collection of windows deleted with Close().
   DeletePendingObjects();
@@ -662,13 +694,17 @@ void wxApp::OnIdle(wxIdleEvent& event)
   if (needMore)
     event.RequestMore(TRUE);
 
   if (needMore)
     event.RequestMore(TRUE);
 
-  inOnIdle = FALSE;
+    // If they are pending events, we must process them: pending events are
+    // either events to the threads other than main or events posted with
+    // wxPostEvent() functions
+    wxMacProcessNotifierAndPendingEvents();
+
+  s_inOnIdle = FALSE;
 }
 
 void wxWakeUpIdle()
 {
 }
 
 void wxWakeUpIdle()
 {
-    // **** please implement me! ****
-    // Wake up the idle handler processor, even if it is in another thread...
+       wxMacWakeUp() ;
 }
 
 // Send idle event to all top-level windows
 }
 
 // Send idle event to all top-level windows
@@ -729,32 +765,76 @@ void wxApp::DeletePendingObjects()
   }
 }
 
   }
 }
 
-wxLog* wxApp::CreateLogTarget()
+wxIcon
+wxApp::GetStdIcon(int which) const
 {
 {
-    return new wxLogGui;
-}
+    switch(which)
+    {
+        case wxICON_INFORMATION:
+            return wxIcon("wxICON_INFO");
 
 
-wxWindow* wxApp::GetTopWindow() const
-{
-    if (m_topWindow)
-        return m_topWindow;
-    else if (wxTopLevelWindows.Number() > 0)
-        return (wxWindow*) wxTopLevelWindows.First()->Data();
-    else
-        return NULL;
+        case wxICON_QUESTION:
+            return wxIcon("wxICON_QUESTION");
+
+        case wxICON_EXCLAMATION:
+            return wxIcon("wxICON_WARNING");
+
+        default:
+            wxFAIL_MSG(wxT("requested non existent standard icon"));
+            // still fall through
+
+        case wxICON_HAND:
+            return wxIcon("wxICON_ERROR");
+    }
 }
 
 void wxExit()
 {
 }
 
 void wxExit()
 {
-  wxApp::CleanUp();
+    wxLogError(_("Fatal error: exiting"));
+
+    wxApp::CleanUp();
        ::ExitToShell() ;
 }
 
        ::ExitToShell() ;
 }
 
+void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event))
+{
+    if (GetTopWindow())
+        GetTopWindow()->Close(TRUE);
+}
+
+// Default behaviour: close the application with prompts. The
+// user can veto the close, and therefore the end session.
+void wxApp::OnQueryEndSession(wxCloseEvent& event)
+{
+    if (GetTopWindow())
+    {
+        if (!GetTopWindow()->Close(!event.CanVeto()))
+            event.Veto(TRUE);
+    }
+}
+
+extern "C" void wxCYield() ;
+void wxCYield()
+{
+       wxYield() ;
+}
+
 // Yield to other processes
 bool wxYield()
 {
 // Yield to other processes
 bool wxYield()
 {
-//     YieldToAnyThread() ;
-       SystemTask() ;
+#if wxUSE_THREADS
+  YieldToAnyThread() ;
+#endif
+  EventRecord event ;
+
+       long sleepTime = 0 ; //::GetCaretTime();
+
+       while ( !wxTheApp->IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, wxApp::s_macCursorRgn))
+       {
+       wxTheApp->MacHandleOneEvent( &event );
+       }
+
+       wxMacProcessNotifierAndPendingEvents() ;
   return TRUE;
 }
 
   return TRUE;
 }
 
@@ -762,6 +842,12 @@ bool wxYield()
 
 void wxApp::MacSuspend( bool convertClipboard )
 {
 
 void wxApp::MacSuspend( bool convertClipboard )
 {
+       // we have to deactive the window manually
+       
+       wxWindow* window = GetTopWindow() ;
+       if ( window )
+               window->MacActivate( MacGetCurrentEvent() , false ) ;
+               
                s_lastMouseDown = 0 ;
                if( convertClipboard )
                {
                s_lastMouseDown = 0 ;
                if( convertClipboard )
                {
@@ -784,13 +870,10 @@ void wxApp::MacResume( bool convertClipboard )
 
 void wxApp::MacConvertPrivateToPublicScrap()
 {
 
 void wxApp::MacConvertPrivateToPublicScrap()
 {
-       ::ZeroScrap();
-       ::TEToScrap();
 }
 
 void wxApp::MacConvertPublicToPrivateScrap()
 {
 }
 
 void wxApp::MacConvertPublicToPrivateScrap()
 {
-       ::TEFromScrap() ;
 }
 
 void wxApp::MacDoOneEvent()
 }
 
 void wxApp::MacDoOneEvent()
@@ -817,9 +900,7 @@ void wxApp::MacDoOneEvent()
 
        // repeaters
 
 
        // repeaters
 
-#if 0
-       wxMacProcessSocketEvents() ;
-#endif
+       wxMacProcessNotifierAndPendingEvents() ;
 }
 
 void wxApp::MacHandleOneEvent( EventRecord *ev )
 }
 
 void wxApp::MacHandleOneEvent( EventRecord *ev )
@@ -874,6 +955,7 @@ void wxApp::MacHandleOneEvent( EventRecord *ev )
                default:
                        break;
        }
                default:
                        break;
        }
+       wxMacProcessNotifierAndPendingEvents() ;
 }
 
 void wxApp::MacHandleHighLevelEvent( EventRecord *ev )
 }
 
 void wxApp::MacHandleHighLevelEvent( EventRecord *ev )
@@ -885,6 +967,8 @@ bool s_macIsInModalLoop = false ;
 
 void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
 {
 
 void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
 {
+       wxToolTip::RemoveToolTips() ;
+
        WindowRef window;
        WindowRef frontWindow = UMAFrontNonFloatingWindow() ;
        WindowAttributes frontWindowAttributes = NULL ;
        WindowRef window;
        WindowRef frontWindow = UMAFrontNonFloatingWindow() ;
        WindowAttributes frontWindowAttributes = NULL ;
@@ -894,6 +978,9 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
        short windowPart = ::FindWindow(ev->where, &window);
        wxWindow* win = wxFindWinFromMacWindow( window ) ;
 
        short windowPart = ::FindWindow(ev->where, &window);
        wxWindow* win = wxFindWinFromMacWindow( window ) ;
 
+       BitMap screenBits;
+       GetQDGlobalsScreenBits( &screenBits );
+
        switch (windowPart)
        {
                case inMenuBar :
        switch (windowPart)
        {
                case inMenuBar :
@@ -908,10 +995,12 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
                                s_lastMouseDown = 0;
                        }
                        break ;
                                s_lastMouseDown = 0;
                        }
                        break ;
+#if !TARGET_CARBON
                case inSysWindow :
                        SystemClick( ev , window ) ;
                        s_lastMouseDown = 0;
                        break ;
                case inSysWindow :
                        SystemClick( ev , window ) ;
                        s_lastMouseDown = 0;
                        break ;
+#endif
                case inDrag :
                        if ( window != frontWindow && s_macIsInModalLoop && !(ev->modifiers & cmdKey ) )
                        {
                case inDrag :
                        if ( window != frontWindow && s_macIsInModalLoop && !(ev->modifiers & cmdKey ) )
                        {
@@ -919,13 +1008,17 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
                        }
                        else
                        {
                        }
                        else
                        {
-                               DragWindow(window, ev->where, &qd.screenBits.bounds);
+                               DragWindow(window, ev->where, &screenBits.bounds);
                                if (win)
                                {
                                        GrafPtr port ;
                                        GetPort( &port ) ;
                                        Point pt = { 0, 0 } ;
                                if (win)
                                {
                                        GrafPtr port ;
                                        GetPort( &port ) ;
                                        Point pt = { 0, 0 } ;
-                                       SetPort( window ) ;
+                                       #if TARGET_CARBON
+                                       SetPort( GetWindowPort(window) ) ;
+                                       #else
+                                       SetPort( (window) ) ;
+                                       #endif
                                        SetOrigin( 0 , 0 ) ;
                                        LocalToGlobal( &pt ) ;
                                        SetPort( port ) ;
                                        SetOrigin( 0 , 0 ) ;
                                        LocalToGlobal( &pt ) ;
                                        SetPort( port ) ;
@@ -944,7 +1037,7 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
                        s_lastMouseDown = 0;
                        break;
                case inGrow:
                        s_lastMouseDown = 0;
                        break;
                case inGrow:
-                               int growResult = GrowWindow(window , ev->where, &qd.screenBits.bounds);
+                               int growResult = GrowWindow(window , ev->where, &screenBits.bounds);
                                if (growResult != 0)
                                {
                                        int newWidth = LoWord(growResult);
                                if (growResult != 0)
                                {
                                        int newWidth = LoWord(growResult);
@@ -969,8 +1062,13 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
                                        // TODO setup size event
                                        ZoomWindow( window , windowPart , false ) ;
                                        if (win)
                                        // TODO setup size event
                                        ZoomWindow( window , windowPart , false ) ;
                                        if (win)
-                                               win->SetSize( -1, -1, window->portRect.right-window->portRect.left ,
-                                                       window->portRect.bottom-window->portRect.top, wxSIZE_USE_EXISTING);
+                                       {
+                                               Rect tempRect ;
+                                               
+                                               GetWindowPortBounds(window, &tempRect ) ;
+                                               win->SetSize( -1, -1, tempRect.right-tempRect.left ,
+                                                       tempRect.bottom-tempRect.top, wxSIZE_USE_EXISTING);
+                                       }
                                }
                        s_lastMouseDown = 0;
                        break;
                                }
                        s_lastMouseDown = 0;
                        break;
@@ -980,6 +1078,17 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
                        break ;
 
                case inContent :
                        break ;
 
                case inContent :
+                               {
+                                       GrafPtr port ;
+                                       GetPort( &port ) ;
+                                       #if TARGET_CARBON
+                                       SetPort( GetWindowPort(window) ) ;
+                                       #else
+                                       SetPort( (window) ) ;
+                                       #endif
+                                       SetOrigin( 0 , 0 ) ;
+                                       SetPort( port ) ;
+                               }
                                if ( window != frontWindow )
                                {
                                        if ( s_macIsInModalLoop )
                                if ( window != frontWindow )
                                {
                                        if ( s_macIsInModalLoop )
@@ -1140,6 +1249,8 @@ long wxMacTranslateKey(unsigned char key, unsigned char code)
 
 void wxApp::MacHandleKeyDownEvent( EventRecord *ev )
 {
 
 void wxApp::MacHandleKeyDownEvent( EventRecord *ev )
 {
+       wxToolTip::RemoveToolTips() ;
+       
        UInt32 menuresult = UMAMenuEvent(ev) ;
        if ( HiWord( menuresult ) )
                MacHandleMenuSelect( HiWord( menuresult ) , LoWord( menuresult ) ) ;
        UInt32 menuresult = UMAMenuEvent(ev) ;
        if ( HiWord( menuresult ) )
                MacHandleMenuSelect( HiWord( menuresult ) , LoWord( menuresult ) ) ;
@@ -1268,12 +1379,14 @@ void wxApp::MacHandleDiskEvent( EventRecord *ev )
 {
        if ( HiWord( ev->message ) != noErr )
   {
 {
        if ( HiWord( ev->message ) != noErr )
   {
+ #if !TARGET_CARBON
                OSErr err ;
                Point point ;
                SetPt( &point , 100 , 100 ) ;
 
                OSErr err ;
                Point point ;
                SetPt( &point , 100 , 100 ) ;
 
-       err = DIBadMount( point , ev->message ) ;
+               err = DIBadMount( point , ev->message ) ;
                wxASSERT( err == noErr ) ;
                wxASSERT( err == noErr ) ;
+#endif
        }
 }
 
        }
 }
 
index 1ae5a445d4b8fc5c16285428023761b29a351955..2eddb0d5b96bd368fe307fcaec01d3fe43ca8ed7 100644 (file)
@@ -25,8 +25,10 @@ extern "C"
        #include "xpm.h"
 } ;
 
        #include "xpm.h"
 } ;
 
+#if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
 IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
 IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
 IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
+#endif
 
 #include <PictUtils.h>
 
 
 #include <PictUtils.h>
 
@@ -69,16 +71,7 @@ GWorldPtr wxMacCreateGWorld( int height , int width , int depth )
        
        if ( depth < 0 )
        {
        
        if ( depth < 0 )
        {
-               // get max pixel depth
-               CGrafPtr port ;
-               GetCWMgrPort( &port ) ; 
-               GDHandle maxDevice ;
-               
-               maxDevice = GetMaxDevice( &port->portRect ) ;
-               if ( maxDevice )
-                       depth = (**((**maxDevice).gdPMap)).pixelSize ;
-               else
-                       depth = 8 ; 
+               depth = wxDisplayDepth() ;     
        }
                
        err = NewGWorld( &port , depth , &rect , NULL , NULL , 0 ) ;
        }
                
        err = NewGWorld( &port , depth , &rect , NULL , NULL , 0 ) ;
@@ -178,7 +171,8 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
                        
                        GetGWorld( &origPort , &origDevice ) ;
                        SetGWorld( M_BITMAPDATA->m_hBitmap , NULL ) ;
                        
                        GetGWorld( &origPort , &origDevice ) ;
                        SetGWorld( M_BITMAPDATA->m_hBitmap , NULL ) ;
-       
+                       LockPixels( GetGWorldPixMap( (CGrafPtr) M_BITMAPDATA->m_hBitmap ) ) ;
+                       
                        // bits is a word aligned array
                        
                        unsigned char* linestart = (unsigned char*) bits ;
                        // bits is a word aligned array
                        
                        unsigned char* linestart = (unsigned char*) bits ;
@@ -211,6 +205,7 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
                                }
                                
                        }
                                }
                                
                        }
+               UnlockPixels( GetGWorldPixMap( (CGrafPtr) M_BITMAPDATA->m_hBitmap ) ) ;
        
                SetGWorld( origPort , origDevice ) ;
           }
        
                SetGWorld( origPort , origDevice ) ;
           }
@@ -514,6 +509,8 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
     }
 
        m_maskBitmap = wxMacCreateGWorld( bitmap.GetWidth() , bitmap.GetHeight() , 1 ) ;        
     }
 
        m_maskBitmap = wxMacCreateGWorld( bitmap.GetWidth() , bitmap.GetHeight() , 1 ) ;        
+       LockPixels( GetGWorldPixMap( (CGrafPtr) m_maskBitmap ) ) ;
+       LockPixels( GetGWorldPixMap( (CGrafPtr) ((wxBitmapRefData*) bitmap.GetRefData())->m_hBitmap ) ) ;
        RGBColor maskColor = colour.GetPixel() ;
 
     // this is not very efficient, but I can't think
        RGBColor maskColor = colour.GetPixel() ;
 
     // this is not very efficient, but I can't think
@@ -545,6 +542,8 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
             }
         }
     }
             }
         }
     }
+       UnlockPixels( GetGWorldPixMap( (CGrafPtr) m_maskBitmap ) ) ;
+       UnlockPixels( GetGWorldPixMap( ((wxBitmapRefData*) bitmap.GetRefData())->m_hBitmap ) ) ;
        SetGWorld( origPort , origDevice ) ;
 
     return TRUE;
        SetGWorld( origPort , origDevice ) ;
 
     return TRUE;
@@ -712,8 +711,8 @@ bool wxXPMFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type
       if (dc)
       {
         if (SelectObject(dc, (HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap))
       if (dc)
       {
         if (SelectObject(dc, (HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap))
-        { /* for following SetPixel */
-          /* fill the XImage struct 'by hand' */
+        { 
+          
     ximage.width = M_BITMAPHANDLERDATA->m_width; 
      ximage.height = M_BITMAPHANDLERDATA->m_height;
     ximage.depth = M_BITMAPHANDLERDATA->m_depth; 
     ximage.width = M_BITMAPHANDLERDATA->m_width; 
      ximage.height = M_BITMAPHANDLERDATA->m_height;
     ximage.depth = M_BITMAPHANDLERDATA->m_depth; 
@@ -725,7 +724,7 @@ bool wxXPMFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type
       DeleteDC(dc);
 
     if (errorStatus == XpmSuccess)
       DeleteDC(dc);
 
     if (errorStatus == XpmSuccess)
-      return TRUE;    /* no error */
+      return TRUE;    
     else
       return FALSE;
         } else return FALSE;
     else
       return FALSE;
         } else return FALSE;
@@ -809,19 +808,6 @@ bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long
     int desiredWidth, int desiredHeight)
 {
     // TODO: load colourmap.
     int desiredWidth, int desiredHeight)
 {
     // TODO: load colourmap.
-/*
-    M_BITMAPHANDLERDATA->m_hBitmap = (WXHBITMAP) ::LoadBitmap(wxGetInstance(), name);
-    if (M_BITMAPHANDLERDATA->m_hBitmap)
-    {
-      M_BITMAPHANDLERDATA->m_ok = TRUE;
-      BITMAP bm;
-      GetObject((HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap, sizeof(BITMAP), (LPSTR) &bm);
-      M_BITMAPHANDLERDATA->m_width = bm.bmWidth;
-      M_BITMAPHANDLERDATA->m_height = bm.bmHeight;
-      M_BITMAPHANDLERDATA->m_depth = bm.bmBitsPixel;
-      return TRUE;
-    }
-*/
   // it's probably not found
   wxLogError("Can't load bitmap '%s' from resources! Check .rc file.", name.c_str());
 
   // it's probably not found
   wxLogError("Can't load bitmap '%s' from resources! Check .rc file.", name.c_str());
 
@@ -852,11 +838,6 @@ bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long fla
 #if USE_IMAGE_LOADING_IN_MSW
     wxPalette *palette = NULL;
     bool success = FALSE;
 #if USE_IMAGE_LOADING_IN_MSW
     wxPalette *palette = NULL;
     bool success = FALSE;
-/*
-    if (type & wxBITMAP_DISCARD_COLOURMAP)
-      success = wxLoadIntoBitmap(WXSTRINGCAST name, bitmap);
-    else
-*/
     success = (wxLoadIntoBitmap(WXSTRINGCAST name, bitmap, &palette) != 0);
     if (!success && palette)
     {
     success = (wxLoadIntoBitmap(WXSTRINGCAST name, bitmap, &palette) != 0);
     if (!success && palette)
     {
@@ -884,7 +865,6 @@ bool wxBMPFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type
 }
 
 
 }
 
 
-
 void wxBitmap::CleanUpHandlers()
 {
     wxNode *node = sm_handlers.First();
 void wxBitmap::CleanUpHandlers()
 {
     wxNode *node = sm_handlers.First();
@@ -903,7 +883,7 @@ void wxBitmap::InitStandardHandlers()
        AddHandler( new wxPICTResourceHandler ) ;
        AddHandler( new wxICONResourceHandler ) ;
        AddHandler(new wxXPMFileHandler);
        AddHandler( new wxPICTResourceHandler ) ;
        AddHandler( new wxICONResourceHandler ) ;
        AddHandler(new wxXPMFileHandler);
-  AddHandler(new wxXPMDataHandler);
+       AddHandler(new wxXPMDataHandler);
        AddHandler(new wxBMPResourceHandler);
        AddHandler(new wxBMPFileHandler);
 }
        AddHandler(new wxBMPResourceHandler);
        AddHandler(new wxBMPFileHandler);
 }
index 569a2cd338b0c634434ede1f7d11c2666785462d..c1431386093f796c0bc2c4762f35cf13b889bd0c 100644 (file)
 
 #include "wx/bmpbuttn.h"
 
 
 #include "wx/bmpbuttn.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton)
 IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton)
+#endif
 
 #include <wx/mac/uma.h>
 
 
 #include <wx/mac/uma.h>
 
-PicHandle MakePict(GWorldPtr wp) ;
+PicHandle MakePict(GWorldPtr wp, GWorldPtr mask ) ;
 
 bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
            const wxPoint& pos,
 
 bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
            const wxPoint& pos,
@@ -48,8 +50,6 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
     if ( height == -1 && bitmap.Ok())
        height = bitmap.GetHeight() + 2*m_marginY;
 
     if ( height == -1 && bitmap.Ok())
        height = bitmap.GetHeight() + 2*m_marginY;
 
-       m_macHorizontalBorder = 0 ; // additional pixels around the real control
-       m_macVerticalBorder = 0 ;
        Rect bounds ;
        Str255 title ;
        MacPreControlCreate( parent , id ,  "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
        Rect bounds ;
        Str255 title ;
        MacPreControlCreate( parent , id ,  "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
@@ -68,7 +68,14 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
                        icon = bmap->m_hPict ;
                else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
                {
                        icon = bmap->m_hPict ;
                else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
                {
-                       icon = MakePict( bmap->m_hBitmap ) ;
+                       if ( m_buttonBitmap.GetMask() )
+                       {
+                               icon = MakePict( bmap->m_hBitmap , m_buttonBitmap.GetMask()->GetMaskBitmap() ) ;
+                       }
+                       else
+                       {
+                               icon = MakePict( bmap->m_hBitmap , NULL ) ;
+                       }
                }
        }
        ControlButtonContentInfo info ;
                }
        }
        ControlButtonContentInfo info ;
@@ -94,7 +101,14 @@ void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap)
                        icon = bmap->m_hPict ;
                else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
                {
                        icon = bmap->m_hPict ;
                else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
                {
-                       icon = MakePict( bmap->m_hBitmap ) ;
+                       if ( m_buttonBitmap.GetMask() )
+                       {
+                               icon = MakePict( bmap->m_hBitmap , m_buttonBitmap.GetMask()->GetMaskBitmap() ) ;
+                       }
+                       else
+                       {
+                               icon = MakePict( bmap->m_hBitmap , NULL ) ;
+                       }
                }
        }
        ControlButtonContentInfo info ;
                }
        }
        ControlButtonContentInfo info ;
index 7ba6dfc99063c4114ad0a246184f4c896fb2c394..cb9d76d1ab28ca05b8bc687c4d0080cabc5feb5c 100644 (file)
@@ -17,7 +17,9 @@
 #include "wx/utils.h"
 #include "wx/brush.h"
 
 #include "wx/utils.h"
 #include "wx/brush.h"
 
+#if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
 IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
+#endif
 
 wxBrushRefData::wxBrushRefData()
 {
 
 wxBrushRefData::wxBrushRefData()
 {
index 4635492a176663fd2be95b2858ffbd6ad4987a4a..47f66425e2ed97fdf2f939ad9fad1d895263bb13 100644 (file)
@@ -15,7 +15,9 @@
 
 #include "wx/button.h"
 
 
 #include "wx/button.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl)
+#endif
 
 #include <wx/mac/uma.h>
 // Button
 
 #include <wx/mac/uma.h>
 // Button
@@ -29,8 +31,6 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
 {
        Rect bounds ;
        Str255 title ;
 {
        Rect bounds ;
        Str255 title ;
-       m_macHorizontalBorder = 2 ; // additional pixels around the real control
-       m_macVerticalBorder = 2 ;
        
        MacPreControlCreate( parent , id ,  label , pos , size ,style, validator , name , &bounds , title ) ;
 
        
        MacPreControlCreate( parent , id ,  label , pos , size ,style, validator , name , &bounds , title ) ;
 
@@ -66,22 +66,32 @@ void wxButton::SetDefault()
 
 wxSize wxButton::DoGetBestSize() const
 {
 
 wxSize wxButton::DoGetBestSize() const
 {
-    int wBtn = m_label.Length() * 8 + 12 + 2 * m_macHorizontalBorder;
-       int hBtn = 13 + 2 * m_macVerticalBorder;
+    int wBtn = m_label.Length() * 8 + 12 ;
+       int hBtn = 20 ;
+       
+       if ( wBtn < 80 )
+               wBtn = 80 ;
 
     return wxSize(wBtn, hBtn);
 }
 
 wxSize wxButton::GetDefaultSize()
 {
 
     return wxSize(wBtn, hBtn);
 }
 
 wxSize wxButton::GetDefaultSize()
 {
-    int wBtn = 15 * 8 + 12 + 2 * 2;
-       int hBtn = 13 + 2 * 2;
+    int wBtn = 80 /* + 2 * m_macHorizontalBorder */ ; 
+       int hBtn = 20 /* +  2 * m_macVerticalBorder */ ;
 
     return wxSize(wBtn, hBtn);
 }
 
 void wxButton::Command (wxCommandEvent & event)
 {
 
     return wxSize(wBtn, hBtn);
 }
 
 void wxButton::Command (wxCommandEvent & event)
 {
+       if ( m_macControl )
+       {
+               HiliteControl( m_macControl , kControlButtonPart ) ;
+               unsigned long finalTicks ;
+               Delay( 8 , &finalTicks ) ;
+               HiliteControl( m_macControl , 0 ) ;
+       }
     ProcessCommand (event);
 }
 
     ProcessCommand (event);
 }
 
index f8796e111a18c8818e43fc86349a269e76f7f7cc..b0b8734d55b0d9702e88b40033d0e8bdb876d48b 100644 (file)
@@ -17,7 +17,9 @@
 #include "wx/accel.h"
 #include "wx/string.h"
 
 #include "wx/accel.h"
 #include "wx/string.h"
 
+#if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject)
 IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject)
+#endif
 
 class WXDLLEXPORT wxAcceleratorRefData: public wxObjectRefData
 {
 
 class WXDLLEXPORT wxAcceleratorRefData: public wxObjectRefData
 {
index 40abb5cbb9df489b2d467a9b76388da0abac3398..6b14ecd9c048993c208b2913bd57cc076bd755d1 100644 (file)
@@ -1,3 +1,5 @@
+#if !TARGET_CARBON
+
 #include <wx/mac/uma.h>
 #include <wx/mac/aga.h>
 #include <extcdef.h>
 #include <wx/mac/uma.h>
 #include <wx/mac/aga.h>
 #include <extcdef.h>
@@ -600,6 +602,10 @@ void AGADeactivateControl( ControlHandle inControl )
                        }
                }
        }
                        }
                }
        }
+       else
+       {
+               ::HiliteControl( inControl , 255 ) ;
+       }
 }
 
 void AGAActivateControl( ControlHandle inControl ) 
 }
 
 void AGAActivateControl( ControlHandle inControl ) 
@@ -615,6 +621,10 @@ void AGAActivateControl( ControlHandle inControl )
                        }
                }
        }
                        }
                }
        }
+       else
+       {
+               ::HiliteControl( inControl , 0 ) ;
+       }
 }
 
 OSErr AGASetKeyboardFocus                              (WindowPtr                              inWindow,
 }
 
 OSErr AGASetKeyboardFocus                              (WindowPtr                              inWindow,
@@ -718,6 +728,7 @@ void DisposeExtCDEFInfo( ControlHandle theControl)
                        DisposeHandle( info->children ) ;
                        info->children = NULL ;
                        free( (void*) (**theControl).contrlRfCon ) ;
                        DisposeHandle( info->children ) ;
                        info->children = NULL ;
                        free( (void*) (**theControl).contrlRfCon ) ;
+                       (**theControl).contrlRfCon = NULL ;
                }
        }
 }
                }
        }
 }
@@ -922,51 +933,6 @@ void AGASetFontStyle( ControlFontStyleRec *fontstyle )
                ::RGBBackColor( &fontstyle->backColor ) ;
 } ;
 
                ::RGBBackColor( &fontstyle->backColor ) ;
 } ;
 
-class AGAPortHelper 
-{
-public :
-       AGAPortHelper() 
-       {
-               GetPenState( &oldPenState ) ;
-               GetBackColor( &oldBackColor ) ;
-               GetForeColor( &oldForeColor ) ;
-
-               GetPort( &port ) ;
-               clip = NewRgn() ;
-               GetClip( clip );
-               font = port->txFont;
-               size = port->txSize;
-               style = port->txFace;
-               mode = port->txMode;    
-
-       }
-       ~AGAPortHelper()
-       {
-                       SetPort( port ) ;
-                       SetClip( clip ) ;
-                       DisposeRgn( clip ) ;
-                       RGBForeColor(&oldForeColor);
-                       RGBBackColor(&oldBackColor);
-                       SetPenState(&oldPenState);                              
-
-                       TextFont( font );
-                       TextSize( size );
-                       TextFace( style );
-                       TextMode( mode );
-       }
-
-private :
-                               GrafPtr                 port ;
-                               PenState                oldPenState ;
-                               RGBColor                oldForeColor ;
-                               RGBColor                oldBackColor ;
-                               RgnHandle               clip ;
-                               short                           font ;
-                               short                           size ;
-                               short                           style ;
-                               short                   mode ;
-} ;
-
 pascal SInt32 AGAProgressBarDefProc (SInt16 procID, ControlHandle theControl, ControlDefProcMessage message, SInt32 param)
 {      
        switch( message )
 pascal SInt32 AGAProgressBarDefProc (SInt16 procID, ControlHandle theControl, ControlDefProcMessage message, SInt32 param)
 {      
        switch( message )
@@ -1079,7 +1045,7 @@ pascal SInt32 AGABevelButtonDefProc (SInt16 procID, ControlHandle theControl, Co
                                        return 0 ;
                                        
                                {
                                        return 0 ;
                                        
                                {
-                                       AGAPortHelper help() ;
+                                       AGAPortHelper help((**theControl).contrlOwner) ;
                                        AGASetFontStyle( &info->fontStyle ) ;
                                        Boolean mRadioBehavior = false ;
                                        
                                        AGASetFontStyle( &info->fontStyle ) ;
                                        Boolean mRadioBehavior = false ;
                                        
@@ -1219,7 +1185,7 @@ pascal SInt32 AGAButtonDefProc (SInt16 procID, ControlHandle theControl, Control
                                        return 0 ;
                                        
                                {
                                        return 0 ;
                                        
                                {
-                                       AGAPortHelper help() ;
+                                       AGAPortHelper help((**theControl).contrlOwner) ;
                                        AGASetFontStyle( &info->fontStyle ) ;
                                        Boolean mRadioBehavior = false ;
                                        
                                        AGASetFontStyle( &info->fontStyle ) ;
                                        Boolean mRadioBehavior = false ;
                                        
@@ -1456,7 +1422,7 @@ pascal SInt32 AGACheckBoxDefProc (SInt16 procID, ControlHandle theControl, Contr
                                                return 0 ;
                                                
                                        {
                                                return 0 ;
                                                
                                        {
-                                               AGAPortHelper help() ;
+                                               AGAPortHelper help((**theControl).contrlOwner) ;
                                                Rect frame =  (**theControl).contrlRect ;
                                                Boolean hasColor = true;
                                                Boolean disabled = (*theControl)->contrlHilite == 255 ;
                                                Rect frame =  (**theControl).contrlRect ;
                                                Boolean hasColor = true;
                                                Boolean disabled = (*theControl)->contrlHilite == 255 ;
@@ -1844,7 +1810,7 @@ pascal SInt32 AGAStaticGroupBoxTextDefProc (SInt16 procID, ControlHandle theCont
                                {
                                        bool disabled = false ;
                                        bool hasColor = true ;
                                {
                                        bool disabled = false ;
                                        bool hasColor = true ;
-                                       AGAPortHelper help() ;
+                                       AGAPortHelper help((**theControl).contrlOwner) ;
                                        AGASetFontStyle( &info->fontStyle ) ;
                                        FontInfo fi ;
                                        ::GetFontInfo( &fi ) ;
                                        AGASetFontStyle( &info->fontStyle ) ;
                                        FontInfo fi ;
                                        ::GetFontInfo( &fi ) ;
@@ -1930,7 +1896,7 @@ pascal SInt32 AGAStaticTextDefProc (SInt16 procID, ControlHandle theControl, Con
                                        return 0 ;
                                        
                                {
                                        return 0 ;
                                        
                                {
-                                       AGAPortHelper help() ;
+                                       AGAPortHelper help((**theControl).contrlOwner) ;
                                        AGASetFontStyle( &info->fontStyle ) ;
                                        int x = (**theControl).contrlRect.left ;
                                        int y = (**theControl).contrlRect.top ;
                                        AGASetFontStyle( &info->fontStyle ) ;
                                        int x = (**theControl).contrlRect.left ;
                                        int y = (**theControl).contrlRect.top ;
@@ -2125,7 +2091,7 @@ pascal SInt32 AGAEditTextDefProc (SInt16 procID, ControlHandle theControl, Contr
        {
                case initCntl :
                        {
        {
                case initCntl :
                        {
-                               AGAPortHelper help() ;
+                               AGAPortHelper help((**theControl).contrlOwner) ;
                                SetPort( (**theControl).contrlOwner ) ;
                                ::TextFont( kFontIDGeneva ) ; 
                                ::TextSize( 10 ) ;
                                SetPort( (**theControl).contrlOwner ) ;
                                ::TextFont( kFontIDGeneva ) ; 
                                ::TextSize( 10 ) ;
@@ -2147,7 +2113,7 @@ pascal SInt32 AGAEditTextDefProc (SInt16 procID, ControlHandle theControl, Contr
                        break ;
                case drawCntl :
                        {
                        break ;
                case drawCntl :
                        {
-                               AGAPortHelper help() ;
+                               AGAPortHelper help((**theControl).contrlOwner) ;
                                AGASetFontStyle( &info->fontStyle ) ;
                                SetPort( (**theControl).contrlOwner ) ;
                                RGBBackColor( &gAGARamp[ kAGAWhite ] ) ;
                                AGASetFontStyle( &info->fontStyle ) ;
                                SetPort( (**theControl).contrlOwner ) ;
                                RGBBackColor( &gAGARamp[ kAGAWhite ] ) ;
@@ -2254,9 +2220,8 @@ pascal SInt32 AGAEditTextDefProc (SInt16 procID, ControlHandle theControl, Contr
                        break ;
                case kControlMsgKeyDown :
                        {
                        break ;
                case kControlMsgKeyDown :
                        {
-                               AGAPortHelper help() ;
+                               AGAPortHelper help( (**theControl).contrlOwner ) ;
                                AGASetFontStyle( &info->fontStyle ) ;
                                AGASetFontStyle( &info->fontStyle ) ;
-                               SetPort( (**theControl).contrlOwner ) ;
                                RGBBackColor( &gAGARamp[ kAGAWhite ] ) ;
                                RGBForeColor( &gAGARamp[ kAGABlack ] ) ;
                                ControlKeyDownRec * rec = (ControlKeyDownRec*) param ;
                                RGBBackColor( &gAGARamp[ kAGAWhite ] ) ;
                                RGBForeColor( &gAGARamp[ kAGABlack ] ) ;
                                ControlKeyDownRec * rec = (ControlKeyDownRec*) param ;
@@ -2364,7 +2329,7 @@ pascal SInt32 AGAListControlDefProc (SInt16 procID, ControlHandle theControl, Co
                        break ;
                case drawCntl :
                        {
                        break ;
                case drawCntl :
                        {
-                               AGAPortHelper help() ;
+                               AGAPortHelper help((**theControl).contrlOwner) ;
                                AGASetFontStyle( &info->fontStyle ) ;
                                RGBBackColor( &gAGARamp[ kAGAWhite ] ) ;
                                EraseRect( &(**theControl).contrlRect ) ;
                                AGASetFontStyle( &info->fontStyle ) ;
                                RGBBackColor( &gAGARamp[ kAGAWhite ] ) ;
                                EraseRect( &(**theControl).contrlRect ) ;
@@ -2578,4 +2543,78 @@ void                     AGASetThemeWindowBackground             (WindowRef                              inWindow,
        SetPort( port ) ;
 }
 
        SetPort( port ) ;
 }
 
+void AGAApplyThemeBackground(ThemeBackgroundKind       inKind,
+                                                                const Rect *                   bounds,
+                                                                ThemeDrawState                 inState,
+                                                                SInt16                                 inDepth,
+                                                                Boolean                                inColorDev) 
+{
+}
+
+#endif
+AGAPortHelper::AGAPortHelper( GrafPtr newport) 
+{
+       GetPort( &port ) ;
+       SetPort( newport ) ;
+//     wxASSERT( newport->portRect.left == 0 && newport->portRect.top == 0 ) ; 
+       GetPenState( &oldPenState ) ;
+       GetBackColor( &oldBackColor ) ;
+       GetForeColor( &oldForeColor ) ;
+
+       clip = NewRgn() ;
+       GetClip( clip );
+       font = GetPortTextFont( newport);
+       size = GetPortTextSize( newport);
+       style = GetPortTextFace( newport);
+       mode = GetPortTextMode( newport);       
+       nport = newport ;
+
+}
+AGAPortHelper::AGAPortHelper()
+{
+       clip = NULL ;
+}
+void AGAPortHelper::Setup( GrafPtr newport )
+{
+       GetPort( &port ) ;
+       SetPort( newport ) ;
+//     wxASSERT( newport->portRect.left == 0 && newport->portRect.top == 0 ) ; 
+       GetPenState( &oldPenState ) ;
+       GetBackColor( &oldBackColor ) ;
+       GetForeColor( &oldForeColor ) ;
+
+       clip = NewRgn() ;
+       GetClip( clip );
+       font = GetPortTextFont( newport);
+       size = GetPortTextSize( newport);
+       style = GetPortTextFace( newport);
+       mode = GetPortTextMode( newport);       
+       nport = newport ;
+}
+void AGAPortHelper::Clear()
+{
+       if ( clip )
+       {
+               DisposeRgn( clip ) ;
+               clip = NULL ;
+       }
+}
+AGAPortHelper::~AGAPortHelper()
+{
+       if ( clip )
+       {
+               SetPort( nport ) ;
+               SetClip( clip ) ;
+               DisposeRgn( clip ) ;
+               RGBForeColor(&oldForeColor);
+               RGBBackColor(&oldBackColor);
+               SetPenState(&oldPenState);                              
+
+               TextFont( font );
+               TextSize( size );
+               TextFace( style );
+               TextMode( mode );
+               SetPort( port ) ;
+       }
+}
 
 
index d5bb4c82d188b089dd992d65a076b4d0473353c1..a11ff6db93eae87862f233e9e8d1d6f236e8cd3c 100644 (file)
@@ -28,7 +28,7 @@
 #include "wx/log.h"
 #include "wx/module.h"
 #include "wx/memory.h"
 #include "wx/log.h"
 #include "wx/module.h"
 #include "wx/memory.h"
-
+#include "wx/tooltip.h"
 #if wxUSE_WX_RESOURCES
 #include "wx/resource.h"
 #endif
 #if wxUSE_WX_RESOURCES
 #include "wx/resource.h"
 #endif
 #include "apprsrc.h"
 
 #include <wx/mac/uma.h>
 #include "apprsrc.h"
 
 #include <wx/mac/uma.h>
+#include <wx/mac/macnotfy.h>
+
+#if wxUSE_SOCKETS
+#include <OpenTransport.h>
+#include <OpenTptInternet.h>
+#endif
 
 extern char *wxBuffer;
 extern wxList wxPendingDelete;
 
 extern char *wxBuffer;
 extern wxList wxPendingDelete;
@@ -52,10 +58,14 @@ extern wxList *wxWinMacControlList;
 
 wxApp *wxTheApp = NULL;
 
 
 wxApp *wxTheApp = NULL;
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
 BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
     EVT_IDLE(wxApp::OnIdle)
 IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
 BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
     EVT_IDLE(wxApp::OnIdle)
+        EVT_END_SESSION(wxApp::OnEndSession)
+        EVT_QUERY_END_SESSION(wxApp::OnQueryEndSession)
 END_EVENT_TABLE()
 END_EVENT_TABLE()
+#endif
 
 
 const short    kMacMinHeap = (29 * 1024) ;
 
 
 const short    kMacMinHeap = (29 * 1024) ;
@@ -76,25 +86,25 @@ bool wxApp::s_macSupportPCMenuShortcuts = true ;
 long wxApp::s_macAboutMenuItemId = wxID_ABOUT ;
 wxString wxApp::s_macHelpMenuTitleName = "&Help" ;
 
 long wxApp::s_macAboutMenuItemId = wxID_ABOUT ;
 wxString wxApp::s_macHelpMenuTitleName = "&Help" ;
 
-OSErr AEHandleODoc( AppleEvent *event , AppleEvent *reply , long refcon )
+pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , unsigned long refcon )
 {
        wxApp* app = (wxApp*) refcon ;
        return wxTheApp->MacHandleAEODoc( event , reply) ;
 }
 
 {
        wxApp* app = (wxApp*) refcon ;
        return wxTheApp->MacHandleAEODoc( event , reply) ;
 }
 
-OSErr AEHandleOApp( AppleEvent *event , AppleEvent *reply , long refcon )
+pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , unsigned long refcon )
 {
        wxApp* app = (wxApp*) refcon ;
        return wxTheApp->MacHandleAEOApp( event , reply ) ;
 }
 
 {
        wxApp* app = (wxApp*) refcon ;
        return wxTheApp->MacHandleAEOApp( event , reply ) ;
 }
 
-OSErr AEHandlePDoc( AppleEvent *event , AppleEvent *reply , long refcon )
+pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , unsigned long refcon )
 {
        wxApp* app = (wxApp*) refcon ;
        return wxTheApp->MacHandleAEPDoc( event , reply ) ;
 }
 
 {
        wxApp* app = (wxApp*) refcon ;
        return wxTheApp->MacHandleAEPDoc( event , reply ) ;
 }
 
-OSErr AEHandleQuit( AppleEvent *event , AppleEvent *reply , long refcon )
+pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , unsigned long refcon )
 {
        wxApp* app = (wxApp*) refcon ;
        return wxTheApp->MacHandleAEQuit( event , reply) ;
 {
        wxApp* app = (wxApp*) refcon ;
        return wxTheApp->MacHandleAEQuit( event , reply) ;
@@ -133,14 +143,14 @@ OSErr wxApp::MacHandleAEQuit(AppleEvent *event , AppleEvent *reply)
        return noErr ;
 }
 
        return noErr ;
 }
 
-char StringMac[] =     "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+char StringMac[] =     "\x0d\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
                                        "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
                                        "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xae\xaf"
                                        "\xb1\xb4\xb5\xb6\xbb\xbc\xbe\xbf"
                                        "\xc0\xc1\xc2\xc4\xc7\xc8\xc9\xcb\xcc\xcd\xce\xcf"
                                        "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd8\xca\xdb" ;
 
                                        "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
                                        "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xae\xaf"
                                        "\xb1\xb4\xb5\xb6\xbb\xbc\xbe\xbf"
                                        "\xc0\xc1\xc2\xc4\xc7\xc8\xc9\xcb\xcc\xcd\xce\xcf"
                                        "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd8\xca\xdb" ;
 
-char StringANSI[] = "\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8"
+char StringANSI[] = "\x0a\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8"
                                        "\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC"
                                        "\x86\xBA\xA2\xA3\xA7\x95\xB6\xDF\xAE\xA9\x99\xB4\xA8\xC6\xD8"
                                        "\xB1\xA5\xB5\xF0\xAA\xBA\xE6\xF8"
                                        "\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC"
                                        "\x86\xBA\xA2\xA3\xA7\x95\xB6\xDF\xAE\xA9\x99\xB4\xA8\xC6\xD8"
                                        "\xB1\xA5\xB5\xF0\xAA\xBA\xE6\xF8"
@@ -321,9 +331,6 @@ bool wxApp::Initialize()
        AEInstallEventHandler( kCoreEventClass , kAEOpenApplication , NewAEEventHandlerProc(AEHandleOApp) , (long) wxTheApp , FALSE ) ;
        AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments , NewAEEventHandlerProc(AEHandlePDoc) , (long) wxTheApp , FALSE ) ;
        AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , NewAEEventHandlerProc(AEHandleQuit) , (long) wxTheApp  , FALSE ) ;
        AEInstallEventHandler( kCoreEventClass , kAEOpenApplication , NewAEEventHandlerProc(AEHandleOApp) , (long) wxTheApp , FALSE ) ;
        AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments , NewAEEventHandlerProc(AEHandlePDoc) , (long) wxTheApp , FALSE ) ;
        AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , NewAEEventHandlerProc(AEHandleQuit) , (long) wxTheApp  , FALSE ) ;
-#if 0
-       GUSISetup(GUSIwithInternetSockets);
-#endif
 
 
   // test the minimal configuration necessary
 
 
   // test the minimal configuration necessary
@@ -378,7 +385,7 @@ bool wxApp::Initialize()
   }
 
 #if __option(profile)
   }
 
 #if __option(profile)
-       ProfilerInit( collectDetailed, bestTimeBase , 20000 , 30 ) ;
+       ProfilerInit( collectDetailed, bestTimeBase , 20000 , 40 ) ;
 #endif
 
   // now avoid exceptions thrown for new (bad_alloc)
 #endif
 
   // now avoid exceptions thrown for new (bad_alloc)
@@ -393,17 +400,15 @@ bool wxApp::Initialize()
   wxBuffer = new char[BUFSIZ + 512];
 #endif
 
   wxBuffer = new char[BUFSIZ + 512];
 #endif
 
-/* No longer used
-#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
+  wxClassInfo::InitializeClasses();
 
 
-  streambuf* sBuf = new wxDebugStreamBuf;
-  ostream* oStr = new ostream(sBuf) ;
-  wxDebugContext::SetStream(oStr, sBuf);
+#if wxUSE_RESOURCES
+//    wxGetResource(wxT("wxWindows"), wxT("OsVersion"), &wxOsVersion);
 #endif
 #endif
-*/
-
-  wxClassInfo::InitializeClasses();
 
 
+#if wxUSE_THREADS
+    wxPendingEventsLocker = new wxCriticalSection;
+#endif
   wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
   wxTheColourDatabase->Initialize();
 
   wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
   wxTheColourDatabase->Initialize();
 
@@ -423,13 +428,29 @@ bool wxApp::Initialize()
   wxWinMacWindowList = new wxList(wxKEY_INTEGER);
   wxWinMacControlList = new wxList(wxKEY_INTEGER);
 
   wxWinMacWindowList = new wxList(wxKEY_INTEGER);
   wxWinMacControlList = new wxList(wxKEY_INTEGER);
 
-       UMAShowArrowCursor() ;
+  wxMacCreateNotifierTable() ;
 
 
+  UMAShowArrowCursor() ;
+  
   return TRUE;
 }
 
 void wxApp::CleanUp()
 {
   return TRUE;
 }
 
 void wxApp::CleanUp()
 {
+#if wxUSE_LOG
+    // flush the logged messages if any and install a 'safer' log target: the
+    // default one (wxLogGui) can't be used after the resources are freed just
+    // below and the user suppliedo ne might be even more unsafe (using any
+    // wxWindows GUI function is unsafe starting from now)
+    wxLog::DontCreateOnDemand();
+
+    // this will flush the old messages if any
+    delete wxLog::SetActiveTarget(new wxLogStderr);
+#endif // wxUSE_LOG
+
+    // One last chance for pending objects to be cleaned up
+    wxTheApp->DeletePendingObjects();
+
   wxModule::CleanUpModules();
 
 #if wxUSE_WX_RESOURCES
   wxModule::CleanUpModules();
 
 #if wxUSE_WX_RESOURCES
@@ -438,19 +459,8 @@ void wxApp::CleanUp()
 
   wxDeleteStockObjects() ;
 
 
   wxDeleteStockObjects() ;
 
-  // Destroy all GDI lists, etc.
-
-  delete wxTheBrushList;
-  wxTheBrushList = NULL;
-
-  delete wxThePenList;
-  wxThePenList = NULL;
-
-  delete wxTheFontList;
-  wxTheFontList = NULL;
-
-  delete wxTheBitmapList;
-  wxTheBitmapList = NULL;
+    // Destroy all GDI lists, etc.
+    wxDeleteStockLists();
 
   delete wxTheColourDatabase;
   wxTheColourDatabase = NULL;
 
   delete wxTheColourDatabase;
   wxTheColourDatabase = NULL;
@@ -460,9 +470,17 @@ void wxApp::CleanUp()
   delete[] wxBuffer;
   wxBuffer = NULL;
 
   delete[] wxBuffer;
   wxBuffer = NULL;
 
+  wxMacDestroyNotifierTable() ;
   if (wxWinMacWindowList)
     delete wxWinMacWindowList ;
 
   if (wxWinMacWindowList)
     delete wxWinMacWindowList ;
 
+    delete wxPendingEvents;
+#if wxUSE_THREADS
+    delete wxPendingEventsLocker;
+    // If we don't do the following, we get an apparent memory leak.
+    ((wxEvtHandler&) wxDefaultValidator).ClearEventLocker();
+#endif
+
   wxClassInfo::CleanUpClasses();
 
 #if __option(profile)
   wxClassInfo::CleanUpClasses();
 
 #if __option(profile)
@@ -474,33 +492,33 @@ void wxApp::CleanUp()
   wxTheApp = NULL;
 
 #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
   wxTheApp = NULL;
 
 #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
-  // At this point we want to check if there are any memory
-  // blocks that aren't part of the wxDebugContext itself,
-  // as a special case. Then when dumping we need to ignore
-  // wxDebugContext, too.
-  if (wxDebugContext::CountObjectsLeft() > 0)
-  {
-    wxTrace("There were memory leaks.\n");
-    wxDebugContext::Dump();
-    wxDebugContext::PrintStatistics();
-  }
-//  wxDebugContext::SetStream(NULL, NULL);
+    // At this point we want to check if there are any memory
+    // blocks that aren't part of the wxDebugContext itself,
+    // as a special case. Then when dumping we need to ignore
+    // wxDebugContext, too.
+    if (wxDebugContext::CountObjectsLeft(TRUE) > 0)
+    {
+        wxLogDebug(wxT("There were memory leaks."));
+        wxDebugContext::Dump();
+        wxDebugContext::PrintStatistics();
+    }
+    //  wxDebugContext::SetStream(NULL, NULL);
 #endif
 
 #endif
 
-  // do it as the very last thing because everything else can log messages
-  wxLog::DontCreateOnDemand();
-  // do it as the very last thing because everything else can log messages
-  delete wxLog::SetActiveTarget(NULL);
+#if wxUSE_LOG
+    // do it as the very last thing because everything else can log messages
+    delete wxLog::SetActiveTarget(NULL);
+#endif // wxUSE_LOG
 
 
-       ::PrClose() ;
        if (s_macCursorRgn)
                ::DisposeRgn(s_macCursorRgn);
        if (s_macCursorRgn)
                ::DisposeRgn(s_macCursorRgn);
+
        #if 0
                TerminateAE() ;
        #endif
 }
 
        #if 0
                TerminateAE() ;
        #endif
 }
 
-int wxEntry( int argc, char *argv[] )
+int wxEntry( int argc, char *argv[] , bool enterLoop )
 {
 #ifdef __MWERKS__
 #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
 {
 #ifdef __MWERKS__
 #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
@@ -513,27 +531,24 @@ int wxEntry( int argc, char *argv[] )
     wxDebugContext::SetCheckpoint();
 #endif
 #endif
     wxDebugContext::SetCheckpoint();
 #endif
 #endif
-  if (!wxApp::Initialize())
-    return FALSE;
-  if (!wxTheApp)
-  {
-    if (!wxApp::GetInitializerFunction())
+    if (!wxApp::Initialize())
+        return 0;
+   // create the application object or ensure that one already exists
+    if (!wxTheApp)
     {
     {
-      printf( "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" );
-      return 0;
-    };
+        // The app may have declared a global application object, but we recommend
+        // the IMPLEMENT_APP macro is used instead, which sets an initializer
+        // function for delayed, dynamic app object construction.
+        wxCHECK_MSG( wxApp::GetInitializerFunction(), 0,
+                     wxT("No initializer - use IMPLEMENT_APP macro.") );
 
 
-       wxTheApp = (wxApp*) (* wxApp::GetInitializerFunction()) ();
-  };
+        wxTheApp = (wxApp*) (*wxApp::GetInitializerFunction()) ();
+    }
 
 
-  if (!wxTheApp)
-  {
-    printf( "wxWindows error: wxTheApp == NULL\n" );
-    return 0;
-  };
+    wxCHECK_MSG( wxTheApp, 0, wxT("You have to define an instance of wxApp!") );
 
 #ifdef __WXMAC__
 
 #ifdef __WXMAC__
-  argc = 1 ; // currently we don't support files as parameters
+  argc = 0 ; // currently we don't support files as parameters
 #endif
 
   wxTheApp->argc = argc;
 #endif
 
   wxTheApp->argc = argc;
@@ -549,42 +564,58 @@ int wxEntry( int argc, char *argv[] )
   // into wxTopLevelWindows by getting created
   // in OnInit().
 
   // into wxTopLevelWindows by getting created
   // in OnInit().
 
-  if (!wxTheApp->OnInit()) return 0;
-
   int retValue = 0;
 
   int retValue = 0;
 
-  if (wxTheApp->Initialized()) retValue = wxTheApp->OnRun();
-
-  if (wxTheApp->GetTopWindow())
-  {
-    delete wxTheApp->GetTopWindow();
-    wxTheApp->SetTopWindow(NULL);
-  }
-
-  wxTheApp->DeletePendingObjects();
-
-  wxTheApp->OnExit();
-
-  wxApp::CleanUp();
+       if ( wxTheApp->OnInit() )
+       {
+           if ( enterLoop )
+           {
+               retValue = wxTheApp->OnRun();
+           }
+           else
+               // We want to initialize, but not run or exit immediately.
+               return 1;
+       }
+       //else: app initialization failed, so we skipped OnRun()
 
 
-  return retValue;
+       wxWindow *topWindow = wxTheApp->GetTopWindow();
+       if ( topWindow )
+       {
+           // Forcibly delete the window.
+           if ( topWindow->IsKindOf(CLASSINFO(wxFrame)) ||
+                   topWindow->IsKindOf(CLASSINFO(wxDialog)) )
+           {
+               topWindow->Close(TRUE);
+               wxTheApp->DeletePendingObjects();
+           }
+           else
+           {
+               delete topWindow;
+               wxTheApp->SetTopWindow(NULL);
+           }
+       }
+       
+       wxTheApp->OnExit();
+       
+       wxApp::CleanUp();
+       
+       return retValue;
 };
 
 // Static member initialization
 };
 
 // Static member initialization
-wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
+wxAppInitializerFunction wxAppBase::m_appInitFn = (wxAppInitializerFunction) NULL;
 
 wxApp::wxApp()
 {
   m_topWindow = NULL;
   wxTheApp = this;
 
 wxApp::wxApp()
 {
   m_topWindow = NULL;
   wxTheApp = this;
-  m_className = "";
+
   m_wantDebugOutput = TRUE ;
   m_wantDebugOutput = TRUE ;
-  m_appName = "";
+
   argc = 0;
   argv = NULL;
 
   m_printMode = wxPRINT_WINDOWS;
   argc = 0;
   argv = NULL;
 
   m_printMode = wxPRINT_WINDOWS;
-
   m_exitOnFrameDelete = TRUE;
   m_auto3D = TRUE;
 }
   m_exitOnFrameDelete = TRUE;
   m_auto3D = TRUE;
 }
@@ -640,13 +671,14 @@ void wxApp::Dispatch()
 
 void wxApp::OnIdle(wxIdleEvent& event)
 {
 
 void wxApp::OnIdle(wxIdleEvent& event)
 {
-  static bool inOnIdle = FALSE;
+   static bool s_inOnIdle = FALSE;
 
 
-  // Avoid recursion (via ProcessEvent default case)
-  if (inOnIdle)
-    return;
+    // Avoid recursion (via ProcessEvent default case)
+    if ( s_inOnIdle )
+        return;
 
 
-  inOnIdle = TRUE;
+
+  s_inOnIdle = TRUE;
 
   // 'Garbage' collection of windows deleted with Close().
   DeletePendingObjects();
 
   // 'Garbage' collection of windows deleted with Close().
   DeletePendingObjects();
@@ -662,13 +694,17 @@ void wxApp::OnIdle(wxIdleEvent& event)
   if (needMore)
     event.RequestMore(TRUE);
 
   if (needMore)
     event.RequestMore(TRUE);
 
-  inOnIdle = FALSE;
+    // If they are pending events, we must process them: pending events are
+    // either events to the threads other than main or events posted with
+    // wxPostEvent() functions
+    wxMacProcessNotifierAndPendingEvents();
+
+  s_inOnIdle = FALSE;
 }
 
 void wxWakeUpIdle()
 {
 }
 
 void wxWakeUpIdle()
 {
-    // **** please implement me! ****
-    // Wake up the idle handler processor, even if it is in another thread...
+       wxMacWakeUp() ;
 }
 
 // Send idle event to all top-level windows
 }
 
 // Send idle event to all top-level windows
@@ -729,32 +765,76 @@ void wxApp::DeletePendingObjects()
   }
 }
 
   }
 }
 
-wxLog* wxApp::CreateLogTarget()
+wxIcon
+wxApp::GetStdIcon(int which) const
 {
 {
-    return new wxLogGui;
-}
+    switch(which)
+    {
+        case wxICON_INFORMATION:
+            return wxIcon("wxICON_INFO");
 
 
-wxWindow* wxApp::GetTopWindow() const
-{
-    if (m_topWindow)
-        return m_topWindow;
-    else if (wxTopLevelWindows.Number() > 0)
-        return (wxWindow*) wxTopLevelWindows.First()->Data();
-    else
-        return NULL;
+        case wxICON_QUESTION:
+            return wxIcon("wxICON_QUESTION");
+
+        case wxICON_EXCLAMATION:
+            return wxIcon("wxICON_WARNING");
+
+        default:
+            wxFAIL_MSG(wxT("requested non existent standard icon"));
+            // still fall through
+
+        case wxICON_HAND:
+            return wxIcon("wxICON_ERROR");
+    }
 }
 
 void wxExit()
 {
 }
 
 void wxExit()
 {
-  wxApp::CleanUp();
+    wxLogError(_("Fatal error: exiting"));
+
+    wxApp::CleanUp();
        ::ExitToShell() ;
 }
 
        ::ExitToShell() ;
 }
 
+void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event))
+{
+    if (GetTopWindow())
+        GetTopWindow()->Close(TRUE);
+}
+
+// Default behaviour: close the application with prompts. The
+// user can veto the close, and therefore the end session.
+void wxApp::OnQueryEndSession(wxCloseEvent& event)
+{
+    if (GetTopWindow())
+    {
+        if (!GetTopWindow()->Close(!event.CanVeto()))
+            event.Veto(TRUE);
+    }
+}
+
+extern "C" void wxCYield() ;
+void wxCYield()
+{
+       wxYield() ;
+}
+
 // Yield to other processes
 bool wxYield()
 {
 // Yield to other processes
 bool wxYield()
 {
-//     YieldToAnyThread() ;
-       SystemTask() ;
+#if wxUSE_THREADS
+  YieldToAnyThread() ;
+#endif
+  EventRecord event ;
+
+       long sleepTime = 0 ; //::GetCaretTime();
+
+       while ( !wxTheApp->IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, wxApp::s_macCursorRgn))
+       {
+       wxTheApp->MacHandleOneEvent( &event );
+       }
+
+       wxMacProcessNotifierAndPendingEvents() ;
   return TRUE;
 }
 
   return TRUE;
 }
 
@@ -762,6 +842,12 @@ bool wxYield()
 
 void wxApp::MacSuspend( bool convertClipboard )
 {
 
 void wxApp::MacSuspend( bool convertClipboard )
 {
+       // we have to deactive the window manually
+       
+       wxWindow* window = GetTopWindow() ;
+       if ( window )
+               window->MacActivate( MacGetCurrentEvent() , false ) ;
+               
                s_lastMouseDown = 0 ;
                if( convertClipboard )
                {
                s_lastMouseDown = 0 ;
                if( convertClipboard )
                {
@@ -784,13 +870,10 @@ void wxApp::MacResume( bool convertClipboard )
 
 void wxApp::MacConvertPrivateToPublicScrap()
 {
 
 void wxApp::MacConvertPrivateToPublicScrap()
 {
-       ::ZeroScrap();
-       ::TEToScrap();
 }
 
 void wxApp::MacConvertPublicToPrivateScrap()
 {
 }
 
 void wxApp::MacConvertPublicToPrivateScrap()
 {
-       ::TEFromScrap() ;
 }
 
 void wxApp::MacDoOneEvent()
 }
 
 void wxApp::MacDoOneEvent()
@@ -817,9 +900,7 @@ void wxApp::MacDoOneEvent()
 
        // repeaters
 
 
        // repeaters
 
-#if 0
-       wxMacProcessSocketEvents() ;
-#endif
+       wxMacProcessNotifierAndPendingEvents() ;
 }
 
 void wxApp::MacHandleOneEvent( EventRecord *ev )
 }
 
 void wxApp::MacHandleOneEvent( EventRecord *ev )
@@ -874,6 +955,7 @@ void wxApp::MacHandleOneEvent( EventRecord *ev )
                default:
                        break;
        }
                default:
                        break;
        }
+       wxMacProcessNotifierAndPendingEvents() ;
 }
 
 void wxApp::MacHandleHighLevelEvent( EventRecord *ev )
 }
 
 void wxApp::MacHandleHighLevelEvent( EventRecord *ev )
@@ -885,6 +967,8 @@ bool s_macIsInModalLoop = false ;
 
 void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
 {
 
 void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
 {
+       wxToolTip::RemoveToolTips() ;
+
        WindowRef window;
        WindowRef frontWindow = UMAFrontNonFloatingWindow() ;
        WindowAttributes frontWindowAttributes = NULL ;
        WindowRef window;
        WindowRef frontWindow = UMAFrontNonFloatingWindow() ;
        WindowAttributes frontWindowAttributes = NULL ;
@@ -894,6 +978,9 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
        short windowPart = ::FindWindow(ev->where, &window);
        wxWindow* win = wxFindWinFromMacWindow( window ) ;
 
        short windowPart = ::FindWindow(ev->where, &window);
        wxWindow* win = wxFindWinFromMacWindow( window ) ;
 
+       BitMap screenBits;
+       GetQDGlobalsScreenBits( &screenBits );
+
        switch (windowPart)
        {
                case inMenuBar :
        switch (windowPart)
        {
                case inMenuBar :
@@ -908,10 +995,12 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
                                s_lastMouseDown = 0;
                        }
                        break ;
                                s_lastMouseDown = 0;
                        }
                        break ;
+#if !TARGET_CARBON
                case inSysWindow :
                        SystemClick( ev , window ) ;
                        s_lastMouseDown = 0;
                        break ;
                case inSysWindow :
                        SystemClick( ev , window ) ;
                        s_lastMouseDown = 0;
                        break ;
+#endif
                case inDrag :
                        if ( window != frontWindow && s_macIsInModalLoop && !(ev->modifiers & cmdKey ) )
                        {
                case inDrag :
                        if ( window != frontWindow && s_macIsInModalLoop && !(ev->modifiers & cmdKey ) )
                        {
@@ -919,13 +1008,17 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
                        }
                        else
                        {
                        }
                        else
                        {
-                               DragWindow(window, ev->where, &qd.screenBits.bounds);
+                               DragWindow(window, ev->where, &screenBits.bounds);
                                if (win)
                                {
                                        GrafPtr port ;
                                        GetPort( &port ) ;
                                        Point pt = { 0, 0 } ;
                                if (win)
                                {
                                        GrafPtr port ;
                                        GetPort( &port ) ;
                                        Point pt = { 0, 0 } ;
-                                       SetPort( window ) ;
+                                       #if TARGET_CARBON
+                                       SetPort( GetWindowPort(window) ) ;
+                                       #else
+                                       SetPort( (window) ) ;
+                                       #endif
                                        SetOrigin( 0 , 0 ) ;
                                        LocalToGlobal( &pt ) ;
                                        SetPort( port ) ;
                                        SetOrigin( 0 , 0 ) ;
                                        LocalToGlobal( &pt ) ;
                                        SetPort( port ) ;
@@ -944,7 +1037,7 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
                        s_lastMouseDown = 0;
                        break;
                case inGrow:
                        s_lastMouseDown = 0;
                        break;
                case inGrow:
-                               int growResult = GrowWindow(window , ev->where, &qd.screenBits.bounds);
+                               int growResult = GrowWindow(window , ev->where, &screenBits.bounds);
                                if (growResult != 0)
                                {
                                        int newWidth = LoWord(growResult);
                                if (growResult != 0)
                                {
                                        int newWidth = LoWord(growResult);
@@ -969,8 +1062,13 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
                                        // TODO setup size event
                                        ZoomWindow( window , windowPart , false ) ;
                                        if (win)
                                        // TODO setup size event
                                        ZoomWindow( window , windowPart , false ) ;
                                        if (win)
-                                               win->SetSize( -1, -1, window->portRect.right-window->portRect.left ,
-                                                       window->portRect.bottom-window->portRect.top, wxSIZE_USE_EXISTING);
+                                       {
+                                               Rect tempRect ;
+                                               
+                                               GetWindowPortBounds(window, &tempRect ) ;
+                                               win->SetSize( -1, -1, tempRect.right-tempRect.left ,
+                                                       tempRect.bottom-tempRect.top, wxSIZE_USE_EXISTING);
+                                       }
                                }
                        s_lastMouseDown = 0;
                        break;
                                }
                        s_lastMouseDown = 0;
                        break;
@@ -980,6 +1078,17 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
                        break ;
 
                case inContent :
                        break ;
 
                case inContent :
+                               {
+                                       GrafPtr port ;
+                                       GetPort( &port ) ;
+                                       #if TARGET_CARBON
+                                       SetPort( GetWindowPort(window) ) ;
+                                       #else
+                                       SetPort( (window) ) ;
+                                       #endif
+                                       SetOrigin( 0 , 0 ) ;
+                                       SetPort( port ) ;
+                               }
                                if ( window != frontWindow )
                                {
                                        if ( s_macIsInModalLoop )
                                if ( window != frontWindow )
                                {
                                        if ( s_macIsInModalLoop )
@@ -1140,6 +1249,8 @@ long wxMacTranslateKey(unsigned char key, unsigned char code)
 
 void wxApp::MacHandleKeyDownEvent( EventRecord *ev )
 {
 
 void wxApp::MacHandleKeyDownEvent( EventRecord *ev )
 {
+       wxToolTip::RemoveToolTips() ;
+       
        UInt32 menuresult = UMAMenuEvent(ev) ;
        if ( HiWord( menuresult ) )
                MacHandleMenuSelect( HiWord( menuresult ) , LoWord( menuresult ) ) ;
        UInt32 menuresult = UMAMenuEvent(ev) ;
        if ( HiWord( menuresult ) )
                MacHandleMenuSelect( HiWord( menuresult ) , LoWord( menuresult ) ) ;
@@ -1268,12 +1379,14 @@ void wxApp::MacHandleDiskEvent( EventRecord *ev )
 {
        if ( HiWord( ev->message ) != noErr )
   {
 {
        if ( HiWord( ev->message ) != noErr )
   {
+ #if !TARGET_CARBON
                OSErr err ;
                Point point ;
                SetPt( &point , 100 , 100 ) ;
 
                OSErr err ;
                Point point ;
                SetPt( &point , 100 , 100 ) ;
 
-       err = DIBadMount( point , ev->message ) ;
+               err = DIBadMount( point , ev->message ) ;
                wxASSERT( err == noErr ) ;
                wxASSERT( err == noErr ) ;
+#endif
        }
 }
 
        }
 }
 
index 1ae5a445d4b8fc5c16285428023761b29a351955..2eddb0d5b96bd368fe307fcaec01d3fe43ca8ed7 100644 (file)
@@ -25,8 +25,10 @@ extern "C"
        #include "xpm.h"
 } ;
 
        #include "xpm.h"
 } ;
 
+#if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
 IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
 IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
 IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
+#endif
 
 #include <PictUtils.h>
 
 
 #include <PictUtils.h>
 
@@ -69,16 +71,7 @@ GWorldPtr wxMacCreateGWorld( int height , int width , int depth )
        
        if ( depth < 0 )
        {
        
        if ( depth < 0 )
        {
-               // get max pixel depth
-               CGrafPtr port ;
-               GetCWMgrPort( &port ) ; 
-               GDHandle maxDevice ;
-               
-               maxDevice = GetMaxDevice( &port->portRect ) ;
-               if ( maxDevice )
-                       depth = (**((**maxDevice).gdPMap)).pixelSize ;
-               else
-                       depth = 8 ; 
+               depth = wxDisplayDepth() ;     
        }
                
        err = NewGWorld( &port , depth , &rect , NULL , NULL , 0 ) ;
        }
                
        err = NewGWorld( &port , depth , &rect , NULL , NULL , 0 ) ;
@@ -178,7 +171,8 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
                        
                        GetGWorld( &origPort , &origDevice ) ;
                        SetGWorld( M_BITMAPDATA->m_hBitmap , NULL ) ;
                        
                        GetGWorld( &origPort , &origDevice ) ;
                        SetGWorld( M_BITMAPDATA->m_hBitmap , NULL ) ;
-       
+                       LockPixels( GetGWorldPixMap( (CGrafPtr) M_BITMAPDATA->m_hBitmap ) ) ;
+                       
                        // bits is a word aligned array
                        
                        unsigned char* linestart = (unsigned char*) bits ;
                        // bits is a word aligned array
                        
                        unsigned char* linestart = (unsigned char*) bits ;
@@ -211,6 +205,7 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
                                }
                                
                        }
                                }
                                
                        }
+               UnlockPixels( GetGWorldPixMap( (CGrafPtr) M_BITMAPDATA->m_hBitmap ) ) ;
        
                SetGWorld( origPort , origDevice ) ;
           }
        
                SetGWorld( origPort , origDevice ) ;
           }
@@ -514,6 +509,8 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
     }
 
        m_maskBitmap = wxMacCreateGWorld( bitmap.GetWidth() , bitmap.GetHeight() , 1 ) ;        
     }
 
        m_maskBitmap = wxMacCreateGWorld( bitmap.GetWidth() , bitmap.GetHeight() , 1 ) ;        
+       LockPixels( GetGWorldPixMap( (CGrafPtr) m_maskBitmap ) ) ;
+       LockPixels( GetGWorldPixMap( (CGrafPtr) ((wxBitmapRefData*) bitmap.GetRefData())->m_hBitmap ) ) ;
        RGBColor maskColor = colour.GetPixel() ;
 
     // this is not very efficient, but I can't think
        RGBColor maskColor = colour.GetPixel() ;
 
     // this is not very efficient, but I can't think
@@ -545,6 +542,8 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
             }
         }
     }
             }
         }
     }
+       UnlockPixels( GetGWorldPixMap( (CGrafPtr) m_maskBitmap ) ) ;
+       UnlockPixels( GetGWorldPixMap( ((wxBitmapRefData*) bitmap.GetRefData())->m_hBitmap ) ) ;
        SetGWorld( origPort , origDevice ) ;
 
     return TRUE;
        SetGWorld( origPort , origDevice ) ;
 
     return TRUE;
@@ -712,8 +711,8 @@ bool wxXPMFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type
       if (dc)
       {
         if (SelectObject(dc, (HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap))
       if (dc)
       {
         if (SelectObject(dc, (HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap))
-        { /* for following SetPixel */
-          /* fill the XImage struct 'by hand' */
+        { 
+          
     ximage.width = M_BITMAPHANDLERDATA->m_width; 
      ximage.height = M_BITMAPHANDLERDATA->m_height;
     ximage.depth = M_BITMAPHANDLERDATA->m_depth; 
     ximage.width = M_BITMAPHANDLERDATA->m_width; 
      ximage.height = M_BITMAPHANDLERDATA->m_height;
     ximage.depth = M_BITMAPHANDLERDATA->m_depth; 
@@ -725,7 +724,7 @@ bool wxXPMFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type
       DeleteDC(dc);
 
     if (errorStatus == XpmSuccess)
       DeleteDC(dc);
 
     if (errorStatus == XpmSuccess)
-      return TRUE;    /* no error */
+      return TRUE;    
     else
       return FALSE;
         } else return FALSE;
     else
       return FALSE;
         } else return FALSE;
@@ -809,19 +808,6 @@ bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long
     int desiredWidth, int desiredHeight)
 {
     // TODO: load colourmap.
     int desiredWidth, int desiredHeight)
 {
     // TODO: load colourmap.
-/*
-    M_BITMAPHANDLERDATA->m_hBitmap = (WXHBITMAP) ::LoadBitmap(wxGetInstance(), name);
-    if (M_BITMAPHANDLERDATA->m_hBitmap)
-    {
-      M_BITMAPHANDLERDATA->m_ok = TRUE;
-      BITMAP bm;
-      GetObject((HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap, sizeof(BITMAP), (LPSTR) &bm);
-      M_BITMAPHANDLERDATA->m_width = bm.bmWidth;
-      M_BITMAPHANDLERDATA->m_height = bm.bmHeight;
-      M_BITMAPHANDLERDATA->m_depth = bm.bmBitsPixel;
-      return TRUE;
-    }
-*/
   // it's probably not found
   wxLogError("Can't load bitmap '%s' from resources! Check .rc file.", name.c_str());
 
   // it's probably not found
   wxLogError("Can't load bitmap '%s' from resources! Check .rc file.", name.c_str());
 
@@ -852,11 +838,6 @@ bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long fla
 #if USE_IMAGE_LOADING_IN_MSW
     wxPalette *palette = NULL;
     bool success = FALSE;
 #if USE_IMAGE_LOADING_IN_MSW
     wxPalette *palette = NULL;
     bool success = FALSE;
-/*
-    if (type & wxBITMAP_DISCARD_COLOURMAP)
-      success = wxLoadIntoBitmap(WXSTRINGCAST name, bitmap);
-    else
-*/
     success = (wxLoadIntoBitmap(WXSTRINGCAST name, bitmap, &palette) != 0);
     if (!success && palette)
     {
     success = (wxLoadIntoBitmap(WXSTRINGCAST name, bitmap, &palette) != 0);
     if (!success && palette)
     {
@@ -884,7 +865,6 @@ bool wxBMPFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type
 }
 
 
 }
 
 
-
 void wxBitmap::CleanUpHandlers()
 {
     wxNode *node = sm_handlers.First();
 void wxBitmap::CleanUpHandlers()
 {
     wxNode *node = sm_handlers.First();
@@ -903,7 +883,7 @@ void wxBitmap::InitStandardHandlers()
        AddHandler( new wxPICTResourceHandler ) ;
        AddHandler( new wxICONResourceHandler ) ;
        AddHandler(new wxXPMFileHandler);
        AddHandler( new wxPICTResourceHandler ) ;
        AddHandler( new wxICONResourceHandler ) ;
        AddHandler(new wxXPMFileHandler);
-  AddHandler(new wxXPMDataHandler);
+       AddHandler(new wxXPMDataHandler);
        AddHandler(new wxBMPResourceHandler);
        AddHandler(new wxBMPFileHandler);
 }
        AddHandler(new wxBMPResourceHandler);
        AddHandler(new wxBMPFileHandler);
 }
index 569a2cd338b0c634434ede1f7d11c2666785462d..c1431386093f796c0bc2c4762f35cf13b889bd0c 100644 (file)
 
 #include "wx/bmpbuttn.h"
 
 
 #include "wx/bmpbuttn.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton)
 IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton)
+#endif
 
 #include <wx/mac/uma.h>
 
 
 #include <wx/mac/uma.h>
 
-PicHandle MakePict(GWorldPtr wp) ;
+PicHandle MakePict(GWorldPtr wp, GWorldPtr mask ) ;
 
 bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
            const wxPoint& pos,
 
 bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
            const wxPoint& pos,
@@ -48,8 +50,6 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
     if ( height == -1 && bitmap.Ok())
        height = bitmap.GetHeight() + 2*m_marginY;
 
     if ( height == -1 && bitmap.Ok())
        height = bitmap.GetHeight() + 2*m_marginY;
 
-       m_macHorizontalBorder = 0 ; // additional pixels around the real control
-       m_macVerticalBorder = 0 ;
        Rect bounds ;
        Str255 title ;
        MacPreControlCreate( parent , id ,  "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
        Rect bounds ;
        Str255 title ;
        MacPreControlCreate( parent , id ,  "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
@@ -68,7 +68,14 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
                        icon = bmap->m_hPict ;
                else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
                {
                        icon = bmap->m_hPict ;
                else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
                {
-                       icon = MakePict( bmap->m_hBitmap ) ;
+                       if ( m_buttonBitmap.GetMask() )
+                       {
+                               icon = MakePict( bmap->m_hBitmap , m_buttonBitmap.GetMask()->GetMaskBitmap() ) ;
+                       }
+                       else
+                       {
+                               icon = MakePict( bmap->m_hBitmap , NULL ) ;
+                       }
                }
        }
        ControlButtonContentInfo info ;
                }
        }
        ControlButtonContentInfo info ;
@@ -94,7 +101,14 @@ void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap)
                        icon = bmap->m_hPict ;
                else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
                {
                        icon = bmap->m_hPict ;
                else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
                {
-                       icon = MakePict( bmap->m_hBitmap ) ;
+                       if ( m_buttonBitmap.GetMask() )
+                       {
+                               icon = MakePict( bmap->m_hBitmap , m_buttonBitmap.GetMask()->GetMaskBitmap() ) ;
+                       }
+                       else
+                       {
+                               icon = MakePict( bmap->m_hBitmap , NULL ) ;
+                       }
                }
        }
        ControlButtonContentInfo info ;
                }
        }
        ControlButtonContentInfo info ;
index 7ba6dfc99063c4114ad0a246184f4c896fb2c394..cb9d76d1ab28ca05b8bc687c4d0080cabc5feb5c 100644 (file)
@@ -17,7 +17,9 @@
 #include "wx/utils.h"
 #include "wx/brush.h"
 
 #include "wx/utils.h"
 #include "wx/brush.h"
 
+#if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
 IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
+#endif
 
 wxBrushRefData::wxBrushRefData()
 {
 
 wxBrushRefData::wxBrushRefData()
 {
index 4635492a176663fd2be95b2858ffbd6ad4987a4a..47f66425e2ed97fdf2f939ad9fad1d895263bb13 100644 (file)
@@ -15,7 +15,9 @@
 
 #include "wx/button.h"
 
 
 #include "wx/button.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl)
+#endif
 
 #include <wx/mac/uma.h>
 // Button
 
 #include <wx/mac/uma.h>
 // Button
@@ -29,8 +31,6 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
 {
        Rect bounds ;
        Str255 title ;
 {
        Rect bounds ;
        Str255 title ;
-       m_macHorizontalBorder = 2 ; // additional pixels around the real control
-       m_macVerticalBorder = 2 ;
        
        MacPreControlCreate( parent , id ,  label , pos , size ,style, validator , name , &bounds , title ) ;
 
        
        MacPreControlCreate( parent , id ,  label , pos , size ,style, validator , name , &bounds , title ) ;
 
@@ -66,22 +66,32 @@ void wxButton::SetDefault()
 
 wxSize wxButton::DoGetBestSize() const
 {
 
 wxSize wxButton::DoGetBestSize() const
 {
-    int wBtn = m_label.Length() * 8 + 12 + 2 * m_macHorizontalBorder;
-       int hBtn = 13 + 2 * m_macVerticalBorder;
+    int wBtn = m_label.Length() * 8 + 12 ;
+       int hBtn = 20 ;
+       
+       if ( wBtn < 80 )
+               wBtn = 80 ;
 
     return wxSize(wBtn, hBtn);
 }
 
 wxSize wxButton::GetDefaultSize()
 {
 
     return wxSize(wBtn, hBtn);
 }
 
 wxSize wxButton::GetDefaultSize()
 {
-    int wBtn = 15 * 8 + 12 + 2 * 2;
-       int hBtn = 13 + 2 * 2;
+    int wBtn = 80 /* + 2 * m_macHorizontalBorder */ ; 
+       int hBtn = 20 /* +  2 * m_macVerticalBorder */ ;
 
     return wxSize(wBtn, hBtn);
 }
 
 void wxButton::Command (wxCommandEvent & event)
 {
 
     return wxSize(wBtn, hBtn);
 }
 
 void wxButton::Command (wxCommandEvent & event)
 {
+       if ( m_macControl )
+       {
+               HiliteControl( m_macControl , kControlButtonPart ) ;
+               unsigned long finalTicks ;
+               Delay( 8 , &finalTicks ) ;
+               HiliteControl( m_macControl , 0 ) ;
+       }
     ProcessCommand (event);
 }
 
     ProcessCommand (event);
 }
 
index df3424b88fca86cc1a7756b8c463cb9926cce626..c3d4ce9709f224f7356a82070aa006f3d1e27c50 100644 (file)
 
 #include "wx/checkbox.h"
 
 
 #include "wx/checkbox.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
 IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
+#endif
 
 #include <wx/mac/uma.h>
 
 
 #include <wx/mac/uma.h>
 
index 7387e3e4719c555bb3ecfe8271e469c978185811..2f43152c2a1ceae6beb1ea7bd062f1ce918100d2 100644 (file)
@@ -23,7 +23,9 @@
 // implementation
 // ============================================================================
 
 // implementation
 // ============================================================================
 
+#if !USE_SHARED_LIBRARY
   IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox)
   IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox)
+#endif
 
 // ----------------------------------------------------------------------------
 // implementation of wxCheckListBox class
 
 // ----------------------------------------------------------------------------
 // implementation of wxCheckListBox class
index 343f3d239ebda7f1e14c6489559f5c0c09e34f8c..1c36eef12d4d13502c256e7bcfbac7672778fe66 100644 (file)
@@ -17,7 +17,9 @@
 #include "wx/choice.h"
 #include "wx/mac/uma.h"
 
 #include "wx/choice.h"
 #include "wx/mac/uma.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
+#endif
 
 bool wxChoice::Create(wxWindow *parent, wxWindowID id,
            const wxPoint& pos,
 
 bool wxChoice::Create(wxWindow *parent, wxWindowID id,
            const wxPoint& pos,
@@ -27,13 +29,12 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
            const wxValidator& validator,
            const wxString& name)
 {
            const wxValidator& validator,
            const wxString& name)
 {
-    m_noStrings = n;
 
                Rect bounds ;
                Str255 title ;
        
                MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
 
                Rect bounds ;
                Str255 title ;
        
                MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
-       
+
                m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0 , 
                kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ; 
        
                m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0 , 
                kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ; 
        
@@ -41,11 +42,15 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
                SetControlData( m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
                for ( int i = 0 ; i < n ; i++ )
                {
                SetControlData( m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
                for ( int i = 0 ; i < n ; i++ )
                {
-                       appendmenu( m_macPopUpMenuHandle , choices[i] ) ;
+                       Str255 label;
+                       wxMenuItem::MacBuildMenuString( label , NULL , NULL , choices[i] ,false);
+                       AppendMenu( m_macPopUpMenuHandle , label ) ;
+                       m_strings.Add( choices[i] ) ;
                }
                SetControlMinimum( m_macControl , 0 ) ;
                }
                SetControlMinimum( m_macControl , 0 ) ;
-               SetControlMaximum( m_macControl , m_noStrings) ;
-               SetControlValue( m_macControl , 1 ) ;
+               SetControlMaximum( m_macControl , Number()) ;
+               if ( n > 0 )
+                       SetControlValue( m_macControl , 1 ) ;
 
                MacPostControlCreate() ;
 
 
                MacPostControlCreate() ;
 
@@ -54,27 +59,28 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
 
 void wxChoice::Append(const wxString& item)
 {
 
 void wxChoice::Append(const wxString& item)
 {
-       appendmenu( m_macPopUpMenuHandle , item ) ;
-    m_noStrings ++;
-       SetControlMaximum( m_macControl , m_noStrings) ;
+       Str255 label;
+       wxMenuItem::MacBuildMenuString( label , NULL , NULL , item ,false);
+       AppendMenu( m_macPopUpMenuHandle , label ) ;
+       m_strings.Add( item ) ;
+       SetControlMaximum( m_macControl , Number()) ;
 }
 
 void wxChoice::Delete(int n)
 {
 }
 
 void wxChoice::Delete(int n)
 {
-       wxASSERT( n < m_noStrings ) ;
     ::DeleteMenuItem( m_macPopUpMenuHandle , n + 1) ;
     ::DeleteMenuItem( m_macPopUpMenuHandle , n + 1) ;
-    m_noStrings --;
-       SetControlMaximum( m_macControl , m_noStrings) ;
+    m_strings.Remove( n ) ;
+       SetControlMaximum( m_macControl , Number()) ;
 }
 
 void wxChoice::Clear()
 {
 }
 
 void wxChoice::Clear()
 {
-    for ( int i = 0 ; i < m_noStrings ; i++ )
+    for ( int i = 0 ; i < Number() ; i++ )
     {
        ::DeleteMenuItem( m_macPopUpMenuHandle , 1 ) ;
        }
     {
        ::DeleteMenuItem( m_macPopUpMenuHandle , 1 ) ;
        }
-    m_noStrings = 0;
-       SetControlMaximum( m_macControl , m_noStrings) ;
+    m_strings.Clear() ;
+       SetControlMaximum( m_macControl , Number()) ;
 }
 
 int wxChoice::GetSelection() const
 }
 
 int wxChoice::GetSelection() const
@@ -99,7 +105,7 @@ void wxChoice::SetSelection(int n)
 
 int wxChoice::FindString(const wxString& s) const
 {
 
 int wxChoice::FindString(const wxString& s) const
 {
-    for( int i = 0 ; i < m_noStrings ; i++ )
+    for( int i = 0 ; i < Number() ; i++ )
     {
        if ( GetString( i ) == s )
                return i ; 
     {
        if ( GetString( i ) == s )
                return i ; 
@@ -109,10 +115,7 @@ int wxChoice::FindString(const wxString& s) const
 
 wxString wxChoice::GetString(int n) const
 {
 
 wxString wxChoice::GetString(int n) const
 {
-       Str255 text ;
-    ::GetMenuItemText( m_macPopUpMenuHandle , n+1 , text ) ;
-    p2cstr( text ) ;
-    return wxString( text );
+       return m_strings[n] ;
 }
 
 void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags)
 }
 
 void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags)
index 36f4c0f4d9e72a4450050f5a0a9877009d768a43..ca5b79339632c428ac59338d65addc48cbb23b22 100644 (file)
 #include "wx/metafile.h"
 #include "wx/clipbrd.h"
 
 #include "wx/metafile.h"
 #include "wx/clipbrd.h"
 
+#define wxUSE_DATAOBJ 1
+
 #include <string.h>
 
 // open/close
 #include <string.h>
 
 // open/close
+
+bool clipboard_opened = false ;
+
 bool wxOpenClipboard()
 {
 bool wxOpenClipboard()
 {
+       clipboard_opened = true ;
     return TRUE;
 }
 
 bool wxCloseClipboard()
 {
     return TRUE;
 }
 
 bool wxCloseClipboard()
 {
+       clipboard_opened = false ;
     return TRUE;
 }
 
 bool wxIsClipboardOpened()
 {
     return TRUE;
 }
 
 bool wxIsClipboardOpened()
 {
-     return TRUE;
+     return clipboard_opened;
 }
 
 }
 
-// get/set data
-
 bool wxEmptyClipboard()
 {
 bool wxEmptyClipboard()
 {
-       ZeroScrap() ;
+       
+#if TARGET_CARBON
+       OSStatus err ;
+       err = ClearCurrentScrap( );
+#else
+       OSErr err ;
+       err = ZeroScrap( );
+#endif
+       if ( err )
+       {
+        wxLogSysError(_("Failed to empty the clipboard."));
+               return FALSE ;
+       }
     return TRUE;
 }
 
     return TRUE;
 }
 
-bool wxSetClipboardData(wxDataFormat dataFormat,const void *data,int width , int height)
+// get/set data
+
+// clipboard formats
+
+bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat)
 {
 {
-    return FALSE;
+#if TARGET_CARBON
+       OSStatus err = noErr;
+       ScrapRef scrapRef;
+       
+       err = GetCurrentScrap( &scrapRef );
+       if ( err != noTypeErr && err != memFullErr )    
+       {
+               ScrapFlavorFlags        flavorFlags;
+               Size                            byteCount;
+               
+               if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
+               {
+                       if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
+                       {
+                               return TRUE ;
+                       }
+               }
+       }
+       return FALSE;
+       
+#else
+       long offset ;
+       if ( GetScrap( NULL , dataFormat.GetFormatId() , &offset ) > 0 )
+       {
+               return TRUE ;
+       }
+     return FALSE;
+#endif
 }
 
 }
 
-void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
+bool wxSetClipboardData(wxDataFormat dataFormat,const void *data,int width , int height)
 {
 {
-    return NULL;
-}
+#if !TARGET_CARBON
+       OSErr err = noErr ;
+#else
+       OSStatus err = noErr ;
+#endif
+       
+    switch (dataFormat.GetType())
+    {
+        case wxDF_BITMAP:
+            {
+               /*
+                wxBitmap *bitmap = (wxBitmap *)data;
+
+                HDC hdcMem = CreateCompatibleDC((HDC) NULL);
+                HDC hdcSrc = CreateCompatibleDC((HDC) NULL);
+                HBITMAP old = (HBITMAP)
+                    ::SelectObject(hdcSrc, (HBITMAP)bitmap->GetHBITMAP());
+                HBITMAP hBitmap = CreateCompatibleBitmap(hdcSrc,
+                                                         bitmap->GetWidth(),
+                                                         bitmap->GetHeight());
+                if (!hBitmap)
+                {
+                    SelectObject(hdcSrc, old);
+                    DeleteDC(hdcMem);
+                    DeleteDC(hdcSrc);
+                    return FALSE;
+                }
+
+                HBITMAP old1 = (HBITMAP) SelectObject(hdcMem, hBitmap);
+                BitBlt(hdcMem, 0, 0, bitmap->GetWidth(), bitmap->GetHeight(),
+                       hdcSrc, 0, 0, SRCCOPY);
+
+                // Select new bitmap out of memory DC
+                SelectObject(hdcMem, old1);
+
+                // Set the data
+                handle = ::SetClipboardData(CF_BITMAP, hBitmap);
+
+                // Clean up
+                SelectObject(hdcSrc, old);
+                DeleteDC(hdcSrc);
+                DeleteDC(hdcMem);
+                */
+                break;
+            }
 
 
+        case wxDF_DIB:
+            {
+               /*
+#if wxUSE_IMAGE_LOADING_IN_MSW
+                wxBitmap *bitmap = (wxBitmap *)data;
+                HBITMAP hBitmap = (HBITMAP)bitmap->GetHBITMAP();
+                // NULL palette means to use the system one
+                HANDLE hDIB = wxBitmapToDIB(hBitmap, (HPALETTE)NULL); 
+                handle = SetClipboardData(CF_DIB, hDIB);
+#endif // wxUSE_IMAGE_LOADING_IN_MSW
+*/
+                break;
+            }
 
 
-// clipboard formats
+#if wxUSE_METAFILE
+        case wxDF_METAFILE:
+            {
+                wxMetafile *wxMF = (wxMetafile *)data;
+                               PicHandle pict = wxMF->GetHMETAFILE() ;
+                               HLock( (Handle) pict ) ;
+#if !TARGET_CARBON
+                               err = PutScrap( GetHandleSize(  (Handle) pict ) , 'PICT' , *pict ) ;
+#else
+                               ScrapRef        scrap;
+                               err = GetCurrentScrap (&scrap); 
+                               if ( !err )
+                               {
+                                       err = PutScrapFlavor (scrap, 'PICT', 0, GetHandleSize((Handle) pict), *pict);
+                               }
+#endif
+                               HUnlock(  (Handle) pict ) ;
+                break;
+            }
+#endif
+        case wxDF_SYLK:
+        case wxDF_DIF:
+        case wxDF_TIFF:
+        case wxDF_PALETTE:
+        default:
+            {
+                wxLogError(_("Unsupported clipboard format."));
+                return FALSE;
+            }
 
 
-bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat)
-{
-     return FALSE;
+        case wxDF_OEMTEXT:
+            dataFormat = wxDF_TEXT;
+            // fall through
+
+        case wxDF_TEXT:
+            {
+               wxString mac ;
+               if ( wxApp::s_macDefaultEncodingIsPC )
+               {
+                       mac = wxMacMakeMacStringFromPC((char *)data) ;
+               }
+               else
+               {
+                       mac = (char *)data ;
+               }
+#if !TARGET_CARBON
+                               err = PutScrap( mac.Length() , 'TEXT' , mac.c_str() ) ;
+#else
+                               ScrapRef        scrap;
+                               err = GetCurrentScrap (&scrap); 
+                               if ( !err )
+                               {
+                                       err = PutScrapFlavor (scrap, 'TEXT', 0, mac.Length(), mac.c_str());
+                               }
+#endif
+                break;
+            }
+    }
+
+    if ( err )
+    {
+        wxLogSysError(_("Failed to set clipboard data."));
+
+        return FALSE;
+    }
+
+    return TRUE;
 }
 
 wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat)
 }
 
 wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat)
@@ -80,11 +246,17 @@ bool wxGetClipboardFormatName(wxDataFormat dataFormat, wxChar *formatName, int m
     return FALSE;
 }
 
     return FALSE;
 }
 
+void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
+{
+    return NULL;
+}
+
+
 /*
  * Generalized clipboard implementation by Matthew Flatt
  */
 
 /*
  * Generalized clipboard implementation by Matthew Flatt
  */
 
-IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject)
+IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxClipboardBase)
 
 wxClipboard::wxClipboard()
 {
 
 wxClipboard::wxClipboard()
 {
@@ -143,9 +315,9 @@ bool wxClipboard::AddData( wxDataObject *data )
 #if wxUSE_DATAOBJ
     wxCHECK_MSG( wxIsClipboardOpened(), FALSE, wxT("clipboard not open") );
 
 #if wxUSE_DATAOBJ
     wxCHECK_MSG( wxIsClipboardOpened(), FALSE, wxT("clipboard not open") );
 
-    wxDataFormat format = data->GetFormat();
+    wxDataFormat format = data->GetPreferredFormat();
 
 
-    switch ( format )
+    switch ( format.GetType() )
     {
         case wxDF_TEXT:
         case wxDF_OEMTEXT:
     {
         case wxDF_TEXT:
         case wxDF_OEMTEXT:
@@ -160,10 +332,10 @@ bool wxClipboard::AddData( wxDataObject *data )
         {
             wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data;
             wxBitmap bitmap(bitmapDataObject->GetBitmap());
         {
             wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data;
             wxBitmap bitmap(bitmapDataObject->GetBitmap());
-            return wxSetClipboardData(data->GetFormat(), &bitmap);
+            return wxSetClipboardData(format, &bitmap);
         }
 
         }
 
-#if wxUSE_METAFILE
+#if 0 // wxUSE_METAFILE
         case wxDF_METAFILE:
         {
             wxMetafileDataObject* metaFileDataObject = 
         case wxDF_METAFILE:
         {
             wxMetafileDataObject* metaFileDataObject = 
@@ -176,11 +348,12 @@ bool wxClipboard::AddData( wxDataObject *data )
 #endif // wxUSE_METAFILE
 
         default:
 #endif // wxUSE_METAFILE
 
         default:
-            return wxSetClipboardData(data);
+ //           return wxSetClipboardData(data);
+                               break ;
     }
 #else // !wxUSE_DATAOBJ
     }
 #else // !wxUSE_DATAOBJ
-    return FALSE;
 #endif 
 #endif 
+    return FALSE;
 }
 
 void wxClipboard::Close()
 }
 
 void wxClipboard::Close()
@@ -188,7 +361,7 @@ void wxClipboard::Close()
     wxCloseClipboard();
 }
 
     wxCloseClipboard();
 }
 
-bool wxClipboard::IsSupported( wxDataFormat format )
+bool wxClipboard::IsSupported( const wxDataFormat &format )
 {
     return wxIsClipboardFormatAvailable(format);
 }
 {
     return wxIsClipboardFormatAvailable(format);
 }
@@ -198,7 +371,7 @@ bool wxClipboard::GetData( wxDataObject& data )
 #if wxUSE_DATAOBJ
     wxCHECK_MSG( wxIsClipboardOpened(), FALSE, wxT("clipboard not open") );
 
 #if wxUSE_DATAOBJ
     wxCHECK_MSG( wxIsClipboardOpened(), FALSE, wxT("clipboard not open") );
 
-    wxDataFormat format = data.GetFormat();
+    wxDataFormat format = data.GetPreferredFormat();
     switch ( format )
     {
         case wxDF_TEXT:
     switch ( format )
     {
         case wxDF_TEXT:
@@ -219,7 +392,7 @@ bool wxClipboard::GetData( wxDataObject& data )
         case wxDF_DIB:
         {
             wxBitmapDataObject& bitmapDataObject = (wxBitmapDataObject &)data;
         case wxDF_DIB:
         {
             wxBitmapDataObject& bitmapDataObject = (wxBitmapDataObject &)data;
-            wxBitmap* bitmap = (wxBitmap *)wxGetClipboardData(data->GetFormat());
+            wxBitmap* bitmap = (wxBitmap *)wxGetClipboardData(format );
             if ( !bitmap )
                 return FALSE;
 
             if ( !bitmap )
                 return FALSE;
 
@@ -228,7 +401,7 @@ bool wxClipboard::GetData( wxDataObject& data )
 
             return TRUE;
         }
 
             return TRUE;
         }
-#if wxUSE_METAFILE
+#if 0 // wxUSE_METAFILE
         case wxDF_METAFILE:
         {
             wxMetafileDataObject& metaFileDataObject = (wxMetafileDataObject &)data;
         case wxDF_METAFILE:
         {
             wxMetafileDataObject& metaFileDataObject = (wxMetafileDataObject &)data;
index e91938f8ad7d402d7e4285767a95d6aa11646d19..c6037a9f964eb9959db27a0dc3f02957e76028e4 100644 (file)
@@ -16,7 +16,9 @@
 
 #include "wx/mac/colordlg.h"
 
 
 #include "wx/mac/colordlg.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
 IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
+#endif
 
 /*
  * wxColourDialog
 
 /*
  * wxColourDialog
index 68abfa77bd2bec2d26134546ad9cbb0a76007813..cc549b5f1144e11e602a5fad4b94f8132ab95a14 100644 (file)
@@ -16,7 +16,9 @@
 #include "wx/gdicmn.h"
 #include "wx/colour.h"
 
 #include "wx/gdicmn.h"
 #include "wx/colour.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
 IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
+#endif
 
 // Colour
 
 
 // Colour
 
index d1fd686a8566ec255f14ac730bd162916010a243..1689c1549076bf34bb11a4c973778aab0c593fb9 100644 (file)
@@ -16,7 +16,9 @@
 #include "wx/combobox.h"
 #include "wx/mac/uma.h"
 
 #include "wx/combobox.h"
 #include "wx/mac/uma.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
+#endif
 
 // right now we don't support editable comboboxes
 
 
 // right now we don't support editable comboboxes
 
@@ -44,7 +46,9 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
                SetControlData( m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
                for ( int i = 0 ; i < n ; i++ )
                {
                SetControlData( m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
                for ( int i = 0 ; i < n ; i++ )
                {
-                       appendmenu( m_macPopUpMenuHandle , choices[i] ) ;
+                       Str255 label;
+                       wxMenuItem::MacBuildMenuString( label , NULL , NULL , choices[i] ,false);
+                       AppendMenu( m_macPopUpMenuHandle , label ) ;
                }
                SetControlMinimum( m_macControl , 0 ) ;
                SetControlMaximum( m_macControl , m_noStrings) ;
                }
                SetControlMinimum( m_macControl , 0 ) ;
                SetControlMaximum( m_macControl , m_noStrings) ;
@@ -125,7 +129,9 @@ void wxComboBox::SetSelection(long from, long to)
 
 void wxComboBox::Append(const wxString& item)
 {
 
 void wxComboBox::Append(const wxString& item)
 {
-       appendmenu( m_macPopUpMenuHandle , item ) ;
+       Str255 label;
+       wxMenuItem::MacBuildMenuString( label , NULL , NULL , item ,false);
+       AppendMenu( m_macPopUpMenuHandle , label ) ;
     m_noStrings ++;
        SetControlMaximum( m_macControl , m_noStrings) ;
 }
     m_noStrings ++;
        SetControlMaximum( m_macControl , m_noStrings) ;
 }
index f6fa56cb91b0ef5859aa363bb0c6d858e35bdf95..161d1b71b19d575af43efb753e0e506d861d1563 100644 (file)
 #include "wx/control.h"
 #include "wx/notebook.h"
 #include "wx/tabctrl.h"
 #include "wx/control.h"
 #include "wx/notebook.h"
 #include "wx/tabctrl.h"
+#include "wx/radiobox.h"
 #include "wx/spinbutt.h"
 
 #include "wx/spinbutt.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
 
 IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
 
-BEGIN_EVENT_TABLE(wxControl, wxControlBase)
+BEGIN_EVENT_TABLE(wxControl, wxWindow)
        EVT_MOUSE_EVENTS( wxControl::OnMouseEvent ) 
        EVT_CHAR( wxControl::OnKeyDown ) 
        EVT_PAINT( wxControl::OnPaint ) 
 END_EVENT_TABLE()
        EVT_MOUSE_EVENTS( wxControl::OnMouseEvent ) 
        EVT_CHAR( wxControl::OnKeyDown ) 
        EVT_PAINT( wxControl::OnPaint ) 
 END_EVENT_TABLE()
+#endif
 
 #include <wx/mac/uma.h>
 
 
 #include <wx/mac/uma.h>
 
@@ -32,6 +35,7 @@ END_EVENT_TABLE()
 
 ControlActionUPP wxMacLiveScrollbarActionUPP = NULL ;
 
 
 ControlActionUPP wxMacLiveScrollbarActionUPP = NULL ;
 
+pascal void wxMacLiveScrollbarActionProc( ControlHandle control , ControlPartCode partCode ) ;
 pascal void wxMacLiveScrollbarActionProc( ControlHandle control , ControlPartCode partCode )
 {
        if ( partCode != 0)
 pascal void wxMacLiveScrollbarActionProc( ControlHandle control , ControlPartCode partCode )
 {
        if ( partCode != 0)
@@ -46,9 +50,9 @@ pascal void wxMacLiveScrollbarActionProc( ControlHandle control , ControlPartCod
 
 wxControl::wxControl()
 {
 
 wxControl::wxControl()
 {
-               m_macControl = NULL ;
-               m_macHorizontalBorder = 0 ; // additional pixels around the real control
-               m_macVerticalBorder = 0 ;
+       m_macControl = NULL ;
+       m_macHorizontalBorder = 0 ; // additional pixels around the real control
+       m_macVerticalBorder = 0 ;
     m_backgroundColour = *wxWHITE;
     m_foregroundColour = *wxBLACK;
 #if WXWIN_COMPATIBILITY
     m_backgroundColour = *wxWHITE;
     m_foregroundColour = *wxBLACK;
 #if WXWIN_COMPATIBILITY
@@ -61,6 +65,24 @@ wxControl::wxControl()
        }
 }
 
        }
 }
 
+bool wxControl::Create(wxWindow *parent, wxWindowID id,
+                       const wxPoint& pos,
+                       const wxSize& size, long style,
+                       const wxValidator& validator,
+                       const wxString& name)
+{
+       m_macControl = NULL ;
+       m_macHorizontalBorder = 0 ; // additional pixels around the real control
+       m_macVerticalBorder = 0 ;
+    bool rval = wxWindow::Create(parent, id, pos, size, style, name);
+    if (rval) {
+#if wxUSE_VALIDATORS
+        SetValidator(validator);
+#endif
+    }
+    return rval;
+}
+
 wxControl::~wxControl()
 {
     m_isBeingDeleted = TRUE;
 wxControl::~wxControl()
 {
     m_isBeingDeleted = TRUE;
@@ -79,21 +101,6 @@ wxControl::~wxControl()
     }
 }
 
     }
 }
 
-bool wxControl::Create(wxWindow *parent, wxWindowID id,
-                       const wxPoint& pos,
-                       const wxSize& size, long style,
-                       const wxValidator& validator,
-                       const wxString& name)
-{
-    bool rval = wxWindow::Create(parent, id, pos, size, style, name);
-    if (rval) {
-#if wxUSE_VALIDATORS
-        SetValidator(validator);
-#endif
-    }
-    return rval;
-}
-
 void wxControl::SetLabel(const wxString& title)
 {
        m_label = title ;
 void wxControl::SetLabel(const wxString& title)
 {
        m_label = title ;
@@ -222,7 +229,7 @@ void wxControl::MacPostControlCreate()
        {
                // no font
        }
        {
                // no font
        }
-       else if ( IsKindOf( CLASSINFO( wxStaticBox ) ) )
+       else if ( IsKindOf( CLASSINFO( wxStaticBox ) ) || IsKindOf( CLASSINFO( wxRadioBox ) ) || IsKindOf( CLASSINFO( wxButton ) ) )
        {
                ControlFontStyleRec             controlstyle ;
                controlstyle.flags = kControlUseFontMask ;
        {
                ControlFontStyleRec             controlstyle ;
                controlstyle.flags = kControlUseFontMask ;
@@ -275,14 +282,16 @@ void wxControl::MacAdjustControlRect()
                {
                        if ( IsKindOf( CLASSINFO( wxButton ) ) )
                        {
                {
                        if ( IsKindOf( CLASSINFO( wxButton ) ) )
                        {
-                               m_width = m_label.Length() * 8 + 12 + 2 * m_macHorizontalBorder;
+                               m_width = m_label.Length() * 8 + 12 ;
                        }
                        else if ( IsKindOf( CLASSINFO( wxStaticText ) ) )
                        {
                                m_width = m_label.Length() * 8 ;
                        }
                        else
                        }
                        else if ( IsKindOf( CLASSINFO( wxStaticText ) ) )
                        {
                                m_width = m_label.Length() * 8 ;
                        }
                        else
-                               m_width = bestsize.right - bestsize.left + 2 * m_macHorizontalBorder;
+                               m_width = bestsize.right - bestsize.left ;
+                       
+                       m_width += 2 * m_macHorizontalBorder ;
                }
                if ( m_height == -1 )
                {
                }
                if ( m_height == -1 )
                {
@@ -296,7 +305,7 @@ void wxControl::MacAdjustControlRect()
                wxMacDrawingHelper helper ( wxFindWinFromMacWindow( GetMacRootWindow() ) ) ;
                if ( helper.Ok() )
                {
                wxMacDrawingHelper helper ( wxFindWinFromMacWindow( GetMacRootWindow() ) ) ;
                if ( helper.Ok() )
                {
-           UMASizeControl( m_macControl , m_width - 2 * m_macHorizontalBorder, m_height -  2 * m_macVerticalBorder ) ;
+               UMASizeControl( m_macControl , m_width - 2 * m_macHorizontalBorder, m_height -  2 * m_macVerticalBorder ) ;
                }
        }
 }
                }
        }
 }
@@ -312,8 +321,10 @@ void wxControl::MacSuperChangedPosition()
 {
        if ( m_macControl )
        {
 {
        if ( m_macControl )
        {
-               int former_mac_x = (**m_macControl).contrlRect.left ;
-               int former_mac_y = (**m_macControl).contrlRect.top ;
+               Rect contrlRect ;               
+               GetControlBounds( m_macControl , &contrlRect ) ; 
+               int former_mac_x = contrlRect.left ;
+               int former_mac_y = contrlRect.top ;
                int mac_x = m_x ;
                int mac_y = m_y ;
                GetParent()->MacClientToRootWindow( & mac_x , & mac_y ) ;
                int mac_x = m_x ;
                int mac_y = m_y ;
                GetParent()->MacClientToRootWindow( & mac_x , & mac_y ) ;
@@ -327,12 +338,12 @@ void wxControl::MacSuperChangedPosition()
                {
                        {
                                Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
                {
                        {
                                Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
-                               InvalRect( &inval ) ;
+                               InvalWindowRect( rootwindow , &inval ) ;
                        }
                        }
-               UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y + m_macVerticalBorder ) ;
+                       UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y + m_macVerticalBorder ) ;
                        {
                                Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
                        {
                                Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
-                               InvalRect( &inval ) ;
+                               InvalWindowRect( rootwindow , &inval ) ;
                        }
                }
                if ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
                        }
                }
                if ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
@@ -378,7 +389,7 @@ void wxControl::MacSuperEnabled( bool enabled )
                }
        }
        wxWindow::MacSuperEnabled( enabled ) ;
                }
        }
        wxWindow::MacSuperEnabled( enabled ) ;
-       */
+*/
 }
 
 void  wxControl::MacSuperShown( bool show ) 
 }
 
 void  wxControl::MacSuperShown( bool show ) 
@@ -418,8 +429,10 @@ void  wxControl::DoSetSize(int x, int y,
        int former_w = m_width ;
        int former_h = m_height ;
        
        int former_w = m_width ;
        int former_h = m_height ;
        
-       int former_mac_x = (**m_macControl).contrlRect.left ;
-       int former_mac_y = (**m_macControl).contrlRect.top ;
+       Rect contrlRect ;               
+       GetControlBounds( m_macControl , &contrlRect ) ; 
+       int former_mac_x = contrlRect.left ;
+       int former_mac_y = contrlRect.top ;
        
   int currentX, currentY;
   GetPosition(&currentX, &currentY);
        
   int currentX, currentY;
   GetPosition(&currentX, &currentY);
@@ -430,9 +443,9 @@ void  wxControl::DoSetSize(int x, int y,
   int actualHeight = height;
   int actualX = x;
   int actualY = y;
   int actualHeight = height;
   int actualX = x;
   int actualY = y;
-  if (x == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+  if (x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
       actualX = currentX;
       actualX = currentX;
-  if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+  if (y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
       actualY = currentY;
   if (width == -1)
       actualWidth = currentW ;
       actualY = currentY;
   if (width == -1)
       actualWidth = currentW ;
@@ -443,7 +456,8 @@ void  wxControl::DoSetSize(int x, int y,
                return ;
                
        AdjustForParentClientOrigin(actualX, actualY, sizeFlags);
                return ;
                
        AdjustForParentClientOrigin(actualX, actualY, sizeFlags);
-       wxMacDrawingHelper focus( wxFindWinFromMacWindow( GetMacRootWindow() ) ) ;
+       WindowRef macrootwindow = GetMacRootWindow() ;
+       wxMacDrawingHelper focus( wxFindWinFromMacWindow( macrootwindow ) ) ;
 
        int mac_x = actualX ;
        int mac_y = actualY ;
 
        int mac_x = actualX ;
        int mac_y = actualY ;
@@ -453,12 +467,12 @@ void  wxControl::DoSetSize(int x, int y,
        {
                {
                        Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
        {
                {
                        Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
-                       InvalRect( &inval ) ;
+                       InvalWindowRect( macrootwindow, &inval ) ;
                }
                }
-       UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y  + m_macVerticalBorder ) ;
+               UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y  + m_macVerticalBorder ) ;
                {
                        Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
                {
                        Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
-                       InvalRect( &inval ) ;
+                       InvalWindowRect(macrootwindow, &inval ) ;
                }
        }
 
                }
        }
 
@@ -477,15 +491,15 @@ void  wxControl::DoSetSize(int x, int y,
        {
                {
                        Rect inval = { mac_y , mac_x , mac_y + former_h , mac_x + former_w } ;
        {
                {
                        Rect inval = { mac_y , mac_x , mac_y + former_h , mac_x + former_w } ;
-                       InvalRect( &inval ) ;
+                       InvalWindowRect( macrootwindow, &inval ) ;
                }
                m_width = actualWidth ;
                m_height = actualHeight ;
 
                }
                m_width = actualWidth ;
                m_height = actualHeight ;
 
-       UMASizeControl( m_macControl ,  m_width - 2 * m_macHorizontalBorder, m_height -  2 * m_macVerticalBorder ) ;
+               UMASizeControl( m_macControl ,  m_width - 2 * m_macHorizontalBorder, m_height -  2 * m_macVerticalBorder ) ;
                {
                        Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
                {
                        Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
-                       InvalRect( &inval ) ;
+                       InvalWindowRect( macrootwindow , &inval ) ;
                }
 
                MacRepositionScrollBars() ;
                }
 
                MacRepositionScrollBars() ;
@@ -555,6 +569,47 @@ void wxControl::Refresh(bool eraseBack, const wxRect *rect)
   }
 }
 
   }
 }
 
+void wxControl::MacRedrawControl()
+{
+       if ( m_macControl )
+       {
+               WindowRef window = GetMacRootWindow() ;
+               if ( window )
+               {
+                       wxWindow* win = wxFindWinFromMacWindow( window ) ;
+                       if ( win )
+                       {
+                               wxMacDrawingHelper help( win ) ;
+                               // the mac control manager always assumes to have the origin at 0,0
+                               SetOrigin( 0 , 0 ) ;
+                               
+                               bool                    hasTabBehind = false ;
+                               wxWindow* parent = GetParent() ;
+                               while ( parent )
+                               {
+                                       if( parent->MacGetWindowData() )
+                                       {
+                                               UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
+                                               break ;
+                                       }
+                                       
+                                       if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) ||  parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
+                                       {
+                                               if ( ((wxControl*)parent)->m_macControl )
+                                                       SetUpControlBackground( ((wxControl*)parent)->m_macControl , -1 , true ) ;
+                                               break ;
+                                       }
+                                       
+                                       parent = parent->GetParent() ;
+                               } 
+                               
+                               UMADrawControl( m_macControl ) ;
+                               UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
+                       }
+               }
+       }
+}
+
 void wxControl::OnPaint(wxPaintEvent& event)
 {
        if ( m_macControl )
 void wxControl::OnPaint(wxPaintEvent& event)
 {
        if ( m_macControl )
@@ -566,6 +621,7 @@ void wxControl::OnPaint(wxPaintEvent& event)
                        if ( win )
                        {
                                wxMacDrawingHelper help( win ) ;
                        if ( win )
                        {
                                wxMacDrawingHelper help( win ) ;
+                               // the mac control manager always assumes to have the origin at 0,0
                                SetOrigin( 0 , 0 ) ;
                                
                                bool                    hasTabBehind = false ;
                                SetOrigin( 0 , 0 ) ;
                                
                                bool                    hasTabBehind = false ;
@@ -629,7 +685,7 @@ void  wxControl::OnMouseEvent( wxMouseEvent &event )
                return ;
        }
                
                return ;
        }
                
-       if (event.GetEventType() == wxEVT_LEFT_DOWN )
+       if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
        {
                        
                int x = event.m_x ;
        {
                        
                int x = event.m_x ;
index dee7c92b5f128a56414063d82a3aa8ce27d7c8f1..fa0bbf76b29f7000d68470e8dfcaa34a1372fcbe 100644 (file)
 #include "wx/cursor.h"
 #include "wx/icon.h"
 
 #include "wx/cursor.h"
 #include "wx/icon.h"
 
+#if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap)
 IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap)
+#endif
 
 const short kwxCursorHandId = 9 ;
 const short kwxCursorSizeWEId = 10 ;
 const short kwxCursorSizeNSId = 11 ;
 
 const short kwxCursorHandId = 9 ;
 const short kwxCursorSizeWEId = 10 ;
 const short kwxCursorSizeNSId = 11 ;
+#if !TARGET_CARBON
 Cursor*                MacArrowCursorPtr = &qd.arrow ;
 CursHandle     MacArrowCursor = &MacArrowCursorPtr ;
 Cursor*                MacArrowCursorPtr = &qd.arrow ;
 CursHandle     MacArrowCursor = &MacArrowCursorPtr ;
+#else
+bool           MacArrowInstalled = false ;
+Cursor                 MacArrow ;
+Cursor*                MacArrowCursorPtr = &MacArrow ;
+CursHandle     MacArrowCursor = &MacArrowCursorPtr ;
+#endif
 CursHandle     gMacCurrentCursor = NULL ;
 
 wxCursorRefData::wxCursorRefData()
 {
 CursHandle     gMacCurrentCursor = NULL ;
 
 wxCursorRefData::wxCursorRefData()
 {
+#if TARGET_CARBON
+       if ( !MacArrowInstalled )
+       {
+               MacArrowCursorPtr = GetQDGlobalsArrow( &MacArrow ) ;
+               MacArrowInstalled = true ;
+       }
+#endif
     m_width = 32; 
     m_height = 32;
     m_hCursor = NULL ;
     m_width = 32; 
     m_height = 32;
     m_hCursor = NULL ;
@@ -34,8 +50,8 @@ wxCursorRefData::wxCursorRefData()
 
 wxCursorRefData::~wxCursorRefData()
 {
 
 wxCursorRefData::~wxCursorRefData()
 {
-       if ( m_hCursor && ( m_hCursor != MacArrowCursor ) )
-               ::DisposeHandle( (Handle) m_hCursor ) ;
+//     if ( m_hCursor && ( m_hCursor != MacArrowCursor ) )
+//             ::ReleaseResource( (Handle) m_hCursor ) ;
 }
 
 // Cursors
 }
 
 // Cursors
index fab57c49fef17f87d70ee7667be89d140b02688a..cb3ff34b9c5e33380e2012d2f04d090f1af07689 100644 (file)
@@ -102,8 +102,8 @@ const wxChar *wxFrameNameStr = wxT("frame");
 const wxChar *wxGaugeNameStr = wxT("gauge");
 const wxChar *wxStaticBoxNameStr = wxT("groupBox");
 const wxChar *wxListBoxNameStr = wxT("listBox");
 const wxChar *wxGaugeNameStr = wxT("gauge");
 const wxChar *wxStaticBoxNameStr = wxT("groupBox");
 const wxChar *wxListBoxNameStr = wxT("listBox");
-const wxChar *wxStaticTextNameStr = wxT("message");
-const wxChar *wxStaticBitmapNameStr = wxT("message");
+const wxChar *wxStaticTextNameStr = wxT("statictext");
+const wxChar *wxStaticBitmapNameStr = wxT("staticbitmap");
 const wxChar *wxMultiTextNameStr = wxT("multitext");
 const wxChar *wxPanelNameStr = wxT("panel");
 const wxChar *wxRadioBoxNameStr = wxT("radioBox");
 const wxChar *wxMultiTextNameStr = wxT("multitext");
 const wxChar *wxPanelNameStr = wxT("panel");
 const wxChar *wxRadioBoxNameStr = wxT("radioBox");
@@ -134,5 +134,17 @@ const wxChar *wxDirDialogDefaultFolderStr = wxT("/");
 const wxChar *wxFloatToStringStr = wxT("%.2f");
 const wxChar *wxDoubleToStringStr = wxT("%.2f");
 
 const wxChar *wxFloatToStringStr = wxT("%.2f");
 const wxChar *wxDoubleToStringStr = wxT("%.2f");
 
+#if wxUSE_SHARED_LIBRARY
+///// Event tables (also must be in one, statically-linked file for shared libraries)
+
+// This is the base, wxEvtHandler 'bootstrap' code which is expanded manually here
+const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; }
+
+const wxEventTable wxEvtHandler::sm_eventTable =
+       { NULL, &wxEvtHandler::sm_eventTableEntries[0] };
+
+const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { { 0, 0, 0, NULL } };
+#endif
+
 const wxSize wxDefaultSize(-1, -1);
 const wxPoint wxDefaultPosition(-1, -1);
 const wxSize wxDefaultSize(-1, -1);
 const wxPoint wxDefaultPosition(-1, -1);
index fbaf93061d047c52b5cc810e653988511e50e13c..67f938b414edce2d0a2b403b55adb0c43627ab05 100644 (file)
 
 wxDataFormat::wxDataFormat()
 {
 
 wxDataFormat::wxDataFormat()
 {
-    m_vType = wxDF_INVALID;
-    m_vFormat = 0;
+    m_type = wxDF_INVALID;
+    m_format = 0;
 }
 
 }
 
-wxDataFormat::wxDataFormat(
-  wxDataFormatId                    vType
-)
+wxDataFormat::wxDataFormat(  wxDataFormatId   vType )
 {
 {
-    PrepareFormats();
     SetType(vType);
 }
 
     SetType(vType);
 }
 
-wxDataFormat::wxDataFormat(
-  const wxChar*                     zId
-)
+wxDataFormat::wxDataFormat(  const wxChar*  zId)
 {
 {
-    PrepareFormats();
     SetId(zId);
 }
 
     SetId(zId);
 }
 
-wxDataFormat::wxDataFormat(
-  const wxString&                   rId
-)
+wxDataFormat::wxDataFormat(  const wxString&   rId)
 {
 {
-    PrepareFormats();
     SetId(rId);
 }
 
     SetId(rId);
 }
 
-wxDataFormat::wxDataFormat(
-  NativeFormat                      vFormat
-)
+wxDataFormat::wxDataFormat( NativeFormat vFormat)
 {
 {
-    PrepareFormats();
     SetId(vFormat);
 }
 
     SetId(vFormat);
 }
 
-void wxDataFormat::SetType(
-  wxDataFormatId                    vType
-)
+void wxDataFormat::SetType(  wxDataFormatId  Type )
 {
 {
-    m_vType = vType;
-
-    if (m_vType == wxDF_TEXT)
-        m_vFormat = 0;
-    else
-    if (m_vType == wxDF_BITMAP)
-        m_vFormat = 0;
-    else
-    if (m_vType == wxDF_FILENAME)
-        m_vFormat = 0;
+    m_type = Type;
+
+    if (m_type == wxDF_TEXT)
+        m_format = 'TEXT';
+    else if (m_type == wxDF_BITMAP || m_type == wxDF_METAFILE )
+        m_format = 'PICT';
+    else if (m_type == wxDF_FILENAME)
+        m_format = 'SPEC';
     else
     {
        wxFAIL_MSG( wxT("invalid dataformat") );
     else
     {
        wxFAIL_MSG( wxT("invalid dataformat") );
@@ -102,56 +86,37 @@ void wxDataFormat::SetType(
 
 wxDataFormatId wxDataFormat::GetType() const
 {
 
 wxDataFormatId wxDataFormat::GetType() const
 {
-    return m_vType;
+    return m_type;
 }
 
 wxString wxDataFormat::GetId() const
 {
 }
 
 wxString wxDataFormat::GetId() const
 {
-    wxString                        sRet("");  // TODO: gdk_atom_name( m_format ) );
+    wxString sRet("");  // TODO: to name of ( m_format ) );
     return sRet;
 }
 
     return sRet;
 }
 
-void wxDataFormat::SetId(
-  NativeFormat                      vFormat
-)
+void wxDataFormat::SetId(  NativeFormat  format )
 {
 {
-    m_vFormat = vFormat;
-// TODO:
-/*
-    if (m_format == g_textAtom)
+    m_format = format;
+
+    if (m_format == 'TEXT')
         m_type = wxDF_TEXT;
     else
         m_type = wxDF_TEXT;
     else
-    if (m_format == g_pngAtom)
+    if (m_format == 'PICT')
         m_type = wxDF_BITMAP;
     else
         m_type = wxDF_BITMAP;
     else
-    if (m_format == g_fileAtom)
+    if (m_format == 'SPEC')
         m_type = wxDF_FILENAME;
     else
         m_type = wxDF_PRIVATE;
         m_type = wxDF_FILENAME;
     else
         m_type = wxDF_PRIVATE;
-*/
 }
 
 }
 
-void wxDataFormat::SetId(
-  const wxChar*                     zId
-)
+void wxDataFormat::SetId( const wxChar* zId )
 {
     wxString                        tmp(zId);
 
 {
     wxString                        tmp(zId);
 
-    m_vType = wxDF_PRIVATE;
-    m_vFormat = 0;// TODO: get the format gdk_atom_intern( wxMBSTRINGCAST tmp.mbc_str(), FALSE );
-}
-
-void wxDataFormat::PrepareFormats()
-{
-// TODO:
-/*
-    if (!g_textAtom)
-        g_textAtom = gdk_atom_intern( "STRING", FALSE );
-    if (!g_pngAtom)
-        g_pngAtom = gdk_atom_intern( "image/png", FALSE );
-    if (!g_fileAtom)
-        g_fileAtom = gdk_atom_intern( "file:ALL", FALSE );
-*/
+    m_type = wxDF_PRIVATE;
+    m_format = 0;// TODO: get the format gdk_atom_intern( wxMBSTRINGCAST tmp.mbc_str(), FALSE );
 }
 
 //-------------------------------------------------------------------------
 }
 
 //-------------------------------------------------------------------------
index ecbb3ca70366564e1087d724907571bf8c4d56f0..1682209492529b1cfe5abd1cacf95ab92cad9d54 100644 (file)
 #endif
 
 #include "wx/dc.h"
 #endif
 
 #include "wx/dc.h"
+#include "wx/mac/uma.h"
 
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
 IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
+#endif
 
 //-----------------------------------------------------------------------------
 // constants
 
 //-----------------------------------------------------------------------------
 // constants
@@ -34,7 +37,7 @@ long wxDC::m_macCurrentPortId = 1 ;
 // wxDC
 //-----------------------------------------------------------------------------
 
 // wxDC
 //-----------------------------------------------------------------------------
 
-wxDC::wxDC(void)
+wxDC::wxDC()
 {
   m_ok = FALSE;
   m_optimize = FALSE;
 {
   m_ok = FALSE;
   m_optimize = FALSE;
@@ -42,8 +45,8 @@ wxDC::wxDC(void)
   m_colour = TRUE;
   m_clipping = FALSE;
   
   m_colour = TRUE;
   m_clipping = FALSE;
   
-  m_mm_to_pix_x = 1.0;
-  m_mm_to_pix_y = 1.0;
+  m_mm_to_pix_x = mm2pt;
+  m_mm_to_pix_y = mm2pt;
   
   m_logicalOriginX = 0;
   m_logicalOriginY = 0;
   
   m_logicalOriginX = 0;
   m_logicalOriginY = 0;
@@ -102,20 +105,32 @@ wxDC::wxDC(void)
 
 wxDC::~wxDC(void)
 {
 
 wxDC::~wxDC(void)
 {
+       if ( !m_macPortHelper.IsCleared() )
+       {
+       GrafPtr port ;
+       GetPort( &port ) ;
+       SetPort( m_macPortHelper.GetCurrentPort() ) ;
+       SetOrigin( 0 , 0 ) ;
+       SetPort( port ) ;
+       }
+       /*
        if ( m_macPort )
        {
        if ( m_macPort )
        {
+               ::SetPort( m_macPort ) ;
                ::SetOrigin( 0 , 0 ) ;
                ::ClipRect( &m_macPort->portRect ) ;
                ::PenNormal() ;
                ::SetPort( m_macOrigPort ) ;
        }
                ::SetOrigin( 0 , 0 ) ;
                ::ClipRect( &m_macPort->portRect ) ;
                ::PenNormal() ;
                ::SetPort( m_macOrigPort ) ;
        }
+       */
        ++m_macCurrentPortId ;
 };
 
 void wxDC::MacSetupPort() const
 {
        ++m_macCurrentPortId ;
 };
 
 void wxDC::MacSetupPort() const
 {
+       AGAPortHelper* help = &m_macPortHelper ;
+       help->Setup( m_macPort ) ;
        m_macPortId = ++m_macCurrentPortId ;
        m_macPortId = ++m_macCurrentPortId ;
-       ::SetPort(m_macPort);
        ::SetOrigin(-m_macLocalOrigin.h, -m_macLocalOrigin.v);
        ::ClipRect(&m_macClipRect);
 
        ::SetOrigin(-m_macLocalOrigin.h, -m_macLocalOrigin.v);
        ::ClipRect(&m_macClipRect);
 
@@ -124,8 +139,10 @@ void wxDC::MacSetupPort() const
        m_macPenInstalled = false ;     
 }
 
        m_macPenInstalled = false ;     
 }
 
-void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
+void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask )
 {
 {
+       float scale = 1.0 ;
+       
   if (!Ok()) 
        return;
   MacVerifySetup() ;
   if (!Ok()) 
        return;
   MacVerifySetup() ;
@@ -140,7 +157,7 @@ void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
     {
                        if ( bmap->m_bitmapType == kMacBitmapTypePict )
                        { 
     {
                        if ( bmap->m_bitmapType == kMacBitmapTypePict )
                        { 
-               Rect bitmaprect = { 0 , 0 , bmap->m_height , bmap->m_width } ;
+               Rect bitmaprect = { 0 , 0 , bmap->m_height * scale , bmap->m_width * scale} ;
                                ::OffsetRect( &bitmaprect , xx1 , yy1 ) ;
                                ::DrawPicture( bmap->m_hPict , &bitmaprect ) ;
                        }
                                ::OffsetRect( &bitmaprect , xx1 , yy1 ) ;
                                ::DrawPicture( bmap->m_hPict , &bitmaprect ) ;
                        }
@@ -165,20 +182,21 @@ void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
                                                source.bottom = bmap->m_height ;
                                                dest.top = YLOG2DEV(y) ;
                                                dest.left = XLOG2DEV(x) ;
                                                source.bottom = bmap->m_height ;
                                                dest.top = YLOG2DEV(y) ;
                                                dest.left = XLOG2DEV(x) ;
-                                               dest.bottom = YLOG2DEV(y + bmap->m_height )  ;
-                                               dest.right = XLOG2DEV(x + bmap->m_width ) ;
+                                               dest.bottom = YLOG2DEV(y + bmap->m_height * scale)  ;
+                                               dest.right = XLOG2DEV(x + bmap->m_width * scale ) ;
        
                                                if ( useMask && bmp.GetMask() )
                                                {
                                                        if ( LockPixels( GetGWorldPixMap( bmp.GetMask()->GetMaskBitmap( ) ) ) )
                                                        {
        
                                                if ( useMask && bmp.GetMask() )
                                                {
                                                        if ( LockPixels( GetGWorldPixMap( bmp.GetMask()->GetMaskBitmap( ) ) ) )
                                                        {
-                                                               CopyMask( &GrafPtr( bmapworld )->portBits , &GrafPtr( bmp.GetMask()->GetMaskBitmap( ) )->portBits , &GrafPtr( m_macPort )->portBits ,
+                                                               CopyMask( GetPortBitMapForCopyBits( bmapworld ) , GetPortBitMapForCopyBits( bmp.GetMask()->GetMaskBitmap( ) ) ,
+                                                                GetPortBitMapForCopyBits( m_macPort ) ,
                                                                        &source, &source , &dest ) ;
                                                                UnlockPixels( GetGWorldPixMap( bmp.GetMask()->GetMaskBitmap( ) )  ) ;
                                                        }
                                                }
                                                else
                                                                        &source, &source , &dest ) ;
                                                                UnlockPixels( GetGWorldPixMap( bmp.GetMask()->GetMaskBitmap( ) )  ) ;
                                                        }
                                                }
                                                else
-                                                       CopyBits( &GrafPtr( bmapworld )->portBits , &GrafPtr( m_macPort )->portBits ,
+                                                       CopyBits( GetPortBitMapForCopyBits( bmapworld ) , GetPortBitMapForCopyBits( m_macPort ),
                                                                &source, &dest, srcCopy, NULL ) ;
 
                                                UnlockPixels( bmappixels ) ;
                                                                &source, &dest, srcCopy, NULL ) ;
 
                                                UnlockPixels( bmappixels ) ;
@@ -192,7 +210,7 @@ void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
        }
 }
 
        }
 }
 
-void wxDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
+void wxDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y )
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -213,69 +231,9 @@ void wxDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
        }
 };
 
        }
 };
 
-void wxDC::DrawPoint( wxPoint& point ) 
-{ 
-  DrawPoint( point.x, point.y ); 
-};
-
-void wxDC::DrawPolygon( wxList *list, long xoffset, long yoffset, int fillStyle )
-{
-  int n = list->Number();
-  wxPoint *points = new wxPoint[n];
-
-  int i = 0;
-  for( wxNode *node = list->First(); node; node = node->Next() )
-  {
-    wxPoint *point = (wxPoint *)node->Data();
-    points[i].x = point->x;
-    points[i++].y = point->y;
-  };
-  DrawPolygon( n, points, xoffset, yoffset, fillStyle );
-  delete[] points;
-};
-
-void wxDC::DrawLines( wxList *list, long xoffset, long yoffset )
-{
-  int n = list->Number();
-  wxPoint *points = new wxPoint[n];
-
-  int i = 0;
-  for( wxNode *node = list->First(); node; node = node->Next() ) 
-  {
-    wxPoint *point = (wxPoint *)node->Data();
-    points[i].x = point->x;
-    points[i++].y = point->y;
-  };
-  DrawLines( n, points, xoffset, yoffset );
-  delete []points;
-};
-
-void wxDC::DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 )
+void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
 {
 {
-  wxList list;
-  list.Append( (wxObject*)new wxPoint(x1, y1) );
-  list.Append( (wxObject*)new wxPoint(x2, y2) );
-  list.Append( (wxObject*)new wxPoint(x3, y3) );
-  DrawSpline(&list);
-  wxNode *node = list.First();
-  while (node)
-  {
-    wxPoint *p = (wxPoint*)node->Data();
-    delete p;
-    node = node->Next();
-  };
-};
-
-void wxDC::DrawSpline( int n, wxPoint points[] )
-{
-  wxList list;
-  for (int i = 0; i < n; i++) list.Append( (wxObject*)&points[i] );
-  DrawSpline( &list );
-};
-
-void wxDC::SetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
-{
-  MacVerifySetup() ;
+       MacVerifySetup() ;
        if( m_clipping )
        {
                m_clipX1 = wxMax( m_clipX1 , x ) ;
        if( m_clipping )
        {
                m_clipX1 = wxMax( m_clipX1 , x ) ;
@@ -300,13 +258,24 @@ void wxDC::SetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord heigh
        
        Rect clip = { y1 , x1 , y2 , x2 } ;
        
        
        Rect clip = { y1 , x1 , y2 , x2 } ;
        
-  ::ClipRect( &clip ) ;
+       ::ClipRect( &clip ) ;
 
 };
 
 
 };
 
-void wxDC::SetClippingRegion(const wxRect& rect)
-{ 
-       SetClippingRegion(rect.x, rect.y, rect.width, rect.height); 
+void wxDC::DoSetClippingRegionAsRegion( const wxRegion &region  )
+{
+    wxCHECK_RET( Ok(), wxT("invalid window dc") );
+
+       MacVerifySetup() ;
+    if (region.Empty())
+    {
+        DestroyClippingRegion();
+        return;
+    }
+
+    wxCoord xx, yy, ww, hh;
+    region.GetBox( xx, yy, ww, hh );
+    wxDC::DoSetClippingRegion( xx, yy, ww, hh );
 }
 
 void wxDC::DestroyClippingRegion(void)
 }
 
 void wxDC::DestroyClippingRegion(void)
@@ -316,48 +285,14 @@ void wxDC::DestroyClippingRegion(void)
 //     Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
        ::ClipRect(&m_macClipRect);
 };
 //     Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
        ::ClipRect(&m_macClipRect);
 };
-
-void wxDC::GetClippingBox( wxCoord *x, wxCoord *y, wxCoord *width, wxCoord *height ) const
-{
-  if (m_clipping)
-  {
-    if (x) *x = m_clipX1;
-    if (y) *y = m_clipY1;
-    if (width) *width = (m_clipX2 - m_clipX1);
-    if (height) *height = (m_clipY2 - m_clipY1);
-  }
-  else
-   *x = *y = *width = *height = 0;
-};
-
-void wxDC::GetClippingBox( long *x, long *y, long *width, long *height ) const
-{
-  if (m_clipping)
-  {
-    if (x) *x = m_clipX1;
-    if (y) *y = m_clipY1;
-    if (width) *width = (m_clipX2 - m_clipX1);
-    if (height) *height = (m_clipY2 - m_clipY1);
-  }
-  else
-   *x = *y = *width = *height = 0;
-};
-
-void wxDC::GetClippingBox(wxRect& rect) const
-{
-  // Necessary to use intermediate variables for 16-bit compilation
-  wxCoord x, y, w, h;
-  GetClippingBox(&x, &y, &w, &h);
-  rect.x = x; rect.y = y; rect.width = w; rect.height = h;
-}
     
     
-void wxDC::GetSize( int* width, int* height ) const
+void wxDC::DoGetSize( int* width, int* height ) const
 {
   *width = m_maxX-m_minX;
   *height = m_maxY-m_minY;
 };
 
 {
   *width = m_maxX-m_minX;
   *height = m_maxY-m_minY;
 };
 
-void wxDC::GetSizeMM( long* width, long* height ) const
+void wxDC::DoGetSizeMM( int* width, int* height ) const
 {
   int w = 0;
   int h = 0;
 {
   int w = 0;
   int h = 0;
@@ -416,12 +351,6 @@ void wxDC::SetUserScale( double x, double y )
   ComputeScaleAndOrigin();
 };
 
   ComputeScaleAndOrigin();
 };
 
-void wxDC::GetUserScale( double *x, double *y )
-{
-  if (x) *x = m_userScaleX;
-  if (y) *y = m_userScaleY;
-};
-
 void wxDC::SetLogicalScale( double x, double y )
 {
   // allow negative ?
 void wxDC::SetLogicalScale( double x, double y )
 {
   // allow negative ?
@@ -430,40 +359,20 @@ void wxDC::SetLogicalScale( double x, double y )
   ComputeScaleAndOrigin();
 };
 
   ComputeScaleAndOrigin();
 };
 
-void wxDC::GetLogicalScale( double *x, double *y )
-{
-  if (x) *x = m_logicalScaleX;
-  if (y) *y = m_logicalScaleY;
-};
-
-void wxDC::SetLogicalOrigin( long x, long y )
+void wxDC::SetLogicalOrigin( wxCoord x, wxCoord y )
 {
   m_logicalOriginX = x * m_signX;   // is this still correct ?
   m_logicalOriginY = y * m_signY;
   ComputeScaleAndOrigin();
 };
 
 {
   m_logicalOriginX = x * m_signX;   // is this still correct ?
   m_logicalOriginY = y * m_signY;
   ComputeScaleAndOrigin();
 };
 
-void wxDC::GetLogicalOrigin( long *x, long *y )
-{
-  if (x) *x = m_logicalOriginX;
-  if (y) *y = m_logicalOriginY;
-};
-
-void wxDC::SetDeviceOrigin( long x, long y )
+void wxDC::SetDeviceOrigin( wxCoord x, wxCoord y )
 {
   m_externalDeviceOriginX = x;
   m_externalDeviceOriginY = y;
   ComputeScaleAndOrigin();
 };
 {
   m_externalDeviceOriginX = x;
   m_externalDeviceOriginY = y;
   ComputeScaleAndOrigin();
 };
-
-void wxDC::GetDeviceOrigin( long *x, long *y )
-{
-//  if (x) *x = m_externalDeviceOriginX;
-//  if (y) *y = m_externalDeviceOriginY;
-  if (x) *x = m_deviceOriginX;
-  if (y) *y = m_deviceOriginY;
-};
-
+/*
 void wxDC::SetInternalDeviceOrigin( long x, long y )
 {
   m_internalDeviceOriginX = x;
 void wxDC::SetInternalDeviceOrigin( long x, long y )
 {
   m_internalDeviceOriginX = x;
@@ -476,53 +385,14 @@ void wxDC::GetInternalDeviceOrigin( long *x, long *y )
   if (x) *x = m_internalDeviceOriginX;
   if (y) *y = m_internalDeviceOriginY;
 };
   if (x) *x = m_internalDeviceOriginX;
   if (y) *y = m_internalDeviceOriginY;
 };
-
+*/
 void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
 {
   m_signX = (xLeftRight ?  1 : -1);
   m_signY = (yBottomUp  ? -1 :  1);
   ComputeScaleAndOrigin();
 };
 void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
 {
   m_signX = (xLeftRight ?  1 : -1);
   m_signY = (yBottomUp  ? -1 :  1);
   ComputeScaleAndOrigin();
 };
-
-long wxDC::DeviceToLogicalX(long x) const
-{
-  return XDEV2LOG(x);
-};
-
-long wxDC::DeviceToLogicalY(long y) const
-{
-  return YDEV2LOG(y);
-};
-
-long wxDC::DeviceToLogicalXRel(long x) const
-{
-  return XDEV2LOGREL(x);
-};
-
-long wxDC::DeviceToLogicalYRel(long y) const
-{
-  return YDEV2LOGREL(y);
-};
-
-long wxDC::LogicalToDeviceX(long x) const
-{
-  return XLOG2DEV(x);
-};
-
-long wxDC::LogicalToDeviceY(long y) const
-{
-  return YLOG2DEV(y);
-};
-
-long wxDC::LogicalToDeviceXRel(long x) const
-{
-  return XLOG2DEVREL(x);
-};
-
-long wxDC::LogicalToDeviceYRel(long y) const
-{
-  return YLOG2DEVREL(y);
-};
+/*
     
 void wxDC::CalcBoundingBox( long x, long y )
 {
     
 void wxDC::CalcBoundingBox( long x, long y )
 {
@@ -531,6 +401,16 @@ void wxDC::CalcBoundingBox( long x, long y )
   if (x > m_maxX) m_maxX = x;
   if (y > m_maxY) m_maxY = y;
 };
   if (x > m_maxX) m_maxX = x;
   if (y > m_maxY) m_maxY = y;
 };
+*/
+wxSize wxDC::GetPPI() const
+{
+    return wxSize(72, 72);
+}
+
+int wxDC::GetDepth() const
+{
+       return wxDisplayDepth() ;
+}
 
 void wxDC::ComputeScaleAndOrigin(void)
 {
 
 void wxDC::ComputeScaleAndOrigin(void)
 {
@@ -547,12 +427,7 @@ void wxDC::ComputeScaleAndOrigin(void)
   // CMB: if scale has changed call SetPen to recalulate the line width 
   if (m_scaleX != origScaleX || m_scaleY != origScaleY)
   {
   // CMB: if scale has changed call SetPen to recalulate the line width 
   if (m_scaleX != origScaleX || m_scaleY != origScaleY)
   {
-    // this is a bit artificial, but we need to force wxDC to think
-    // the pen has changed
-    wxPen* pen = & GetPen();
-    wxPen tempPen;
-    m_pen = tempPen;
-    SetPen(* pen);
+       // TODO : set internal flags for recalc
   }
 };
 
   }
 };
 
@@ -634,16 +509,17 @@ void  wxDC::SetLogicalFunction( int function )
        m_macPenInstalled = false ;
 }
 
        m_macPenInstalled = false ;
 }
 
-void  wxDC::FloodFill( long x1, long y1, const wxColour& col, int style )
+void  wxDC::DoFloodFill( wxCoord x, wxCoord y, const wxColour& col,
+                             int style )
 {
 }
 
 {
 }
 
-bool  wxDC::GetPixel( long x1, long y1, wxColour *col ) const 
+bool  wxDC::DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const 
 {
        return true ;
 }
 
 {
        return true ;
 }
 
-void  wxDC::DrawLine( long x1, long y1, long x2, long y2 )
+void  wxDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -664,19 +540,22 @@ void  wxDC::DrawLine( long x1, long y1, long x2, long y2 )
   };
 }
 
   };
 }
 
-void  wxDC::CrossHair( long x, long y )
+void  wxDC::DoCrossHair( wxCoord x, wxCoord y )
 {
 }
 
 {
 }
 
-void  wxDC::DrawArc( long x1, long y1, long x2, long y2, long xc, long yc )
+void  wxDC::DoDrawArc( wxCoord x1, wxCoord y1,
+                           wxCoord x2, wxCoord y2,
+                           wxCoord xc, wxCoord yc )
 {
 }
 
 {
 }
 
-void  wxDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
+void  wxDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
+                                   double sa, double ea )
 {
 }
 
 {
 }
 
-void  wxDC::DrawPoint( long x, long y )
+void  wxDC::DoDrawPoint( wxCoord x, wxCoord y )
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -694,7 +573,8 @@ void  wxDC::DrawPoint( long x, long y )
   };
 }
 
   };
 }
 
-void  wxDC::DrawLines( int n, wxPoint points[], long xoffset , long yoffset  )
+void  wxDC::DoDrawLines(int n, wxPoint points[],
+                             wxCoord xoffset, wxCoord yoffset)
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -719,8 +599,9 @@ void  wxDC::DrawLines( int n, wxPoint points[], long xoffset , long yoffset  )
   }
 }
 
   }
 }
 
-void  wxDC::DrawPolygon( int n, wxPoint points[], long xoffset , long yoffset , 
-                              int fillStyle )
+void  wxDC::DoDrawPolygon(int n, wxPoint points[],
+                               wxCoord xoffset, wxCoord yoffset,
+                               int fillStyle )
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -754,7 +635,7 @@ void  wxDC::DrawPolygon( int n, wxPoint points[], long xoffset , long yoffset ,
   KillPoly( polygon ) ;
 }
 
   KillPoly( polygon ) ;
 }
 
-void  wxDC::DrawRectangle( long x, long y, long width, long height )
+void  wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -797,7 +678,9 @@ void  wxDC::DrawRectangle( long x, long y, long width, long height )
        };
 }
 
        };
 }
 
-void  wxDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius  )
+void  wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
+                                        wxCoord width, wxCoord height,
+                                        double radius)
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -843,7 +726,7 @@ void  wxDC::DrawRoundedRectangle( long x, long y, long width, long height, doubl
        };
 }
 
        };
 }
 
-void  wxDC::DrawEllipse( long x, long y, long width, long height )
+void  wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -1001,7 +884,7 @@ static void wx_spline_draw_point_array(wxDC *dc)
   }
 }
 
   }
 }
 
-void  wxDC::DrawSpline( wxList *points )
+void  wxDC::DoDrawSpline(wxList *points)
 {
     wxPoint *p;
     double           cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
 {
     wxPoint *p;
     double           cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
@@ -1059,8 +942,8 @@ bool  wxDC::CanDrawBitmap(void) const
 }
 
 
 }
 
 
-bool  wxDC::Blit( long xdest, long ydest, long width, long height,
-       wxDC *source, long xsrc, long ysrc, int logical_func , bool useMask )
+bool  wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
+                        wxDC *source, wxCoord xsrc, wxCoord ysrc, int logical_func , bool useMask )
 {
   if (!Ok()) return FALSE;
   MacVerifySetup() ;
 {
   if (!Ok()) return FALSE;
   MacVerifySetup() ;
@@ -1069,8 +952,8 @@ bool  wxDC::Blit( long xdest, long ydest, long width, long height,
        PixMapHandle    bmappixels =  GetGWorldPixMap( sourcePort ) ; 
        RGBColor                white = { 0xFFFF, 0xFFFF,0xFFFF} ;
        RGBColor                black = { 0,0,0} ;
        PixMapHandle    bmappixels =  GetGWorldPixMap( sourcePort ) ; 
        RGBColor                white = { 0xFFFF, 0xFFFF,0xFFFF} ;
        RGBColor                black = { 0,0,0} ;
-               RGBForeColor( &m_textForegroundColour.GetPixel() ) ;
-               RGBBackColor( &m_textBackgroundColour.GetPixel() ) ;
+       RGBForeColor( &m_textForegroundColour.GetPixel() ) ;
+       RGBBackColor( &m_textBackgroundColour.GetPixel() ) ;
 
        if ( LockPixels(bmappixels) )
        {
 
        if ( LockPixels(bmappixels) )
        {
@@ -1094,7 +977,7 @@ bool  wxDC::Blit( long xdest, long ydest, long width, long height,
        logical_func == wxXOR ? srcXor :
   //   logical_func == wxOR_REVERSE ? MERGEPAINT :
   //   logical_func == wxAND_REVERSE ? SRCERASE :
        logical_func == wxXOR ? srcXor :
   //   logical_func == wxOR_REVERSE ? MERGEPAINT :
   //   logical_func == wxAND_REVERSE ? SRCERASE :
-       logical_func == wxSRC_OR ? srcOr :
+  //   logical_func == wxSRC_OR ? srcOr :
   //   logical_func == wxSRC_AND ? SRCAND :
                srcCopy );
 
   //   logical_func == wxSRC_AND ? SRCAND :
                srcCopy );
 
@@ -1103,14 +986,15 @@ bool  wxDC::Blit( long xdest, long ydest, long width, long height,
                        wxASSERT( mode == srcCopy ) ;
                        if ( LockPixels( GetGWorldPixMap( source->m_macMask ) ) )
                        {
                        wxASSERT( mode == srcCopy ) ;
                        if ( LockPixels( GetGWorldPixMap( source->m_macMask ) ) )
                        {
-                               CopyMask( &GrafPtr( sourcePort )->portBits , &GrafPtr( source->m_macMask )->portBits , &GrafPtr( m_macPort )->portBits ,
+                               CopyMask( GetPortBitMapForCopyBits( sourcePort ) , GetPortBitMapForCopyBits( source->m_macMask ) , 
+                               GetPortBitMapForCopyBits( m_macPort ) ,
                                        &srcrect, &srcrect , &dstrect ) ;
                                UnlockPixels( GetGWorldPixMap( source->m_macMask )  ) ;
                        }
                }
                else
                {
                                        &srcrect, &srcrect , &dstrect ) ;
                                UnlockPixels( GetGWorldPixMap( source->m_macMask )  ) ;
                        }
                }
                else
                {
-               CopyBits( &GrafPtr( sourcePort )->portBits , &GrafPtr( m_macPort )->portBits ,
+                       CopyBits( GetPortBitMapForCopyBits( sourcePort ) , GetPortBitMapForCopyBits( m_macPort ) ,
                                &srcrect, &dstrect, mode, NULL ) ;
                }
                UnlockPixels( bmappixels ) ;
                                &srcrect, &dstrect, mode, NULL ) ;
                }
                UnlockPixels( bmappixels ) ;
@@ -1123,7 +1007,11 @@ bool  wxDC::Blit( long xdest, long ydest, long width, long height,
   return TRUE;
 }
 
   return TRUE;
 }
 
-void  wxDC::DrawText( const wxString &string, long x, long y, bool use16)
+void  wxDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
+                                   double angle)
+{
+}
+void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -1161,14 +1049,14 @@ void  wxDC::DrawText( const wxString &string, long x, long y, bool use16)
 
                if ( wxApp::s_macDefaultEncodingIsPC )
                {
 
                if ( wxApp::s_macDefaultEncodingIsPC )
                {
-                       macText = wxMacMakeMacStringFromPC( string ) ;
+                       macText = wxMacMakeMacStringFromPC( strtext ) ;
                        text = macText ;
                        length = macText.Length() ;
                }
                else
                {
                        text = macText ;
                        length = macText.Length() ;
                }
                else
                {
-                       text = string ;
-                       length = string.Length() ;
+                       text = strtext ;
+                       length = strtext.Length() ;
                }
                
                int laststop = 0 ;
                }
                
                int laststop = 0 ;
@@ -1200,9 +1088,9 @@ bool  wxDC::CanGetTextExtent(void) const
        return true ;
 }
 
        return true ;
 }
 
-void  wxDC::GetTextExtent( const wxString &string, long *width, long *height,
-                     long *descent, long *externalLeading ,
-                     wxFont *theFont , bool use16  ) const
+void  wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height,
+                     wxCoord *descent, wxCoord *externalLeading ,
+                     wxFont *theFont ) const
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -1217,11 +1105,8 @@ void  wxDC::GetTextExtent( const wxString &string, long *width, long *height,
        
                if ( font )
                {
        
                if ( font )
                {
-               long yy1 = YLOG2DEV(0);
-                       long yy2 = YLOG2DEV(font->m_macFontSize);
-       
                        ::TextFont( font->m_macFontNum ) ;
                        ::TextFont( font->m_macFontNum ) ;
-                       ::TextSize( abs( yy2-yy1) ) ;
+                       ::TextSize( YLOG2DEVREL( font->m_macFontSize) ) ;
                        ::TextFace( font->m_macFontStyle ) ;
                }
        }
                        ::TextFace( font->m_macFontStyle ) ;
                }
        }
@@ -1233,9 +1118,12 @@ void  wxDC::GetTextExtent( const wxString &string, long *width, long *height,
        FontInfo fi ;
        ::GetFontInfo( &fi ) ;
 
        FontInfo fi ;
        ::GetFontInfo( &fi ) ;
 
-       *height = fi.descent + fi.ascent ;
-       *descent = fi.descent ;
-       *externalLeading = fi.leading ;
+       if ( height )
+               *height = YDEV2LOGREL( fi.descent + fi.ascent ) ;
+       if ( descent )
+               *descent =YDEV2LOGREL( fi.descent );
+       if ( externalLeading )
+               *externalLeading = YDEV2LOGREL( fi.leading ) ;
        
        const char *text = NULL ;
        int length = 0 ;
        
        const char *text = NULL ;
        int length = 0 ;
@@ -1255,24 +1143,28 @@ void  wxDC::GetTextExtent( const wxString &string, long *width, long *height,
        int laststop = 0 ;
        int i = 0 ;
        int curwidth = 0 ;
        int laststop = 0 ;
        int i = 0 ;
        int curwidth = 0 ;
-       *width = 0 ;
-       
-       while( i < length )
+       if ( width )
        {
        {
-               if( text[i] == 13 || text[i] == 10)
+               *width = 0 ;
+       
+               while( i < length )
                {
                {
-                       *height += fi.descent + fi.ascent + fi.leading;
-                       curwidth = ::TextWidth( text , laststop , i - laststop ) ;
-                       if ( curwidth > *width )
-                               *width = curwidth ;
-                       laststop = i+1 ;
+                       if( text[i] == 13 || text[i] == 10)
+                       {
+                               if ( height )
+                                       *height += YDEV2LOGREL( fi.descent + fi.ascent + fi.leading ) ;
+                               curwidth = ::TextWidth( text , laststop , i - laststop ) ;
+                               if ( curwidth > *width )
+                                       *width = XDEV2LOGREL( curwidth ) ;
+                               laststop = i+1 ;
+                       }
+                       i++ ;
                }
                }
-               i++ ;
+                               
+               curwidth = ::TextWidth( text , laststop , i - laststop ) ;
+               if ( curwidth > *width )
+                       *width = XDEV2LOGREL( curwidth ) ;
        }
        }
-                       
-       curwidth = ::TextWidth( text , laststop , i - laststop ) ;
-       if ( curwidth > *width )
-               *width = curwidth ;
 
        if ( theFont )
        {
 
        if ( theFont )
        {
@@ -1292,7 +1184,7 @@ wxCoord   wxDC::GetCharWidth(void) const
        FontInfo fi ;
        ::GetFontInfo( &fi ) ;
 
        FontInfo fi ;
        ::GetFontInfo( &fi ) ;
 
-       return (fi.descent + fi.ascent) / 2 ;
+       return YDEV2LOGREL((fi.descent + fi.ascent) / 2) ;
 }
 
 wxCoord   wxDC::GetCharHeight(void) const
 }
 
 wxCoord   wxDC::GetCharHeight(void) const
@@ -1307,7 +1199,7 @@ wxCoord   wxDC::GetCharHeight(void) const
        FontInfo fi ;
        ::GetFontInfo( &fi ) ;
 
        FontInfo fi ;
        ::GetFontInfo( &fi ) ;
 
-       return fi.descent + fi.ascent ;
+       return YDEV2LOGREL( fi.descent + fi.ascent );
 }
 
 void  wxDC::Clear(void)
 }
 
 void  wxDC::Clear(void)
@@ -1332,7 +1224,8 @@ void wxDC::MacInstallFont() const
 
        if ( m_macFontInstalled )
                return ;
 
        if ( m_macFontInstalled )
                return ;
-               
+       Pattern blackColor ;
+       
        wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
 
        if ( font )
        wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
 
        if ( font )
@@ -1377,7 +1270,7 @@ void wxDC::MacInstallFont() const
                        mode = patCopy ;
                        break ;
                case wxINVERT:     // NOT dst
                        mode = patCopy ;
                        break ;
                case wxINVERT:     // NOT dst
-                       ::PenPat(&qd.black);
+                       ::PenPat(GetQDGlobalsBlack(&blackColor));
                        mode = patXor ;
                        break ;
                case wxXOR:        // src XOR dst
                        mode = patXor ;
                        break ;
                case wxXOR:        // src XOR dst
@@ -1403,8 +1296,8 @@ void wxDC::MacInstallFont() const
                case wxNAND:       // (NOT src) OR (NOT dst)
                case wxOR:         // src OR dst
                case wxSET:        // 1
                case wxNAND:       // (NOT src) OR (NOT dst)
                case wxOR:         // src OR dst
                case wxSET:        // 1
-               case wxSRC_OR:     // source _bitmap_ OR destination
-               case wxSRC_AND:     // source _bitmap_ AND destination
+//             case wxSRC_OR:     // source _bitmap_ OR destination
+//             case wxSRC_AND:     // source _bitmap_ AND destination
                        break ;
        }
        ::PenMode( mode ) ;
                        break ;
        }
        ::PenMode( mode ) ;
@@ -1447,6 +1340,8 @@ void wxDC::MacInstallPen() const
        return;
   MacVerifySetup() ;
 
        return;
   MacVerifySetup() ;
 
+       Pattern  blackColor;
+
        if ( m_macPenInstalled )
                return ;
 
        if ( m_macPenInstalled )
                return ;
 
@@ -1460,7 +1355,7 @@ void wxDC::MacInstallPen() const
        int penStyle = m_pen.GetStyle();
        
        if (penStyle == wxSOLID)
        int penStyle = m_pen.GetStyle();
        
        if (penStyle == wxSOLID)
-               ::PenPat(&qd.black);
+               ::PenPat(GetQDGlobalsBlack(&blackColor));
        else if (IS_HATCH(penStyle))
        {
                Pattern pat ;
        else if (IS_HATCH(penStyle))
        {
                Pattern pat ;
@@ -1469,7 +1364,7 @@ void wxDC::MacInstallPen() const
        }
        else
        {
        }
        else
        {
-               ::PenPat(&qd.black);
+               ::PenPat(GetQDGlobalsBlack(&blackColor));
        }
 
        short mode = patCopy ;
        }
 
        short mode = patCopy ;
@@ -1482,7 +1377,7 @@ void wxDC::MacInstallPen() const
                        mode = patCopy ;
                        break ;
                case wxINVERT:     // NOT dst
                        mode = patCopy ;
                        break ;
                case wxINVERT:     // NOT dst
-                       ::PenPat(&qd.black);
+                       ::PenPat(GetQDGlobalsBlack(&blackColor));
                        mode = patXor ;
                        break ;
                case wxXOR:        // src XOR dst
                        mode = patXor ;
                        break ;
                case wxXOR:        // src XOR dst
@@ -1508,8 +1403,8 @@ void wxDC::MacInstallPen() const
                case wxNAND:       // (NOT src) OR (NOT dst)
                case wxOR:         // src OR dst
                case wxSET:        // 1
                case wxNAND:       // (NOT src) OR (NOT dst)
                case wxOR:         // src OR dst
                case wxSET:        // 1
-               case wxSRC_OR:     // source _bitmap_ OR destination
-               case wxSRC_AND:     // source _bitmap_ AND destination
+//             case wxSRC_OR:     // source _bitmap_ OR destination
+//             case wxSRC_AND:     // source _bitmap_ AND destination
                        break ;
        }
        ::PenMode( mode ) ;
                        break ;
        }
        ::PenMode( mode ) ;
@@ -1523,7 +1418,7 @@ void wxDC::MacInstallBrush() const
   if (!Ok()) 
        return;
   MacVerifySetup() ;
   if (!Ok()) 
        return;
   MacVerifySetup() ;
-
+       Pattern  blackColor, whiteColor ;
        if ( m_macBrushInstalled )
                return ;
 
        if ( m_macBrushInstalled )
                return ;
 
@@ -1534,7 +1429,7 @@ void wxDC::MacInstallBrush() const
 
        int brushStyle = m_brush.GetStyle();
        if (brushStyle == wxSOLID)
 
        int brushStyle = m_brush.GetStyle();
        if (brushStyle == wxSOLID)
-               ::PenPat(&qd.black);
+               ::PenPat(GetQDGlobalsBlack(&blackColor));
        else if (IS_HATCH(brushStyle))
        {
                Pattern pat ;
        else if (IS_HATCH(brushStyle))
        {
                Pattern pat ;
@@ -1543,7 +1438,7 @@ void wxDC::MacInstallBrush() const
        }
        else
        {
        }
        else
        {
-               ::PenPat(&qd.black);
+               ::PenPat(GetQDGlobalsBlack(&blackColor));
        }
 
        
        }
 
        
@@ -1551,7 +1446,7 @@ void wxDC::MacInstallBrush() const
        
        brushStyle = m_backgroundBrush.GetStyle();
        if (brushStyle == wxSOLID)
        
        brushStyle = m_backgroundBrush.GetStyle();
        if (brushStyle == wxSOLID)
-               ::BackPat(&qd.white);
+               ::BackPat(GetQDGlobalsWhite(&whiteColor));
        else if (IS_HATCH(brushStyle))
        {
                Pattern pat ;
        else if (IS_HATCH(brushStyle))
        {
                Pattern pat ;
@@ -1560,7 +1455,7 @@ void wxDC::MacInstallBrush() const
        }
        else
        {
        }
        else
        {
-               ::BackPat(&qd.white);
+               ::BackPat(GetQDGlobalsWhite(&whiteColor));
        }
        
        short mode = patCopy ;
        }
        
        short mode = patCopy ;
@@ -1573,7 +1468,7 @@ void wxDC::MacInstallBrush() const
                        mode = patCopy ;
                        break ;
                case wxINVERT:     // NOT dst
                        mode = patCopy ;
                        break ;
                case wxINVERT:     // NOT dst
-                       ::PenPat(&qd.black);
+                       ::PenPat(GetQDGlobalsBlack(&blackColor));
                        mode = patXor ;
                        break ;
                case wxXOR:        // src XOR dst
                        mode = patXor ;
                        break ;
                case wxXOR:        // src XOR dst
@@ -1599,8 +1494,8 @@ void wxDC::MacInstallBrush() const
                case wxNAND:       // (NOT src) OR (NOT dst)
                case wxOR:         // src OR dst
                case wxSET:        // 1
                case wxNAND:       // (NOT src) OR (NOT dst)
                case wxOR:         // src OR dst
                case wxSET:        // 1
-               case wxSRC_OR:     // source _bitmap_ OR destination
-               case wxSRC_AND:     // source _bitmap_ AND destination
+//             case wxSRC_OR:     // source _bitmap_ OR destination
+//             case wxSRC_AND:     // source _bitmap_ AND destination
                        break ;
        }
        ::PenMode( mode ) ;
                        break ;
        }
        ::PenMode( mode ) ;
@@ -1609,4 +1504,47 @@ void wxDC::MacInstallBrush() const
        m_macFontInstalled = false ;
 }
 
        m_macFontInstalled = false ;
 }
 
+// ---------------------------------------------------------------------------
+// coordinates transformations
+// ---------------------------------------------------------------------------
 
 
+
+wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
+{
+    return ((wxDC *)this)->XDEV2LOG(x);
+}
+
+wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
+{
+    return ((wxDC *)this)->YDEV2LOG(y);
+}
+
+wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
+{
+    return ((wxDC *)this)->XDEV2LOGREL(x);
+}
+
+wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
+{
+    return ((wxDC *)this)->YDEV2LOGREL(y);
+}
+
+wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
+{
+    return ((wxDC *)this)->XLOG2DEV(x);
+}
+
+wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
+{
+    return ((wxDC *)this)->YLOG2DEV(y);
+}
+
+wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
+{
+    return ((wxDC *)this)->XLOG2DEVREL(x);
+}
+
+wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
+{
+    return ((wxDC *)this)->YLOG2DEVREL(y);
+}
index 12100b81cdef2320b31f5b789f8db2b4825eac2a..6f3a6b35179c9db23d8be0503173d5c1bb85f2f8 100644 (file)
 // wxPaintDC
 //-----------------------------------------------------------------------------
 
 // wxPaintDC
 //-----------------------------------------------------------------------------
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
 IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
 IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
 IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
 IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
 IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
+#endif
 
 /*
  * wxWindowDC
 
 /*
  * wxWindowDC
@@ -38,11 +40,11 @@ IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
 
 #include <wx/mac/uma.h>
 
 
 #include <wx/mac/uma.h>
 
-wxWindowDC::wxWindowDC(void)
+wxWindowDC::wxWindowDC(
 {
 }
 
 {
 }
 
-wxWindowDC::wxWindowDC(wxWindow *the_canvas)
+wxWindowDC::wxWindowDC(wxWindow *the_canvas) 
 {
        WindowRef windowref ;
        wxWindow* rootwindow ;
 {
        WindowRef windowref ;
        wxWindow* rootwindow ;
@@ -51,11 +53,16 @@ wxWindowDC::wxWindowDC(wxWindow *the_canvas)
        
        the_canvas->MacGetPortParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
        m_macPort = UMAGetWindowPort( windowref ) ;
        
        the_canvas->MacGetPortParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
        m_macPort = UMAGetWindowPort( windowref ) ;
+       m_minY = m_minX =  0;
+       wxSize size = the_canvas->GetSize() ;
+       m_maxX = size.x  ;
+       m_maxY = size.y ; 
+
        MacSetupPort() ;
        m_ok = TRUE ;
 }
 
        MacSetupPort() ;
        m_ok = TRUE ;
 }
 
-wxWindowDC::~wxWindowDC(void)
+wxWindowDC::~wxWindowDC()
 {
 }
 
 {
 }
 
@@ -63,7 +70,7 @@ wxWindowDC::~wxWindowDC(void)
  * wxClientDC
  */
 
  * wxClientDC
  */
 
-wxClientDC::wxClientDC(void)
+wxClientDC::wxClientDC()
 {
 }
 
 {
 }
 
@@ -75,12 +82,16 @@ wxClientDC::wxClientDC(wxWindow *window)
        window->MacGetPortClientParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
        m_macPort = UMAGetWindowPort( windowref ) ;
        MacSetupPort() ;
        window->MacGetPortClientParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
        m_macPort = UMAGetWindowPort( windowref ) ;
        MacSetupPort() ;
+       m_minY = m_minX =  0;
+       wxSize size = window->GetSize() ;
+       m_maxX = size.x  ;
+       m_maxY = size.y ; 
        m_ok = TRUE ;
        SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID));
        SetFont( window->GetFont() ) ;
 }
 
        m_ok = TRUE ;
        SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID));
        SetFont( window->GetFont() ) ;
 }
 
-wxClientDC::~wxClientDC(void)
+wxClientDC::~wxClientDC()
 {
 }
 
 {
 }
 
@@ -88,7 +99,7 @@ wxClientDC::~wxClientDC(void)
  * wxPaintDC
  */
 
  * wxPaintDC
  */
 
-wxPaintDC::wxPaintDC(void)
+wxPaintDC::wxPaintDC()
 {
 }
 
 {
 }
 
@@ -104,6 +115,10 @@ wxPaintDC::wxPaintDC(wxWindow *window)
        m_ok = TRUE ;
        long x , y ,w , h ;
        window->GetUpdateRegion().GetBox( x , y , w , h ) ;
        m_ok = TRUE ;
        long x , y ,w , h ;
        window->GetUpdateRegion().GetBox( x , y , w , h ) ;
+       m_minY = m_minX =  0;
+       wxSize size = window->GetSize() ;
+       m_maxX = size.x  ;
+       m_maxY = size.y ; 
        SetClippingRegion( x , y , w , h ) ;
        SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID));
        SetFont(window->GetFont() ) ;
        SetClippingRegion( x , y , w , h ) ;
        SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID));
        SetFont(window->GetFont() ) ;
index fe88bf806cfa070d3f05e15e107f8f80ede1df6d..a56c7b5c49b033b771acc2b887c094a266dd4dfb 100644 (file)
@@ -33,10 +33,20 @@ wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
 
 wxMemoryDC::~wxMemoryDC(void)
 {
 
 wxMemoryDC::~wxMemoryDC(void)
 {
+       if ( m_selected.Ok() )
+       {
+               wxBitmapRefData * bmap = (wxBitmapRefData*) (m_selected.GetRefData()) ;
+               UnlockPixels( GetGWorldPixMap(  (CGrafPtr) bmap->m_hBitmap ) ) ;
+       }
 };
 
 void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
 {
 };
 
 void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
 {
+       if ( m_selected.Ok() )
+       {
+               wxBitmapRefData * bmap = (wxBitmapRefData*) (m_selected.GetRefData()) ;
+               UnlockPixels( GetGWorldPixMap(  (CGrafPtr) bmap->m_hBitmap ) ) ;
+       }
   m_selected = bitmap;
   if (m_selected.Ok())
   {
   m_selected = bitmap;
   if (m_selected.Ok())
   {
@@ -44,6 +54,7 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
                if ( bmap->m_hBitmap )
                {
                        m_macPort = (GrafPtr) bmap->m_hBitmap ;
                if ( bmap->m_hBitmap )
                {
                        m_macPort = (GrafPtr) bmap->m_hBitmap ;
+                       LockPixels( GetGWorldPixMap(  (CGrafPtr)  m_macPort ) ) ;
                        wxMask * mask = bitmap.GetMask() ;
                        if ( mask )
                        {
                        wxMask * mask = bitmap.GetMask() ;
                        if ( mask )
                        {
index 449f44e2060e3205e4f7c729e25675d028c4d35d..257c74206b6a7707bae2d3479b742e1376374e50 100644 (file)
 
 #include "wx/dcprint.h"
 #include "math.h"
 
 #include "wx/dcprint.h"
 #include "math.h"
+#include "wx/mac/uma.h"
 
 
 
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_CLASS(wxPrinterDC, wxDC)
 IMPLEMENT_CLASS(wxPrinterDC, wxDC)
+#endif
 
 GrafPtr macPrintFormerPort = NULL ;
 
 wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
 {
 
 GrafPtr macPrintFormerPort = NULL ;
 
 wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
 {
+#if !TARGET_CARBON
        OSErr err ;
        wxString message ;
        
        m_printData = printdata ;
        m_printData.ConvertToNative() ;
        
        OSErr err ;
        wxString message ;
        
        m_printData = printdata ;
        m_printData.ConvertToNative() ;
        
-       ::PrOpen() ;
+       ::UMAPrOpen() ;
        err = PrError() ;
        if ( err )
        {
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
        err = PrError() ;
        if ( err )
        {
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               PrClose() ;
+               UMAPrClose() ;
        }
        
        if ( ::PrValidate( m_printData.m_macPrintInfo ) )
        {
        }
        
        if ( ::PrValidate( m_printData.m_macPrintInfo ) )
        {
+               ::PrStlDialog( m_printData.m_macPrintInfo ) ;
                // the driver has changed in the mean time, should we pop up a page setup dialog ?
        }
        err = PrError() ;
                // the driver has changed in the mean time, should we pop up a page setup dialog ?
        }
        err = PrError() ;
@@ -57,20 +62,31 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
        {
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
        {
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               PrClose() ;
+               UMAPrClose() ;
        }
        ::GetPort( &macPrintFormerPort ) ;
        m_macPrintPort = ::PrOpenDoc( m_printData.m_macPrintInfo , NULL , NULL ) ;
        }
        ::GetPort( &macPrintFormerPort ) ;
        m_macPrintPort = ::PrOpenDoc( m_printData.m_macPrintInfo , NULL , NULL ) ;
+       err = PrError() ;
+       if ( err )
+       {
+               message.Printf( "Print Error %d", err ) ;
+               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+               UMAPrClose() ;
+       }
        // sets current port
        m_macPort = (GrafPtr ) m_macPrintPort ;
        m_ok = TRUE ;
        m_minY = m_minX = 0 ;
        m_maxX = (**m_printData.m_macPrintInfo).rPaper.right - (**m_printData.m_macPrintInfo).rPaper.left ;
        m_maxY = (**m_printData.m_macPrintInfo).rPaper.bottom - (**m_printData.m_macPrintInfo).rPaper.top ;
        // sets current port
        m_macPort = (GrafPtr ) m_macPrintPort ;
        m_ok = TRUE ;
        m_minY = m_minX = 0 ;
        m_maxX = (**m_printData.m_macPrintInfo).rPaper.right - (**m_printData.m_macPrintInfo).rPaper.left ;
        m_maxY = (**m_printData.m_macPrintInfo).rPaper.bottom - (**m_printData.m_macPrintInfo).rPaper.top ;
+#else
+#pragma warning "TODO:printing support for carbon"
+#endif
 }
 
 wxPrinterDC::~wxPrinterDC(void)
 {
 }
 
 wxPrinterDC::~wxPrinterDC(void)
 {
+#if !TARGET_CARBON
        if ( m_ok )
        {
                OSErr err ;
        if ( m_ok )
        {
                OSErr err ;
@@ -91,11 +107,16 @@ wxPrinterDC::~wxPrinterDC(void)
                {
                        message.Printf( "Print Error %d", err ) ;
                        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
                {
                        message.Printf( "Print Error %d", err ) ;
                        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-                       PrClose() ;
+                       UMAPrClose() ;
                }
                }
-               ::PrClose() ;
-         ::SetPort( macPrintFormerPort ) ;
+               ::UMAPrClose() ;
+//       ::SetPort( macPrintFormerPort ) ;
+               ::SetPort( LMGetWMgrPort() ) ;
+               m_macPortHelper.Clear() ;
        }
        }
+#else
+#pragma warning "TODO:printing support for carbon"
+#endif
 }
 
 bool wxPrinterDC::StartDoc( const wxString& WXUNUSED(message) ) 
 }
 
 bool wxPrinterDC::StartDoc( const wxString& WXUNUSED(message) ) 
@@ -109,13 +130,30 @@ void wxPrinterDC::EndDoc(void)
 
 void wxPrinterDC::StartPage(void) 
 {
 
 void wxPrinterDC::StartPage(void) 
 {
+#if !TARGET_CARBON
        if ( !m_ok )
                return ;
        if ( !m_ok )
                return ;
+
+       m_logicalFunction = wxCOPY;
+//  m_textAlignment = wxALIGN_TOP_LEFT;
+       m_backgroundMode = wxTRANSPARENT;
+  
+       m_textForegroundColour = *wxBLACK;
+       m_textBackgroundColour = *wxWHITE;
+       m_pen = *wxBLACK_PEN;
+       m_font = *wxNORMAL_FONT;
+       m_brush = *wxTRANSPARENT_BRUSH;
+       m_backgroundBrush = *wxWHITE_BRUSH;
+    
+       m_macFontInstalled = false ;
+       m_macBrushInstalled = false ;
+       m_macPenInstalled = false ;
+
                
        OSErr err ;
        wxString message ;
 
                
        OSErr err ;
        wxString message ;
 
-  PrOpenPage( m_macPrintPort , NULL ) ;
+       PrOpenPage( m_macPrintPort , NULL ) ;
        SetOrigin(  - (**m_printData.m_macPrintInfo).rPaper.left , - (**m_printData.m_macPrintInfo).rPaper.top ) ;
        Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
        ::ClipRect( &clip ) ;
        SetOrigin(  - (**m_printData.m_macPrintInfo).rPaper.left , - (**m_printData.m_macPrintInfo).rPaper.top ) ;
        Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
        ::ClipRect( &clip ) ;
@@ -126,14 +164,18 @@ void wxPrinterDC::StartPage(void)
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
                ::PrClosePage(  m_macPrintPort) ;
                ::PrCloseDoc( m_macPrintPort  ) ;
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
                ::PrClosePage(  m_macPrintPort) ;
                ::PrCloseDoc( m_macPrintPort  ) ;
-               ::PrClose() ;
+               ::UMAPrClose() ;
                ::SetPort( macPrintFormerPort ) ;
                m_ok = FALSE ;
        }
                ::SetPort( macPrintFormerPort ) ;
                m_ok = FALSE ;
        }
+#else
+#pragma warning "TODO:printing support for carbon"
+#endif
 }
 
 void wxPrinterDC::EndPage(void) 
 {
 }
 
 void wxPrinterDC::EndPage(void) 
 {
+#if !TARGET_CARBON
        if ( !m_ok )
                return ;
 
        if ( !m_ok )
                return ;
 
@@ -147,8 +189,12 @@ void wxPrinterDC::EndPage(void)
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
                ::PrCloseDoc( m_macPrintPort  ) ;
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
                ::PrCloseDoc( m_macPrintPort  ) ;
-               ::PrClose() ;
+               ::UMAPrClose() ;
                ::SetPort( macPrintFormerPort ) ;
                m_ok = FALSE ;
        }
                ::SetPort( macPrintFormerPort ) ;
                m_ok = FALSE ;
        }
+#else
+#pragma warning "TODO:printing support for carbon"
+#endif
+
 }
 }
index 1d802afba448d938bd239e659616e413a051eba8..c47126248e7ab604fd8899f72bedb5a242004294 100644 (file)
 #endif
 
 #include "wx/dcscreen.h"
 #endif
 
 #include "wx/dcscreen.h"
+#include "wx/mac/uma.h"
 
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
+#endif
 
 // Create a DC representing the whole screen
 wxScreenDC::wxScreenDC()
 {
 
 // Create a DC representing the whole screen
 wxScreenDC::wxScreenDC()
 {
+#if TARGET_CARBON
+       m_macPort = GetQDGlobalsThePort() ;
+#else
        m_macPort = LMGetWMgrPort() ;
        m_macPort = LMGetWMgrPort() ;
+#endif
        MacSetupPort() ;
        m_ok = TRUE ;
        MacSetupPort() ;
        m_ok = TRUE ;
+       BitMap screenBits;
+       GetQDGlobalsScreenBits( &screenBits );
+       m_minX = screenBits.bounds.left ;
+ #if TARGET_CARBON
+       SInt16 height ;
+       GetThemeMenuBarHeight( &height ) ;
+       m_minY = screenBits.bounds.top + height ;
+ #else
+       m_minY = screenBits.bounds.top + LMGetMBarHeight() ;
+ #endif
+       m_maxX = screenBits.bounds.right  ;
+       m_maxY = screenBits.bounds.bottom ; 
 }
 
 wxScreenDC::~wxScreenDC()
 }
 
 wxScreenDC::~wxScreenDC()
index d75706f6a3594dcc43354f4efa09bff5ca0a9384..760c07680a91543be3bb019f8eba670f2e08b247 100644 (file)
@@ -27,6 +27,7 @@ wxList wxModalDialogs;
 wxList wxModelessWindows;  // Frames and modeless dialogs
 extern wxList wxPendingDelete;
 
 wxList wxModelessWindows;  // Frames and modeless dialogs
 extern wxList wxPendingDelete;
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxPanel)
 
 BEGIN_EVENT_TABLE(wxDialog, wxPanel)
 IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxPanel)
 
 BEGIN_EVENT_TABLE(wxDialog, wxPanel)
@@ -39,11 +40,11 @@ BEGIN_EVENT_TABLE(wxDialog, wxPanel)
   EVT_CLOSE(wxDialog::OnCloseWindow)
 END_EVENT_TABLE()
 
   EVT_CLOSE(wxDialog::OnCloseWindow)
 END_EVENT_TABLE()
 
+#endif
 
 wxDialog::wxDialog()
 {
 
 wxDialog::wxDialog()
 {
-  m_isShown = FALSE;
-  m_modalShowing = FALSE;
+       m_isShown = FALSE;
     SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
 }
 
     SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
 }
 
@@ -54,15 +55,8 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
            long style,
            const wxString& name)
 {
            long style,
            const wxString& name)
 {
-  m_windowStyle = style;
-  m_isShown = FALSE;
-  m_modalShowing = FALSE;
 
 
-#if wxUSE_TOOLTIPS
-    m_hwndToolTip = 0;
-#endif
   SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
   SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
-  SetName(name);
   
   if (!parent)
     wxTopLevelWindows.Append(this);
   
   if (!parent)
     wxTopLevelWindows.Append(this);
@@ -74,59 +68,26 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
   else
        m_windowId = id;
 
   else
        m_windowId = id;
 
-       Rect theBoundsRect;
-
-  m_x = (int)pos.x;
-  m_y = (int)pos.y;
-  if ( m_y < 50 )
-       m_y = 50 ;
-  if ( m_x < 20 )
-       m_x = 20 ;
-       
-  m_width = size.x;
-       if (m_width == -1) 
-               m_width = 20;
-  m_height = size.y;
-       if (m_height == -1) 
-               m_height = 20;
-
-       ::SetRect(&theBoundsRect, m_x, m_y, m_x + m_width, m_y + m_height);
-       m_macWindowData = new MacWindowData() ;
-
-       WindowClass wclass = kMovableModalWindowClass ;
-       WindowAttributes attr = kWindowNoAttributes ;
-       
-       if ( ( m_windowStyle & wxMINIMIZE_BOX ) || ( m_windowStyle & wxMAXIMIZE_BOX ) )
-       {
-               attr |= kWindowFullZoomAttribute ;
-               attr |= kWindowResizableAttribute ;
-       }
+       MacCreateRealWindow( title , pos , size , MacRemoveBordersFromStyle(style)  , name ) ;
 
 
-       UMACreateNewWindow( wclass , attr , &theBoundsRect , &m_macWindowData->m_macWindow ) ;
-       wxAssociateWinWithMacWindow( m_macWindowData->m_macWindow , this ) ;
-       wxString label ;
-       if( wxApp::s_macDefaultEncodingIsPC )
-               label = wxMacMakeMacStringFromPC( title ) ;
-       else
-               label = title ;
-       UMASetWTitleC( m_macWindowData->m_macWindow , label ) ;
        m_macWindowData->m_macWindowBackgroundTheme = kThemeBrushDialogBackgroundActive ;
        m_macWindowData->m_macWindowBackgroundTheme = kThemeBrushDialogBackgroundActive ;
-       UMACreateRootControl( m_macWindowData->m_macWindow , &m_macWindowData->m_macRootControl ) ;
-       m_macWindowData->m_macFocus = NULL ;
   return TRUE;
 }
 
 void wxDialog::SetModal(bool flag)
 {
   return TRUE;
 }
 
 void wxDialog::SetModal(bool flag)
 {
-       if ( flag )
-               m_windowStyle |= wxDIALOG_MODAL ;
-       else
-               if ( m_windowStyle & wxDIALOG_MODAL )
-                       m_windowStyle -= wxDIALOG_MODAL ;
-  
-  wxModelessWindows.DeleteObject(this);
-  if (!flag)
-    wxModelessWindows.Append(this);
+  if ( flag )
+    {
+        m_windowStyle |= wxDIALOG_MODAL;
+
+        wxModelessWindows.DeleteObject(this);
+    }
+    else
+    {
+        m_windowStyle &= ~wxDIALOG_MODAL;
+
+        wxModelessWindows.Append(this);
+    }
 }
 
 wxDialog::~wxDialog()
 }
 
 wxDialog::~wxDialog()
@@ -134,10 +95,10 @@ wxDialog::~wxDialog()
        m_isBeingDeleted = TRUE ;
     wxTopLevelWindows.DeleteObject(this);
 
        m_isBeingDeleted = TRUE ;
     wxTopLevelWindows.DeleteObject(this);
 
-  m_modalShowing = FALSE;
+       Show(FALSE);
 
 
-  if ( (GetWindowStyleFlag() & wxDIALOG_MODAL) != wxDIALOG_MODAL )
-    wxModelessWindows.DeleteObject(this);
+    if ( !IsModal() )
+       wxModelessWindows.DeleteObject(this);
 
     // If this is the last top-level window, exit.
     if (wxTheApp && (wxTopLevelWindows.Number() == 0))
 
     // If this is the last top-level window, exit.
     if (wxTheApp && (wxTopLevelWindows.Number() == 0))
@@ -184,19 +145,20 @@ void wxDialog::DoSetClientSize(int width, int height)
        wxWindow::DoSetClientSize( width , height ) ;
 }
 
        wxWindow::DoSetClientSize( width , height ) ;
 }
 
-void wxDialog::GetPosition(int *x, int *y) const
+void wxDialog::DoGetPosition(int *x, int *y) const
 {
 {
-       DoGetPosition( x , y ) ;
+       wxWindow::DoGetPosition( x , y ) ;
 }
 
 }
 
-bool wxDialog::IsShown() const
+bool wxDialog::IsModal() const
 {
 {
-  return m_isShown;
+    return (GetWindowStyleFlag() & wxDIALOG_MODAL) != 0;
 }
 
 }
 
-bool wxDialog::IsModal() const
+
+bool wxDialog::IsModalShowing() const
 {
 {
-    return wxModalDialogs.Find((wxDialog *)this) != 0; // const_cast
+    return wxModalDialogs.Find((wxDialog *)this) != NULL; // const_cast
 }
 
 
 }
 
 
@@ -204,122 +166,77 @@ extern bool s_macIsInModalLoop ;
 
 bool wxDialog::Show(bool show)
 {
 
 bool wxDialog::Show(bool show)
 {
-  m_isShown = show;
-
-  if (show)
-    InitDialog();
+    if ( !wxDialogBase::Show(show) )
+    {
+        // nothing to do
+        return FALSE;
+    }
 
 
-  bool modal =  ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL) ;
+    if ( show )
+    {
+        // usually will result in TransferDataToWindow() being called
+        InitDialog();
+    }
 
 
-#if WXGARBAGE_COLLECTION_ON /* MATTHEW: GC */
-  if (!modal) 
-  {
-    if (show) 
+    if ( IsModal() )
     {
     {
-      if (!wxModelessWindows.Find(this))
-        wxModelessWindows.Append(this);
-    } 
-    else
-      wxModelessWindows.DeleteObject(this);
-  }
-  if (show) 
-  {
-    if (!wxTopLevelWindows.Find(this))
-       wxTopLevelWindows.Append(this);
-  } 
-  else
-       wxTopLevelWindows.DeleteObject(this);
-#endif
+        if ( show )
+        {
+            DoShowModal();
+        }
+        else // end of modal dialog
+        {
+            // this will cause IsModalShowing() return FALSE and our local
+            // message loop will terminate
+            wxModalDialogs.DeleteObject(this);
+        }
+    }
 
 
-       if ( modal )
-       {
-               s_macIsInModalLoop = true ;
-               if (show)
-               {
-               if (m_modalShowing)
-               {
-//                     BringWindowToTop((HWND) GetHWND());
-                       return TRUE;
-               }
-
-               m_modalShowing = TRUE;
-               // if we don't do it, some window might be deleted while we have pointers
-               // to them in our disabledWindows list and the program will crash when it
-               // will try to reenable them after the modal dialog end
-               wxTheApp->DeletePendingObjects();
-
-               UMAShowWindow( m_macWindowData->m_macWindow ) ;
-               UMASelectWindow( m_macWindowData->m_macWindow ) ;
-
-       if (!wxModalDialogs.Member(this))
-               wxModalDialogs.Append(this);
-
-       while (wxModalDialogs.Member(this) )
-       {
-               wxTheApp->MacDoOneEvent() ;
-       }
-         }
-         else
-         {
-       wxModalDialogs.DeleteObject(this);
-       UMAHideWindow( m_macWindowData->m_macWindow ) ;
-         }
-         s_macIsInModalLoop = false ;
-       }
-       else // !modal
-       {
-         if (show)
-         {
-       UMAShowWindow( m_macWindowData->m_macWindow ) ;
-       UMASelectWindow( m_macWindowData->m_macWindow ) ;
-         }
-         else
-         {
-       UMAHideWindow( m_macWindowData->m_macWindow ) ;
-         }
-       }
-       return TRUE ;
+    return TRUE;
 }
 
 }
 
-void wxDialog::SetTitle(const wxString& title)
+void wxDialog::DoShowModal()
 {
 {
-       wxWindow::SetTitle( title ) ;
-}
+    wxCHECK_RET( !IsModalShowing(), _T("DoShowModal() called twice") );
 
 
-wxString wxDialog::GetTitle() const
-{
-       return wxWindow::GetTitle() ;
-}
+    wxModalDialogs.Append(this);
 
 
-void wxDialog::Centre(int direction)
-{
-  int x_offset,y_offset ;
-  int display_width, display_height;
-  int  width, height, x, y;
-  wxWindow *parent = GetParent();
-  if ((direction & wxCENTER_FRAME) && parent)
-  {
-      parent->GetPosition(&x_offset,&y_offset) ;
-      parent->GetSize(&display_width,&display_height) ;
-  }
-  else
-  {
-    wxDisplaySize(&display_width, &display_height);
-    x_offset = 0 ;
-    y_offset = 0 ;
-  }
+       wxWindow *parent = GetParent();
+
+    // remember where the focus was
+    wxWindow *winFocus = FindFocus();
+    if ( !winFocus )
+    {
+        winFocus = parent;
+    }
+    if ( !winFocus )
+    {
+        winFocus = wxTheApp->GetTopWindow();
+    }
+       // TODO : test whether parent gets disabled
+
+       s_macIsInModalLoop = true ;
 
 
-  GetSize(&width, &height);
-  GetPosition(&x, &y);
+       while ( IsModalShowing() )
+       {
+               while ( !wxTheApp->Pending() && wxTheApp->ProcessIdle() )
+               {
+               }
+               wxTheApp->MacDoOneEvent() ;
+       }
+       
+       s_macIsInModalLoop = false ;
 
 
-  if (direction & wxHORIZONTAL)
-    x = (int)((display_width - width)/2);
-  if (direction & wxVERTICAL)
-    y = (int)((display_height - height)/2);
+    // TODO probably reenable the parent window if any
 
 
-  SetSize(x+x_offset, y+y_offset, width, height);
+    // and restore focus
+    if ( winFocus )
+    {
+        winFocus->SetFocus();
+    }
 }
 
 }
 
+
 // Replacement for Show(TRUE) for modal dialogs - returns return code
 int wxDialog::ShowModal()
 {
 // Replacement for Show(TRUE) for modal dialogs - returns return code
 int wxDialog::ShowModal()
 {
@@ -328,6 +245,8 @@ int wxDialog::ShowModal()
   return GetReturnCode();
 }
 
   return GetReturnCode();
 }
 
+// NB: this function (surprizingly) may be called for both modal and modeless
+//     dialogs and should work for both of them
 void wxDialog::EndModal(int retCode)
 {
   SetReturnCode(retCode);
 void wxDialog::EndModal(int retCode)
 {
   SetReturnCode(retCode);
@@ -339,13 +258,7 @@ void wxDialog::OnOK(wxCommandEvent& event)
 {
   if ( Validate() && TransferDataFromWindow() )
   {
 {
   if ( Validate() && TransferDataFromWindow() )
   {
-        if ( IsModal() )
-            EndModal(wxID_OK);
-        else
-        {
-            SetReturnCode(wxID_OK);
-            this->Show(FALSE);
-        }
+      EndModal(wxID_OK);
   }
 }
 
   }
 }
 
@@ -358,20 +271,7 @@ void wxDialog::OnApply(wxCommandEvent& event)
 
 void wxDialog::OnCancel(wxCommandEvent& event)
 {
 
 void wxDialog::OnCancel(wxCommandEvent& event)
 {
-    if ( IsModal() )
         EndModal(wxID_CANCEL);
         EndModal(wxID_CANCEL);
-    else
-    {
-        SetReturnCode(wxID_CANCEL);
-        this->Show(FALSE);
-    }
-}
-
-void wxDialog::OnPaint(wxPaintEvent& event)
-{
-  // No: if you call the default procedure, it makes
-  // the following painting code not work.
-//  wxWindow::OnPaint(event);
 }
 
 void wxDialog::OnCloseWindow(wxCloseEvent& event)
 }
 
 void wxDialog::OnCloseWindow(wxCloseEvent& event)
@@ -407,30 +307,16 @@ void wxDialog::OnCloseWindow(wxCloseEvent& event)
 // Destroy the window (delayed, if a managed window)
 bool wxDialog::Destroy()
 {
 // Destroy the window (delayed, if a managed window)
 bool wxDialog::Destroy()
 {
-  if (!wxPendingDelete.Member(this))
+    wxCHECK_MSG( !wxPendingDelete.Member(this), FALSE,
+                 _T("wxDialog destroyed twice") );
+
     wxPendingDelete.Append(this);
   return TRUE;
 }
 
     wxPendingDelete.Append(this);
   return TRUE;
 }
 
-void wxDialog::OnSize(wxSizeEvent& WXUNUSED(event))
-{
-  // if we're using constraints - do use them
-  #if wxUSE_CONSTRAINTS
-    if ( GetAutoLayout() )
-    {
-      Layout();
-    }
-  #endif
-}
-
 void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& event)
 {
   SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
   Refresh();
 }
 
 void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& event)
 {
   SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
   Refresh();
 }
 
-void wxDialog::Fit()
-{
-  wxWindow::Fit();
-}
-
index ec94a4e1ec5f0216a21113491258943ccb740bfd..f0b6664010a3bffeae63ceb7b33953e4be98c48f 100644 (file)
@@ -147,6 +147,7 @@ bool wxDirData::Read(wxString *filename)
                if ( err != noErr )
                        break ;
                        
                if ( err != noErr )
                        break ;
                        
+               p2cstr( m_name ) ;
                if ( ( m_CPB.dirInfo.ioFlAttrib & ioDirMask) != 0 && (m_flags & wxDIR_DIRS) ) //  we have a directory
                        break ;
                        
                if ( ( m_CPB.dirInfo.ioFlAttrib & ioDirMask) != 0 && (m_flags & wxDIR_DIRS) ) //  we have a directory
                        break ;
                        
@@ -156,17 +157,37 @@ bool wxDirData::Read(wxString *filename)
         if ( ( m_CPB.hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible ) && !(m_flags & wxDIR_HIDDEN) ) // its hidden but we don't want it
                        continue ;
 
         if ( ( m_CPB.hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible ) && !(m_flags & wxDIR_HIDDEN) ) // its hidden but we don't want it
                        continue ;
 
+               wxString file( m_name ) ;
+               if ( m_filespec.IsEmpty() || m_filespec == "*.*" )
+               {
+               }
+               else if ( m_filespec.Length() > 1 && m_filespec.Left(1) =="*" )
+               {
+                       if ( file.Right( m_filespec.Length() - 1 ).Upper() != m_filespec.Mid(1).Upper() )
+                       {
+                               continue ;
+                       }
+               }
+               else if ( m_filespec.Length() > 1 && m_filespec.Right(1) == "*" )
+               {
+                       if ( file.Left( m_filespec.Length() - 1 ).Upper() != m_filespec.Left( m_filespec.Length() - 1 ).Upper() )
+                       {
+                               continue ;
+                       }
+               }
+               else if ( file.Upper() != m_filespec.Upper() )
+               {
+                       continue ;
+               }
+
                break ;
        }
        if ( err != noErr )
        {
                return FALSE ;
        }
                break ;
        }
        if ( err != noErr )
        {
                return FALSE ;
        }
-       FSSpec spec ;
-       
-       FSMakeFSSpecCompat(m_CPB.hFileInfo.ioVRefNum, m_dirId, m_name,&spec) ;
-                                                                 
-       *filename = wxMacFSSpec2UnixFilename( &spec ) ;
+
+       *filename = (char*) m_name ;
 
     return TRUE;
 }
 
     return TRUE;
 }
index 344b8b32b93e6e9a1691f257393f263bd27213ae..02bbef6a204bad2100a085c8786858f9820e07b6 100644 (file)
 
 #include "wx/cmndata.h"
 
 
 #include "wx/cmndata.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_CLASS(wxDirDialog, wxDialog)
 IMPLEMENT_CLASS(wxDirDialog, wxDialog)
-
-enum {
-       kSelectItem = 10,                       // select button item number
-       kSFGetFolderDlgID = 250,        // dialog resource number
-       kStrListID = 250,                       // our strings
-       kSelectStrNum = 1,                      // word 'Select: ' for button
-       kDesktopStrNum = 2,                     // word 'Desktop' for button
-       kSelectNoQuoteStrNum = 3,       // word 'Select: ' for button
-       
-       kUseQuotes = true,                      // parameter for SetButtonName
-       kDontUseQuotes = false
-};
+#endif
 
 // the data we need to pass to our standard file hook routine
 // includes a pointer to the dialog, a pointer to the standard
 
 // the data we need to pass to our standard file hook routine
 // includes a pointer to the dialog, a pointer to the standard
@@ -48,6 +38,21 @@ struct UserDataRec {
 typedef struct UserDataRec
        UserDataRec, *UserDataRecPtr;
 
 typedef struct UserDataRec
        UserDataRec, *UserDataRecPtr;
 
+#if !TARGET_CARBON
+
+enum {
+       kSelectItem = 10,                       // select button item number
+       kSFGetFolderDlgID = 250,        // dialog resource number
+       kStrListID = 250,                       // our strings
+       kSelectStrNum = 1,                      // word 'Select: ' for button
+       kDesktopStrNum = 2,                     // word 'Desktop' for button
+       kSelectNoQuoteStrNum = 3,       // word 'Select: ' for button
+       
+       kUseQuotes = true,                      // parameter for SetButtonName
+       kDontUseQuotes = false
+};
+
+
 static void GetLabelString(StringPtr theStr, short stringNum)
 {
        GetIndString(theStr, kStrListID, stringNum);
 static void GetLabelString(StringPtr theStr, short stringNum)
 {
        GetIndString(theStr, kStrListID, stringNum);
@@ -302,6 +307,7 @@ static pascal short SFGetFolderDialogHook(short item, DialogPtr theDlgPtr, Ptr d
        
        return item;
 }
        
        return item;
 }
+#endif
 
 void StandardGetFolder( ConstStr255Param message , ConstStr255Param path , FileFilterYDUPP fileFilter, StandardFileReply *theSFR)
 {
 
 void StandardGetFolder( ConstStr255Param message , ConstStr255Param path , FileFilterYDUPP fileFilter, StandardFileReply *theSFR)
 {
@@ -321,7 +327,7 @@ void StandardGetFolder( ConstStr255Param message , ConstStr255Param path , FileF
        
        // set initial contents of Select button to a space
        
        
        // set initial contents of Select button to a space
        
-       CopyPStr("\p ", theSFR->sfFile.name);
+       memcpy(theSFR->sfFile.name, "\p ", 2);
        
        // point the user data parameter at the reply record so we can get to it later
        
        
        // point the user data parameter at the reply record so we can get to it later
        
@@ -329,6 +335,8 @@ void StandardGetFolder( ConstStr255Param message , ConstStr255Param path , FileF
        
        // display the dialog
        
        
        // display the dialog
        
+       #if !TARGET_CARBON
+       
        dlgHookUPP = NewDlgHookYDProc(SFGetFolderDialogHook);
        myModalFilterUPP = NewModalFilterYDProc(SFGetFolderModalDialogFilter);
        
        dlgHookUPP = NewDlgHookYDProc(SFGetFolderDialogHook);
        myModalFilterUPP = NewModalFilterYDProc(SFGetFolderModalDialogFilter);
        
@@ -350,6 +358,8 @@ void StandardGetFolder( ConstStr255Param message , ConstStr255Param path , FileF
                                        
        DisposeRoutineDescriptor(dlgHookUPP);
        DisposeRoutineDescriptor(myModalFilterUPP);
                                        
        DisposeRoutineDescriptor(dlgHookUPP);
        DisposeRoutineDescriptor(myModalFilterUPP);
+       #else
+       #endif
        
        // if cancel wasn't pressed and no fatal error occurred...
        
        
        // if cancel wasn't pressed and no fatal error occurred...
        
@@ -445,14 +455,18 @@ int wxDirDialog::ShowModal()
                strcpy((char *)path, m_path ) ;
                c2pstr((char *)path ) ;
 
                strcpy((char *)path, m_path ) ;
                c2pstr((char *)path ) ;
 
-               FileFilterYDUPP         invisiblesExcludedCustomFilterUPP;
                StandardFileReply       reply ;
                StandardFileReply       reply ;
+               FileFilterYDUPP         invisiblesExcludedCustomFilterUPP = 0 ;
+               #if !TARGET_CARBON
                invisiblesExcludedCustomFilterUPP = 
                        NewFileFilterYDProc(OnlyVisibleFoldersCustomFileFilter);
                invisiblesExcludedCustomFilterUPP = 
                        NewFileFilterYDProc(OnlyVisibleFoldersCustomFileFilter);
+               #endif
 
                StandardGetFolder( prompt , path , invisiblesExcludedCustomFilterUPP, &reply);
        
 
                StandardGetFolder( prompt , path , invisiblesExcludedCustomFilterUPP, &reply);
        
+               #if !TARGET_CARBON
                DisposeRoutineDescriptor(invisiblesExcludedCustomFilterUPP);
                DisposeRoutineDescriptor(invisiblesExcludedCustomFilterUPP);
+               #endif
                if ( reply.sfGood == false )
                {
                        m_path = "" ;
                if ( reply.sfGood == false )
                {
                        m_path = "" ;
index 32088eef0f6deea25207f69117d2fdeb92a3f6da..cebcd3aab05bc848c17998b5c1049cbc3c660020 100644 (file)
@@ -18,6 +18,8 @@
 #include "wx/app.h"
 #include "wx/gdicmn.h"
 
 #include "wx/app.h"
 #include "wx/gdicmn.h"
 
+#if wxUSE_DRAG_AND_DROP
+
 // ----------------------------------------------------------------------------
 // global
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // global
 // ----------------------------------------------------------------------------
@@ -131,3 +133,4 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
     return wxDragError;
 };
 
     return wxDragError;
 };
 
+#endif
\ No newline at end of file
index ee50e2e6bd98a197d2fc6bc1ca25d54ae33fbc73..7837183e2aef2d18e0fea4344eec463399db25de 100644 (file)
@@ -1,6 +1,6 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        filedlg.cpp
 /////////////////////////////////////////////////////////////////////////////
 // Name:        filedlg.cpp
-// Purpose:     wxFileDialog
+// Purpose:     wxFileDialog 
 // Author:      AUTHOR
 // Modified by:
 // Created:     ??/??/98
 // Author:      AUTHOR
 // Modified by:
 // Created:     ??/??/98
@@ -19,7 +19,9 @@
 #include "wx/filedlg.h"
 #include "wx/intl.h"
 
 #include "wx/filedlg.h"
 #include "wx/intl.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_CLASS(wxFileDialog, wxDialog)
 IMPLEMENT_CLASS(wxFileDialog, wxDialog)
+#endif
 
 // begin wxmac
 
 
 // begin wxmac
 
@@ -43,6 +45,27 @@ OSType gfiltersmac[] =
        '****'
 } ;
 
        '****'
 } ;
 
+// the data we need to pass to our standard file hook routine
+// includes a pointer to the dialog, a pointer to the standard
+// file reply record (so we can inspect the current selection)
+// and a copy of the "previous" file spec of the reply record
+// so we can see if the selection has changed
+
+const int kwxMacFileTypes = 10 ;
+
+struct OpenUserDataRec {
+       StandardFileReply       *sfrPtr;
+       FSSpec                          oldSelectionFSSpec;
+       char                            filter[kwxMacFileTypes][10] ;
+       OSType                          filtermactypes[kwxMacFileTypes] ;
+       int                                     numfilters ;
+       DialogPtr                       theDlgPtr;
+};
+typedef struct OpenUserDataRec
+       OpenUserDataRec, *OpenUserDataRecPtr;
+
+#if !TARGET_CARBON
+
 static void wxMacSetupStandardFile(short newVRefNum, long newDirID) 
 { 
        enum 
 static void wxMacSetupStandardFile(short newVRefNum, long newDirID) 
 { 
        enum 
@@ -97,25 +120,6 @@ enum {
        kDontUseQuotes = false
 };
 
        kDontUseQuotes = false
 };
 
-// the data we need to pass to our standard file hook routine
-// includes a pointer to the dialog, a pointer to the standard
-// file reply record (so we can inspect the current selection)
-// and a copy of the "previous" file spec of the reply record
-// so we can see if the selection has changed
-
-const int kwxMacFileTypes = 10 ;
-
-struct OpenUserDataRec {
-       StandardFileReply       *sfrPtr;
-       FSSpec                          oldSelectionFSSpec;
-       char                            filter[kwxMacFileTypes][10] ;
-       OSType                          filtermactypes[kwxMacFileTypes] ;
-       int                                     numfilters ;
-       DialogPtr                       theDlgPtr;
-};
-typedef struct OpenUserDataRec
-       OpenUserDataRec, *OpenUserDataRecPtr;
-
 static void GetLabelString(StringPtr theStr, short stringNum)
 {
        GetIndString(theStr, kStrListID, stringNum);
 static void GetLabelString(StringPtr theStr, short stringNum)
 {
        GetIndString(theStr, kStrListID, stringNum);
@@ -185,6 +189,7 @@ static pascal Boolean SFGetFolderModalDialogFilter(DialogPtr theDlgPtr, EventRec
                
        return false;
 }
                
        return false;
 }
+#endif
 
 void ExtendedOpenFile( ConstStr255Param message , ConstStr255Param path , const char *filter , FileFilterYDUPP fileFilter, StandardFileReply *theSFR)
 {
 
 void ExtendedOpenFile( ConstStr255Param message , ConstStr255Param path , const char *filter , FileFilterYDUPP fileFilter, StandardFileReply *theSFR)
 {
@@ -204,7 +209,7 @@ void ExtendedOpenFile( ConstStr255Param message , ConstStr255Param path , const
        
        // set initial contents of Select button to a space
        
        
        // set initial contents of Select button to a space
        
-       CopyPStr("\p ", theSFR->sfFile.name);
+       memcpy( theSFR->sfFile.name , "\p " , 2 ) ;
        
        // point the user data parameter at the reply record so we can get to it later
        
        
        // point the user data parameter at the reply record so we can get to it later
        
@@ -240,6 +245,8 @@ void ExtendedOpenFile( ConstStr255Param message , ConstStr255Param path , const
                myData.numfilters = 0 ;
        }
        // display the dialog
                myData.numfilters = 0 ;
        }
        // display the dialog
+
+#if !TARGET_CARBON
        
        dlgHookUPP = NULL ;
 //     dlgHookUPP = NewDlgHookYDProc(SFGetFolderDialogHook);
        
        dlgHookUPP = NULL ;
 //     dlgHookUPP = NewDlgHookYDProc(SFGetFolderDialogHook);
@@ -263,7 +270,8 @@ void ExtendedOpenFile( ConstStr255Param message , ConstStr255Param path , const
                                        
        DisposeRoutineDescriptor(dlgHookUPP);
        DisposeRoutineDescriptor(myModalFilterUPP);
                                        
        DisposeRoutineDescriptor(dlgHookUPP);
        DisposeRoutineDescriptor(myModalFilterUPP);
-       
+#else
+#endif 
        // if cancel wasn't pressed and no fatal error occurred...
        
        if (theSFR->sfGood)
        // if cancel wasn't pressed and no fatal error occurred...
        
        if (theSFR->sfGood)
@@ -454,8 +462,12 @@ int wxFileDialog::ShowModal()
        
                strcpy((char *)filename, m_fileName) ;
                c2pstr((char *)filename ) ;
        
                strcpy((char *)filename, m_fileName) ;
                c2pstr((char *)filename ) ;
+               #if !TARGET_CARBON
                
                StandardPutFile( prompt , filename , &reply ) ;
                
                StandardPutFile( prompt , filename , &reply ) ;
+       
+               #else
+               #endif
                if ( reply.sfGood == false )
                {
                        m_path = "" ;
                if ( reply.sfGood == false )
                {
                        m_path = "" ;
@@ -479,14 +491,17 @@ int wxFileDialog::ShowModal()
                strcpy((char *)path, m_path ) ;
                c2pstr((char *)path ) ;
 
                strcpy((char *)path, m_path ) ;
                c2pstr((char *)path ) ;
 
-               FileFilterYDUPP         crossPlatformFileFilterUPP;
                StandardFileReply       reply ;
                StandardFileReply       reply ;
+               FileFilterYDUPP crossPlatformFileFilterUPP = 0 ;
+               #if !TARGET_CARBON
                crossPlatformFileFilterUPP = 
                        NewFileFilterYDProc(CrossPlatformFileFilter);
                crossPlatformFileFilterUPP = 
                        NewFileFilterYDProc(CrossPlatformFileFilter);
+               #endif
 
                ExtendedOpenFile( prompt , path , m_wildCard , crossPlatformFileFilterUPP, &reply);
 
                ExtendedOpenFile( prompt , path , m_wildCard , crossPlatformFileFilterUPP, &reply);
-       
-               DisposeRoutineDescriptor(crossPlatformFileFilterUPP);
+               #if !TARGET_CARBON
+               DisposeFileFilterYDUPP(crossPlatformFileFilterUPP);
+               #endif
                if ( reply.sfGood == false )
                {
                        m_path = "" ;
                if ( reply.sfGood == false )
                {
                        m_path = "" ;
index a5df9049a20fa3b8ea2d01e50130f4fd920d1a42..4f26c04f914e3bfab6d22d3655d28981ec364b68 100644 (file)
@@ -18,7 +18,9 @@
 #include "wx/font.h"
 #include "wx/gdicmn.h"
 
 #include "wx/font.h"
 #include "wx/gdicmn.h"
 
+#if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
 IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
+#endif
 
 
 
 
 
 
@@ -77,7 +79,7 @@ void wxFontRefData::MacFindFont()
                                ::GetFNum( "\pTimes" , &m_macFontNum) ;
                                break ;
                        case wxSWISS :
                                ::GetFNum( "\pTimes" , &m_macFontNum) ;
                                break ;
                        case wxSWISS :
-                               ::GetFNum( "\pHelvetica" , &m_macFontNum) ;
+                               ::GetFNum( "\pGeneva" , &m_macFontNum) ;
                                break ;
                        case wxMODERN :
                                ::GetFNum( "\pMonaco" , &m_macFontNum) ;
                                break ;
                        case wxMODERN :
                                ::GetFNum( "\pMonaco" , &m_macFontNum) ;
index 9a0843d64bc0aba3ca60e6ea408328178ee18bfd..d775c24c169eeefdea89bd141b3df424f2226783 100644 (file)
@@ -17,7 +17,9 @@
 #include "wx/mac/fontdlg.h"
 #include "wx/cmndata.h"
 
 #include "wx/mac/fontdlg.h"
 #include "wx/cmndata.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
 IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
+#endif
 
 /*
  * wxFontDialog
 
 /*
  * wxFontDialog
index c5a0f583d673221edbb9fe943360501c6eb14444..4f61d13ff40a7a10b9f71a77498c6c8b71e5b6d7 100644 (file)
 // ----------------------------------------------------------------------------
 
 // convert to/from the string representation: format is
 // ----------------------------------------------------------------------------
 
 // convert to/from the string representation: format is
-//      encodingid;facename[;charset]
+//      facename[;charset]
 
 bool wxNativeEncodingInfo::FromString(const wxString& s)
 {
     wxStringTokenizer tokenizer(s, _T(";"));
 
 
 bool wxNativeEncodingInfo::FromString(const wxString& s)
 {
     wxStringTokenizer tokenizer(s, _T(";"));
 
-    wxString encid = tokenizer.GetNextToken();
-    long enc;
-    if ( !encid.ToLong(&enc) )
-        return FALSE;
-    encoding = (wxFontEncoding)enc;
-
     facename = tokenizer.GetNextToken();
     if ( !facename )
         return FALSE;
     facename = tokenizer.GetNextToken();
     if ( !facename )
         return FALSE;
@@ -85,10 +79,7 @@ bool wxNativeEncodingInfo::FromString(const wxString& s)
 
 wxString wxNativeEncodingInfo::ToString() const
 {
 
 wxString wxNativeEncodingInfo::ToString() const
 {
-    wxString s;
-    
-    s << (long)encoding << _T(';') << facename;
-
+    wxString s(facename);
     if ( charset != 0 )
     {
         s << _T(';') << charset;
     if ( charset != 0 )
     {
         s << _T(';') << charset;
@@ -159,8 +150,6 @@ bool wxGetNativeFontEncoding(wxFontEncoding encoding,
             return FALSE;
     }
 
             return FALSE;
     }
 
-    info->encoding = encoding;
-
     return TRUE;
 }
 
     return TRUE;
 }
 
index cded59c604887d003c26c948ada38447adf10940..b5498fec48450d102bf501997a0d0485eb4d28e5 100644 (file)
@@ -14,7 +14,7 @@
 #endif
 
 #include "wx/frame.h"
 #endif
 
 #include "wx/frame.h"
-#include "wx/statusbr.h"
+#include "wx/mac/statusbr.h"
 #include "wx/toolbar.h"
 #include "wx/menuitem.h"
 #include "wx/menu.h"
 #include "wx/toolbar.h"
 #include "wx/menuitem.h"
 #include "wx/menu.h"
 extern wxList wxModelessWindows;
 extern wxList wxPendingDelete;
 
 extern wxList wxModelessWindows;
 extern wxList wxPendingDelete;
 
-BEGIN_EVENT_TABLE(wxFrame, wxWindow)
-  EVT_SIZE(wxFrame::OnSize)
+#if !USE_SHARED_LIBRARY
+BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
+//  EVT_SIZE(wxFrame::OnSize)
   EVT_ACTIVATE(wxFrame::OnActivate)
   EVT_ACTIVATE(wxFrame::OnActivate)
-  EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
// EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
   EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
   EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
-  EVT_IDLE(wxFrame::OnIdle)
-  EVT_CLOSE(wxFrame::OnCloseWindow)
+//  EVT_IDLE(wxFrame::OnIdle)
+//  EVT_CLOSE(wxFrame::OnCloseWindow)
 END_EVENT_TABLE()
 
 IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
 END_EVENT_TABLE()
 
 IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
+#endif
 
 #if wxUSE_NATIVE_STATUSBAR
 bool wxFrame::m_useNativeStatusBar = TRUE;
 
 #if wxUSE_NATIVE_STATUSBAR
 bool wxFrame::m_useNativeStatusBar = TRUE;
@@ -45,17 +47,43 @@ bool wxFrame::m_useNativeStatusBar = TRUE;
 bool wxFrame::m_useNativeStatusBar = FALSE;
 #endif
 
 bool wxFrame::m_useNativeStatusBar = FALSE;
 #endif
 
-wxFrame::wxFrame()
+#define WX_MAC_STATUSBAR_HEIGHT 15 
+// ----------------------------------------------------------------------------
+// creation/destruction
+// ----------------------------------------------------------------------------
+
+void wxFrame::Init()
 {
 {
-#if wxUSE_TOOLBAR
-  m_frameToolBar = NULL ;
+    m_iconized = FALSE;
+
+#if wxUSE_TOOLTIPS
+    m_hwndToolTip = 0;
 #endif
 #endif
+}
 
 
-       // in order to be able to give size events on show
-  m_frameMenuBar = NULL;
-  m_frameStatusBar = NULL;
-  m_iconized = FALSE;
-  m_isShown = FALSE;
+wxPoint wxFrame::GetClientAreaOrigin() const
+{
+       // on mac we are at position -1,-1 with the control
+    wxPoint pt(0, 0);
+
+#if wxUSE_TOOLBAR
+    if ( GetToolBar() )
+    {
+        int w, h;
+        GetToolBar()->GetSize(& w, & h);
+
+        if ( GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL )
+        {
+            pt.x += w - 1;
+        }
+        else
+        {
+            pt.y += h - 1 ;
+        }
+    }
+#endif // wxUSE_TOOLBAR
+
+    return pt;
 }
 
 bool wxFrame::Create(wxWindow *parent,
 }
 
 bool wxFrame::Create(wxWindow *parent,
@@ -66,13 +94,7 @@ bool wxFrame::Create(wxWindow *parent,
            long style,
            const wxString& name)
 {
            long style,
            const wxString& name)
 {
-  if (!parent)
-    wxTopLevelWindows.Append(this);
-
-  SetName(name);
-  m_windowStyle = style;
   m_frameMenuBar = NULL;
   m_frameMenuBar = NULL;
-  m_isShown = FALSE;
 
 #if wxUSE_TOOLBAR
   m_frameToolBar = NULL ;
 
 #if wxUSE_TOOLBAR
   m_frameToolBar = NULL ;
@@ -88,74 +110,24 @@ bool wxFrame::Create(wxWindow *parent,
 
   if (parent) parent->AddChild(this);
 
 
   if (parent) parent->AddChild(this);
 
-  wxModelessWindows.Append(this);
-
-  // create frame.
-
-       Rect theBoundsRect;
-
-  m_x = (int)pos.x;
-  m_y = (int)pos.y;
-  if ( m_y < 50 )
-       m_y = 50 ;
-  if ( m_x < 20 )
-       m_x = 20 ;
-       
-  m_width = size.x;
-       if (m_width == -1) 
-               m_width = 20;
-  m_height = size.y;
-       if (m_height == -1) 
-               m_height = 20;
+  if (!parent)
+    wxTopLevelWindows.Append(this);
 
 
-       m_macWindowData = new MacWindowData() ;
+  MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
+  
+       m_macWindowData->m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
 
 
-       ::SetRect(&theBoundsRect, m_x, m_y, m_x + m_width, m_y + m_height);
+  wxModelessWindows.Append(this);
 
 
-       WindowClass wclass = kDocumentWindowClass ;
-       WindowAttributes attr = kWindowNoAttributes ;
-       
-       if ( ( m_windowStyle & wxMINIMIZE_BOX ) || ( m_windowStyle & wxMAXIMIZE_BOX ) )
-       {
-               attr |= kWindowFullZoomAttribute ;
-               attr |= kWindowResizableAttribute ;
-       }
-       if ( m_windowStyle & wxSTAY_ON_TOP )
-       {
-               wclass = kFloatingWindowClass ;
-               
-//                     if ( m_windowStyle & wxCAPTION )
-//                             attr |= kHasPaletteTitlebarMask ;
-       }
-       else
-       {
-       }
-       if ( m_windowStyle & wxSYSTEM_MENU )
-       {
-               attr |= kWindowCloseBoxAttribute ;
-       }
-       UMACreateNewWindow( wclass , attr , &theBoundsRect , &m_macWindowData->m_macWindow ) ;
-       wxAssociateWinWithMacWindow( m_macWindowData->m_macWindow , this ) ;
-       wxString label ;
-       if( wxApp::s_macDefaultEncodingIsPC )
-               label = wxMacMakeMacStringFromPC( title ) ;
-       else
-               label = title ;
-       UMASetWTitleC( m_macWindowData->m_macWindow , label ) ;
-       UMACreateRootControl( m_macWindowData->m_macWindow , &m_macWindowData->m_macRootControl ) ;
-       m_macWindowData->m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
-       m_macWindowData->m_macFocus = NULL ;
   return TRUE;
 }
 
 wxFrame::~wxFrame()
 {
   return TRUE;
 }
 
 wxFrame::~wxFrame()
 {
+  m_isBeingDeleted = TRUE;
   wxTopLevelWindows.DeleteObject(this);
 
   wxTopLevelWindows.DeleteObject(this);
 
-  if (m_frameStatusBar)
-    delete m_frameStatusBar;
-  if (m_frameMenuBar)
-    delete m_frameMenuBar;
+  DeleteAllBars();
 
 /* Check if it's the last top-level window */
 
 
 /* Check if it's the last top-level window */
 
@@ -173,11 +145,21 @@ wxFrame::~wxFrame()
 }
 
 
 }
 
 
-void wxFrame::Iconize(bool iconize)
+bool wxFrame::Enable(bool enable)
 {
 {
-    // TODO
-}
+    if ( !wxWindow::Enable(enable) )
+        return FALSE;
 
 
+       if ( m_frameMenuBar && m_frameMenuBar == wxMenuBar::MacGetInstalledMenuBar() )
+       {
+               for ( int i = 0 ; i < m_frameMenuBar->GetMenuCount() ; ++ i )
+               {
+                       m_frameMenuBar->EnableTop( i , enable ) ;
+               }
+       }
+
+    return TRUE;
+}
 // Equivalent to maximize/restore in Windows
 void wxFrame::Maximize(bool maximize)
 {
 // Equivalent to maximize/restore in Windows
 void wxFrame::Maximize(bool maximize)
 {
@@ -190,6 +172,11 @@ bool wxFrame::IsIconized() const
     return FALSE;
 }
 
     return FALSE;
 }
 
+void wxFrame::Iconize(bool iconize)
+{
+    // TODO
+}
+
 // Is the frame maximized?
 bool wxFrame::IsMaximized(void) const
 {
 // Is the frame maximized?
 bool wxFrame::IsMaximized(void) const
 {
@@ -197,10 +184,14 @@ bool wxFrame::IsMaximized(void) const
     return FALSE;
 }
 
     return FALSE;
 }
 
+void wxFrame::Restore()
+{
+    // TODO
+}
+
 void wxFrame::SetIcon(const wxIcon& icon)
 {
 void wxFrame::SetIcon(const wxIcon& icon)
 {
-  m_icon = icon;
-  // TODO
+   wxFrameBase::SetIcon(icon);
 }
 
 wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
 }
 
 wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
@@ -208,61 +199,12 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
 {
     wxStatusBar *statusBar = NULL;
 
 {
     wxStatusBar *statusBar = NULL;
 
-    statusBar = new wxStatusBar(this, id, wxPoint(0, 0), wxSize(100, 17),
-        style, name);
-
-    // Set the height according to the font and the border size
-    // we shouldn't do this on the mac, because we have to fit the grow box
-    /*
-    wxClientDC dc(statusBar);
-    dc.SetFont(statusBar->GetFont());
-
-    long x, y;
-    dc.GetTextExtent("X", &x, &y);
-
-    int height = (int)( (y  * 1.1) + 2* statusBar->GetBorderY());
-
-    statusBar->SetSize(-1, -1, 100, height);
-
-               */
+    statusBar = new wxStatusBar(this, id, style, name);
 
     statusBar->SetFieldsCount(number);
     return statusBar;
 }
 
 
     statusBar->SetFieldsCount(number);
     return statusBar;
 }
 
-wxStatusBar* wxFrame::CreateStatusBar(int number, long style, wxWindowID id,
-    const wxString& name)
-{
-  // Calling CreateStatusBar twice is an error.
-  wxCHECK_MSG( m_frameStatusBar == NULL, FALSE, 
-               "recreating status bar in wxFrame" );
-
-  m_frameStatusBar = OnCreateStatusBar(number, style, id,
-    name);
-  if ( m_frameStatusBar )
-  {
-    PositionStatusBar();
-    return m_frameStatusBar;
-  }
-  else
-    return NULL;
-}
-
-void wxFrame::SetStatusText(const wxString& text, int number)
-{
-  wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" );
-
-  m_frameStatusBar->SetStatusText(text, number);
-}
-
-void wxFrame::SetStatusWidths(int n, const int widths_field[])
-{
-  wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" );
-
-  m_frameStatusBar->SetStatusWidths(n, widths_field);
-  PositionStatusBar();
-}
-
 void wxFrame::PositionStatusBar()
 {
   if (m_frameStatusBar )
 void wxFrame::PositionStatusBar()
 {
   if (m_frameStatusBar )
@@ -274,7 +216,7 @@ void wxFrame::PositionStatusBar()
 
     // Since we wish the status bar to be directly under the client area,
     // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
 
     // Since we wish the status bar to be directly under the client area,
     // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
-    m_frameStatusBar->SetSize(0, h, w, sh);
+    m_frameStatusBar->SetSize(0, h, w, WX_MAC_STATUSBAR_HEIGHT );
    }
 }
 
    }
 }
 
@@ -282,43 +224,15 @@ void wxFrame::SetMenuBar(wxMenuBar *menuBar)
 {
     if (!menuBar)
     {
 {
     if (!menuBar)
     {
-        m_frameMenuBar = NULL;
         return;
     }
   
         return;
     }
   
+    m_frameMenuBar = NULL;
     m_frameMenuBar = menuBar;
     m_frameMenuBar = menuBar;
-               // TODO : we move this into the app code
     m_frameMenuBar->MacInstallMenuBar() ;
     m_frameMenuBar->MacInstallMenuBar() ;
+    m_frameMenuBar->Attach(this);
 }
 
 }
 
-void wxFrame::Fit()
-{
-  // Work out max. size
-  wxNode *node = GetChildren().First();
-  int max_width = 0;
-  int max_height = 0;
-  while (node)
-  {
-    // Find a child that's a subwindow, but not a dialog box.
-    wxWindow *win = (wxWindow *)node->Data();
-
-    if (!win->IsKindOf(CLASSINFO(wxFrame)) &&
-         !win->IsKindOf(CLASSINFO(wxDialog)))
-    {
-      int width, height;
-      int x, y;
-      win->GetSize(&width, &height);
-      win->GetPosition(&x, &y);
-
-      if ((x + width) > max_width)
-        max_width = x + width;
-      if ((y + height) > max_height)
-        max_height = y + height;
-    }
-    node = node->Next();
-  }
-  SetClientSize(max_width, max_height);
-}
 
 // Responds to colour changes, and passes event on to children.
 void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
 
 // Responds to colour changes, and passes event on to children.
 void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
@@ -337,217 +251,55 @@ void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
     wxWindow::OnSysColourChanged(event);
 }
 
     wxWindow::OnSysColourChanged(event);
 }
 
-// Default resizing behaviour - if only ONE subwindow,
-// resize to client rectangle size
-void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) )
-{
-    DoMenuUpdates();
-}
-
-
-// update all menus
-void wxFrame::DoMenuUpdates()
-{
-    wxMenuBar* bar = GetMenuBar();
-
-    if ( bar != NULL )
-    {
-        int nCount = bar->GetMenuCount();
-        for (int n = 0; n < nCount; n++)
-            DoMenuUpdates(bar->GetMenu(n), (wxWindow*) NULL);
-    }
-}
-
-// update a menu and all submenus recursively
-void wxFrame::DoMenuUpdates(wxMenu* menu, wxWindow* WXUNUSED(focusWin))
-{
-    wxEvtHandler* evtHandler = GetEventHandler();
-    wxMenuItemList::Node* node = menu->GetMenuItems().GetFirst();
-    while (node)
-    {
-        wxMenuItem* item = node->GetData();
-        if ( !item->IsSeparator() )
-        {
-            wxWindowID id = item->GetId();
-            wxUpdateUIEvent event(id);
-            event.SetEventObject( this );
-
-            if (evtHandler->ProcessEvent(event))
-            {
-                if (event.GetSetText())
-                    menu->SetLabel(id, event.GetText());
-                if (event.GetSetChecked())
-                    menu->Check(id, event.GetChecked());
-                if (event.GetSetEnabled())
-                    menu->Enable(id, event.GetEnabled());
-            }
-
-            if (item->GetSubMenu())
-                DoMenuUpdates(item->GetSubMenu(), (wxWindow*) NULL);
-        }
-        node = node->GetNext();
-    }
-}
-
-void wxFrame::OnSize(wxSizeEvent& event)
-{
-  // if we're using constraints - do use them
-  #if wxUSE_CONSTRAINTS
-    if ( GetAutoLayout() ) {
-      Layout();
-      return;
-    }
-  #endif
-
-  // do we have _exactly_ one child?
-  wxWindow *child = NULL;
-  for ( wxNode *node = GetChildren().First(); node; node = node->Next() )
-  {
-    wxWindow *win = (wxWindow *)node->Data();
-    if ( !win->IsKindOf(CLASSINFO(wxFrame))  &&
-         !win->IsKindOf(CLASSINFO(wxDialog)) && 
-         (win != GetStatusBar()) 
-#if wxUSE_TOOLBAR
-         &&
-         (win != GetToolBar()) 
-#endif
-         )
-    {
-      if ( child )
-        return;     // it's our second subwindow - nothing to do
-      child = win;
-    }
-  }
-
-  if ( child ) {
-    // we have exactly one child - set it's size to fill the whole frame
-    int clientW, clientH;
-    GetClientSize(&clientW, &clientH);
-
-    int x = 0;
-    int y = 0;
-
-    child->SetSize(x, y, clientW, clientH);
-  }
-}
 
 // Default activation behaviour - set the focus for the first child
 // subwindow found.
 void wxFrame::OnActivate(wxActivateEvent& event)
 {
 
 // Default activation behaviour - set the focus for the first child
 // subwindow found.
 void wxFrame::OnActivate(wxActivateEvent& event)
 {
-  for(wxNode *node = GetChildren().First(); node; node = node->Next())
-  {
-    // Find a child that's a subwindow, but not a dialog box.
-    wxWindow *child = (wxWindow *)node->Data();
-    if (!child->IsKindOf(CLASSINFO(wxFrame)) &&
-         !child->IsKindOf(CLASSINFO(wxDialog)))
+    if ( !event.GetActive() )
     {
     {
-      child->SetFocus();
-      return;
+        event.Skip();
+        return;
     }
     }
-  }
-}
-
-// The default implementation for the close window event.
-void wxFrame::OnCloseWindow(wxCloseEvent& event)
-{
-    this->Destroy();
-}
-
-// Destroy the window (delayed, if a managed window)
-bool wxFrame::Destroy()
-{
-  if (!wxPendingDelete.Member(this))
-    wxPendingDelete.Append(this);
-  return TRUE;
-}
 
 
-// Default menu selection behaviour - display a help string
-void wxFrame::OnMenuHighlight(wxMenuEvent& event)
-{
-  if (GetStatusBar())
-  {
-    if (event.GetMenuId() == -1)
-      SetStatusText("");
-    else
+    for ( wxWindowList::Node *node = GetChildren().GetFirst();
+          node;
+          node = node->GetNext() )
     {
     {
-      wxMenuBar *menuBar = GetMenuBar();
-      if (menuBar)
-      {
-        wxString helpString(menuBar->GetHelpString(event.GetMenuId()));
-        if (helpString != "")
-          SetStatusText(helpString);
-      }
-    }
-  }
-}
-
-wxMenuBar *wxFrame::GetMenuBar() const
-{
-  return m_frameMenuBar;
-}
+        // FIXME all this is totally bogus - we need to do the same as wxPanel,
+        //       but how to do it without duplicating the code?
 
 
+        // restore focus
+        wxWindow *child = node->GetData();
 
 
-// Call this to simulate a menu command
-void wxFrame::Command(int id)
-{
-  ProcessCommand(id);
-}
-
-void wxFrame::ProcessCommand(int id)
-{
-  wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, id);
-  commandEvent.SetInt( id );
-  commandEvent.SetEventObject( this );
-
-  wxMenuBar *bar = GetMenuBar() ;
-  if (!bar)
-    return;
-
-/* TODO: check the menu item if required
-  wxMenuItem *item = bar->FindItemForId(id) ;
-  if (item && item->IsCheckable())
-  {
-    bar->Check(id,!bar->Checked(id)) ;
-  }
-*/
-
-  GetEventHandler()->ProcessEvent(commandEvent);
-}
-
-// Checks if there is a toolbar, and returns the first free client position
-wxPoint wxFrame::GetClientAreaOrigin() const
-{
-    wxPoint pt(0, 0);
+        if ( !child->IsTopLevel()
 #if wxUSE_TOOLBAR
 #if wxUSE_TOOLBAR
-    if (GetToolBar())
-    {
-        int w, h;
-        GetToolBar()->GetSize(& w, & h);
-
-        if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL)
+             && !wxDynamicCast(child, wxToolBar)
+#endif // wxUSE_TOOLBAR
+#if wxUSE_STATUSBAR
+             && !wxDynamicCast(child, wxStatusBar)
+#endif // wxUSE_STATUSBAR
+           )
         {
         {
-            pt.x += w;
-        }
-        else
-        {
-            pt.y += h;
+            child->SetFocus();
+            return;
         }
     }
         }
     }
-#endif
-    return pt;
 }
 
 void wxFrame::DoGetClientSize(int *x, int *y) const
 {
        wxWindow::DoGetClientSize( x , y ) ;
 
 }
 
 void wxFrame::DoGetClientSize(int *x, int *y) const
 {
        wxWindow::DoGetClientSize( x , y ) ;
 
+#if wxUSE_STATUSBAR
   if ( GetStatusBar() )
   {
     int statusX, statusY;
     GetStatusBar()->GetClientSize(&statusX, &statusY);
   if ( GetStatusBar() )
   {
     int statusX, statusY;
     GetStatusBar()->GetClientSize(&statusX, &statusY);
-    *y -= statusY;
+    // right now this is a constant, this might change someday
+    *y -= WX_MAC_STATUSBAR_HEIGHT ;
   }
   }
+#endif // wxUSE_STATUSBAR
 
   wxPoint pt(GetClientAreaOrigin());
   *y -= pt.y;
 
   wxPoint pt(GetClientAreaOrigin());
   *y -= pt.y;
@@ -576,39 +328,20 @@ void wxFrame::DoSetClientSize(int clientwidth, int clientheight)
 #if wxUSE_TOOLBAR
 wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
 {
 #if wxUSE_TOOLBAR
 wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
 {
-    wxCHECK_MSG( m_frameToolBar == NULL, FALSE,
-               "recreating toolbar in wxFrame" );
-
-    wxToolBar* toolBar = OnCreateToolBar(style, id, name);
-    if (toolBar)
+    if ( wxFrameBase::CreateToolBar(style, id, name) )
     {
     {
-        SetToolBar(toolBar);
         PositionToolBar();
         PositionToolBar();
-        return toolBar;
-    }
-    else
-    {
-        return NULL;
     }
     }
-}
 
 
-wxToolBar* wxFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& name)
-{
-    return new wxToolBar(this, id, wxDefaultPosition, wxDefaultSize, style, name);
+    return m_frameToolBar;
 }
 
 void wxFrame::PositionToolBar()
 {
     int cw, ch;
 
 }
 
 void wxFrame::PositionToolBar()
 {
     int cw, ch;
 
-    // TODO: we actually need to use the low-level client size, before
-    // the toolbar/status bar were added.
-    // So DEFINITELY replace the line below with something appropriate.
-
-   //  GetClientSize(& cw, &ch);
-
-               cw = m_width ;
-               ch = m_height ;
+       cw = m_width ;
+       ch = m_height ;
 
     if ( GetStatusBar() )
     {
 
     if ( GetStatusBar() )
     {
@@ -627,12 +360,12 @@ void wxFrame::PositionToolBar()
             // Use the 'real' position. wxSIZE_NO_ADJUSTMENTS
             // means, pretend we don't have toolbar/status bar, so we
             // have the original client size.
             // Use the 'real' position. wxSIZE_NO_ADJUSTMENTS
             // means, pretend we don't have toolbar/status bar, so we
             // have the original client size.
-            GetToolBar()->SetSize(0, 0, tw, ch, wxSIZE_NO_ADJUSTMENTS);
+            GetToolBar()->SetSize(-1, -1, tw, ch + 2 , wxSIZE_NO_ADJUSTMENTS | wxSIZE_ALLOW_MINUS_ONE );
         }
         else
         {
             // Use the 'real' position
         }
         else
         {
             // Use the 'real' position
-            GetToolBar()->SetSize(0, 0, cw, th, wxSIZE_NO_ADJUSTMENTS);
+            GetToolBar()->SetSize(-1, -1, cw + 2, th, wxSIZE_NO_ADJUSTMENTS | wxSIZE_ALLOW_MINUS_ONE );
         }
     }
 }
         }
     }
 }
index be0d0d0a3c904d1983126b5abc2aa3339f81f55a..67d5dd9c845ff2db660fd5d9efcc6d6cb1a65adf 100644 (file)
@@ -15,7 +15,9 @@
 
 #include "wx/gauge.h"
 
 
 #include "wx/gauge.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
+#endif
 
 #include <wx/mac/uma.h>
 
 
 #include <wx/mac/uma.h>
 
@@ -31,15 +33,13 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
        Rect bounds ;
        Str255 title ;
        m_rangeMax = range ;
        Rect bounds ;
        Str255 title ;
        m_rangeMax = range ;
-       m_macHorizontalBorder = 2 ; // additional pixels around the real control
-       m_macVerticalBorder = 2 ;
        
        if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
        {
                size = wxSize( 200 , 16 ) ;
        }
        
        
        if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
        {
                size = wxSize( 200 , 16 ) ;
        }
        
-       MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
+       MacPreControlCreate( parent , id ,  "" , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , range, 
                kControlProgressBarProc , (long) this ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , range, 
                kControlProgressBarProc , (long) this ) ;
@@ -66,7 +66,7 @@ void wxGauge::SetRange(int r)
 void wxGauge::SetValue(int pos)
 {
     m_gaugePos = pos;
 void wxGauge::SetValue(int pos)
 {
     m_gaugePos = pos;
-   ::SetControlValue( m_macControl , m_gaugePos ) ;
+       ::SetControlValue( m_macControl , m_gaugePos ) ;
 }
 
 int wxGauge::GetShadowWidth() const
 }
 
 int wxGauge::GetShadowWidth() const
index 46b1aa871fc57fd8ed02bd1ad813ad4655bfb5bd..63697c835427fdea399f1bf61d3a3b046d4af9c9 100644 (file)
@@ -15,6 +15,8 @@
 
 #include "wx/gdiobj.h"
 
 
 #include "wx/gdiobj.h"
 
+#if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
 IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
+#endif
 
 // TODO: Nothing to do, unless you want to.
 
 // TODO: Nothing to do, unless you want to.
index b7f0babfa212b608402e9a04bf273570e904b878..086762c6462598ee2843740606907910b37c451e 100644 (file)
@@ -17,7 +17,9 @@
 
 #include <string.h>
 
 
 #include <string.h>
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxXXXXHelpController, wxHelpControllerBase)
 IMPLEMENT_DYNAMIC_CLASS(wxXXXXHelpController, wxHelpControllerBase)
+#endif
 
 wxXXXXHelpController::wxXXXXHelpController()
 {
 
 wxXXXXHelpController::wxXXXXHelpController()
 {
index 2fb0616ba868dd7be6f3d61460c6c464f2489fed..4ec1f1b5e95bc4dc2386b4965e9b28ac87ec1c84 100644 (file)
@@ -15,7 +15,9 @@
 
 #include "wx/icon.h"
 
 
 #include "wx/icon.h"
 
+#if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
 IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
+#endif
 
 /*
  * Icons
 
 /*
  * Icons
@@ -58,6 +60,14 @@ wxIcon::wxIcon(const char WXUNUSED(bits)[], int WXUNUSED(width), int WXUNUSED(he
 {
 }
 
 {
 }
 
+wxIcon::wxIcon( const char **bits, int width, int height )
+{
+}
+
+wxIcon::wxIcon( char **bits, int width, int height )
+{
+}
+
 wxIcon::wxIcon(const wxString& icon_file, long flags,
     int desiredWidth, int desiredHeight)
 
 wxIcon::wxIcon(const wxString& icon_file, long flags,
     int desiredWidth, int desiredHeight)
 
@@ -96,20 +106,23 @@ bool  wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo
        c2pstr( (char*) theName ) ;
        
        Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
        c2pstr( (char*) theName ) ;
        
        Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
-       GetResInfo( resHandle , &theId , &theType , theName ) ;
-       ReleaseResource( resHandle ) ;
-       
-       CIconHandle theIcon = (CIconHandle ) GetCIcon( theId ) ;
-       if ( theIcon )
+       if ( resHandle != 0L )
        {
        {
-               M_ICONHANDLERDATA->m_hIcon = theIcon ;
-               M_ICONHANDLERDATA->m_width =  32 ;
-               M_ICONHANDLERDATA->m_height = 32 ;
+               GetResInfo( resHandle , &theId , &theType , theName ) ;
+               ReleaseResource( resHandle ) ;
                
                
-               M_ICONHANDLERDATA->m_depth = 8 ;
-               M_ICONHANDLERDATA->m_ok = true ;
-               M_ICONHANDLERDATA->m_numColors = 256 ;
-               return TRUE ;
+               CIconHandle theIcon = (CIconHandle ) GetCIcon( theId ) ;
+               if ( theIcon )
+               {
+                       M_ICONHANDLERDATA->m_hIcon = theIcon ;
+                       M_ICONHANDLERDATA->m_width =  32 ;
+                       M_ICONHANDLERDATA->m_height = 32 ;
+                       
+                       M_ICONHANDLERDATA->m_depth = 8 ;
+                       M_ICONHANDLERDATA->m_ok = true ;
+                       M_ICONHANDLERDATA->m_numColors = 256 ;
+                       return TRUE ;
+               }
        }
        return FALSE ;
        }
        return FALSE ;
-}
+}
\ No newline at end of file
index cb4b9ff01c4da817ba0904b0416fcaf1b6a7782e..4cb47b4e693ba6a9a223ded7a417fd4336e80087 100644 (file)
@@ -15,7 +15,9 @@
 
 #include "wx/stubs/imaglist.h"
 
 
 #include "wx/stubs/imaglist.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject)
 IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject)
+#endif
 
 wxImageList::wxImageList()
 {
 
 wxImageList::wxImageList()
 {
index c518ad035ccb495731dd670ffaf0ce91a5874f3e..6564af7b7777ee1a33213e0a7cea0433eb16561a 100644 (file)
 #include "wx/utils.h"
 #include "extldef.h"
 
 #include "wx/utils.h"
 #include "extldef.h"
 
+#if !USE_SHARED_LIBRARY
   IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
 
 BEGIN_EVENT_TABLE(wxListBox, wxControl)
        EVT_SIZE( wxListBox::OnSize ) 
 END_EVENT_TABLE()
   IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
 
 BEGIN_EVENT_TABLE(wxListBox, wxControl)
        EVT_SIZE( wxListBox::OnSize ) 
 END_EVENT_TABLE()
+#endif
 
 #include <wx/mac/uma.h>
 
 
 #include <wx/mac/uma.h>
 
@@ -41,6 +43,7 @@ wxListBox::wxListBox()
 {
   m_noItems = 0;
   m_selected = 0;
 {
   m_noItems = 0;
   m_selected = 0;
+  m_macList = NULL ;
 }
 
 bool wxListBox::Create(wxWindow *parent, wxWindowID id,
 }
 
 bool wxListBox::Create(wxWindow *parent, wxWindowID id,
@@ -56,8 +59,6 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
 
        Rect bounds ;
        Str255 title ;
 
        Rect bounds ;
        Str255 title ;
-       m_macHorizontalBorder = 5 ; // additional pixels around the real control
-       m_macVerticalBorder = 5 ;
        
        MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
 
        
        MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
 
@@ -67,6 +68,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
        long    result ;
        UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxListHandleTag , sizeof( ListHandle ) , (char*) &m_macList  , &result ) ;
 
        long    result ;
        UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxListHandleTag , sizeof( ListHandle ) , (char*) &m_macList  , &result ) ;
 
+       HLock( (Handle) m_macList ) ;
        NewExtLDEFInfo( m_macList , MacDrawStringCell , (long) this ) ;
        (**m_macList).selFlags = 0 ;
        if ( style & wxLB_MULTIPLE )
        NewExtLDEFInfo( m_macList , MacDrawStringCell , (long) this ) ;
        (**m_macList).selFlags = 0 ;
        if ( style & wxLB_MULTIPLE )
@@ -109,7 +111,11 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
 wxListBox::~wxListBox()
 {
        Free() ;
 wxListBox::~wxListBox()
 {
        Free() ;
-       DisposeExtLDEFInfo( m_macList ) ;
+       if ( m_macList )
+       {
+               DisposeExtLDEFInfo( m_macList ) ;
+               m_macList = NULL ;
+       }
 }
 
 void wxListBox::Free()
 }
 
 void wxListBox::Free()
@@ -156,7 +162,7 @@ void wxListBox::Delete(int N)
 #endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
        m_stringArray.Remove( N ) ;
        m_dataArray.Remove( N ) ;
 #endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
        m_stringArray.Remove( N ) ;
        m_dataArray.Remove( N ) ;
-       m_noItems --;
+       m_noItems --;
        
        MacDelete( N ) ;
 }
        
        MacDelete( N ) ;
 }
@@ -236,19 +242,29 @@ int wxListBox::FindString(const wxString& st) const
        {
                wxString search = s.Left( s.Length() - 1 ) ;
                int len = search.Length() ;
        {
                wxString search = s.Left( s.Length() - 1 ) ;
                int len = search.Length() ;
-    for ( int i = 0 ; i < m_noItems ; ++ i )
-    {
-       if ( equalstring( m_stringArray[i].Left( len ) , search , false , false ) )
-               return i ;
-    }
+       Str255 s1 , s2 ;
+           strcpy( (char*) s2 , search.c_str() ) ;
+           c2pstr( (char*) s2 ) ;
+       for ( int i = 0 ; i < m_noItems ; ++ i )
+           {
+               strcpy( (char*) s1 , m_stringArray[i].Left( len ).c_str() ) ;
+               c2pstr( (char*) s1 ) ;
+               if ( EqualString( s1 , s2 , false , false ) )
+                       return i ;
+           }
        }
        else
        {
        }
        else
        {
-    for ( int i = 0 ; i < m_noItems ; ++ i )
-    {
-       if ( equalstring( m_stringArray[i] , s , false , false ) )
-               return i ;
-    }
+       Str255 s1 , s2 ;
+           strcpy( (char*) s2 , s.c_str() ) ;
+           c2pstr( (char*) s2 ) ;
+           for ( int i = 0 ; i < m_noItems ; ++ i )
+           {
+               strcpy( (char*) s1 , m_stringArray[i].c_str() ) ;
+               c2pstr( (char*) s1 ) ;
+               if ( EqualString( s1 , s2 , false , false ) )
+                       return i ;
+           }
    }
    return -1;
 }
    }
    return -1;
 }
@@ -308,7 +324,7 @@ void wxListBox::DoSetItemClientData(int N, void *Client_data)
        if ( m_dataArray.GetCount() > N )
        {
        m_dataArray[N] = (char*) Client_data ;
        if ( m_dataArray.GetCount() > N )
        {
        m_dataArray[N] = (char*) Client_data ;
-       }
+    }
     else
     {
        m_dataArray.Add( (char*) Client_data ) ;
     else
     {
        m_dataArray.Add( (char*) Client_data ) ;
@@ -379,7 +395,14 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
 
 void wxListBox::SetString(int N, const wxString& s)
 {
 
 void wxListBox::SetString(int N, const wxString& s)
 {
-       m_stringArray[N] = s ;
+       wxString str ;
+       if( wxApp::s_macDefaultEncodingIsPC )
+       {
+               str = wxMacMakeMacStringFromPC( s )  ;
+       }
+       else
+               str = s ;
+       m_stringArray[N] = str ;
        MacSet( N , s ) ;
 }
 
        MacSet( N , s ) ;
 }
 
@@ -539,7 +562,7 @@ void wxListBox::MacScrollTo( int n )
 void wxListBox::OnSize( const wxSizeEvent &event)
 {
        Point pt = (**m_macList).cellSize ;
 void wxListBox::OnSize( const wxSizeEvent &event)
 {
        Point pt = (**m_macList).cellSize ;
-       pt.h =  m_width - 15 /* scrollbar */ - m_macHorizontalBorder * 2 ;
+       pt.h =  m_width - 15  ;
        LCellSize( pt , m_macList ) ;
 }
 
        LCellSize( pt , m_macList ) ;
 }
 
index 2c11981bf2621628487b9d2ef9283c4895f9bb4d..d1d844565201ff29c49e1f4de52ee49ec1495579 100644 (file)
 #include "wx/stubs/textctrl.h"
 #include "wx/stubs/listctrl.h"
 
 #include "wx/stubs/textctrl.h"
 #include "wx/stubs/listctrl.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject)
 
 IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject)
 
+#endif
 
 wxListCtrl::wxListCtrl()
 {
 
 wxListCtrl::wxListCtrl()
 {
index 8672b2f8973cd7e74390e3fe7863f4a06dde6737..887f726504c62372d91931ae79baa126d0e637ad 100644 (file)
@@ -19,6 +19,7 @@
 
 extern wxList wxModelessWindows;
 
 
 extern wxList wxModelessWindows;
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
 IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
 IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
 IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
 IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
 IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
@@ -33,6 +34,7 @@ BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
   EVT_SCROLL(wxMDIClientWindow::OnScroll)
 END_EVENT_TABLE()
 
   EVT_SCROLL(wxMDIClientWindow::OnScroll)
 END_EVENT_TABLE()
 
+#endif
 
 // Parent frame
 
 
 // Parent frame
 
@@ -61,7 +63,7 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
     else
         m_windowId = (int)NewControlId();
 
     else
         m_windowId = (int)NewControlId();
 
-    // TODO: create MDI parent frame
+       // this window does not exist really
 
     wxModelessWindows.Append(this);
 
 
     wxModelessWindows.Append(this);
 
@@ -75,7 +77,7 @@ wxMDIParentFrame::~wxMDIParentFrame()
 // Get size *available for subwindows* i.e. excluding menu bar.
 void wxMDIParentFrame::DoGetClientSize(int *x, int *y) const
 {
 // Get size *available for subwindows* i.e. excluding menu bar.
 void wxMDIParentFrame::DoGetClientSize(int *x, int *y) const
 {
-   wxFrame::DoGetClientSize( x , y ) ;
+       wxDisplaySize( x , y ) ;
 }
 
 void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
 }
 
 void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
@@ -175,7 +177,9 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
 
     if (parent) parent->AddChild(this);
 
 
     if (parent) parent->AddChild(this);
 
-    // TODO: create child frame
+       MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
+  
+       m_macWindowData->m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
 
     wxModelessWindows.Append(this);
     return FALSE;
 
     wxModelessWindows.Append(this);
     return FALSE;
index 427db90852fd76c82b19f57c160a7b38ebd20c00..9a66f806d2a33aa0cdb10eba2d5f9afe160aea1c 100644 (file)
 // ----------------------
 #include <string.h>
 
 // ----------------------
 #include <string.h>
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
 IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler)
 IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
 IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler)
+#endif
 
 // the (popup) menu title has this special id
 static const int idMenuTitle = -2;
 
 // the (popup) menu title has this special id
 static const int idMenuTitle = -2;
@@ -47,145 +49,6 @@ const short kwxMacAppleMenuId = 1 ;
 // implementation
 // ============================================================================
 
 // implementation
 // ============================================================================
 
-//
-// Helper Functions to get Mac Menus the way they should be ;-)
-//
-
-void wxMacCtoPString(const char* theCString, Str255 thePString);
-
-// remove inappropriate characters, if useShortcuts is false, the ampersand will not auto-generate a mac menu-shortcut
-
-void wxMacBuildMenuString(StringPtr outMacItemText, char *outMacShortcutChar , short *outMacModifiers , const char *inItemText , bool useShortcuts )
-{
-       char *p = (char *) &outMacItemText[1] ;
-       short macModifiers = 0 ;
-       char macShortCut = 0 ;
-       const char *inItemName ;
-       wxString inItemTextMac ;
-       
-       if (wxApp::s_macDefaultEncodingIsPC)
-       {
-               inItemTextMac =  wxMacMakeMacStringFromPC( inItemText ) ;
-               inItemName = inItemTextMac ;
-       }
-       else
-       {
-               inItemName = inItemText ;
-       }
-       
-       if ( useShortcuts && !wxApp::s_macSupportPCMenuShortcuts )
-               useShortcuts = false ;
-       
-       // we have problems with a leading hypen - it will be taken as a separator
-       
-       while ( *inItemName == '-' )
-               inItemName++ ;
-               
-       while( *inItemName )
-       {
-               switch ( *inItemName )
-               {
-                       // special characters for macintosh menus -> use some replacement
-                       case ';' :
-                               *p++ = ',' ;
-                               break ;
-                       case '^' :
-                               *p++ = ' ' ;
-                               break ;
-                       case '!' :
-                               *p++ = ' ' ;
-                               break ;
-                       case '<' :
-                               *p++ = ' ' ;
-                               break ;
-                       case '/' :
-                               *p++ = '|' ;
-                               break ;
-                       case '(' :
-                               *p++ = '[' ;
-                               break ;
-                       case ')' :      
-                               *p++ = ']' ;
-                               break ;
-                       // shortcuts
-                       case '&' :
-                               {
-                                       ++inItemName ;
-                                       if ( *inItemName )
-                                       {
-                                               *p++ = *inItemName ;
-                                               if ( useShortcuts )
-                                                       macShortCut = *inItemName ;
-                                       }
-                                       else
-                                               --inItemName ;
-                               }
-                               break ;
-                       // win-like accelerators
-                       case '\t' :
-                               {
-                                       ++inItemName ;
-                                       while( *inItemName )
-                                       {
-                                               if (strncmp("Ctrl", inItemName, 4) == 0) 
-                                               {
-                                                       inItemName = inItemName + 5;
-                                                       macShortCut = *inItemName;
-                                               }
-                                               else if  (strncmp("Cntrl", inItemName, 5) == 0) 
-                                               {
-                                                       inItemName = inItemName + 6;
-                                                       macShortCut = *inItemName;
-                                               }
-                                               else if (strncmp("Alt", inItemName, 3) == 0) 
-                                               {
-                                                       inItemName = inItemName + 4;
-                                                       macModifiers |= kMenuOptionModifier ;
-                                                       macShortCut = *inItemName ;
-                                               }
-                                               else if (strncmp("Shift", inItemName, 5) == 0) 
-                                               {
-                                                       inItemName = inItemName + 6;
-                                                       macModifiers |= kMenuShiftModifier ;
-                                                       macShortCut = *inItemName ;
-                                               }
-                                               else if (strncmp("F", inItemName, 1) == 0) 
-                                               {
-                                                       inItemName += strlen( inItemName ) ;
-                                                       // no function keys at the moment
-                                                       // macModifiers |= kMenuShiftModifier ;
-                                                       // macShortCut = *inItemName ;
-                                               }
-                                               else
-                                               {
-                                                       break ;
-                                               }
-                                       }
-
-                                       if ( *inItemName == 0 )
-                                               --inItemName ;
-                                               
-                               }
-                               break ;
-                       default :
-                               *p++ = *inItemName ;
-               }
-               ++inItemName ;
-       }
-
-       outMacItemText[0] = (p - (char *)outMacItemText) - 1;
-       if ( outMacShortcutChar )
-               *outMacShortcutChar = macShortCut ;
-       if ( outMacModifiers )
-               *outMacModifiers = macModifiers ;
-       if ( macShortCut )
-       {
-                       int pos = outMacItemText[0] ;
-                       outMacItemText[++pos] = '/';
-                       outMacItemText[++pos] = toupper( macShortCut );
-                       outMacItemText[0] = pos ;
-       }
-}
 
 // Menus
 
 
 // Menus
 
@@ -199,10 +62,10 @@ void wxMenu::Init()
 
     // create the menu
        Str255  label;
 
     // create the menu
        Str255  label;
-       wxMacBuildMenuString( label, NULL , NULL , m_title , false );
+       wxMenuItem::MacBuildMenuString( label, NULL , NULL , m_title , false );
        m_macMenuId = s_macNextMenuId++; 
     wxCHECK_RET( s_macNextMenuId < 236 , "menu ids > 235 cannot be used for submenus on mac" );
        m_macMenuId = s_macNextMenuId++; 
     wxCHECK_RET( s_macNextMenuId < 236 , "menu ids > 235 cannot be used for submenus on mac" );
-       m_hMenu = ::NewMenu(m_macMenuId, label);
+       m_hMenu = UMANewMenu(m_macMenuId, label);
 
     if ( !m_hMenu )
     {
 
     if ( !m_hMenu )
     {
@@ -220,7 +83,7 @@ void wxMenu::Init()
 wxMenu::~wxMenu()
 {
        if (m_hMenu)
 wxMenu::~wxMenu()
 {
        if (m_hMenu)
-               ::DisposeMenu(m_hMenu);
+               UMADisposeMenu(m_hMenu);
 
 #if wxUSE_ACCEL
     // delete accels
 
 #if wxUSE_ACCEL
     // delete accels
@@ -310,38 +173,28 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
                        Str255 label;
                        wxASSERT_MSG( pSubMenu->m_hMenu != NULL , "invalid submenu added");
                    pSubMenu->m_menuParent = this ;
                        Str255 label;
                        wxASSERT_MSG( pSubMenu->m_hMenu != NULL , "invalid submenu added");
                    pSubMenu->m_menuParent = this ;
-                       wxMacBuildMenuString( label , NULL , NULL , pItem->GetText() ,false);
-               
-                       // hardcoded adding of the submenu combination for mac
+                       wxMenuItem::MacBuildMenuString( label , NULL , NULL , pItem->GetText() ,false);
                
                
-                       int theEnd = label[0] + 1; 
-                       if (theEnd > 251) 
-                               theEnd = 251; // mac allows only 255 characters
-                       label[theEnd++] = '/';
-                       label[theEnd++] = hMenuCmd; 
-                       label[theEnd++] = '!';
-                       label[theEnd++] = pSubMenu->m_macMenuId; 
-                       label[theEnd] = 0x00;
-                       label[0] = theEnd;
-
                        if (wxMenuBar::MacGetInstalledMenuBar() == m_menuBar) 
                        {
                        if (wxMenuBar::MacGetInstalledMenuBar() == m_menuBar) 
                        {
-                               ::InsertMenu( pSubMenu->m_hMenu , -1 ) ;
+                               UMAInsertMenu( pSubMenu->m_hMenu , -1 ) ;
                        }
                        
                        if ( pos == (size_t)-1 )
                        {
                        }
                        
                        if ( pos == (size_t)-1 )
                        {
-                               MacAppendMenu(m_hMenu, label);
+                               UMAAppendSubMenuItem(m_hMenu, label, pSubMenu->m_macMenuId);
                        }
                        else
                        {
                        }
                        else
                        {
-                               MacInsertMenuItem(m_hMenu, label , pos);
+                               UMAInsertSubMenuItem(m_hMenu, label , pos, pSubMenu->m_macMenuId);
                        }
                }
                else
                {
                        Str255 label ;
                        }
                }
                else
                {
                        Str255 label ;
-                       wxMacBuildMenuString( label , NULL , NULL , pItem->GetText(), pItem->GetId() == wxApp::s_macAboutMenuItemId);
+                       UInt8 modifiers ;
+                       SInt16 key ;
+                       wxMenuItem::MacBuildMenuString( label, &key  , &modifiers , pItem->GetText(), pItem->GetId() == wxApp::s_macAboutMenuItemId);
                        if ( label[0] == 0 )
                        {
                                // we cannot add empty menus on mac
                        if ( label[0] == 0 )
                        {
                                // we cannot add empty menus on mac
@@ -350,17 +203,17 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
                        }
                        if ( pos == (size_t)-1 )
                        {
                        }
                        if ( pos == (size_t)-1 )
                        {
-                               MacAppendMenu(m_hMenu, label);
+                               UMAAppendMenuItem(m_hMenu, label,key,modifiers);
                        }
                        else
                        {
                        }
                        else
                        {
-                               MacInsertMenuItem(m_hMenu, label , pos);
+                               UMAInsertMenuItem(m_hMenu, label , pos,key,modifiers);
                        }
                        if ( pItem->GetId() == idMenuTitle ) 
                        {
                                if ( pos == (size_t)-1 )
                                {
                        }
                        if ( pItem->GetId() == idMenuTitle ) 
                        {
                                if ( pos == (size_t)-1 )
                                {
-                                       UMADisableMenuItem( m_hMenu , CountMItems( m_hMenu ) ) ;
+                                       UMADisableMenuItem( m_hMenu , CountMenuItems( m_hMenu ) ) ;
                                }
                                else
                                {
                                }
                                else
                                {
@@ -452,113 +305,9 @@ void wxMenu::SetTitle(const wxString& label)
 {
        Str255 title ;
     m_title = label ;
 {
        Str255 title ;
     m_title = label ;
-       wxMacBuildMenuString( title, NULL , NULL , label , false );
+       wxMenuItem::MacBuildMenuString( title, NULL , NULL , label , false );
        UMASetMenuTitle( m_hMenu , title ) ;
 }
        UMASetMenuTitle( m_hMenu , title ) ;
 }
-
-/*
-
-void wxMenu::SetLabel(int id, const wxString& label)
-{
-    Str255 maclabel ;
-   int index ;
-    wxMenuItem *item = FindItemForId(id) ;
-    if (item==NULL)
-        return;
-
-    index = MacGetIndexFromItem( item ) ;
-    if (index < 1)
-               return;
-
-    if (item->GetSubMenu()==NULL)
-    {
-               wxMacBuildMenuString( maclabel , NULL , NULL , label , false );
-               ::SetMenuItemText( m_hMenu , index , maclabel ) ;
-    }
-    else
-    {
-               wxMacBuildMenuString( maclabel , NULL , NULL , label , false );
-               ::SetMenuItemText( m_hMenu , index , maclabel ) ;
-    }
-    item->SetName(label);
-}
-
-wxString wxMenu::GetLabel(int Id) const
-{
-    wxMenuItem *pItem = FindItemForId(Id) ;
-    return pItem->GetName() ;
-}
-
-// Finds the item id matching the given string, -1 if not found.
-int wxMenu::FindItem (const wxString& itemString) const
-{
-    char buf1[200];
-    char buf2[200];
-    wxStripMenuCodes ((char *)(const char *)itemString, buf1);
-
-    for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
-    {
-      wxMenuItem *item = (wxMenuItem *) node->Data ();
-      if (item->GetSubMenu())
-      {
-        int ans = item->GetSubMenu()->FindItem(itemString);
-        if (ans > -1)
-          return ans;
-      }
-      if ( !item->IsSeparator() )
-      {
-        wxStripMenuCodes((char *)item->GetName().c_str(), buf2);
-        if (strcmp(buf1, buf2) == 0)
-          return item->GetId();
-      }
-    }
-
-    return -1;
-}
-
-wxMenuItem *wxMenu::FindItemForId(int itemId, wxMenu ** itemMenu) const
-{
-    if (itemMenu)
-        *itemMenu = NULL;
-    for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
-    {
-        wxMenuItem *item = (wxMenuItem *) node->Data ();
-
-        if (item->GetId() == itemId)
-        {
-            if (itemMenu)
-                *itemMenu = (wxMenu *) this;
-            return item;
-        }
-
-        if (item->GetSubMenu())
-        {
-            wxMenuItem *ans = item->GetSubMenu()->FindItemForId (itemId, itemMenu);
-            if (ans)
-                return ans;
-        }
-    }
-
-    if (itemMenu)
-        *itemMenu = NULL;
-    return NULL;
-}
-
-void wxMenu::SetHelpString(int itemId, const wxString& helpString)
-{
-    wxMenuItem *item = FindItemForId (itemId);
-    if (item)
-        item->SetHelp(helpString);
-}
-
-wxString wxMenu::GetHelpString (int itemId) const
-{
-    wxMenuItem *item = FindItemForId (itemId);
-    wxString str("");
-    return (item == NULL) ? str : item->GetHelp();
-}
-*/
-
 bool wxMenu::ProcessCommand(wxCommandEvent & event)
 {
     bool processed = FALSE;
 bool wxMenu::ProcessCommand(wxCommandEvent & event)
 {
     bool processed = FALSE;
@@ -678,7 +427,10 @@ bool wxMenu::MacMenuSelect( wxEvtHandler* handler, long when , int macMenuId, in
                if (node) 
                {
                        wxMenuItem *pItem = (wxMenuItem*)node->Data();
                if (node) 
                {
                        wxMenuItem *pItem = (wxMenuItem*)node->Data();
-       
+
+                       if (pItem->IsCheckable())
+                               pItem->Check(! pItem->IsChecked());
+
                        wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, pItem->GetId());
                        event.m_timeStamp = when;
                        event.SetEventObject(handler);
                        wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, pItem->GetId());
                        event.m_timeStamp = when;
                        event.SetEventObject(handler);
@@ -892,7 +644,8 @@ void wxMenuBar::MacInstallMenuBar()
        int pos ;
                        wxMenu* menu = m_menus[i] , *subMenu = NULL ;
                
        int pos ;
                        wxMenu* menu = m_menus[i] , *subMenu = NULL ;
                
-                       
+#if !TARGET_CARBON
+                       /* the help menu does not exist in CARBON anymore */                    
                        if( m_titles[i] == "?" || m_titles[i] == "&?"  || m_titles[i] == wxApp::s_macHelpMenuTitleName )
                        {
                                MenuHandle mh = NULL ;
                        if( m_titles[i] == "?" || m_titles[i] == "&?"  || m_titles[i] == wxApp::s_macHelpMenuTitleName )
                        {
                                MenuHandle mh = NULL ;
@@ -906,8 +659,8 @@ void wxMenuBar::MacInstallMenuBar()
                                                formerHelpMenuItems = CountMenuItems( mh ) ;
                                }
                                        
                                                formerHelpMenuItems = CountMenuItems( mh ) ;
                                }
                                        
-                       for (pos = 0 , node = menu->GetMenuItems().First(); node; node = node->Next(), pos++) 
-                       {
+                               for (pos = 0 , node = menu->GetMenuItems().First(); node; node = node->Next(), pos++) 
+                               {
                                        item = (wxMenuItem *)node->Data();
                                        subMenu = item->GetSubMenu() ;
                                        if (subMenu)                    
                                        item = (wxMenuItem *)node->Data();
                                        subMenu = item->GetSubMenu() ;
                                        if (subMenu)                    
@@ -919,12 +672,14 @@ void wxMenuBar::MacInstallMenuBar()
                                                if ( item->IsSeparator() )
                                                {
                                                        if ( mh )
                                                if ( item->IsSeparator() )
                                                {
                                                        if ( mh )
-                                                               ::AppendMenu(mh, "\p-" );
+                                                               UMAAppendMenuItem(mh, "\p-" );
                                                }
                                                else
                                                {
                                                        Str255 label ;
                                                }
                                                else
                                                {
                                                        Str255 label ;
-                                                       wxMacBuildMenuString( label , NULL , NULL , item->GetText(), item->GetId() != wxApp::s_macAboutMenuItemId); // no shortcut in about menu
+                                                       UInt8 modifiers ;
+                                                       SInt16 key ;
+                                                       wxMenuItem::MacBuildMenuString( label, &key , &modifiers  , item->GetText(), item->GetId() != wxApp::s_macAboutMenuItemId); // no shortcut in about menu
                                                        if ( label[0] == 0 )
                                                        {
                                                                // we cannot add empty menus on mac
                                                        if ( label[0] == 0 )
                                                        {
                                                                // we cannot add empty menus on mac
@@ -933,36 +688,36 @@ void wxMenuBar::MacInstallMenuBar()
                                                        }
                                                        if ( item->GetId() == wxApp::s_macAboutMenuItemId )
                                                        { 
                                                        }
                                                        if ( item->GetId() == wxApp::s_macAboutMenuItemId )
                                                        { 
-                                                                       ::SetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , label );
-                       //                                      ::EnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
-                                                                       ::EnableItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
+                                                                       UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , label );
+                                                                       UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
                                                        }
                                                        else
                                                        {
                                                                if ( mh )
                                                        }
                                                        else
                                                        {
                                                                if ( mh )
-                                                                       ::AppendMenu(mh, label );
+                                                                       UMAAppendMenuItem(mh, label , key , modifiers );
                                                        }
                                                }
                                        }
                                }
                        }
                        else
                                                        }
                                                }
                                        }
                                }
                        }
                        else
+#endif
                        {
                        {
-                               wxMacBuildMenuString( label, NULL , NULL , m_titles[i] , false );
+                               wxMenuItem::MacBuildMenuString( label, NULL , NULL , m_titles[i] , false );
                                UMASetMenuTitle( menu->GetHMenu() , label ) ;
                                UMASetMenuTitle( menu->GetHMenu() , label ) ;
-                       for (pos = 0, node = menu->GetMenuItems().First(); node; node = node->Next(), pos++) 
-                       {
+                               for (pos = 0, node = menu->GetMenuItems().First(); node; node = node->Next(), pos++) 
+                               {
                                        item = (wxMenuItem *)node->Data();
                                        subMenu = item->GetSubMenu() ;
                                        if (subMenu)                    
                                        {
                                        item = (wxMenuItem *)node->Data();
                                        subMenu = item->GetSubMenu() ;
                                        if (subMenu)                    
                                        {
-                                               ::InsertMenu( subMenu->GetHMenu() , -1 ) ;
+                                               UMAInsertMenu( subMenu->GetHMenu() , -1 ) ;
                                        }
                                }
                                        }
                                }
-                               ::InsertMenu(m_menus[i]->GetHMenu(), 0);
+                               UMAInsertMenu(m_menus[i]->GetHMenu(), 0);
                        }
                }
                        }
                }
-               ::DrawMenuBar() ;
+               UMADrawMenuBar() ;
 
        s_macInstalledMenuBar = this;
 }
 
        s_macInstalledMenuBar = this;
 }
@@ -1037,18 +792,18 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
     {
                if (s_macInstalledMenuBar == this)
                {
     {
                if (s_macInstalledMenuBar == this)
                {
-                       ::DeleteMenu( menuOld->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
+                       UMADeleteMenu( menuOld->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
                        {
                                Str255  label;
                        {
                                Str255  label;
-                               wxMacBuildMenuString( label, NULL , NULL , title , false );
+                               wxMenuItem::MacBuildMenuString( label, NULL , NULL , title , false );
                                UMASetMenuTitle( menu->GetHMenu() , label ) ;
                                if ( pos == m_menus.GetCount() - 1)
                                {
                                UMASetMenuTitle( menu->GetHMenu() , label ) ;
                                if ( pos == m_menus.GetCount() - 1)
                                {
-                                       ::InsertMenu( menu->GetHMenu() , 0 ) ;
+                                       UMAInsertMenu( menu->GetHMenu() , 0 ) ;
                                }
                                else
                                {
                                }
                                else
                                {
-                                       ::InsertMenu( menu->GetHMenu() , m_menus[pos+1]->MacGetMenuId() ) ;
+                                       UMAInsertMenu( menu->GetHMenu() , m_menus[pos+1]->MacGetMenuId() ) ;
                                }
                        }
                }
                                }
                        }
                }
@@ -1206,6 +961,16 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
     return TRUE;
 }
 
     return TRUE;
 }
 
+void wxMenuBar::Attach(wxFrame *frame)
+{
+//    wxASSERT_MSG( !IsAttached(), wxT("menubar already attached!") );
+
+    m_menuBarFrame = frame;
+
+#if wxUSE_ACCEL
+    RebuildAccelTable();
+#endif // wxUSE_ACCEL
+}
 // ---------------------------------------------------------------------------
 // wxMenuBar searching for menu items
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 // wxMenuBar searching for menu items
 // ---------------------------------------------------------------------------
index 22b07f575d83e385089483cb25107422a66b9e17..153c750c4476b660df8e9d4026eb57b286702cde 100644 (file)
 // dynamic classes implementation
 // ----------------------------------------------------------------------------
 
 // dynamic classes implementation
 // ----------------------------------------------------------------------------
 
+#if !USE_SHARED_LIBRARY
   IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
   IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
-
-void wxMacBuildMenuString(StringPtr outMacItemText, char *outMacShortcutChar , short *outMacModifiers , const char *inItemName , bool useShortcuts ) ;
-
-wxString wxMenuItemBase::GetLabelFromText(const wxString& text)
-{
-    return wxStripMenuCodes(text);
-}
+#endif  //USE_SHARED_LIBRARY
 
 // ----------------------------------------------------------------------------
 // wxMenuItem
 // ----------------------------------------------------------------------------
 
 
 // ----------------------------------------------------------------------------
 // wxMenuItem
 // ----------------------------------------------------------------------------
 
+//
+// Helper Functions to get Mac Menus the way they should be ;-)
+//
+
+void wxMacCtoPString(const char* theCString, Str255 thePString);
+
+// remove inappropriate characters, if useShortcuts is false, the ampersand will not auto-generate a mac menu-shortcut
+
+wxMenuItem::MacBuildMenuString(StringPtr outMacItemText, SInt16 *outMacShortcutChar , UInt8 *outMacModifiers , const char *inItemText , bool useShortcuts )
+{
+       char *p = (char *) &outMacItemText[1] ;
+       short macModifiers = 0 ;
+       char macShortCut = 0 ;
+       const char *inItemName ;
+       wxString inItemTextMac ;
+       
+       if (wxApp::s_macDefaultEncodingIsPC)
+       {
+               inItemTextMac =  wxMacMakeMacStringFromPC( inItemText ) ;
+               inItemName = inItemTextMac ;
+       }
+       else
+       {
+               inItemName = inItemText ;
+       }
+       
+       if ( useShortcuts && !wxApp::s_macSupportPCMenuShortcuts )
+               useShortcuts = false ;
+       
+       // we have problems with a leading hypen - it will be taken as a separator
+       
+       while ( *inItemName == '-' )
+               inItemName++ ;
+               
+       while( *inItemName )
+       {
+               switch ( *inItemName )
+               {
+                       // special characters for macintosh menus -> use some replacement
+                       case ';' :
+                               *p++ = ',' ;
+                               break ;
+                       case '^' :
+                               *p++ = ' ' ;
+                               break ;
+                       case '!' :
+                               *p++ = ' ' ;
+                               break ;
+                       case '<' :
+                               *p++ = '[' ;
+                               break ;
+                       case '>' :
+                               *p++ = ']' ;
+                               break ;
+                       case '/' :
+                               *p++ = '|' ;
+                               break ;
+                       case '(' :
+                               *p++ = '[' ;
+                               break ;
+                       case ')' :      
+                               *p++ = ']' ;
+                               break ;
+                       // shortcuts
+                       case '&' :
+                               {
+                                       ++inItemName ;
+                                       if ( *inItemName )
+                                       {
+                                               *p++ = *inItemName ;
+                                               if ( useShortcuts )
+                                                       macShortCut = *inItemName ;
+                                       }
+                                       else
+                                               --inItemName ;
+                               }
+                               break ;
+                       // win-like accelerators
+                       case '\t' :
+                               {
+                                       ++inItemName ;
+                                       while( *inItemName )
+                                       {
+                                               if (strncmp("Ctrl", inItemName, 4) == 0) 
+                                               {
+                                                       inItemName = inItemName + 5;
+                                                       macShortCut = *inItemName;
+                                               }
+                                               else if (strncmp("Cntrl", inItemName, 5) == 0) 
+                                               {
+                                                       inItemName = inItemName + 6;
+                                                       macShortCut = *inItemName;
+                                               }
+                                               else if (strncmp("Alt", inItemName, 3) == 0) 
+                                               {
+                                                       inItemName = inItemName + 4;
+                                                       macModifiers |= kMenuOptionModifier ;
+                                                       macShortCut = *inItemName ;
+                                               }
+                                               else if (strncmp("Shift", inItemName, 5) == 0) 
+                                               {
+                                                       inItemName = inItemName + 6;
+                                                       macModifiers |= kMenuShiftModifier ;
+                                                       macShortCut = *inItemName ;
+                                               }
+                                               else if (strncmp("F", inItemName, 1) == 0) 
+                                               {
+                                                       inItemName += strlen( inItemName ) ;
+                                                       // no function keys at the moment
+                                                       // macModifiers |= kMenuShiftModifier ;
+                                                       // macShortCut = *inItemName ;
+                                               }
+                                               else
+                                               {
+                                                       break ;
+                                               }
+                                       }
+
+                                       if ( *inItemName == 0 )
+                                               --inItemName ;
+                                               
+                               }
+                               break ;
+                       default :
+                               *p++ = *inItemName ;
+               }
+               ++inItemName ;
+       }
+
+       outMacItemText[0] = (p - (char *)outMacItemText) - 1;
+       if ( outMacShortcutChar )
+               *outMacShortcutChar = macShortCut ;
+       if ( outMacModifiers )
+               *outMacModifiers = macModifiers ;
+               
+       return 0 ;
+}
+
 // ctor & dtor
 // -----------
 
 // ctor & dtor
 // -----------
 
@@ -184,8 +317,8 @@ void wxMenuItem::SetText(const wxString& text)
                if ( index >= 1 )
                {
                        Str255 label;
                if ( index >= 1 )
                {
                        Str255 label;
-                       wxMacBuildMenuString( label , NULL , NULL , text ,false);
-                       ::SetMenuItemText( m_parentMenu->GetHMenu() , index , label ) ; // checkmark
+                       MacBuildMenuString( label , NULL , NULL , text ,false);
+                       UMASetMenuItemText( m_parentMenu->GetHMenu() , index , label ) ; // checkmark
                }
        }
 
                }
        }
 
@@ -204,6 +337,12 @@ void wxMenuItem::SetCheckable(bool checkable)
 // wxMenuItemBase
 // ----------------------------------------------------------------------------
 
 // wxMenuItemBase
 // ----------------------------------------------------------------------------
 
+/* static */
+wxString wxMenuItemBase::GetLabelFromText(const wxString& text)
+{
+    return wxStripMenuCodes(text);
+}
+
 wxMenuItem *wxMenuItemBase::New(wxMenu *parentMenu,
                                 int id,
                                 const wxString& name,
 wxMenuItem *wxMenuItemBase::New(wxMenu *parentMenu,
                                 int id,
                                 const wxString& name,
index 5742ba4ce62e1148ccf4f8e04818a9df9c898d65..fc6c64b825e3a284dfa572c6b0c6d921cd4041f7 100644 (file)
 
 extern bool wxClipboardIsOpen;
 
 
 extern bool wxClipboardIsOpen;
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxMetafile, wxObject)
 IMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC)
 IMPLEMENT_DYNAMIC_CLASS(wxMetafile, wxObject)
 IMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC)
+#endif
 
 /*
  * Metafiles
 
 /*
  * Metafiles
@@ -57,7 +59,7 @@ wxMetafileRefData::~wxMetafileRefData(void)
 {
     if (m_metafile)
     {
 {
     if (m_metafile)
     {
-                               KillPicture( m_metafile ) ;
+               KillPicture( m_metafile ) ;
         m_metafile = 0;
     }
 }
         m_metafile = 0;
     }
 }
@@ -83,7 +85,7 @@ bool wxMetaFile::SetClipboard(int width, int height)
 {
     if (!m_refData)
         return FALSE;
 {
     if (!m_refData)
         return FALSE;
-/*
+
     bool alreadyOpen=wxClipboardOpen();
     if (!alreadyOpen)
     {
     bool alreadyOpen=wxClipboardOpen();
     if (!alreadyOpen)
     {
@@ -92,11 +94,19 @@ bool wxMetaFile::SetClipboard(int width, int height)
     }
     bool success = wxSetClipboardData(wxDF_METAFILE, this, width,height);
     if (!alreadyOpen) wxCloseClipboard();
     }
     bool success = wxSetClipboardData(wxDF_METAFILE, this, width,height);
     if (!alreadyOpen) wxCloseClipboard();
-    return (bool) success;
-    */
+           return (bool) success;
+
     return TRUE ;
 }
 
     return TRUE ;
 }
 
+void wxMetafile::SetHMETAFILE(PicHandle mf)
+{
+    if (!m_refData)
+        m_refData = new wxMetafileRefData;
+
+    M_METAFILEDATA->m_metafile = mf;
+}
+
 bool wxMetaFile::Play(wxDC *dc)
 {
   if (!m_refData)
 bool wxMetaFile::Play(wxDC *dc)
 {
   if (!m_refData)
@@ -142,11 +152,11 @@ wxMetaFileDC::wxMetaFileDC(const wxString& file)
 
   wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
 
 
   wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
 
-       m_metaFile = new wxMetaFile("") ;
-       Rect r={0,0,100,100} ;
+  m_metaFile = new wxMetaFile("") ;
+  Rect r={0,0,1000,1000} ;
        
        
-       m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
-       ::GetPort( &m_macPort ) ;       
+  m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
+  ::GetPort( &m_macPort ) ;    
   m_ok = TRUE ;
 
   SetMapMode(wxMM_TEXT); 
   m_ok = TRUE ;
 
   SetMapMode(wxMM_TEXT); 
@@ -184,5 +194,4 @@ wxMetaFile *wxMetaFileDC::Close()
        return m_metaFile;
 }
 
        return m_metaFile;
 }
 
-
 #endif
 #endif
index cbe09b7d812883ed928eef6dc9cb3744e6caeda2..4f6f5e5fcbb6005644fb9f5e23ed542f19fb71f9 100644 (file)
@@ -15,6 +15,8 @@
 
 #include "wx/minifram.h"
 
 
 #include "wx/minifram.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame, wxFrame)
 IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame, wxFrame)
+#endif
 
 
 
 
index cf229e520008140529f009f37dd7cbfedda33d15..bbdea6abf8c6174e57eb2c0298becf39b22a93e3 100644 (file)
@@ -16,7 +16,9 @@
 #include "wx/msgdlg.h"
 #include "wx/mac/uma.h"
 
 #include "wx/msgdlg.h"
 #include "wx/mac/uma.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_CLASS(wxMessageDialog, wxDialog)
 IMPLEMENT_CLASS(wxMessageDialog, wxDialog)
+#endif
 
 #define kMacOKAlertResourceID 128
 #define kMacYesNoAlertResourceID 129
 
 #define kMacOKAlertResourceID 128
 #define kMacYesNoAlertResourceID 129
@@ -70,7 +72,6 @@ int wxMessageDialog::ShowModal()
        Str255 pascalTitle ;
        Str255 pascalText ;
        
        Str255 pascalTitle ;
        Str255 pascalText ;
        
-       
        if (wxApp::s_macDefaultEncodingIsPC)
        {
                strcpy( (char*) pascalTitle , wxMacMakeMacStringFromPC( m_caption ) ) ;
        if (wxApp::s_macDefaultEncodingIsPC)
        {
                strcpy( (char*) pascalTitle , wxMacMakeMacStringFromPC( m_caption ) ) ;
index 676f54739aa1b8b2be49a6e394ad455461566535..85a9fd16d8346f140ac9127f71b2217f94747e27 100644 (file)
@@ -15,7 +15,9 @@
 
 #include "wx/palette.h"
 
 
 #include "wx/palette.h"
 
+#if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject)
 IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject)
+#endif
 
 /*
  * Palette
 
 /*
  * Palette
index 65da06087d46a85e349477da4755290109648f0a..1e3ced2a3a484c777157da7da10c70737831a760 100644 (file)
@@ -17,7 +17,9 @@
 #include "wx/utils.h"
 #include "wx/pen.h"
 
 #include "wx/utils.h"
 #include "wx/pen.h"
 
+#if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject)
 IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject)
+#endif
 
 wxPenRefData::wxPenRefData()
 {
 
 wxPenRefData::wxPenRefData()
 {
@@ -26,7 +28,7 @@ wxPenRefData::wxPenRefData()
     m_join = wxJOIN_ROUND ;
     m_cap = wxCAP_ROUND ;
     m_nbDash = 0 ;
     m_join = wxJOIN_ROUND ;
     m_cap = wxCAP_ROUND ;
     m_nbDash = 0 ;
-    m_dash = (wxMACDash*)NULL;
+    m_dash = ;
 /* TODO: null data
     m_hPen = 0;
 */
 /* TODO: null data
     m_hPen = 0;
 */
@@ -76,7 +78,7 @@ wxPen::wxPen(const wxColour& col, int Width, int Style)
     M_PENDATA->m_join = wxJOIN_ROUND ;
     M_PENDATA->m_cap = wxCAP_ROUND ;
     M_PENDATA->m_nbDash = 0 ;
     M_PENDATA->m_join = wxJOIN_ROUND ;
     M_PENDATA->m_cap = wxCAP_ROUND ;
     M_PENDATA->m_nbDash = 0 ;
-    M_PENDATA->m_dash = (wxMACDash*)NULL;
+    M_PENDATA->m_dash = ;
 
     RealizeResource();
 
 
     RealizeResource();
 
@@ -94,7 +96,7 @@ wxPen::wxPen(const wxBitmap& stipple, int Width)
     M_PENDATA->m_join = wxJOIN_ROUND ;
     M_PENDATA->m_cap = wxCAP_ROUND ;
     M_PENDATA->m_nbDash = 0 ;
     M_PENDATA->m_join = wxJOIN_ROUND ;
     M_PENDATA->m_cap = wxCAP_ROUND ;
     M_PENDATA->m_nbDash = 0 ;
-    M_PENDATA->m_dash = (wxMACDash*)NULL;
+    M_PENDATA->m_dash = ;
 
     RealizeResource();
 
 
     RealizeResource();
 
@@ -168,7 +170,7 @@ void wxPen::SetDashes(int nb_dashes, const wxDash *Dash)
     Unshare();
 
     M_PENDATA->m_nbDash = nb_dashes;
     Unshare();
 
     M_PENDATA->m_nbDash = nb_dashes;
-    M_PENDATA->m_dash = (wxMACDash *)Dash;
+    M_PENDATA->m_dash = (wxDash *)Dash;
   
     RealizeResource();
 }
   
     RealizeResource();
 }
index a1f8f6b196b18553f4bd2bd2d6f18399588c1072..a5c41e0737c7f70706688537975e782ce4109a90 100644 (file)
 #include "wx/object.h"
 #include "wx/printdlg.h"
 #include "wx/dcprint.h"
 #include "wx/object.h"
 #include "wx/printdlg.h"
 #include "wx/dcprint.h"
+#include "wx/mac/uma.h"
 
 // Use generic page setup dialog: use your own native one if one exists.
 
 
 // Use generic page setup dialog: use your own native one if one exists.
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog)
 IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
 IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog)
 IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
+#endif
 
 wxPrintDialog::wxPrintDialog()
 {
 
 wxPrintDialog::wxPrintDialog()
 {
@@ -64,15 +67,17 @@ wxPrintDialog::~wxPrintDialog()
 int wxPrintDialog::ShowModal()
 {
        int result = wxID_CANCEL ;
 int wxPrintDialog::ShowModal()
 {
        int result = wxID_CANCEL ;
+       #if !TARGET_CARBON
+       
        OSErr err ;
        wxString message ;
        OSErr err ;
        wxString message ;
-       ::PrOpen() ;
+       ::UMAPrOpen() ;
        err = PrError() ;
        
        if ( !err )
        {
                m_printDialogData.ConvertToNative() ;
        err = PrError() ;
        
        if ( !err )
        {
                m_printDialogData.ConvertToNative() ;
-               if  ( m_printDialogData.m_macPrintInfo && ::PrJobDialog( m_printDialogData.m_macPrintInfo ) )
+               if  ( ::PrJobDialog( m_printDialogData.GetPrintData().m_macPrintInfo ) )
                {
                        m_printDialogData.ConvertFromNative() ;
                        result = wxID_OK ;
                {
                        m_printDialogData.ConvertFromNative() ;
                        result = wxID_OK ;
@@ -84,8 +89,10 @@ int wxPrintDialog::ShowModal()
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message  , "", wxICON_HAND | wxOK) ;
        }
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message  , "", wxICON_HAND | wxOK) ;
        }
-       ::PrClose() ;
-
+       ::UMAPrClose() ;
+       #else
+       #pragma warning "TODO:Printing for carbon"
+       #endif
        return result ;
 }
 
        return result ;
 }
 
@@ -127,15 +134,17 @@ wxPageSetupDialog::~wxPageSetupDialog()
 int wxPageSetupDialog::ShowModal()
 {
        int result = wxID_CANCEL ;
 int wxPageSetupDialog::ShowModal()
 {
        int result = wxID_CANCEL ;
+#if !TARGET_CARBON
+
        OSErr err ;
        wxString message ;
        OSErr err ;
        wxString message ;
-       ::PrOpen() ;
+       ::UMAPrOpen() ;
        err = PrError() ;
        
        if ( !err )
        {
                m_pageSetupData.ConvertToNative() ;
        err = PrError() ;
        
        if ( !err )
        {
                m_pageSetupData.ConvertToNative() ;
-               if  ( m_pageSetupData.m_macPageSetupInfo && ::PrStlDialog( m_pageSetupData.m_macPageSetupInfo ) )
+               if  ( ::PrStlDialog( m_pageSetupData.GetPrintData().m_macPrintInfo ) )
                {
                        m_pageSetupData.ConvertFromNative() ;
                        result = wxID_OK ;
                {
                        m_pageSetupData.ConvertFromNative() ;
                        result = wxID_OK ;
@@ -147,8 +156,10 @@ int wxPageSetupDialog::ShowModal()
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
        }
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
        }
-       ::PrClose() ;
-
+       ::UMAPrClose() ;
+#else
+#pragma warning "TODO:printing for carbon"
+#endif
        return result ;
 }
 
        return result ;
 }
 
index 0d4862cfa241c17ab35c59b818c7356f89de8d24..08a6bf77adc5cff8fed862dd499249361a3e0c25 100644 (file)
 
 #include <stdlib.h>
 
 
 #include <stdlib.h>
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxMacPrinter, wxPrinterBase)
 IMPLEMENT_CLASS(wxMacPrintPreview, wxPrintPreviewBase)
 IMPLEMENT_DYNAMIC_CLASS(wxMacPrinter, wxPrinterBase)
 IMPLEMENT_CLASS(wxMacPrintPreview, wxPrintPreviewBase)
+#endif
 
 /*
  * Printer
 
 /*
  * Printer
@@ -92,31 +94,16 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
   else
     m_printDialogData.EnablePageNumbers(FALSE);
 
   else
     m_printDialogData.EnablePageNumbers(FALSE);
 
-  // Create a suitable device context  
  // Create a suitable device context  
   wxDC *dc = NULL;
   if (prompt)
   {
  // Create a suitable device context  
   wxDC *dc = NULL;
   if (prompt)
   {
-               PrOpen() ;
-               m_printDialogData.ConvertToNative() ; // make sure we have a valid handle
-               if ( m_printDialogData.m_macPrintInfo )
-               {
-                       // todo incorporate the changes from a global page setup
-                       if  ( ::PrStlDialog( m_printDialogData.m_macPrintInfo ) ) // we should have the page setup dialog
-                       {
-                               PrClose() ;
-                       wxPrintDialog dialog(parent, & m_printDialogData);
-                       if (dialog.ShowModal() == wxID_OK)
-                       {
-                         dc = dialog.GetPrintDC();
-                         m_printDialogData = dialog.GetPrintData();
-                       }
-                       }
-                       else
-                       {
-                               PrClose() ;
-                       }
-               }
+        wxPrintDialog dialog(parent, & m_printDialogData);
+        if (dialog.ShowModal() == wxID_OK)
+               {
+                    dc = dialog.GetPrintDC();
+                    m_printDialogData = dialog.GetPrintData();
+               }
   }
   else
   {
   }
   else
   {
@@ -140,7 +127,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
   printout->SetDC(dc);
 
   int w, h;
   printout->SetDC(dc);
 
   int w, h;
-  long ww, hh;
+  wxCoord ww, hh;
   dc->GetSize(&w, &h);
   printout->SetPageSizePixels((int)w, (int)h);
   dc->GetSizeMM(&ww, &hh);
   dc->GetSize(&w, &h);
   printout->SetPageSizePixels((int)w, (int)h);
   dc->GetSizeMM(&ww, &hh);
@@ -278,50 +265,35 @@ bool wxMacPrintPreview::Print(bool interactive)
 
 void wxMacPrintPreview::DetermineScaling(void)
 {
 
 void wxMacPrintPreview::DetermineScaling(void)
 {
-/*
-    HDC dc = ::GetDC(NULL);
-    int screenWidth = ::GetDeviceCaps(dc, HORZSIZE);
-//    int screenHeight = ::GetDeviceCaps(dc, VERTSIZE);
-    int screenXRes = ::GetDeviceCaps(dc, HORZRES);
-//    int screenYRes = ::GetDeviceCaps(dc, VERTRES);
-    int logPPIScreenX = ::GetDeviceCaps(dc, LOGPIXELSX);
-    int logPPIScreenY = ::GetDeviceCaps(dc, LOGPIXELSY);
-    m_previewPrintout->SetPPIScreen(logPPIScreenX, logPPIScreenY);
-
-    ::ReleaseDC(NULL, dc);
+       int screenWidth , screenHeight ;
+       wxDisplaySize( &screenWidth , &screenHeight ) ;
+       
+       m_previewPrintout->SetPPIScreen( 72 , 72 ) ;
+       m_previewPrintout->SetPPIPrinter( 72 , 72 ) ;
+       m_previewPrintout->SetPageSizeMM( 8 * 25.6 , 11 * 25.6 ) ;
+       m_previewPrintout->SetPageSizePixels( 8 * 72 , 11 * 72 ) ;
+    m_pageWidth = 8 * 72 ;
+    m_pageHeight = 11 * 72 ;
+    m_previewScale = 1 ;
 
     // Get a device context for the currently selected printer
 
     // Get a device context for the currently selected printer
-    wxPrinterDC printerDC("", "", "", FALSE, m_printDialogData.GetOrientation());
-
-    int printerWidth = 150;
-    int printerHeight = 250;
-    int printerXRes = 1500;
-    int printerYRes = 2500;
-
-    if (printerDC.GetHDC())
+    wxPrinterDC printerDC(m_printDialogData.GetPrintData());
+    if (printerDC.Ok())
     {
     {
-      printerWidth = ::GetDeviceCaps((HDC) printerDC.GetHDC(), HORZSIZE);
-      printerHeight = ::GetDeviceCaps((HDC) printerDC.GetHDC(), VERTSIZE);
-      printerXRes = ::GetDeviceCaps((HDC) printerDC.GetHDC(), HORZRES);
-      printerYRes = ::GetDeviceCaps((HDC) printerDC.GetHDC(), VERTRES);
-
-      int logPPIPrinterX = ::GetDeviceCaps((HDC) printerDC.GetHDC(), LOGPIXELSX);
-      int logPPIPrinterY = ::GetDeviceCaps((HDC) printerDC.GetHDC(), LOGPIXELSY);
-
-      m_previewPrintout->SetPPIPrinter(logPPIPrinterX, logPPIPrinterY);
-      m_previewPrintout->SetPageSizeMM(printerWidth, printerHeight);
-      
-      if (logPPIPrinterX == 0 || logPPIPrinterY == 0 || printerWidth == 0 || printerHeight == 0)
-        m_isOk = FALSE;
-    }
-    else
-      m_isOk = FALSE;
-
-    m_pageWidth = printerXRes;
-    m_pageHeight = printerYRes;
-
+               int x , y ;
+               wxCoord ww, hh;
+               printerDC.GetSizeMM(&ww, &hh);
+               printerDC.GetSize( &x , &y ) ;
+               m_previewPrintout->SetPageSizeMM((int)ww, (int)hh);
+               m_previewPrintout->SetPageSizePixels( x , y) ;
+               m_pageWidth = x ;
+               m_pageHeight =  y ;
+               m_isOk = true ;
+
+       }
     // At 100%, the page should look about page-size on the screen.
     // At 100%, the page should look about page-size on the screen.
-    m_previewScale = (float)((float)screenWidth/(float)printerWidth);
-    m_previewScale = m_previewScale * (float)((float)screenXRes/(float)printerYRes);
-*/
+    // m_previewScale = (float)((float)screenWidth/(float)printerWidth);
+    // m_previewScale = m_previewScale * (float)((float)screenXRes/(float)printerXRes);
+    
+    m_previewScale = 1 ;
 }
 }
index 416ba0b18f8e20ad9690ef5395b1ff4340b96ce7..1f74fae6d21774cfdc4b900d3f616e3b0862b39f 100644 (file)
@@ -20,7 +20,9 @@
 #include "wx/radiobox.h"
 #include <wx/mac/uma.h>
 
 #include "wx/radiobox.h"
 #include <wx/mac/uma.h>
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
+#endif
 
 #pragma mark -
 #pragma mark ### Constructors & destructor ###
 
 #pragma mark -
 #pragma mark ### Constructors & destructor ###
@@ -93,7 +95,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
        Rect bounds ;
        Str255 title ;
        
        Rect bounds ;
        Str255 title ;
        
-       MacPreControlCreate( parent , id ,  label , pos , size ,style, *((wxValidator*)NULL) , name , &bounds , title ) ;
+       MacPreControlCreate( parent , id ,  label , pos , size ,style, val , name , &bounds , title ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1, 
                kControlGroupBoxTextTitleProc , (long) this ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1, 
                kControlGroupBoxTextTitleProc , (long) this ) ;
@@ -435,9 +437,9 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
        x_offset = x;
        y_offset = y;
        GetPosition(&x_current, &y_current);
        x_offset = x;
        y_offset = y;
        GetPosition(&x_current, &y_current);
-       if ((x == -1) || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+       if ((x == -1) && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
                x_offset = x_current;
                x_offset = x_current;
-       if ((y == -1) || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+       if ((y == -1)&& !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
                y_offset = y_current;
 
 // define size
                y_offset = y_current;
 
 // define size
@@ -490,7 +492,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
        
        
        x_start = charWidth;
        
        
        x_start = charWidth;
-       y_start = charHeight*3/2;
+       y_start = 15 ;
        x_offset = x_start;
        y_offset = y_start;
        
        x_offset = x_start;
        y_offset = y_start;
        
@@ -507,7 +509,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
                else
                        {
                                x_offset = x_start;
                else
                        {
                                x_offset = x_start;
-                       y_offset += maxHeight + charHeight/2;
+                       y_offset += maxHeight ; /*+ charHeight/2;*/
                                }
                        }
 
                                }
                        }
 
@@ -515,7 +517,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
                current=current->NextInCycle();
                
                if (m_windowStyle & wxRA_SPECIFY_ROWS)
                current=current->NextInCycle();
                
                if (m_windowStyle & wxRA_SPECIFY_ROWS)
-                       y_offset += maxHeight + charHeight/2;
+                       y_offset += maxHeight ; /*+ charHeight/2;*/
                else
                        x_offset += maxWidth + charWidth;
                }
                else
                        x_offset += maxWidth + charWidth;
                }
index f5f95dfab2ed077ed0129df18750e82cc96a650e..9a93378c0cbb1ccdcb2d40d4b8868c76838556bc 100644 (file)
@@ -15,7 +15,9 @@
 
 #include "wx/radiobut.h"
 
 
 #include "wx/radiobut.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
+#endif
 
 #include <wx/mac/uma.h>
 
 
 #include <wx/mac/uma.h>
 
@@ -48,7 +50,8 @@ void wxRadioButton::SetValue(bool val)
        
    ::SetControlValue( m_macControl , val ) ;
    
        
    ::SetControlValue( m_macControl , val ) ;
    
-   if (val) {
+   if (val) 
+   {
                cycle=this->NextInCycle();
                if (cycle!=NULL) {
                        while (cycle!=this) {
                cycle=this->NextInCycle();
                if (cycle!=NULL) {
                        while (cycle!=this) {
@@ -94,4 +97,3 @@ wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)
                return(cycle);
        }
 }  
                return(cycle);
        }
 }  
-
index 5c01ddd438b31c848d782db2e7d34e2c1d59fcc2..afe12ce60332d74ceabf9d43c6f806b81230d09c 100644 (file)
 
 #include "wx/region.h"
 #include "wx/gdicmn.h"
 
 #include "wx/region.h"
 #include "wx/gdicmn.h"
+#include "wx/mac/uma.h"
 
 
+#if !USE_SHARED_LIBRARY
        IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
        IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)
        IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
        IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)
+#endif
 
 //-----------------------------------------------------------------------------
 // wxRegionRefData implementation
 
 //-----------------------------------------------------------------------------
 // wxRegionRefData implementation
@@ -195,7 +198,8 @@ void wxRegion::GetBox(long& x, long& y, long&w, long &h) const
 {
        if (m_refData) 
        {
 {
        if (m_refData) 
        {
-               Rect box = (**M_REGION).rgnBBox ;
+               Rect box ;
+               GetRegionBounds( M_REGION , &box ) ;
         x = box.left ;
         y = box.top ;
         w = box.right - box.left ;
         x = box.left ;
         y = box.top ;
         w = box.right - box.left ;
@@ -329,7 +333,8 @@ void wxRegionIterator::Reset(const wxRegion& region)
     {
        // we cannot dissolve it into rects on mac
         m_rects = new wxRect[1];
     {
        // we cannot dissolve it into rects on mac
         m_rects = new wxRect[1];
-        Rect rect = (**OTHER_M_REGION( region )).rgnBBox ;
+               Rect rect ;
+               GetRegionBounds( OTHER_M_REGION( region ) , &rect ) ;
         m_rects[0].x = rect.left;
         m_rects[0].y = rect.top;
         m_rects[0].width = rect.right - rect.left;
         m_rects[0].x = rect.left;
         m_rects[0].y = rect.top;
         m_rects[0].width = rect.right - rect.left;
index 2db4a175bb25a42339c81534f792deb339ef20f5..92d6dd1fafe7b9b1f1c27a2b6774ab810d21420f 100644 (file)
 #include "wx/scrolbar.h"
 #include "wx/mac/uma.h"
 
 #include "wx/scrolbar.h"
 #include "wx/mac/uma.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
 
 BEGIN_EVENT_TABLE(wxScrollBar, wxControl)
 END_EVENT_TABLE()
 
 IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
 
 BEGIN_EVENT_TABLE(wxScrollBar, wxControl)
 END_EVENT_TABLE()
 
+#endif
 
 extern ControlActionUPP wxMacLiveScrollbarActionUPP ;
 
 
 extern ControlActionUPP wxMacLiveScrollbarActionUPP ;
 
index 2d72222ab892d3586c16aa80572c4541ab447158..b13b5733ccc9f314816194d8f03ae89ffdd01628 100644 (file)
@@ -74,7 +74,6 @@ wxColour wxSystemSettings::GetSystemColour(int index)
                        break ;
                case wxSYS_COLOUR_INFOBK :
                case wxSYS_COLOUR_APPWORKSPACE: 
                        break ;
                case wxSYS_COLOUR_INFOBK :
                case wxSYS_COLOUR_APPWORKSPACE: 
-               case wxSYS_COLOUR_LISTBOX:
                        return *wxWHITE ;
                        break ;
        }
                        return *wxWHITE ;
                        break ;
        }
index 9218d560bb8dbe1d6d4e2d679d28f9ad80dd4966..936ccddb477dfede68c3a6e1bb809583925c08cf 100644 (file)
 #include "wx/slider.h"
 #include "wx/mac/uma.h"
 
 #include "wx/slider.h"
 #include "wx/mac/uma.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
 
 BEGIN_EVENT_TABLE(wxSlider, wxControl)
 END_EVENT_TABLE()
 IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
 
 BEGIN_EVENT_TABLE(wxSlider, wxControl)
 END_EVENT_TABLE()
+#endif
 
 
 
 
 
 
index 944f72dc1011d0c644f103637b94056f4afeeef1..f5ac7bc9bb64660f145224c52fd2c841ed8e6bc5 100644 (file)
 // wxWin macros
 // ----------------------------------------------------------------------------
 
 // wxWin macros
 // ----------------------------------------------------------------------------
 
+#if !USE_SHARED_LIBRARY
     IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
     IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent);
     IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
     IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent);
+#endif
 
 bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
             long style, const wxString& name)
 
 bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
             long style, const wxString& name)
index ce1e5d1ec871626e1548e19a3b8ded38da41bc91..fa75e68fd5aff8980aa7deb3085125c9d8a84e53 100644 (file)
@@ -15,7 +15,9 @@
 
 #include "wx/statbmp.h"
 
 
 #include "wx/statbmp.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
+#endif
 
 /*
  * wxStaticBitmap
 
 /*
  * wxStaticBitmap
@@ -28,11 +30,12 @@ END_EVENT_TABLE()
 bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
            const wxBitmap& bitmap,
            const wxPoint& pos,
 bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
            const wxBitmap& bitmap,
            const wxPoint& pos,
-           const wxSize& size,
+           const wxSize& s,
            long style,
            const wxString& name)
 {
     SetName(name);
            long style,
            const wxString& name)
 {
     SetName(name);
+       wxSize size = s ;
 
     m_backgroundColour = parent->GetBackgroundColour() ;
     m_foregroundColour = parent->GetForegroundColour() ;
 
     m_backgroundColour = parent->GetBackgroundColour() ;
     m_foregroundColour = parent->GetForegroundColour() ;
@@ -47,9 +50,8 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
     m_windowStyle = style;
 
     bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
     m_windowStyle = style;
 
     bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
+       SetSizeOrDefault( size ) ;
     
     
-       SetSizeOrDefault() ;
-       
     return ret;
 }
 
     return ret;
 }
 
index ea7ca9dfbbad0aec9a119692f7e34d4e5693b794..e0d8257d0f19ead27aaae78cb869c60810bde958 100644 (file)
 #include "wx/statbox.h"
 #include "wx/mac/uma.h"
 
 #include "wx/statbox.h"
 #include "wx/mac/uma.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
 
 BEGIN_EVENT_TABLE(wxStaticBox, wxControl)
        EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
 END_EVENT_TABLE()
 
 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
 
 BEGIN_EVENT_TABLE(wxStaticBox, wxControl)
        EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
 END_EVENT_TABLE()
 
+#endif
 
 /*
  * Static box
 
 /*
  * Static box
@@ -37,7 +39,7 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
        Rect bounds ;
        Str255 title ;
        
        Rect bounds ;
        Str255 title ;
        
-       MacPreControlCreate( parent , id ,  label , pos , size ,style, *((wxValidator*)NULL) , name , &bounds , title ) ;
+       MacPreControlCreate( parent , id ,  label , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1, 
                kControlGroupBoxTextTitleProc , (long) this ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1, 
                kControlGroupBoxTextTitleProc , (long) this ) ;
index b249fc0e11b8be216d0363d123a1e9c8a4701907..22653f651e02c6b0370599febc420f63e240260c 100644 (file)
@@ -18,7 +18,9 @@
 
 #include <stdio.h>
 
 
 #include <stdio.h>
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
+#endif
 
 #include <wx/mac/uma.h>
 
 
 #include <wx/mac/uma.h>
 
@@ -51,69 +53,208 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
     return ret;
 }
 
     return ret;
 }
 
-void wxStaticText::OnPaint( wxPaintEvent &event ) 
+void wxStaticText::OnDraw( wxDC &dc )
 {
 {
-    wxPaintDC dc(this);
     PrepareDC(dc);
     dc.Clear() ;
     PrepareDC(dc);
     dc.Clear() ;
-    dc.DrawText( m_label , 0 , 0 ) ;
-}
+    
+    int x = 0 ;
+    int y = 0 ;
+    wxString text = m_label ;
+    wxString paragraph ;
+       int i = 0 ;
+       int laststop = 0 ;
+       long width, height ;
 
 
-wxSize wxStaticText::DoGetBestSize() const
-{
-       int x , y  ;
-       GetTextExtent( m_label , &x , &y ) ;
-       return wxSize( x , y ) ;
+       while( i < text.Length() )
+       {
+               if( text[i] == 13 || text[i] == 10)
+               {
+                       paragraph = text.Mid( laststop , i - laststop ) ;
+                       while( paragraph.Length() > 0 )
+                       {
+                               dc.GetTextExtent( paragraph , &width , &height ) ;
+                               if ( width > m_width )
+                               {
+                                       for ( int p = paragraph.Length() -1 ; p > 0 ; --p )
+                                       {
+                                               if ( paragraph[p]=='.' )
+                                               {
+                                                       dc.GetTextExtent( paragraph.Left(p+1) , &width , &height ) ;
+                                                       if ( width <= m_width )
+                                                       {       
+                                                               int pos = x ;
+                                                               if ( HasFlag( wxALIGN_CENTER ) )
+                                                               {
+                                                                       pos += ( m_width - width ) / 2 ;
+                                                               }
+                                                               else if ( HasFlag( wxALIGN_RIGHT ) )
+                                                               {
+                                                                       pos += ( m_width - width ) ;
+                                                               }               
+                                                       dc.DrawText( paragraph.Left(p+1), pos , y) ;
+                                                       y += height ;
+                                                               paragraph = paragraph.Mid(p+1) ;
+                                                               break ;
+                                                       }
+                                               }
+                                               if ( paragraph[p]==' ' )
+                                               {
+                                                       dc.GetTextExtent( paragraph.Left(p) , &width , &height ) ;
+                                                       if ( width <= m_width )
+                                                       {
+                                                               int pos = x ;
+                                                               if ( HasFlag( wxALIGN_CENTER ) )
+                                                               {
+                                                                       pos += ( m_width - width ) / 2 ;
+                                                               }
+                                                               else if ( HasFlag( wxALIGN_RIGHT ) )
+                                                               {
+                                                                       pos += ( m_width - width ) ;
+                                                               }               
+                                                       dc.DrawText( paragraph.Left(p), pos , y) ;
+                                                       y += height ;
+                                                               paragraph = paragraph.Mid(p+1) ;
+                                                               break ;
+                                                       }
+                                               }
+                                       }
+                               }
+                               else
+                               {
+                               dc.DrawText( paragraph, x , y) ;
+                               paragraph="";
+                               y += height ;
+                               }
+                       }
+                       laststop = i+1 ;
+               }
+               ++i ;
+       }
+       paragraph = text.Mid( laststop , text.Length() - laststop ) ;
+       while( paragraph.Length() > 0 )
+       {
+               dc.GetTextExtent( paragraph , &width , &height ) ;
+               if ( width > m_width )
+               {
+                       for ( int p = paragraph.Length() -1 ; p > 0 ; --p )
+                       {
+                               if ( paragraph[p]=='.' )
+                               {
+                                       dc.GetTextExtent( paragraph.Left(p+1) , &width , &height ) ;
+                                       if ( width <= m_width )
+                                       {
+                                               int pos = x ;
+                                               if ( HasFlag( wxALIGN_CENTER ) )
+                                               {
+                                                       pos += ( m_width - width ) / 2 ;
+                                               }
+                                               else if ( HasFlag( wxALIGN_RIGHT ) )
+                                               {
+                                                       pos += ( m_width - width ) ;
+                                               }               
+                                               dc.DrawText( paragraph.Left(p+1), pos , y) ;
+                                               y += height ;
+                                               paragraph = paragraph.Mid(p+1) ;
+                                               break ;
+                                       }
+                               }
+                               if ( paragraph[p]==' ' )
+                               {
+                                       dc.GetTextExtent( paragraph.Left(p) , &width , &height ) ;
+                                       if ( width <= m_width )
+                                       {
+                                               int pos = x ;
+                                               if ( HasFlag( wxALIGN_CENTER ) )
+                                               {
+                                                       pos += ( m_width - width ) / 2 ;
+                                               }
+                                               else if ( HasFlag( wxALIGN_RIGHT ) )
+                                               {
+                                                       pos += ( m_width - width ) ;
+                                               }               
+                                               dc.DrawText( paragraph.Left(p), pos , y) ;
+                                               y += height ;
+                                               paragraph = paragraph.Mid(p+1) ;
+                                               break ;
+                                       }
+                               }
+                       }
+               }
+               else
+               {
+                       int pos = x ;
+                       if ( HasFlag( wxALIGN_CENTER ) )
+                       {
+                               pos += ( m_width - width ) / 2 ;
+                       }
+                       else if ( HasFlag( wxALIGN_RIGHT ) )
+                       {
+                               pos += ( m_width - width ) ;
+                       }               
+                       dc.DrawText( paragraph, pos , y) ;
+                       paragraph="";
+                       y += height ;
+               }
+       }
 }
 
 }
 
-void wxStaticText::SetLabel(const wxString& st , bool resize )
-{
-       SetTitle( st ) ;
-       m_label = st ;
-       if ( resize )
-               SetSizeOrDefault() ;
-       else
-               Refresh() ;
-}
-/*
-void wxStaticText::SetSize(int x, int y, int width, int height, int sizeFlags)
+void wxStaticText::OnPaint( wxPaintEvent &event ) 
 {
 {
-    wxControl::SetSize( x , y , width , height , sizeFlags ) ;
+    wxPaintDC dc(this);
+    OnDraw( dc ) ;
 }
 
 }
 
-bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
-           const wxString& label,
-           const wxPoint& pos,
-           const wxSize& size,
-           long style,
-           const wxString& name)
+wxSize wxStaticText::DoGetBestSize() const
 {
 {
-       Rect bounds ;
-       Str255 title ;
-       
-       MacPreControlCreate( parent , id ,  label , pos , size ,style, *((wxValidator*)NULL) , name , &bounds , title ) ;
+       int x , y  ;
+   int widthTextMax = 0, widthLine,
+        heightTextTotal = 0, heightLineDefault = 0, heightLine = 0;
 
 
-       m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1, 
-               kControlStaticTextProc , (long) this ) ;
-       ::UMASetControlData( m_macControl, kControlLabelPart, kControlStaticTextTextTag , (long) title[0] , (char*) &title[1] ) ;
-       
-       MacPostControlCreate() ;
+    wxString curLine;
+    for ( const wxChar *pc = m_label; ; pc++ ) {
+        if ( *pc == wxT('\n') || *pc == wxT('\0') ) {
+            if ( !curLine ) {
+                // we can't use GetTextExtent - it will return 0 for both width
+                // and height and an empty line should count in height
+                // calculation
+                if ( !heightLineDefault )
+                    heightLineDefault = heightLine;
+                if ( !heightLineDefault )
+                    GetTextExtent(_T("W"), NULL, &heightLineDefault);
+
+                heightTextTotal += heightLineDefault;
+            }
+            else {
+                GetTextExtent(curLine, &widthLine, &heightLine);
+                if ( widthLine > widthTextMax )
+                    widthTextMax = widthLine;
+                heightTextTotal += heightLine;
+            }
+
+            if ( *pc == wxT('\n') ) {
+               curLine.Empty();
+            }
+            else {
+               // the end of string
+               break;
+            }
+        }
+        else {
+            curLine += *pc;
+        }
+    }
 
 
-  return TRUE;
+    return wxSize(widthTextMax, heightTextTotal);
 }
 
 }
 
-void wxStaticText::SetLabel(const wxString& st , bool resize )
+void wxStaticText::SetLabel(const wxString& st )
 {
        SetTitle( st ) ;
 {
        SetTitle( st ) ;
-       wxString label ;
+       m_label = st ;
+       if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
+               SetSizeOrDefault() ;
        
        
-       if( wxApp::s_macDefaultEncodingIsPC )
-               label = wxMacMakeMacStringFromPC( st ) ;
-       else
-               label = st ;
-               
-       ::UMASetControlData( m_macControl, kControlLabelPart, kControlStaticTextTextTag , (long) label.Length() , (char*)(const char*) label ) ;
-       Refresh() ;
+    wxClientDC dc(this);
+    OnDraw( dc ) ;
 }
 }
-*/
-
index ed13c3ac8aa2a0ef896c7e9ac9566288c2616127..54821412688f56487af8752ba8fe91edbe432c4c 100644 (file)
 #include "wx/tabctrl.h"
 #include "wx/mac/uma.h"
 
 #include "wx/tabctrl.h"
 #include "wx/mac/uma.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl, wxControl)
 
 BEGIN_EVENT_TABLE(wxTabCtrl, wxControl)
 END_EVENT_TABLE()
 IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl, wxControl)
 
 BEGIN_EVENT_TABLE(wxTabCtrl, wxControl)
 END_EVENT_TABLE()
+#endif
 
 wxTabCtrl::wxTabCtrl()
 {
 
 wxTabCtrl::wxTabCtrl()
 {
@@ -35,7 +37,7 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
 
   m_imageList = NULL;
        
 
   m_imageList = NULL;
        
-       MacPreControlCreate( parent , id ,  "" , pos , size ,style, *((wxValidator*)NULL) , name , &bounds , title ) ;
+       MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1, 
                kControlTabSmallProc , (long) this ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1, 
                kControlTabSmallProc , (long) this ) ;
index c1b98861b03d6f1c41cdfb7833064da1af5a547c..af3919bb7bd4ca122df4e2cf3dbfcc9c3a4fd069 100644 (file)
 
 #include "wx/mac/uma.h"
 
 
 #include "wx/mac/uma.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
 
 BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
        EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
        EVT_CHAR(wxTextCtrl::OnChar)
 IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
 
 BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
        EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
        EVT_CHAR(wxTextCtrl::OnChar)
+    EVT_MENU(wxID_CUT, wxTextCtrl::OnCut)
+    EVT_MENU(wxID_COPY, wxTextCtrl::OnCopy)
+    EVT_MENU(wxID_PASTE, wxTextCtrl::OnPaste)
+    EVT_MENU(wxID_UNDO, wxTextCtrl::OnUndo)
+    EVT_MENU(wxID_REDO, wxTextCtrl::OnRedo)
+
+    EVT_UPDATE_UI(wxID_CUT, wxTextCtrl::OnUpdateCut)
+    EVT_UPDATE_UI(wxID_COPY, wxTextCtrl::OnUpdateCopy)
+    EVT_UPDATE_UI(wxID_PASTE, wxTextCtrl::OnUpdatePaste)
+    EVT_UPDATE_UI(wxID_UNDO, wxTextCtrl::OnUpdateUndo)
+    EVT_UPDATE_UI(wxID_REDO, wxTextCtrl::OnUpdateRedo)
 END_EVENT_TABLE()
 END_EVENT_TABLE()
+#endif
 
 // Text item
 wxTextCtrl::wxTextCtrl()
 
 // Text item
 wxTextCtrl::wxTextCtrl()
-#ifndef NO_TEXT_WINDOW_STREAM
- :streambuf()
-#endif
 {
 {
-    m_fileName = "";
 }
 
 }
 
+const short kVerticalMargin = 2 ;
+const short kHorizontalMargin = 2 ;
+
 bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
                   const wxString& st,
            const wxPoint& pos,
 bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
                   const wxString& st,
            const wxPoint& pos,
@@ -61,25 +73,40 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
            const wxValidator& validator,
            const wxString& name)
 {
            const wxValidator& validator,
            const wxString& name)
 {
-       m_macHorizontalBorder = 2 ; // additional pixels around the real control
-       m_macVerticalBorder = 2 ;
+    // base initialization
+    if ( !CreateBase(parent, id, pos, size, style, validator, name) )
+        return FALSE;
 
        wxSize mySize = size ;
 
        wxSize mySize = size ;
+       if ( UMAHasAppearance() )
+       {
+               m_macHorizontalBorder = 5 ; // additional pixels around the real control
+               m_macVerticalBorder = 5 ;
+       }
+       else
+       {
+               m_macHorizontalBorder = 0 ; // additional pixels around the real control
+               m_macVerticalBorder = 0 ;
+       }
+
 
        Rect bounds ;
        Str255 title ;
 
        Rect bounds ;
        Str255 title ;
-       
+
        if ( mySize.y == -1 )
        {
                if ( UMAHasAppearance() )
        if ( mySize.y == -1 )
        {
                if ( UMAHasAppearance() )
-                       mySize.y = 16 ;
+                       mySize.y = 13 ;
                else
                        mySize.y = 24 ;
                else
                        mySize.y = 24 ;
+               
+               mySize.y += 2 * m_macVerticalBorder ;
        }
        }
+
        MacPreControlCreate( parent , id ,  "" , pos , mySize ,style, validator , name , &bounds , title ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1, 
        MacPreControlCreate( parent , id ,  "" , pos , mySize ,style, validator , name , &bounds , title ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1, 
-               kControlEditTextProc , (long) this ) ;
+               ( style & wxTE_PASSWORD ) ? kControlEditTextPasswordProc : kControlEditTextProc , (long) this ) ;
        MacPostControlCreate() ;
 
        wxString value ;
        MacPostControlCreate() ;
 
        wxString value ;
@@ -88,7 +115,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
                value = wxMacMakeMacStringFromPC( st ) ;
        else
                value = st ;
                value = wxMacMakeMacStringFromPC( st ) ;
        else
                value = st ;
-       UMASetControlData( m_macControl, 0, kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ;
+       UMASetControlData( m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ;
 
   return TRUE;
 }
 
   return TRUE;
 }
@@ -96,7 +123,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
 wxString wxTextCtrl::GetValue() const
 {
        Size actualsize;
 wxString wxTextCtrl::GetValue() const
 {
        Size actualsize;
-       UMAGetControlData( m_macControl, 0, kControlEditTextTextTag , 32767 , wxBuffer , &actualsize) ;
+       UMAGetControlData( m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , 32767 , wxBuffer , &actualsize) ;
        wxBuffer[actualsize] = 0 ;
        if( wxApp::s_macDefaultEncodingIsPC )
                return wxMacMakePCStringFromMac( wxBuffer ) ;
        wxBuffer[actualsize] = 0 ;
        if( wxApp::s_macDefaultEncodingIsPC )
                return wxMacMakePCStringFromMac( wxBuffer ) ;
@@ -104,6 +131,18 @@ wxString wxTextCtrl::GetValue() const
        return wxString(wxBuffer);
 }
 
        return wxString(wxBuffer);
 }
 
+void wxTextCtrl::GetSelection(long* from, long* to) const
+{
+   ControlEditTextSelectionRec selection ;
+   TEHandle teH ;
+   long size ;
+   
+   UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
+
+    *from = (**teH).selStart;
+    *to = (**teH).selEnd;
+}
+
 void wxTextCtrl::SetValue(const wxString& st)
 {
        wxString value ;
 void wxTextCtrl::SetValue(const wxString& st)
 {
        wxString value ;
@@ -112,44 +151,116 @@ void wxTextCtrl::SetValue(const wxString& st)
                value = wxMacMakeMacStringFromPC( st ) ;
        else
                value = st ;
                value = wxMacMakeMacStringFromPC( st ) ;
        else
                value = st ;
-       UMASetControlData( m_macControl, 0, kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ;
+       UMASetControlData( m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ;
        Refresh() ;
 //     MacInvalidateControl() ;
 }
 
        Refresh() ;
 //     MacInvalidateControl() ;
 }
 
-void wxTextCtrl::SetSize(int x, int y, int width, int height, int sizeFlags)
-{
-    wxControl::SetSize( x , y , width , height , sizeFlags ) ;
-}
-
 // Clipboard operations
 void wxTextCtrl::Copy()
 {
 // Clipboard operations
 void wxTextCtrl::Copy()
 {
-   TEHandle teH ;
-   long size ;
+    if (CanCopy())
+    {
+               TEHandle teH ;
+               long size ;
    
    
-   UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
-       TECopy( teH ) ;
+                UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
+               TECopy( teH ) ;
+#if TARGET_CARBON
+               OSStatus err ;
+               err = ClearCurrentScrap( );
+#else
+               OSErr err ;
+               err = ZeroScrap( );
+#endif
+               TEToScrap() ;
+       }
 }
 
 void wxTextCtrl::Cut()
 {
 }
 
 void wxTextCtrl::Cut()
 {
-   TEHandle teH ;
-   long size ;
+    if (CanCut())
+    {
+               TEHandle teH ;
+               long size ;
    
    
-   UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
-       TECut( teH ) ;
-//     MacInvalidateControl() ;
+               UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
+               TECut( teH ) ;
+#if TARGET_CARBON
+               OSStatus err ;
+               err = ClearCurrentScrap( );
+#else
+               OSErr err ;
+               err = ZeroScrap( );
+#endif
+               TEToScrap() ;
+               //      MacInvalidateControl() ;
+       }
 }
 
 void wxTextCtrl::Paste()
 {
 }
 
 void wxTextCtrl::Paste()
 {
-   TEHandle teH ;
-   long size ;
+    if (CanPaste())
+    {
+               TEHandle teH ;
+               long size ;
    
    
-   UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
-       TEPaste( teH ) ;
+               UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
+               TEFromScrap() ;
+               TEPaste( teH ) ;
 //     MacInvalidateControl() ;
 //     MacInvalidateControl() ;
+       }
+}
+
+bool wxTextCtrl::CanCopy() const
+{
+    // Can copy if there's a selection
+    long from, to;
+    GetSelection(& from, & to);
+    return (from != to);
+}
+
+bool wxTextCtrl::CanCut() const
+{
+    // Can cut if there's a selection
+    long from, to;
+    GetSelection(& from, & to);
+    return (from != to);
+}
+
+bool wxTextCtrl::CanPaste() const
+{
+    if (!IsEditable())
+        return FALSE;
+
+       long offset ;
+#if TARGET_CARBON
+       OSStatus err = noErr;
+       ScrapRef scrapRef;
+       
+       err = GetCurrentScrap( &scrapRef );
+       if ( err != noTypeErr && err != memFullErr )    
+       {
+               ScrapFlavorFlags        flavorFlags;
+               Size                            byteCount;
+               
+               if (( err = GetScrapFlavorFlags( scrapRef, 'TEXT', &flavorFlags )) == noErr)
+               {
+                       if (( err = GetScrapFlavorSize( scrapRef, 'TEXT', &byteCount )) == noErr)
+                       {
+                               return TRUE ;
+                       }
+               }
+       }
+       return FALSE;
+       
+#else
+       if ( GetScrap( NULL , 'TEXT' , &offset ) > 0 )
+       {
+               return TRUE ;
+       }
+#endif
+       return FALSE ;
 }
 
 void wxTextCtrl::SetEditable(bool editable)
 }
 
 void wxTextCtrl::SetEditable(bool editable)
@@ -243,65 +354,10 @@ void wxTextCtrl::SetSelection(long from, long to)
 
 bool wxTextCtrl::LoadFile(const wxString& file)
 {
 
 bool wxTextCtrl::LoadFile(const wxString& file)
 {
-    if (!wxFileExists(file))
-        return FALSE;
-
-    m_fileName = file;
-
-    Clear();
-
-#ifndef __WXMAC__
-    ifstream input((char*) (const char*) file, ios::nocreate | ios::in);
-#else
-    ifstream input((char*) (const char*) file, ios::in);
-#endif
-    if (!input.bad())
+    if ( wxTextCtrlBase::LoadFile(file) )
     {
     {
-        struct stat stat_buf;
-        if (stat(file, &stat_buf) < 0)
-            return FALSE;
-        // This may need to be a bigger buffer than the file size suggests,
-        // if it's a UNIX file. Give it an extra 1000 just in case.
-        char *tmp_buffer = (char*)malloc((size_t)(stat_buf.st_size+1+1000));
-        long no_lines = 0;
-        long pos = 0;
-        while (!input.eof() && input.peek() != EOF)
-        {
-            input.getline(wxBuffer, 500);
-               int len = strlen(wxBuffer);
-               wxBuffer[len] = 13;
-               wxBuffer[len+1] = 10;
-               wxBuffer[len+2] = 0;
-               strcpy(tmp_buffer+pos, wxBuffer);
-               pos += strlen(wxBuffer);
-               no_lines++;
-         }
-
-         // TODO add line
-
-         free(tmp_buffer);
-
-         return TRUE;
+        return TRUE;
     }
     }
-    return FALSE;
-}
-
-// If file is null, try saved file name first
-// Returns TRUE if succeeds.
-bool wxTextCtrl::SaveFile(const wxString& file)
-{
-    wxString theFile(file);
-    if (theFile == "")
-        theFile = m_fileName;
-    if (theFile == "")
-        return FALSE;
-    m_fileName = theFile;
-
-    ofstream output((char*) (const char*) theFile);
-    if (output.bad())
-           return FALSE;
-
-    // TODO get and save text
 
     return FALSE;
 }
 
     return FALSE;
 }
@@ -329,18 +385,8 @@ void wxTextCtrl::AppendText(const wxString& text)
 
 void wxTextCtrl::Clear()
 {
 
 void wxTextCtrl::Clear()
 {
-    TEHandle teH ;
-    long size ;
-       ControlEditTextSelectionRec selection ;
-   
-       selection.selStart = 0 ;
-       selection.selEnd = 32767 ;
-   
-    UMASetControlData( m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ;
-   
-    UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
-               TECut( teH ) ;
-//     MacInvalidateControl() ;
+       UMASetControlData( m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , 0 , (char*) ((const char*)NULL) ) ;
+       Refresh() ;
 }
 
 bool wxTextCtrl::IsModified() const
 }
 
 bool wxTextCtrl::IsModified() const
@@ -348,6 +394,73 @@ bool wxTextCtrl::IsModified() const
     return TRUE;
 }
 
     return TRUE;
 }
 
+bool wxTextCtrl::IsEditable() const
+{
+    return IsEnabled();
+}
+
+bool wxTextCtrl::AcceptsFocus() const
+{
+    // we don't want focus if we can't be edited
+    return IsEditable() && wxControl::AcceptsFocus();
+}
+
+wxSize wxTextCtrl::DoGetBestSize() const
+{
+    int wText = 100 ;
+       
+    int hText ;
+               if ( UMAHasAppearance() )
+                       hText = 13 ;
+               else
+                       hText = 24 ;
+       hText += 2 * m_macHorizontalBorder ;
+/*
+    int cx, cy;
+    wxGetCharSize(GetHWND(), &cx, &cy, &GetFont());
+
+    int wText = DEFAULT_ITEM_WIDTH;
+
+    int hText = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
+
+    return wxSize(wText, hText);
+*/
+    if ( m_windowStyle & wxTE_MULTILINE )
+    {
+        hText *= wxMin(GetNumberOfLines(), 5);
+    }
+    //else: for single line control everything is ok
+    return wxSize(wText, hText);
+}
+
+// ----------------------------------------------------------------------------
+// Undo/redo
+// ----------------------------------------------------------------------------
+
+void wxTextCtrl::Undo()
+{
+    if (CanUndo())
+    {
+    }
+}
+
+void wxTextCtrl::Redo()
+{
+    if (CanRedo())
+    {
+    }
+}
+
+bool wxTextCtrl::CanUndo() const
+{
+    return FALSE ;
+}
+
+bool wxTextCtrl::CanRedo() const
+{
+    return FALSE ;
+}
+
 // Makes 'unmodified'
 void wxTextCtrl::DiscardEdits()
 {
 // Makes 'unmodified'
 void wxTextCtrl::DiscardEdits()
 {
@@ -366,9 +479,9 @@ long wxTextCtrl::XYToPosition(long x, long y) const
     return 0;
 }
 
     return 0;
 }
 
-void wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
+bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
 {
 {
-    // TODO
+    return FALSE ;
 }
 
 void wxTextCtrl::ShowPosition(long pos)
 }
 
 void wxTextCtrl::ShowPosition(long pos)
@@ -407,204 +520,125 @@ void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event)
 
 void wxTextCtrl::OnChar(wxKeyEvent& event)
 {
 
 void wxTextCtrl::OnChar(wxKeyEvent& event)
 {
-    switch( event.KeyCode() )
+    switch ( event.KeyCode() )
     {
         case WXK_RETURN:
     {
         case WXK_RETURN:
-        {
-            if ( !(m_windowStyle & wxTE_MULTILINE) )
-            {
+               if (m_windowStyle & wxPROCESS_ENTER)
+               {
                 wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
                 event.SetEventObject( this );
                 if ( GetEventHandler()->ProcessEvent(event) )
                     return;
                 wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
                 event.SetEventObject( this );
                 if ( GetEventHandler()->ProcessEvent(event) )
                     return;
+               } 
+            if ( !(m_windowStyle & wxTE_MULTILINE) )
+            {
+                       wxWindow *parent = GetParent();
+                       wxPanel *panel = wxDynamicCast(parent, wxPanel);
+                       while ( parent != NULL && panel == NULL )
+                       {
+                               parent = parent->GetParent() ;
+                               panel = wxDynamicCast(parent, wxPanel);
+                       }
+                       if ( panel && panel->GetDefaultItem() )
+                       {
+                               wxButton *def = panel->GetDefaultItem() ;
+                               wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
+                                       event.SetEventObject(def);
+                                       def->Command(event);
+                               event.Skip() ;
+                       return ;
+                       }
             }
             //else: multiline controls need Enter for themselves
 
             break;
             }
             //else: multiline controls need Enter for themselves
 
             break;
-        }
+
         case WXK_TAB:
             // always produce navigation event - even if we process TAB
             // ourselves the fact that we got here means that the user code
             // decided to skip processing of this TAB - probably to let it
             // do its default job.
         case WXK_TAB:
             // always produce navigation event - even if we process TAB
             // ourselves the fact that we got here means that the user code
             // decided to skip processing of this TAB - probably to let it
             // do its default job.
-            //
-            // NB: Notice that Ctrl-Tab is handled elsewhere and Alt-Tab is
-            //     handled by Windows
             {
                 wxNavigationKeyEvent eventNav;
                 eventNav.SetDirection(!event.ShiftDown());
             {
                 wxNavigationKeyEvent eventNav;
                 eventNav.SetDirection(!event.ShiftDown());
-                eventNav.SetWindowChange(FALSE);
+                eventNav.SetWindowChange(event.ControlDown());
                 eventNav.SetEventObject(this);
 
                 eventNav.SetEventObject(this);
 
-                if ( GetEventHandler()->ProcessEvent(eventNav) )
+                if ( GetParent()->GetEventHandler()->ProcessEvent(eventNav) )
                     return;
                     return;
+                       event.Skip() ;
+                return ;
             }
             break;
             }
             break;
-
-        default:
-            event.Skip();
-            return;
     }
 
     }
 
-    // don't just call event.Skip() because this will cause TABs and ENTERs
-    // be passed upwards and we don't always want this - instead process it
-    // right here
-
-    // FIXME
-    event.Skip();
-}
-// The streambuf code was partly taken from chapter 3 by Jerry Schwarz of
-// AT&T's "C++ Lanuage System Release 3.0 Library Manual" - Stein Somers
-
-//=========================================================================
-// Called then the buffer is full (gcc 2.6.3) 
-// or when "endl" is output (Borland 4.5)
-//=========================================================================
-// Class declaration using multiple inheritance doesn't work properly for
-// Borland. See note in wb_text.h.
-#ifndef NO_TEXT_WINDOW_STREAM
-int wxTextCtrl::overflow(int c)
-{
-  // Make sure there is a holding area
-  if ( allocate()==EOF )
-  {
-    wxError("Streambuf allocation failed","Internal error");
-    return EOF;
-  }
-  
-  // Verify that there are no characters in get area
-  if ( gptr() && gptr() < egptr() )
-  {
-     wxError("Who's trespassing my get area?","Internal error");
-     return EOF;
-  }
-
-  // Reset get area
-  setg(0,0,0);
-
-  // Make sure there is a put area
-  if ( ! pptr() )
-  {
-/* This doesn't seem to be fatal so comment out error message */
-//    wxError("Put area not opened","Internal error");
-    setp( base(), base() );
-  }
-
-  // Determine how many characters have been inserted but no consumed
-  int plen = pptr() - pbase();
-
-  // Now Jerry relies on the fact that the buffer is at least 2 chars
-  // long, but the holding area "may be as small as 1" ???
-  // And we need an additional \0, so let's keep this inefficient but
-  // safe copy.
-
-  // If c!=EOF, it is a character that must also be comsumed
-  int xtra = c==EOF? 0 : 1;
-
-  // Write temporary C-string to wxTextWindow
-  {
-  char *txt = new char[plen+xtra+1];
-  memcpy(txt, pbase(), plen);
-  txt[plen] = (char)c;     // append c
-  txt[plen+xtra] = '\0';   // append '\0' or overwrite c
-    // If the put area already contained \0, output will be truncated there
-  AppendText(txt);
-    delete[] txt;
-  }
-
-  // Reset put area
-  setp(pbase(), epptr());
-
-#if defined(__WATCOMC__)
-  return __NOT_EOF;
-#elif defined(zapeof)     // HP-UX (all cfront based?)
-  return zapeof(c);
-#else
-  return c!=EOF ? c : 0;  // this should make everybody happy
-#endif
+       EventRecord *ev = wxTheApp->MacGetCurrentEvent() ;
+       short keycode ;
+       short keychar ;
+       keychar = short(ev->message & charCodeMask);
+       keycode = short(ev->message & keyCodeMask) >> 8 ;
+       UMAHandleControlKey( m_macControl , keycode , keychar , ev->modifiers ) ;
+       if ( keychar >= 0x20 || event.KeyCode() == WXK_RETURN)
+       {
+        wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
+        event.SetString( GetValue() ) ;
+        event.SetEventObject( this );
+        GetEventHandler()->ProcessEvent(event);
+       }
+
 }
 
 }
 
-//=========================================================================
-// called then "endl" is output (gcc) or then explicit sync is done (Borland)
-//=========================================================================
-int wxTextCtrl::sync()
-{
-  // Verify that there are no characters in get area
-  if ( gptr() && gptr() < egptr() )
-  {
-     wxError("Who's trespassing my get area?","Internal error");
-     return EOF;
-  }
-
-  if ( pptr() && pptr() > pbase() ) return overflow(EOF);
-
-  return 0;
-/* OLD CODE
-  int len = pptr() - pbase();
-  char *txt = new char[len+1];
-  strncpy(txt, pbase(), len);
-  txt[len] = '\0';
-  (*this) << txt;
-  setp(pbase(), epptr());
-  delete[] txt;
-  return 0;
-*/
+// ----------------------------------------------------------------------------
+// standard handlers for standard edit menu events
+// ----------------------------------------------------------------------------
+
+void wxTextCtrl::OnCut(wxCommandEvent& event)
+{
+    Cut();
 }
 
 }
 
-//=========================================================================
-// Should not be called by a "ostream". Used by a "istream"
-//=========================================================================
-int wxTextCtrl::underflow()
+void wxTextCtrl::OnCopy(wxCommandEvent& event)
 {
 {
-  return EOF;
+    Copy();
 }
 }
-#endif
 
 
-wxTextCtrl& wxTextCtrl::operator<<(const wxString& s)
+void wxTextCtrl::OnPaste(wxCommandEvent& event)
 {
 {
-    AppendText(s);
-    return *this;
+    Paste();
 }
 
 }
 
-wxTextCtrl& wxTextCtrl::operator<<(float f)
+void wxTextCtrl::OnUndo(wxCommandEvent& event)
 {
 {
-    wxString str;
-    str.Printf("%.2f", f);
-    AppendText(str);
-    return *this;
+    Undo();
 }
 
 }
 
-wxTextCtrl& wxTextCtrl::operator<<(double d)
+void wxTextCtrl::OnRedo(wxCommandEvent& event)
 {
 {
-    wxString str;
-    str.Printf("%.2f", d);
-    AppendText(str);
-    return *this;
+    Redo();
 }
 
 }
 
-wxTextCtrl& wxTextCtrl::operator<<(int i)
+void wxTextCtrl::OnUpdateCut(wxUpdateUIEvent& event)
 {
 {
-    wxString str;
-    str.Printf("%d", i);
-    AppendText(str);
-    return *this;
+    event.Enable( CanCut() );
 }
 
 }
 
-wxTextCtrl& wxTextCtrl::operator<<(long i)
+void wxTextCtrl::OnUpdateCopy(wxUpdateUIEvent& event)
 {
 {
-    wxString str;
-    str.Printf("%ld", i);
-    AppendText(str);
-    return *this;
+    event.Enable( CanCopy() );
 }
 
 }
 
-wxTextCtrl& wxTextCtrl::operator<<(const char c)
+void wxTextCtrl::OnUpdatePaste(wxUpdateUIEvent& event)
 {
 {
-    char buf[2];
+    event.Enable( CanPaste() );
+}
 
 
-    buf[0] = c;
-    buf[1] = 0;
-    AppendText(buf);
-    return *this;
+void wxTextCtrl::OnUpdateUndo(wxUpdateUIEvent& event)
+{
+    event.Enable( CanUndo() );
+}
+
+void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event)
+{
+    event.Enable( CanRedo() );
 }
 
 }
 
index d845d50108efea892a4dff22c4d4c0e09344fb30..3d0bb31c08e718579e87b0449ec457dad83e404b 100644 (file)
 
 #include "wx/timer.h"
 
 
 #include "wx/timer.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
 IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
+#endif
+
+static void wxProcessTimer( unsigned long event , void *data ) ;
+
+pascal void MacTimerProc( TMTask * t )
+{
+       MacTimerInfo * tm = (MacTimerInfo*)  t ;
+       wxMacAddEvent( tm->m_table , wxProcessTimer, 0 , (void*) tm->m_timer , TRUE ) ;
+}
+
+void wxProcessTimer( unsigned long event , void *data )
+{
+       if ( !data )
+               return ;
+               
+       wxTimer* timer = (wxTimer*) data ;
+       if ( timer->IsOneShot() )
+               timer->Stop() ;
+               
+    timer->Notify();
+
+    if ( timer->m_info.m_task.tmAddr && !timer->IsOneShot() )
+    {
+           PrimeTime( (QElemPtr)  &timer->m_info.m_task , timer->GetInterval() ) ;
+    }
+}
 
 wxTimer::wxTimer()
 {
 
 wxTimer::wxTimer()
 {
-    m_milli = 0 ;
-    m_id = 0;
-    m_oneShot = FALSE;
+       m_info.m_task.tmAddr = NULL ;
+       m_info.m_task.tmWakeUp = 0 ;
+       m_info.m_task.tmReserved = 0 ;
+       m_info.m_task.qType = 0 ;
+       m_info.m_table = wxMacGetNotifierTable() ;
+       m_info.m_timer = this ;
+}
+
+bool wxTimer::IsRunning() const 
+{
+       return ( m_info.m_task.qType & kTMTaskActive ) ;
 }
 
 wxTimer::~wxTimer()
 }
 
 wxTimer::~wxTimer()
@@ -31,20 +66,31 @@ wxTimer::~wxTimer()
 
 bool wxTimer::Start(int milliseconds,bool mode)
 {
 
 bool wxTimer::Start(int milliseconds,bool mode)
 {
-    m_oneShot = mode ;
-    if (milliseconds <= 0)
-        return FALSE;
+    (void)wxTimerBase::Start(milliseconds, mode);
 
 
-    m_milli = milliseconds;
+    wxCHECK_MSG( m_milli > 0, FALSE, wxT("invalid value for timer timeour") );
+    wxCHECK_MSG( m_info.m_task.tmAddr == NULL , FALSE, wxT("attempting to restart a timer") );
 
 
-    // TODO: set the timer going.
+    m_milli = milliseconds;
+       m_info.m_task.tmAddr = NewTimerProc( MacTimerProc ) ;
+       m_info.m_task.tmWakeUp = 0 ;
+       m_info.m_task.tmReserved = 0 ;
+    InsXTime((QElemPtr) &m_info.m_task ) ;
+    PrimeTime( (QElemPtr) &m_info.m_task , m_milli ) ;
     return FALSE;
 }
 
 void wxTimer::Stop()
 {
     return FALSE;
 }
 
 void wxTimer::Stop()
 {
-    m_id = 0 ;
     m_milli = 0 ;
     m_milli = 0 ;
+    if ( m_info.m_task.tmAddr )
+    {
+       RmvTime(  (QElemPtr) &m_info.m_task ) ;
+       DisposeTimerUPP(m_info.m_task.tmAddr) ;
+       m_info.m_task.tmAddr = NULL ;
+    }
+    wxMacRemoveAllNotifiersForData( wxMacGetNotifierTable() , this ) ;
 }
 
 
 }
 
 
+
index e4bd0aff79ff5484358c1a55fa5c1f4925745315..e118add0ed08f5fa423d714fa181fe2c5e119bec 100644 (file)
@@ -5,8 +5,7 @@
 // Modified by:
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Modified by:
 // Created:     04/01/98
 // RCS-ID:      $Id$
-// Copyright:   (c) AUTHOR
-// Licence:    wxWindows licence
+// Copyright:   (c) AUTHORy
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 #if wxUSE_TOOLBAR
 
 #include "wx/toolbar.h"
 #if wxUSE_TOOLBAR
 
 #include "wx/toolbar.h"
+#include "wx/notebook.h"
+#include "wx/tabctrl.h"
 
 
-IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxToolBarBase)
+#if !USE_SHARED_LIBRARY
+IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
 
 BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
 
 BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
+       EVT_MOUSE_EVENTS( wxToolBar::OnMouse ) 
+       EVT_PAINT( wxToolBar::OnPaint ) 
 END_EVENT_TABLE()
 END_EVENT_TABLE()
+#endif
 
 #include <wx/mac/uma.h>
 
 
 #include <wx/mac/uma.h>
 
@@ -45,14 +50,14 @@ public:
                             clientData, shortHelpString, longHelpString)
     {
         m_nSepCount = 0;
                             clientData, shortHelpString, longHelpString)
     {
         m_nSepCount = 0;
-        m_index = 0 ;
+        m_index = -1 ;
     }
 
     wxToolBarTool(wxToolBar *tbar, wxControl *control)
         : wxToolBarToolBase(tbar, control)
     {
         m_nSepCount = 1;
     }
 
     wxToolBarTool(wxToolBar *tbar, wxControl *control)
         : wxToolBarToolBase(tbar, control)
     {
         m_nSepCount = 1;
-        m_index = 0 ;
+        m_index = -1 ;
     }
 
     // set/get the number of separators which we use to cover the space used by
     }
 
     // set/get the number of separators which we use to cover the space used by
@@ -74,6 +79,9 @@ private:
 // wxToolBarTool
 // ----------------------------------------------------------------------------
 
 // wxToolBarTool
 // ----------------------------------------------------------------------------
 
+const short defwidth = 24 ;
+const short defheight = 22 ;
+
 wxToolBarToolBase *wxToolBar::CreateTool(int id,
                                          const wxBitmap& bitmap1,
                                          const wxBitmap& bitmap2,
 wxToolBarToolBase *wxToolBar::CreateTool(int id,
                                          const wxBitmap& bitmap1,
                                          const wxBitmap& bitmap2,
@@ -91,16 +99,12 @@ wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control)
     return new wxToolBarTool(this, control);
 }
 
     return new wxToolBarTool(this, control);
 }
 
-// ----------------------------------------------------------------------------
-// wxToolBar construction
-// ----------------------------------------------------------------------------
-
 void wxToolBar::Init()
 {
   m_maxWidth = -1;
   m_maxHeight = -1;
 void wxToolBar::Init()
 {
   m_maxWidth = -1;
   m_maxHeight = -1;
-  m_defaultWidth = 24;
-  m_defaultHeight = 22;
+  m_defaultWidth = defwidth;
+  m_defaultHeight = defheight;
   // TODO
 }
 
   // TODO
 }
 
@@ -109,8 +113,8 @@ bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
 {
   m_maxWidth = m_maxHeight = 0;
 
 {
   m_maxWidth = m_maxHeight = 0;
 
-  m_defaultWidth = 24;
-  m_defaultHeight = 22;
+  m_defaultWidth = defwidth;
+  m_defaultHeight = defheight;
   
   int x = pos.x;
   int y = pos.y;
   
   int x = pos.x;
   int y = pos.y;
@@ -125,16 +129,39 @@ bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
     x = 0;
   if (y < 0)
     y = 0;
     x = 0;
   if (y < 0)
     y = 0;
-
+#if 1
+       {
+         SetName(name);
+
+         m_windowStyle = style;
+         parent->AddChild(this);
+
+         m_backgroundColour = parent->GetBackgroundColour() ;
+         m_foregroundColour = parent->GetForegroundColour() ;
+
+         if (id == -1)
+             m_windowId = NewControlId();
+         else
+             m_windowId = id;
+
+               m_width = size.x ;
+               m_height = size.y ;
+               int x = pos.x ;
+               int y = pos.y ;
+               AdjustForParentClientOrigin(x, y, wxSIZE_USE_EXISTING);
+               m_x = x ;
+               m_y = y ;
+       }
+#else
        Rect bounds ;
        Str255 title ;
        
        Rect bounds ;
        Str255 title ;
        
-       MacPreControlCreate( parent , id ,  "" , wxPoint( x , y ) , wxSize( width , height ) ,style, *((wxValidator*)NULL) , name , &bounds , title ) ;
+       MacPreControlCreate( parent , id ,  "" , wxPoint( x , y ) , wxSize( width , height ) ,style, wxDefaultValidator , name , &bounds , title ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1, 
                kControlPlacardProc , (long) this ) ;
        MacPostControlCreate() ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1, 
                kControlPlacardProc , (long) this ) ;
        MacPostControlCreate() ;
-
+#endif
   return TRUE;
 }
 
   return TRUE;
 }
 
@@ -143,7 +170,8 @@ wxToolBar::~wxToolBar()
     // TODO
 }
 
     // TODO
 }
 
-PicHandle MakePict(GWorldPtr wp)
+PicHandle MakePict(GWorldPtr wp, GWorldPtr mask ) ;
+PicHandle MakePict(GWorldPtr wp, GWorldPtr mask ) 
 {
        CGrafPtr                origPort ;
        GDHandle                origDev ;
 {
        CGrafPtr                origPort ;
        GDHandle                origDev ;
@@ -151,52 +179,77 @@ PicHandle MakePict(GWorldPtr wp)
        PicHandle               pict;                           // this is the Picture we give back
 
        RGBColor                gray = { 0xCCCC ,0xCCCC , 0xCCCC } ;
        PicHandle               pict;                           // this is the Picture we give back
 
        RGBColor                gray = { 0xCCCC ,0xCCCC , 0xCCCC } ;
+       RGBColor                white = { 0xffff ,0xffff , 0xffff } ;
+       RGBColor                black = { 0x0000 ,0x0000 , 0x0000 } ;
        
        
-       GetGWorld( &origPort , &origDev ) ;
-       SetGWorld( wp , NULL ) ;
-       
-       pict = OpenPicture(&wp->portRect);      // open a picture, this disables drawing
-       if(!pict)       
-               return NULL;
-       
-       RGBBackColor( &gray ) ;
-       EraseRect(&wp->portRect) ;
-       CopyBits((BitMap*)*wp->portPixMap,                      // src PixMap   - we copy image over itself -
-                               (BitMap*)*wp->portPixMap,               // dst PixMap   - no drawing occurs -
-                               &wp->portRect,                  // srcRect              - it will be recorded and compressed -
-                               &wp->portRect,                  // dstRect              - into the picture that is open -
-                               srcCopy,NULL);                  // copyMode and no clip region
-
-       ClosePicture();                                         // We are done recording the picture
-       SetGWorld( origPort , origDev ) ;
-       return pict;                                            // return our groovy pict handle
-}
-
-PicHandle MakePictWhite(GWorldPtr wp)
-{
-       CGrafPtr                origPort ;
-       GDHandle                origDev ;
+       unsigned char *maskimage = NULL ;
+       Rect portRect ;
+       GetPortBounds( wp , &portRect ) ;
+       int width = portRect.right - portRect.left ;
+       int height = portRect.bottom - portRect.top ;
        
        
-       PicHandle               pict;                           // this is the Picture we give back
+       LockPixels( GetGWorldPixMap( wp ) ) ;
+       GetGWorld( &origPort , &origDev ) ;
 
 
-       RGBColor                white = { 0xFFFF ,0xFFFF  , 0xFFFF  } ;
+       if ( mask )
+       {
+               
+               maskimage = (unsigned char*) malloc( width * height ) ;
+               SetGWorld( mask , NULL ) ;
+               LockPixels( GetGWorldPixMap( mask ) ) ;
+               for ( int y = 0 ; y < height ; ++y )
+               {
+                       for( int x = 0 ; x < width ; ++x )
+                       {
+                               RGBColor col ;
+                               
+                               GetCPixel( x + portRect.left , y + portRect.top , &col ) ;
+                               maskimage[y*width + x] = ( col.red == 0 ) ; // for monochrome masks
+                       }
+               }
+               UnlockPixels( GetGWorldPixMap( mask ) ) ;
+       }
        
        
-       GetGWorld( &origPort , &origDev ) ;
        SetGWorld( wp , NULL ) ;
        
        SetGWorld( wp , NULL ) ;
        
-       pict = OpenPicture(&wp->portRect);      // open a picture, this disables drawing
+       pict = OpenPicture(&portRect);  // open a picture, this disables drawing
        if(!pict)       
                return NULL;
        if(!pict)       
                return NULL;
-       
+
+       RGBBackColor( &gray ) ;
+       RGBForeColor( &black ) ;
+       EraseRect(&portRect) ;
        RGBBackColor( &white ) ;
        RGBBackColor( &white ) ;
-       EraseRect(&wp->portRect) ;
-       CopyBits((BitMap*)*wp->portPixMap,                      // src PixMap   - we copy image over itself -
-                               (BitMap*)*wp->portPixMap,               // dst PixMap   - no drawing occurs -
-                               &wp->portRect,                  // srcRect              - it will be recorded and compressed -
-                               &wp->portRect,                  // dstRect              - into the picture that is open -
+
+       if ( maskimage )
+       {
+               for ( int y = 0 ; y < height ; ++y )
+               {
+                       for( int x = 0 ; x < width ; ++x )
+                       {
+                               if ( maskimage[y*width + x] )
+                               {
+                                       RGBColor col ;
+                               
+                                       GetCPixel( x + portRect.left , y + portRect.top , &col ) ;
+                                       SetCPixel( x + portRect.left , y + portRect.top , &col ) ;
+                               }
+                       }
+               }
+               free( maskimage ) ;
+               maskimage = NULL ;
+       }
+       else
+       {
+               CopyBits(GetPortBitMapForCopyBits(wp),                  // src PixMap   - we copy image over itself -
+                               GetPortBitMapForCopyBits(wp),           // dst PixMap   - no drawing occurs -
+                               &portRect,                      // srcRect              - it will be recorded and compressed -
+                               &portRect,                      // dstRect              - into the picture that is open -
                                srcCopy,NULL);                  // copyMode and no clip region
 
                                srcCopy,NULL);                  // copyMode and no clip region
 
+       }
        ClosePicture();                                         // We are done recording the picture
        ClosePicture();                                         // We are done recording the picture
+       UnlockPixels( GetGWorldPixMap( wp ) ) ;
        SetGWorld( origPort , origDev ) ;
        return pict;                                            // return our groovy pict handle
 }
        SetGWorld( origPort , origDev ) ;
        return pict;                                            // return our groovy pict handle
 }
@@ -226,7 +279,7 @@ bool wxToolBar::Realize()
                wxToolBarTool *tool = (wxToolBarTool *)node->Data();
                wxBitmapRefData * bmap = (wxBitmapRefData*) ( tool->GetBitmap1().GetRefData()) ;
                
                wxToolBarTool *tool = (wxToolBarTool *)node->Data();
                wxBitmapRefData * bmap = (wxBitmapRefData*) ( tool->GetBitmap1().GetRefData()) ;
                
-               if( !tool->IsSeparator() )
+               if(  !tool->IsSeparator()  )
                {
                        Rect toolrect = { toolbarrect.top + kwxMacToolBarTopMargin , toolbarrect.left + x + kwxMacToolBarLeftMargin , 0 , 0 } ;
                        toolrect.right = toolrect.left + toolSize.x ;
                {
                        Rect toolrect = { toolbarrect.top + kwxMacToolBarTopMargin , toolbarrect.left + x + kwxMacToolBarLeftMargin , 0 , 0 } ;
                        toolrect.right = toolrect.left + toolSize.x ;
@@ -239,12 +292,19 @@ bool wxToolBar::Realize()
                                        icon = bmap->m_hPict ;
                                else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
                                {
                                        icon = bmap->m_hPict ;
                                else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
                                {
-                                       icon = MakePict( bmap->m_hBitmap ) ;
+                                       if ( tool->GetBitmap1().GetMask() )
+                                       {
+                                               icon = MakePict( bmap->m_hBitmap , tool->GetBitmap1().GetMask()->GetMaskBitmap() ) ;
+                                       }
+                                       else
+                                       {
+                                               icon = MakePict( bmap->m_hBitmap , NULL ) ;
+                                       }
                                }
                        }
                        
                        ControlHandle m_macToolHandle ;
                                }
                        }
                        
                        ControlHandle m_macToolHandle ;
-                               
+                       
                        SInt16 behaviour = kControlBehaviorOffsetContents ;
                        if ( tool->CanBeToggled() )
                                behaviour += kControlBehaviorToggles ;
                        SInt16 behaviour = kControlBehaviorOffsetContents ;
                        if ( tool->CanBeToggled() )
                                behaviour += kControlBehaviorToggles ;
@@ -266,8 +326,19 @@ bool wxToolBar::Realize()
                                                behaviour  , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
                        }
                        m_macToolHandles.Add( m_macToolHandle ) ;
                                                behaviour  , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
                        }
                        m_macToolHandles.Add( m_macToolHandle ) ;
+                       tool->m_index = m_macToolHandles.Count() -1 ;
+                       if ( !tool->IsEnabled() )
+                       {
+                               UMADeactivateControl( m_macToolHandle ) ;
+                       }
+                       if ( tool->CanBeToggled() && tool->IsToggled() )
+                       {
+                               ::SetControlValue( m_macToolHandle , 1 ) ;
+                       }
                        UMASetControlFontStyle( m_macToolHandle , &controlstyle ) ;
                        UMASetControlFontStyle( m_macToolHandle , &controlstyle ) ;
-                       UMAEmbedControl( m_macToolHandle , m_macControl ) ;
+                       ControlHandle container = GetParent()->MacGetContainerForEmbedding() ;
+                       wxASSERT_MSG( container != NULL , "No valid mac container control" ) ;
+                       UMAEmbedControl( m_macToolHandle , container ) ;
                        
                        x += (int)toolSize.x;
                        noButtons ++;
                        
                        x += (int)toolSize.x;
                        noButtons ++;
@@ -311,7 +382,7 @@ void wxToolBar::SetToolBitmapSize(const wxSize& size)
 // The button size is bigger than the bitmap size
 wxSize wxToolBar::GetToolSize() const
 {
 // The button size is bigger than the bitmap size
 wxSize wxToolBar::GetToolSize() const
 {
-    return wxSize(m_defaultWidth + 8, m_defaultHeight + 7);
+    return wxSize(m_defaultWidth + 4, m_defaultHeight + 4);
 }
 
 void wxToolBar::MacHandleControlClick( ControlHandle control , SInt16 controlpart ) 
 }
 
 void wxToolBar::MacHandleControlClick( ControlHandle control , SInt16 controlpart ) 
@@ -321,7 +392,13 @@ void wxToolBar::MacHandleControlClick( ControlHandle control , SInt16 controlpar
        {
                if ( m_macToolHandles[index] == (void*) control )
                {
        {
                if ( m_macToolHandles[index] == (void*) control )
                {
-                       OnLeftClick( ( (wxToolBarTool*) (m_tools.Nth( index )->Data() ) ) ->m_index , ( (wxToolBarTool*) (m_tools.Nth( index )->Data() ) ) ->IsToggled() ) ;
+                       wxToolBarTool *tool = (wxToolBarTool *)m_tools.Nth( index )->Data();
+                       if ( tool->CanBeToggled() )
+               {
+                       tool->Toggle( GetControlValue( control ) ) ;
+               }
+                       OnLeftClick( tool->GetId() , tool -> IsToggled() ) ;
+                       break ;
                }
        }
 }
                }
        }
 }
@@ -340,43 +417,54 @@ void wxToolBar::SetRows(int nRows)
 wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
 {
     MacClientToRootWindow( &x , &y ) ;
 wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
 {
     MacClientToRootWindow( &x , &y ) ;
-    Point pt = { x ,y } ;
+    Point pt = { y ,x } ;
 
        int index = 0 ;
        for ( index = 0 ; index < m_macToolHandles.Count() ; ++index )
        {
 
        int index = 0 ;
        for ( index = 0 ; index < m_macToolHandles.Count() ; ++index )
        {
-               if ( PtInRect( pt , &(**(ControlHandle)(m_macToolHandles[index])).contrlRect) )
+               if ( m_macToolHandles[index] )
                {
                {
-                       return  (wxToolBarTool*) (m_tools.Nth( index )->Data() ) ;
+                       Rect bounds ;
+                       GetControlBounds((ControlHandle) m_macToolHandles[index], &bounds ) ;
+                       if ( PtInRect( pt , &bounds ) )
+                       {
+                               return  (wxToolBarTool*) (m_tools.Nth( index )->Data() ) ;
+                       }
                }
        }
 
     return (wxToolBarToolBase *)NULL;
 }
 
                }
        }
 
     return (wxToolBarToolBase *)NULL;
 }
 
+wxString wxToolBar::MacGetToolTipString( wxPoint &pt )
+{
+       wxToolBarToolBase* tool = FindToolForPosition( pt.x , pt.y ) ;
+       if ( tool )
+       {
+               return tool->GetShortHelp() ;
+       }
+       return "" ;
+}
+
 void wxToolBar::DoEnableTool(wxToolBarToolBase *t, bool enable)
 {
         wxToolBarTool *tool = (wxToolBarTool *)t;
 void wxToolBar::DoEnableTool(wxToolBarToolBase *t, bool enable)
 {
         wxToolBarTool *tool = (wxToolBarTool *)t;
+        if ( tool->m_index < 0 )
+               return ;
+               
         ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
         ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
-               if ( UMAHasAppearance() )
-               {
-                       if ( enable )
-                               ::ActivateControl( control ) ;
-                       else
-                               ::DeactivateControl( control ) ;
-               }
+
+               if ( enable )
+                       UMAActivateControl( control ) ;
                else
                else
-               {
-                       if ( enable )
-                               ::HiliteControl( control , 0 ) ;
-                       else
-                               ::HiliteControl( control , 255 ) ;
-               }
+                       UMADeactivateControl( control ) ;
 }
 
 void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle)
 {
        wxToolBarTool *tool = (wxToolBarTool *)t;
 }
 
 void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle)
 {
        wxToolBarTool *tool = (wxToolBarTool *)t;
+        if ( tool->m_index < 0 )
+               return ;
         
        ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
                ::SetControlValue( control , toggle ) ;
         
        ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
                ::SetControlValue( control , toggle ) ;
@@ -402,5 +490,116 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
 {
                return TRUE ;
 }
 {
                return TRUE ;
 }
+
+void wxToolBar::OnPaint(wxPaintEvent& event)
+{
+       WindowRef window = GetMacRootWindow() ;
+       if ( window )
+       {
+               wxWindow* win = wxFindWinFromMacWindow( window ) ;
+               if ( win )
+               {
+                       wxMacDrawingHelper help( win ) ;
+                       // the mac control manager always assumes to have the origin at 0,0
+                       SetOrigin( 0 , 0 ) ;
+                       
+                       bool                    hasTabBehind = false ;
+                       wxWindow* parent = GetParent() ;
+                       while ( parent )
+                       {
+                               if( parent->MacGetWindowData() )
+                               {
+                                       UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
+                                       break ;
+                               }
+                               
+                               if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) ||  parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
+                               {
+                                       if ( ((wxControl*)parent)->GetMacControl() )
+                                               SetUpControlBackground( ((wxControl*)parent)->GetMacControl() , -1 , true ) ;
+                                       break ;
+                               }
+                               
+                               parent = parent->GetParent() ;
+                       } 
+                       Rect toolbarrect = { m_y , m_x , m_y + m_height , m_x + m_width } ;
+
+                       UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
+                       {
+                               int index = 0 ;
+                               for ( index = 0 ; index < m_macToolHandles.Count() ; ++index )
+                               {
+                                       if ( m_macToolHandles[index] )
+                                       {
+                                               UMADrawControl( (ControlHandle) m_macToolHandles[index] ) ;
+                                       }
+                               }
+                       }
+                       UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
+               }
+       }
+}
+void  wxToolBar::OnMouse( wxMouseEvent &event ) 
+{
+               
+       if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
+       {
+                       
+               int x = event.m_x ;
+               int y = event.m_y ;
+               
+               MacClientToRootWindow( &x , &y ) ;
+                       
+               ControlHandle   control ;
+               Point           localwhere ;
+               GrafPtr         port ;
+               SInt16          controlpart ;
+               WindowRef       window = GetMacRootWindow() ;
+               
+               localwhere.h = x ;
+               localwhere.v = y ;
+       
+               short modifiers = 0;
+               
+               if ( !event.m_leftDown && !event.m_rightDown )
+                       modifiers  |= btnState ;
+       
+               if ( event.m_shiftDown )
+                       modifiers |= shiftKey ;
+                       
+               if ( event.m_controlDown )
+                       modifiers |= controlKey ;
+       
+               if ( event.m_altDown )
+                       modifiers |= optionKey ;
+       
+               if ( event.m_metaDown )
+                       modifiers |= cmdKey ;
+       
+               controlpart = FindControl( localwhere , window , &control ) ;
+               {
+                       if ( AcceptsFocus() && FindFocus() != this )
+                       {
+                               SetFocus() ;
+                       }
+                       if ( control && UMAIsControlActive( control ) )
+                       {
+                               {
+                                       if ( controlpart == kControlIndicatorPart && !UMAHasAppearance() )
+                                               controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) NULL ) ;
+                                       else
+                                               controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) -1 ) ;
+                                       wxTheApp->s_lastMouseDown = 0 ;
+                                       if ( controlpart && ! ( ( UMAHasAppearance() || (controlpart != kControlIndicatorPart) ) 
+                                               && (IsKindOf( CLASSINFO( wxScrollBar ) ) ) ) ) // otherwise we will get the event twice
+                                       {
+                                               MacHandleControlClick( control , controlpart ) ;
+                                       }
+                               }
+                       }
+               }
+       }
+}
+
 #endif // wxUSE_TOOLBAR
 
 #endif // wxUSE_TOOLBAR
 
index 3aea32e970e95e791b783448a9c81f198ab64193..137a885dbfa7e32c9096f78376146fda7cffaf68 100644 (file)
 #include "wx/stubs/textctrl.h"
 #include "wx/stubs/treectrl.h"
 
 #include "wx/stubs/textctrl.h"
 #include "wx/stubs/treectrl.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxTreeItem, wxObject)
 
 IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxTreeItem, wxObject)
 
+#endif
 
 wxTreeCtrl::wxTreeCtrl()
 {
 
 wxTreeCtrl::wxTreeCtrl()
 {
index ba96908df9b93f0f8acd205fee847c816880646a..4dce1ce377002275bd563efca535af9618c102e7 100644 (file)
@@ -33,7 +33,7 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
        long total,contig;
        PurgeSpace(&total, &contig);
 #else
        long total,contig;
        PurgeSpace(&total, &contig);
 #else
-       InitMenus() ;
+       InitCursor();
 #endif
 
 #if UMA_USE_APPEARANCE
 #endif
 
 #if UMA_USE_APPEARANCE
@@ -87,7 +87,7 @@ bool UMAGetProcessModeDoesActivateOnFGSwitch()
 
 // menu manager
 
 
 // menu manager
 
-void UMASetMenuTitle( MenuRef menu , ConstStr255Param title )
+void UMASetMenuTitle( MenuRef menu , StringPtr title )
 {
 #if !TARGET_CARBON
        long                    size = GetHandleSize( (Handle) menu ) ;
 {
 #if !TARGET_CARBON
        long                    size = GetHandleSize( (Handle) menu ) ;
@@ -117,11 +117,13 @@ void UMASetMenuTitle( MenuRef menu , ConstStr255Param title )
 
 UInt32 UMAMenuEvent( EventRecord *inEvent )
 {
 
 UInt32 UMAMenuEvent( EventRecord *inEvent )
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
                return MenuEvent( inEvent ) ;
        }
        else
        if ( UMAHasAppearance() )
        {
                return MenuEvent( inEvent ) ;
        }
        else
+#endif
        {
                        if ( inEvent->what == keyDown && inEvent->modifiers & cmdKey)
                        {
        {
                        if ( inEvent->what == keyDown && inEvent->modifiers & cmdKey)
                        {
@@ -133,7 +135,7 @@ UInt32 UMAMenuEvent( EventRecord *inEvent )
 
 void                   UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex inItem ) 
 {
 
 void                   UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex inItem ) 
 {
-#if UMA_USE_8_6
+#if UMA_USE_8_6 || TARGET_CARBON
        EnableMenuItem( inMenu , inItem ) ;
 #else
        EnableItem( inMenu , inItem ) ;
        EnableMenuItem( inMenu , inItem ) ;
 #else
        EnableItem( inMenu , inItem ) ;
@@ -142,14 +144,145 @@ void                     UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex inItem )
 
 void                   UMADisableMenuItem( MenuRef inMenu , MenuItemIndex inItem ) 
 {
 
 void                   UMADisableMenuItem( MenuRef inMenu , MenuItemIndex inItem ) 
 {
-#if UMA_USE_8_6
+#if UMA_USE_8_6 || TARGET_CARBON
        DisableMenuItem( inMenu , inItem ) ;
 #else
        DisableItem( inMenu , inItem ) ;
 #endif
 }
        DisableMenuItem( inMenu , inItem ) ;
 #else
        DisableItem( inMenu , inItem ) ;
 #endif
 }
+
+void UMAAppendSubMenuItem( MenuRef menu , StringPtr l , SInt16 id ) 
+{
+       Str255 label ;
+       memcpy( label , l , l[0]+1 ) ;
+       // hardcoded adding of the submenu combination for mac
+
+       int theEnd = label[0] + 1; 
+       if (theEnd > 251) 
+               theEnd = 251; // mac allows only 255 characters
+       label[theEnd++] = '/';
+       label[theEnd++] = hMenuCmd; 
+       label[theEnd++] = '!';
+       label[theEnd++] = id ; 
+       label[theEnd] = 0x00;
+       label[0] = theEnd;
+       MacAppendMenu(menu, label);
+}
+
+void UMAInsertSubMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 id  ) 
+{
+       Str255 label ;
+       memcpy( label , l , l[0]+1 ) ;
+       // hardcoded adding of the submenu combination for mac
+
+       int theEnd = label[0] + 1; 
+       if (theEnd > 251) 
+               theEnd = 251; // mac allows only 255 characters
+       label[theEnd++] = '/';
+       label[theEnd++] = hMenuCmd; 
+       label[theEnd++] = '!';
+       label[theEnd++] = id; 
+       label[theEnd] = 0x00;
+       label[0] = theEnd;
+       MacInsertMenuItem(menu, label , item);
+}
+
+void UMAAppendMenuItem( MenuRef menu , StringPtr l , SInt16 key, UInt8 modifiers ) 
+{
+       Str255 label ;
+       memcpy( label , l , l[0]+1 ) ;
+       if ( key )
+       {
+                       int pos = label[0] ;
+                       label[++pos] = '/';
+                       label[++pos] = toupper( key );
+                       label[0] = pos ;
+       }
+       MacAppendMenu( menu , label ) ;
+}
+
+void UMAInsertMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 key, UInt8 modifiers ) 
+{
+       Str255 label ;
+       memcpy( label , l , l[0]+1 ) ;
+       if ( key )
+       {
+                       int pos = label[0] ;
+                       label[++pos] = '/';
+                       label[++pos] = toupper( key );
+                       label[0] = pos ;
+       }
+       MacInsertMenuItem( menu , label , item) ;
+}
+
+void UMADrawMenuBar() 
+{
+       DrawMenuBar() ;
+}
+
+
+void UMASetMenuItemText( MenuRef menu , MenuItemIndex item , StringPtr label ) 
+{
+       ::SetMenuItemText( menu , item , label ) ;
+}
+
+MenuRef        UMANewMenu( SInt16 menuid , StringPtr label ) 
+{
+       return ::NewMenu(menuid, label);
+}
+
+void UMADisposeMenu( MenuRef menu )
+{
+       DisposeMenu( menu ) ;
+}
+void UMADeleteMenu( SInt16 menuId ) 
+{
+       ::DeleteMenu( menuId ) ;
+}
+
+void UMAInsertMenu( MenuRef insertMenu , SInt16 afterId ) 
+{
+       ::InsertMenu( insertMenu , afterId ) ;
+}
+
+
 // quickdraw
 
 // quickdraw
 
+int gPrOpenCounter = 0 ;
+
+void UMAPrOpen() 
+{
+#if !TARGET_CARBON
+       OSErr err = noErr ;
+       ++gPrOpenCounter ;
+       if ( gPrOpenCounter == 1 )
+       {
+               PrOpen() ;
+               err = PrError() ;
+               wxASSERT( err == noErr ) ;
+       }
+#else
+       #pragma warning "TODO Printing for Carbon"
+#endif
+}
+
+void UMAPrClose() 
+{
+#if !TARGET_CARBON
+       OSErr err = noErr ;
+       wxASSERT( gPrOpenCounter >= 1 ) ;
+       if ( gPrOpenCounter == 1 )
+       {
+               PrClose() ;
+               err = PrError() ;
+               wxASSERT( err == noErr ) ;
+       }
+       --gPrOpenCounter ;
+#else
+       #pragma warning "TODO Printing for Carbon"
+#endif
+}
+
 #if !TARGET_CARBON
 
 pascal QDGlobalsPtr GetQDGlobalsPtr (void)
 #if !TARGET_CARBON
 
 pascal QDGlobalsPtr GetQDGlobalsPtr (void)
@@ -260,77 +393,145 @@ void                     UMACloseWindow(WindowRef inWindowRef)
 
 void UMAActivateControl( ControlHandle inControl ) 
 {
 
 void UMAActivateControl( ControlHandle inControl ) 
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        ::ActivateControl( inControl ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
        ::ActivateControl( inControl ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
    {
        AGAActivateControl( inControl ) ;
    }
    {
        AGAActivateControl( inControl ) ;
    }
+#else
+       {
+       }
+#endif
 }
 
 void UMADrawControl( ControlHandle inControl ) 
 {
 }
 
 void UMADrawControl( ControlHandle inControl ) 
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        ::DrawControlInCurrentPort( inControl ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
        ::DrawControlInCurrentPort( inControl ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
    {
        AGADrawControl( inControl ) ;
    }
    {
        AGADrawControl( inControl ) ;
    }
+#else
+       {
+       }
+#endif
 }
 
 void UMAMoveControl( ControlHandle inControl , short x , short y ) 
 {
 }
 
 void UMAMoveControl( ControlHandle inControl , short x , short y ) 
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
                ::MoveControl( inControl , x , y ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
                ::MoveControl( inControl , x , y ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
    {
        AGAMoveControl( inControl , x ,y  ) ;
    }
    {
        AGAMoveControl( inControl , x ,y  ) ;
    }
+#else
+       {
+       }
+#endif
 }
 
 void UMASizeControl( ControlHandle inControl , short x , short y ) 
 {
 }
 
 void UMASizeControl( ControlHandle inControl , short x , short y ) 
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
                ::SizeControl( inControl , x , y ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
                ::SizeControl( inControl , x , y ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
    {
        AGASizeControl( inControl , x ,y  ) ;
    }
    {
        AGASizeControl( inControl , x ,y  ) ;
    }
+#else
+       {
+       }
+#endif
 }
 
 void UMADeactivateControl( ControlHandle inControl ) 
 {
 }
 
 void UMADeactivateControl( ControlHandle inControl ) 
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        ::DeactivateControl( inControl ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
        ::DeactivateControl( inControl ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
    {
         AGADeactivateControl( inControl ) ;
    }
    {
         AGADeactivateControl( inControl ) ;
    }
+#else
+       {
+       }
+#endif
 }
 
 void                   UMASetThemeWindowBackground             (WindowRef                              inWindow,
                                                                 ThemeBrush                     inBrush,
 }
 
 void                   UMASetThemeWindowBackground             (WindowRef                              inWindow,
                                                                 ThemeBrush                     inBrush,
-                                                                Boolean                                inUpdate){
+                                                                Boolean                                inUpdate)
+{
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        ::SetThemeWindowBackground( inWindow ,inBrush , inUpdate ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
        ::SetThemeWindowBackground( inWindow ,inBrush , inUpdate ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
    {
        AGASetThemeWindowBackground( inWindow , inBrush , inUpdate ) ;
    }
    {
        AGASetThemeWindowBackground( inWindow , inBrush , inUpdate ) ;
    }
+#else
+       {
+       }
+#endif
 }
 
 }
 
+void                   UMAApplyThemeBackground                 (ThemeBackgroundKind    inKind,
+                                                                const Rect *                   bounds,
+                                                                ThemeDrawState                 inState,
+                                                                SInt16                                 inDepth,
+                                                                Boolean                                inColorDev)
+{
+#if UMA_USE_APPEARANCE
+       if ( UMAHasAppearance() )
+       {
+       /*
+               if ( sUMAAppearanceVersion >= 0x0110 )
+                       ::ApplyThemeBackground( inKind ,bounds , inState , inDepth , inColorDev ) ;
+   */
+   }
+   else
+#endif
+#if !TARGET_CARBON
+   {
+       AGAApplyThemeBackground( inKind ,bounds , inState , inDepth , inColorDev ) ;
+   }
+#else
+       {
+       }
+#endif
+}
 
 ControlHandle UMANewControl(WindowPtr                          owningWindow,
                                                                 const Rect *                   boundsRect,
 
 ControlHandle UMANewControl(WindowPtr                          owningWindow,
                                                                 const Rect *                   boundsRect,
@@ -343,16 +544,23 @@ ControlHandle UMANewControl(WindowPtr                             owningWindow,
                                                                 SInt32                                 controlReference)
 {
        ControlHandle theControl = NULL ;
                                                                 SInt32                                 controlReference)
 {
        ControlHandle theControl = NULL ;
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
    theControl =  NewControl( owningWindow , boundsRect , controlTitle , initiallyVisible ,
                initialValue , minimumValue , maximumValue , procID , controlReference ) ;
        }
        else
        if ( UMAHasAppearance() )
        {
    theControl =  NewControl( owningWindow , boundsRect , controlTitle , initiallyVisible ,
                initialValue , minimumValue , maximumValue , procID , controlReference ) ;
        }
        else
+#endif
+#if !TARGET_CARBON
        {
                theControl = AGANewControl( owningWindow , boundsRect , controlTitle , initiallyVisible ,
                initialValue , minimumValue , maximumValue , procID , controlReference ) ;
        }
        {
                theControl = AGANewControl( owningWindow , boundsRect , controlTitle , initiallyVisible ,
                initialValue , minimumValue , maximumValue , procID , controlReference ) ;
        }
+#else
+       {
+       }
+#endif
        return theControl ;
 }
 
        return theControl ;
 }
 
@@ -415,7 +623,9 @@ void UMASetControlVisibility                        (ControlHandle                  inControl,
                                                                 {
        if ( UMAHasAppearance() )
        {
                                                                 {
        if ( UMAHasAppearance() )
        {
+#if UMA_USE_APPEARANCE
        ::SetControlVisibility( inControl , inIsVisible, inDoDraw ) ;
        ::SetControlVisibility( inControl , inIsVisible, inDoDraw ) ;
+#endif
    }
 }
 
    }
 }
 
@@ -423,21 +633,29 @@ void UMASetControlVisibility                      (ControlHandle                  inControl,
 
 bool UMAIsControlActive                                        (ControlHandle                  inControl)
 {
 
 bool UMAIsControlActive                                        (ControlHandle                  inControl)
 {
+#if TARGET_CARBON
+       return IsControlActive( inControl ) ;
+#else
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        return IsControlActive( inControl ) ;
    }
   else
        if ( UMAHasAppearance() )
        {
        return IsControlActive( inControl ) ;
    }
   else
+#endif
        return (**inControl).contrlHilite == 0 ;
        return (**inControl).contrlHilite == 0 ;
+#endif
 }
 
 
 bool UMAIsControlVisible                               (ControlHandle                  inControl)
 {
 }
 
 
 bool UMAIsControlVisible                               (ControlHandle                  inControl)
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        return IsControlVisible( inControl ) ;
    }
        if ( UMAHasAppearance() )
        {
        return IsControlVisible( inControl ) ;
    }
+#endif
        return true ;
 }
 
        return true ;
 }
 
@@ -445,26 +663,42 @@ OSErr UMAGetBestControlRect                               (ControlHandle                  inControl,
                                                                 Rect *                                 outRect,
                                                                 SInt16 *                               outBaseLineOffset)
 {
                                                                 Rect *                                 outRect,
                                                                 SInt16 *                               outBaseLineOffset)
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        return GetBestControlRect( inControl , outRect , outBaseLineOffset ) ;
    }
   else
        if ( UMAHasAppearance() )
        {
        return GetBestControlRect( inControl , outRect , outBaseLineOffset ) ;
    }
   else
+#endif
+#if !TARGET_CARBON
   {
        return AGAGetBestControlRect( inControl , outRect , outBaseLineOffset ) ;
   }
   {
        return AGAGetBestControlRect( inControl , outRect , outBaseLineOffset ) ;
   }
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
 OSErr UMASetControlFontStyle                           (ControlHandle                  inControl,
                                                                 const ControlFontStyleRec * inStyle)   
 {
 }
 
 
 OSErr UMASetControlFontStyle                           (ControlHandle                  inControl,
                                                                 const ControlFontStyleRec * inStyle)   
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
                return ::SetControlFontStyle( inControl , inStyle ) ;
        }
        else
        if ( UMAHasAppearance() )
        {
                return ::SetControlFontStyle( inControl , inStyle ) ;
        }
        else
+#endif
+#if !TARGET_CARBON
                return AGASetControlFontStyle( inControl , inStyle ) ;
                return AGASetControlFontStyle( inControl , inStyle ) ;
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
 }
 
 
@@ -474,12 +708,20 @@ OSErr UMASetControlFontStyle                              (ControlHandle                  inControl,
 OSErr UMACreateRootControl                             (WindowPtr                              inWindow,
                                                                 ControlHandle *                outControl)
 {
 OSErr UMACreateRootControl                             (WindowPtr                              inWindow,
                                                                 ControlHandle *                outControl)
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        return CreateRootControl( inWindow , outControl  ) ;
    }
   else
        if ( UMAHasAppearance() )
        {
        return CreateRootControl( inWindow , outControl  ) ;
    }
   else
+#endif
+#if !TARGET_CARBON
        return AGACreateRootControl( inWindow , outControl ) ;
        return AGACreateRootControl( inWindow , outControl ) ;
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
 }
 
 
@@ -487,12 +729,20 @@ OSErr UMACreateRootControl                                (WindowPtr                              inWindow,
 OSErr UMAEmbedControl                                  (ControlHandle                  inControl,
                                                                 ControlHandle                  inContainer)
 {
 OSErr UMAEmbedControl                                  (ControlHandle                  inControl,
                                                                 ControlHandle                  inContainer)
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        return EmbedControl( inControl , inContainer ) ;
    }
   else
        if ( UMAHasAppearance() )
        {
        return EmbedControl( inControl , inContainer ) ;
    }
   else
+#endif
+#if !TARGET_CARBON
        return AGAEmbedControl( inControl , inContainer ) ; ;
        return AGAEmbedControl( inControl , inContainer ) ; ;
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
 }
 
 
@@ -502,12 +752,30 @@ OSErr UMASetKeyboardFocus                         (WindowPtr                              inWindow,
                                                                 ControlHandle                  inControl,
                                                                 ControlFocusPart               inPart)
 {
                                                                 ControlHandle                  inControl,
                                                                 ControlFocusPart               inPart)
 {
+       OSErr err = noErr;
+       GrafPtr port ;
+       GetPort( &port ) ;
+#if TARGET_CARBON
+       SetPort( GetWindowPort( inWindow ) ) ;
+#else
+       SetPort( inWindow ) ;
+#endif
+       SetOrigin( 0 , 0 ) ;
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        if ( UMAHasAppearance() )
        {
-       return SetKeyboardFocus( inWindow , inControl , inPart ) ;
+       err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
    }
   else
    }
   else
-       return AGASetKeyboardFocus( inWindow , inControl , inPart ) ;
+#endif
+#if !TARGET_CARBON
+       err = AGASetKeyboardFocus( inWindow , inControl , inPart ) ;
+#else
+       {
+       }
+#endif
+       SetPort( port ) ;
+       return err ;
 }
 
 
 }
 
 
@@ -520,14 +788,22 @@ ControlPartCode UMAHandleControlClick                             (ControlHandle                  inControl,
                                                                 SInt16                                 inModifiers,
                                                                 ControlActionUPP               inAction)                
 {
                                                                 SInt16                                 inModifiers,
                                                                 ControlActionUPP               inAction)                
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        return HandleControlClick( inControl , inWhere , inModifiers , inAction ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
        return HandleControlClick( inControl , inWhere , inModifiers , inAction ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
    {
        return AGAHandleControlClick( inControl , inWhere , inModifiers , inAction ) ;
    }
    {
        return AGAHandleControlClick( inControl , inWhere , inModifiers , inAction ) ;
    }
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
 }
 
 
@@ -536,52 +812,82 @@ SInt16 UMAHandleControlKey                                (ControlHandle                  inControl,
                                                                 SInt16                                 inCharCode,
                                                                 SInt16                                 inModifiers)
 {
                                                                 SInt16                                 inCharCode,
                                                                 SInt16                                 inModifiers)
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        return HandleControlKey( inControl , inKeyCode , inCharCode , inModifiers ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
        return HandleControlKey( inControl , inKeyCode , inCharCode , inModifiers ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
    {
        return AGAHandleControlKey(inControl , inKeyCode , inCharCode , inModifiers ) ;
    }
    {
        return AGAHandleControlKey(inControl , inKeyCode , inCharCode , inModifiers ) ;
    }
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
                                                                 
 void UMAIdleControls                                   (WindowPtr                              inWindow)
 {
 }
 
 
                                                                 
 void UMAIdleControls                                   (WindowPtr                              inWindow)
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
                IdleControls( inWindow ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
                IdleControls( inWindow ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
    {
                AGAIdleControls( inWindow ) ;
    }
    {
                AGAIdleControls( inWindow ) ;
    }
+#else
+       {
+       }
+#endif
 }
 
 void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) 
 {
 }
 
 void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) 
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
                UpdateControls( inWindow , inRgn ) ;
        }
        else
        if ( UMAHasAppearance() )
        {
                UpdateControls( inWindow , inRgn ) ;
        }
        else
+#endif
+#if !TARGET_CARBON
        {
                AGAUpdateControls( inWindow , inRgn ) ;
        }
        {
                AGAUpdateControls( inWindow , inRgn ) ;
        }
+#else
+       {
+       }
+#endif
 }
 
 OSErr UMAGetRootControl( WindowPtr inWindow , ControlHandle *outControl ) 
 {
 }
 
 OSErr UMAGetRootControl( WindowPtr inWindow , ControlHandle *outControl ) 
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
                return GetRootControl( inWindow , outControl ) ;
        }
        else
        if ( UMAHasAppearance() )
        {
                return GetRootControl( inWindow , outControl ) ;
        }
        else
+#endif
+#if !TARGET_CARBON
        {
                return AGAGetRootControl( inWindow , outControl ) ;
        }
        {
                return AGAGetRootControl( inWindow , outControl ) ;
        }
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
 }
 
 
@@ -593,12 +899,20 @@ OSErr UMASetControlData                                   (ControlHandle                  inControl,
                                                                 Size                                   inSize,
                                                                 Ptr                                    inData)
 {
                                                                 Size                                   inSize,
                                                                 Ptr                                    inData)
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
         return SetControlData( inControl , inPart , inTagName , inSize , inData ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
         return SetControlData( inControl , inPart , inTagName , inSize , inData ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
                return AGASetControlData( inControl , inPart , inTagName , inSize , inData ) ;
                return AGASetControlData( inControl , inPart , inTagName , inSize , inData ) ;
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
 }
 
 
@@ -610,15 +924,22 @@ OSErr UMAGetControlData                                   (ControlHandle                  inControl,
                                                                 Ptr                                    outBuffer,
                                                                 Size *                                 outActualSize)
 {
                                                                 Ptr                                    outBuffer,
                                                                 Size *                                 outActualSize)
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
                return ::GetControlData( inControl , inPart , inTagName , inBufferSize , outBuffer , outActualSize ) ;
        }
        else
        if ( UMAHasAppearance() )
        {
                return ::GetControlData( inControl , inPart , inTagName , inBufferSize , outBuffer , outActualSize ) ;
        }
        else
+#endif
+#if !TARGET_CARBON
        {
                return AGAGetControlData( inControl , inPart , inTagName , inBufferSize , outBuffer , outActualSize ) ;
        }
        {
                return AGAGetControlData( inControl , inPart , inTagName , inBufferSize , outBuffer , outActualSize ) ;
        }
-       
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
 }
 
 
@@ -627,14 +948,22 @@ OSErr UMAGetControlDataSize                               (ControlHandle                  inControl,
                                                                 ResType                                inTagName,
                                                                 Size *                                 outMaxSize)
 {
                                                                 ResType                                inTagName,
                                                                 Size *                                 outMaxSize)
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
                return GetControlDataSize( inControl , inPart , inTagName , outMaxSize ) ;
        }
        else
        if ( UMAHasAppearance() )
        {
                return GetControlDataSize( inControl , inPart , inTagName , outMaxSize ) ;
        }
        else
+#endif
+#if !TARGET_CARBON
        {
                return AGAGetControlDataSize( inControl , inPart , inTagName , outMaxSize ) ;
        }
        {
                return AGAGetControlDataSize( inControl , inPart , inTagName , outMaxSize ) ;
        }
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
 }
 
 
@@ -711,11 +1040,70 @@ OSStatus         UMACreateNewWindow( WindowClass windowClass , WindowAttributes attribu
                                case kMovableModalWindowClass :
                                        procID = kWindowMovableModalDialogProc;
                                        break ;
                                case kMovableModalWindowClass :
                                        procID = kWindowMovableModalDialogProc;
                                        break ;
-                               case kDocumentWindowClass :
-                                       procID = kWindowFullZoomGrowDocumentProc;
+                               case kModalWindowClass :
+                                       procID = kWindowShadowDialogProc;
+                                       break ;
+                               case kFloatingWindowClass :
+                                       if ( attributes & kWindowSideTitlebarAttribute )
+                                       {
+                                               if( ( attributes & kWindowResizableAttribute ) &&  
+                                                       ( attributes & kWindowFullZoomAttribute ) )
+                                               {
+                                                       procID = kWindowFloatSideFullZoomGrowProc ;
+                                               }
+                                               else if( attributes & kWindowFullZoomAttribute )
+                                               {
+                                                       procID = kWindowFloatSideFullZoomProc;
+                                               }
+                                               else if ( attributes & kWindowResizableAttribute )
+                                               {
+                                                       procID = kWindowFloatSideGrowProc;
+                                               }
+                                               else
+                                               {
+                                                       procID = kWindowFloatSideProc;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               if( ( attributes & kWindowResizableAttribute ) &&  
+                                                       ( attributes & kWindowFullZoomAttribute ) )
+                                               {
+                                                       procID = kWindowFloatFullZoomGrowProc ;
+                                               }
+                                               else if( attributes & kWindowFullZoomAttribute )
+                                               {
+                                                       procID = kWindowFloatFullZoomProc;
+                                               }
+                                               else if ( attributes & kWindowResizableAttribute )
+                                               {
+                                                       procID = kWindowFloatGrowProc;
+                                               }
+                                               else
+                                               {
+                                                       procID = kWindowFloatProc;
+                                               }
+                                       }
                                        break ;
                                        break ;
+                               case kDocumentWindowClass :
                                default :
                                default :
-                                       procID = kWindowMovableModalDialogProc;
+                                       if( ( attributes & kWindowResizableAttribute ) &&  
+                                               ( attributes & kWindowFullZoomAttribute ) )
+                                       {
+                                               procID = kWindowFullZoomGrowDocumentProc;
+                                       }
+                                       else if( attributes & kWindowFullZoomAttribute )
+                                       {
+                                               procID = kWindowFullZoomDocumentProc;
+                                       }
+                                       else if ( attributes & kWindowResizableAttribute )
+                                       {
+                                               procID = kWindowGrowDocumentProc;
+                                       }
+                                       else
+                                       {
+                                               procID = kWindowDocumentProc;
+                                       }
                                        break ;
                        }
                }
                                        break ;
                        }
                }
@@ -725,13 +1113,72 @@ OSStatus         UMACreateNewWindow( WindowClass windowClass , WindowAttributes attribu
                        {
                                case kMovableModalWindowClass :
                                        procID = movableDBoxProc;
                        {
                                case kMovableModalWindowClass :
                                        procID = movableDBoxProc;
-//                                     procID += kMovableModalDialogVariantCode;
                                        break ;
                                        break ;
-                               case kDocumentWindowClass :
-                                       procID = zoomDocProc;
+                               case kModalWindowClass :
+                                       procID = altDBoxProc;
+                                       break ;
+                               case kFloatingWindowClass :
+                                       if ( attributes & kWindowSideTitlebarAttribute )
+                                       {
+                                               if( ( attributes & kWindowResizableAttribute ) &&  
+                                                       ( attributes & kWindowFullZoomAttribute ) )
+                                               {
+                                                       procID = floatSideZoomGrowProc ;
+                                               }
+                                               else if( attributes & kWindowFullZoomAttribute )
+                                               {
+                                                       procID = floatSideZoomProc;
+                                               }
+                                               else if ( attributes & kWindowResizableAttribute )
+                                               {
+                                                       procID = floatSideGrowProc;
+                                               }
+                                               else
+                                               {
+                                                       procID = floatSideProc;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               if( ( attributes & kWindowResizableAttribute ) &&  
+                                                       ( attributes & kWindowFullZoomAttribute ) )
+                                               {
+                                                       procID = floatZoomGrowProc ;
+                                               }
+                                               else if( attributes & kWindowFullZoomAttribute )
+                                               {
+                                                       procID = floatZoomProc;
+                                               }
+                                               else if ( attributes & kWindowResizableAttribute )
+                                               {
+                                                       procID = floatGrowProc;
+                                               }
+                                               else
+                                               {
+                                                       procID = floatProc;
+                                               }
+                                       }
                                        break ;
                                        break ;
+                               case kDocumentWindowClass :
                                default :
                                default :
-                                       procID = documentProc;
+                                       if( ( attributes & kWindowResizableAttribute ) &&  
+                                               ( attributes & kWindowFullZoomAttribute ) )
+                                       {
+                                               procID = zoomDocProc;
+                                       }
+                                       else if( attributes & kWindowFullZoomAttribute )
+                                       {
+                                               procID = zoomNoGrow;
+                                       }
+                                       else if ( attributes & kWindowResizableAttribute )
+                                       {
+                                               procID = documentProc;
+                                       }
+                                       else
+                                       {
+                                               procID = noGrowDocProc;
+                                       }
+                                       break ;
                                        break ;
                        }
                }
                                        break ;
                        }
                }
@@ -853,6 +1300,32 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
 //             bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
 //             if ( inActivate != isHightlited )
                                HiliteWindow( inWindowRef , inActivate ) ;
 //             bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
 //             if ( inActivate != isHightlited )
                                HiliteWindow( inWindowRef , inActivate ) ;
+                               ControlHandle control = NULL ;
+                               UMAGetRootControl( inWindowRef , & control ) ;
+                               if ( control )
+                               {
+                                       if ( inActivate )
+                                               UMAActivateControl( control ) ;
+                                       else
+                                               UMADeactivateControl( control ) ;
+                               }       
        }
 }
        }
 }
+OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState ) 
+{
+#if UMA_USE_APPEARANCE
+       if ( UMAHasAppearance() )
+       {
+               ::DrawThemePlacard( inRect , inState ) ;
+   }
+   else
+#endif
+#if !TARGET_CARBON
+   {
+   }
+#else
+       {
+       }
+#endif
+}
 
 
index 817138cb63f2d440462b7e347bb721103d613970..0031f1efade1df19e67b0e7d6246b9774b3b4aac 100644 (file)
@@ -18,6 +18,7 @@
 #include "wx/setup.h"
 #include "wx/utils.h"
 #include "wx/app.h"
 #include "wx/setup.h"
 #include "wx/utils.h"
 #include "wx/app.h"
+#include "wx/mac/uma.h"
 
 #include <ctype.h>
 
 
 #include <ctype.h>
 
 #include <string.h>
 #include <stdarg.h>
 
 #include <string.h>
 #include <stdarg.h>
 
-// Get full hostname (eg. DoDo.BSn-Germany.crg.de)
+// get full hostname (with domain name if possible)
+bool wxGetFullHostName(wxChar *buf, int maxSize)
+{
+    return wxGetHostName(buf, maxSize);
+}
+
+// Get hostname only (without domain name)
 bool wxGetHostName(char *buf, int maxSize)
 {
     // TODO
 bool wxGetHostName(char *buf, int maxSize)
 {
     // TODO
@@ -227,7 +234,10 @@ void wxEndBusyCursor()
     if ( gMacStoredActiveCursor )
        ::SetCursor( *gMacStoredActiveCursor ) ;
     else
     if ( gMacStoredActiveCursor )
        ::SetCursor( *gMacStoredActiveCursor ) ;
     else
-       ::SetCursor( &qd.arrow ) ;
+    {
+               Cursor          MacArrow ;
+       ::SetCursor( GetQDGlobalsArrow( &MacArrow ) ) ;
+    }
        gMacStoredActiveCursor = NULL ;
   }
 }
        gMacStoredActiveCursor = NULL ;
   }
 }
@@ -238,6 +248,25 @@ bool wxIsBusy()
   return (wxBusyCursorCount > 0);
 }    
 
   return (wxBusyCursorCount > 0);
 }    
 
+wxString wxMacFindFolder( short                                        vol,
+                                                                OSType                                 folderType,
+                                                                Boolean                                createFolder)
+{
+       short           vRefNum  ;
+       long            dirID ;
+       wxString strDir ;
+               
+       if ( FindFolder( vol, folderType, createFolder, &vRefNum, &dirID) == noErr)
+       {
+               FSSpec file ;
+               if ( FSMakeFSSpec( vRefNum , dirID , "\p" , &file ) == noErr )
+               {
+                       strDir = wxMacFSSpec2UnixFilename( &file ) + "/" ;
+               }
+       }
+       return strDir ;
+}
+
 char *wxGetUserHome (const wxString& user)
 {
     // TODO
 char *wxGetUserHome (const wxString& user)
 {
     // TODO
@@ -271,23 +300,32 @@ bool wxColourDisplay()
 // Returns depth of screen
 int wxDisplayDepth()
 {
 // Returns depth of screen
 int wxDisplayDepth()
 {
-               // get max pixel depth
-               CGrafPtr port ;
-               GetCWMgrPort( &port ) ; 
-               GDHandle maxDevice ;
+       Rect globRect ; 
+       SetRect(&globRect, -32760, -32760, 32760, 32760);
+       GDHandle        theMaxDevice;
+
+       int theDepth = 8;
+       theMaxDevice = GetMaxDevice(&globRect);
+       if (theMaxDevice != nil)
+               theDepth = (**(**theMaxDevice).gdPMap).pixelSize;
                
                
-               maxDevice = GetMaxDevice( &port->portRect ) ;
-               if ( maxDevice )
-                       return (**((**maxDevice).gdPMap)).pixelSize ;
-               else
-                       return 8 ; 
+       return theDepth ;
 }
 
 // Get size of display
 void wxDisplaySize(int *width, int *height)
 {
 }
 
 // Get size of display
 void wxDisplaySize(int *width, int *height)
 {
-    *width = qd.screenBits.bounds.right - qd.screenBits.bounds.left  ;
-    *height = qd.screenBits.bounds.bottom - qd.screenBits.bounds.top ; 
-    *height -= LMGetMBarHeight() ;
+       BitMap screenBits;
+       GetQDGlobalsScreenBits( &screenBits );
+
+    *width = screenBits.bounds.right - screenBits.bounds.left  ;
+    *height = screenBits.bounds.bottom - screenBits.bounds.top ; 
+ #if TARGET_CARBON
+       SInt16 mheight ;
+       GetThemeMenuBarHeight( &mheight ) ;
+     *height -= mheight ;
+#else
+     *height -= LMGetMBarHeight() ;
+ #endif
 }
 
 }
 
index f8099265a2094b1dc026ee55dc26349fdf83653d..3dd198b36997c90f3570183a59f78acebbab0f21 100644 (file)
@@ -29,6 +29,7 @@
 #include "wx/frame.h"
 #include "wx/notebook.h"
 #include "wx/tabctrl.h"
 #include "wx/frame.h"
 #include "wx/notebook.h"
 #include "wx/tabctrl.h"
+#include "wx/tooltip.h"
 // TODO remove the line below, just for lookup-up convenience CS
 #include "wx/mac/window.h"
 
 // TODO remove the line below, just for lookup-up convenience CS
 #include "wx/mac/window.h"
 
@@ -54,8 +55,8 @@
 extern wxList wxPendingDelete;
 wxWindow* gFocusWindow = NULL ;
 
 extern wxList wxPendingDelete;
 wxWindow* gFocusWindow = NULL ;
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxEvtHandler)
 IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxEvtHandler)
-
 BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler)
   EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground)
   EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged)
 BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler)
   EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground)
   EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged)
@@ -64,6 +65,7 @@ BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler)
 //  EVT_SCROLL(wxWindow::OnScroll)
 END_EVENT_TABLE()
 
 //  EVT_SCROLL(wxWindow::OnScroll)
 END_EVENT_TABLE()
 
+#endif
 
 
 
 
 
 
@@ -163,6 +165,7 @@ wxWindow::~wxWindow()
 
        if ( m_macWindowData )
        {
 
        if ( m_macWindowData )
        {
+               wxToolTip::NotifyWindowDelete(m_macWindowData->m_macWindow) ;
        UMADisposeWindow( m_macWindowData->m_macWindow ) ;
        delete m_macWindowData ;
        wxRemoveMacWindowAssociation( this ) ;
        UMADisposeWindow( m_macWindowData->m_macWindow ) ;
        delete m_macWindowData ;
        wxRemoveMacWindowAssociation( this ) ;
@@ -189,7 +192,10 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
        m_width = WidthDefault( size.x );
        m_height = HeightDefault( size.y ) ;
 
        m_width = WidthDefault( size.x );
        m_height = HeightDefault( size.y ) ;
 
-    MacCreateScrollBars( style ) ;
+       if ( ! IsKindOf( CLASSINFO ( wxControl ) ) )
+       {
+       MacCreateScrollBars( style ) ;
+       }
 
     return TRUE;
 }
 
     return TRUE;
 }
@@ -211,6 +217,7 @@ void wxWindow::SetFocus()
                        if ( control && control->GetMacControl() )
                        {
                                UMASetKeyboardFocus( gFocusWindow->GetMacRootWindow() , control->GetMacControl()  , kControlFocusNoPart ) ;
                        if ( control && control->GetMacControl() )
                        {
                                UMASetKeyboardFocus( gFocusWindow->GetMacRootWindow() , control->GetMacControl()  , kControlFocusNoPart ) ;
+                               control->MacRedrawControl() ;
                        }
                wxFocusEvent event(wxEVT_KILL_FOCUS, gFocusWindow->m_windowId);
                event.SetEventObject(gFocusWindow);
                        }
                wxFocusEvent event(wxEVT_KILL_FOCUS, gFocusWindow->m_windowId);
                event.SetEventObject(gFocusWindow);
@@ -248,11 +255,6 @@ bool wxWindow::Enable(bool enable)
 {
     if ( !wxWindowBase::Enable(enable) )
         return FALSE;
 {
     if ( !wxWindowBase::Enable(enable) )
         return FALSE;
-/*
-    HWND hWnd = GetHwnd();
-    if ( hWnd )
-        ::EnableWindow(hWnd, (BOOL)enable);
-*/
 
     wxWindowList::Node *node = GetChildren().GetFirst();
     while ( node )
 
     wxWindowList::Node *node = GetChildren().GetFirst();
     while ( node )
@@ -319,9 +321,6 @@ void wxWindow::DoGetPosition(int *x, int *y) const
 }
 
 
 }
 
 
-
-
-
 bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
 {
        menu->SetInvokingWindow(this);
 bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
 {
        menu->SetInvokingWindow(this);
@@ -370,6 +369,7 @@ void wxWindow::DoClientToScreen(int *x, int *y) const
        GrafPtr         port ;  
        ::GetPort( &port ) ;
        ::SetPort( UMAGetWindowPort( window ) ) ;
        GrafPtr         port ;  
        ::GetPort( &port ) ;
        ::SetPort( UMAGetWindowPort( window ) ) ;
+       ::SetOrigin( 0 , 0 ) ;
        ::LocalToGlobal( &localwhere ) ;
        ::SetPort( port ) ;
        *x = localwhere.h ;
        ::LocalToGlobal( &localwhere ) ;
        ::SetPort( port ) ;
        *x = localwhere.h ;
@@ -437,10 +437,52 @@ void wxWindow::DoGetClientSize(int *x, int *y) const
     *x = m_width ;
     *y = m_height ;
 
     *x = m_width ;
     *y = m_height ;
 
-  if (m_vScrollBar && m_vScrollBar->IsShown() )
-       (*x) -= MAC_SCROLLBAR_SIZE;
-  if (m_hScrollBar  && m_hScrollBar->IsShown() )
-       (*y) -= MAC_SCROLLBAR_SIZE;
+       *x -= 2 * MacGetBorderSize(  ) ;
+       *y -= 2 * MacGetBorderSize(  ) ;
+       
+  if ( (m_vScrollBar && m_vScrollBar->IsShown()) || (m_hScrollBar  && m_hScrollBar->IsShown()) )
+  {
+       int x1 = 0 ; 
+       int y1 = 0 ;
+       int w = m_width ;
+       int h = m_height ;
+       
+       MacClientToRootWindow( &x1 , &y1 ) ;
+       MacClientToRootWindow( &w , &h ) ;
+       
+       WindowRef window = NULL ;
+       wxWindow *iter = (wxWindow*)this ;
+       
+       int totW = 10000 , totH = 10000;
+       while( iter )
+       {
+               if ( iter->m_macWindowData )
+               {
+                       totW = iter->m_width ;
+                       totH = iter->m_height ;
+                       break ;
+               }
+
+               iter = iter->GetParent() ;
+       } 
+       
+       if (m_hScrollBar  && m_hScrollBar->IsShown() )
+       {
+               (*y) -= MAC_SCROLLBAR_SIZE;
+               if ( h-y1 >= totH )
+               {
+                       (*y)+= 1 ;
+               }
+    }
+       if (m_vScrollBar  && m_vScrollBar->IsShown() )
+       {
+       (*x) -= MAC_SCROLLBAR_SIZE;
+               if ( w-x1 >= totW )
+               {
+               (*x) += 1 ;
+       }
+       }
+  }
 }
 
 
 }
 
 
@@ -454,8 +496,8 @@ void wxWindow::DoSetToolTip(wxToolTip *tooltip)
 {
     wxWindowBase::DoSetToolTip(tooltip);
 
 {
     wxWindowBase::DoSetToolTip(tooltip);
 
-//    if ( m_tooltip )
-//        m_tooltip->SetWindow(this);
+       if ( m_tooltip )
+               m_tooltip->SetWindow(this);
 }
 
 #endif // wxUSE_TOOLTIPS
 }
 
 #endif // wxUSE_TOOLTIPS
@@ -467,6 +509,7 @@ void wxWindow::DoMoveWindow(int x, int y, int width, int height)
 
 void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
 {
 
 void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
 {
+
        int former_x = m_x ;
        int former_y = m_y ;
        int former_w = m_width ;
        int former_x = m_x ;
        int former_y = m_y ;
        int former_w = m_width ;
@@ -481,9 +524,9 @@ void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
   int actualHeight = height;
   int actualX = x;
   int actualY = y;
   int actualHeight = height;
   int actualX = x;
   int actualY = y;
-  if (x == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+  if (x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
       actualX = currentX;
       actualX = currentX;
-  if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+  if (y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
       actualY = currentY;
   if (width == -1)
       actualWidth = currentW ;
       actualY = currentY;
   if (width == -1)
       actualWidth = currentW ;
@@ -524,7 +567,7 @@ void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
                                if ( focus.Ok() )
                                {
                                Rect clientrect = { 0 , 0 , m_height , m_width } ;
                                if ( focus.Ok() )
                                {
                                Rect clientrect = { 0 , 0 , m_height , m_width } ;
-                           InvalRect( &clientrect ) ;
+                           InvalWindowRect( GetMacRootWindow() , &clientrect ) ;
                                }
                        }
                }
                                }
                        }
                }
@@ -535,18 +578,18 @@ void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
                if ( m_macWindowData )
                {
                        if ( doMove )
                if ( m_macWindowData )
                {
                        if ( doMove )
-                               ::MoveWindow(m_macWindowData->m_macWindow, m_x, m_y, false); // don't make frontmost
+                               ::MoveWindow(m_macWindowData->m_macWindow, m_x, m_y  , false); // don't make frontmost
                        
                        if ( doResize )
                        
                        if ( doResize )
-                               ::SizeWindow(m_macWindowData->m_macWindow, m_width, m_height, true); 
+                               ::SizeWindow(m_macWindowData->m_macWindow, m_width, m_height  , true); 
                        
                        // the OS takes care of invalidating and erasing        
                        
                        if ( IsKindOf( CLASSINFO( wxFrame ) ) )
                        {
                                wxFrame* frame = (wxFrame*) this ;
                        
                        // the OS takes care of invalidating and erasing        
                        
                        if ( IsKindOf( CLASSINFO( wxFrame ) ) )
                        {
                                wxFrame* frame = (wxFrame*) this ;
-                         frame->PositionStatusBar();
-                       frame->PositionToolBar();
+                               frame->PositionStatusBar();
+                               frame->PositionToolBar();
                        }
                }
                else
                        }
                }
                else
@@ -556,8 +599,8 @@ void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
                                wxMacDrawingClientHelper focus( this ) ;
                                if ( focus.Ok() )
                                {
                                wxMacDrawingClientHelper focus( this ) ;
                                if ( focus.Ok() )
                                {
-                               Rect clientrect = { 0 , 0 , m_height , m_width } ;
-                           InvalRect( &clientrect ) ;
+                                       Rect clientrect = { 0 , 0 , m_height , m_width } ;
+                               InvalWindowRect( GetMacRootWindow() , &clientrect ) ;
                                }
                        }
                        if ( doMove )
                                }
                        }
                        if ( doMove )
@@ -566,17 +609,17 @@ void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
                MacRepositionScrollBars() ;
                if ( doMove )
                {
                MacRepositionScrollBars() ;
                if ( doMove )
                {
-       wxMoveEvent event(wxPoint(m_x, m_y), m_windowId);
-       event.SetEventObject(this);
-       GetEventHandler()->ProcessEvent(event) ;
-    }
-    if ( doResize )
-    {
+               wxMoveEvent event(wxPoint(m_x, m_y), m_windowId);
+               event.SetEventObject(this);
+               GetEventHandler()->ProcessEvent(event) ;
+       }
+       if ( doResize )
+       {
                        MacRepositionScrollBars() ;
                        MacRepositionScrollBars() ;
-           wxSizeEvent event(wxSize(m_width, m_height), m_windowId);
-           event.SetEventObject(this);
-           GetEventHandler()->ProcessEvent(event);
-    }
+               wxSizeEvent event(wxSize(m_width, m_height), m_windowId);
+               event.SetEventObject(this);
+               GetEventHandler()->ProcessEvent(event);
+       }
        }
 }
 // For implementation purposes - sometimes decorations make the client area
        }
 }
 // For implementation purposes - sometimes decorations make the client area
@@ -584,7 +627,7 @@ void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
 
 wxPoint wxWindow::GetClientAreaOrigin() const
 {
 
 wxPoint wxWindow::GetClientAreaOrigin() const
 {
-    return wxPoint(0, 0);
+    return wxPoint(MacGetBorderSize(  ) , MacGetBorderSize(  ) );
 }
 
 // Makes an adjustment to the window position (for example, a frame that has
 }
 
 // Makes an adjustment to the window position (for example, a frame that has
@@ -632,7 +675,8 @@ bool wxWindow::Show(bool show)
          {
                UMAShowWindow( m_macWindowData->m_macWindow ) ;
                UMASelectWindow( m_macWindowData->m_macWindow ) ;
          {
                UMAShowWindow( m_macWindowData->m_macWindow ) ;
                UMASelectWindow( m_macWindowData->m_macWindow ) ;
-                       // no need to generate events here, they will get them triggered by macos
+               // no need to generate events here, they will get them triggered by macos
+               // actually they should be , but apparently they are not
            wxSizeEvent event(wxSize(m_width, m_height), m_windowId);
            event.SetEventObject(this);
            GetEventHandler()->ProcessEvent(event);
            wxSizeEvent event(wxSize(m_width, m_height), m_windowId);
            event.SetEventObject(this);
            GetEventHandler()->ProcessEvent(event);
@@ -644,6 +688,8 @@ bool wxWindow::Show(bool show)
        }
        MacSuperShown( show ) ;
        Refresh() ;
        }
        MacSuperShown( show ) ;
        Refresh() ;
+       if(m_macWindowData)
+               MacUpdateImmediately() ;
 
     return TRUE;
 }
 
     return TRUE;
 }
@@ -682,10 +728,14 @@ void wxWindow::GetTextExtent(const wxString& string, int *x, int *y,
     wxClientDC dc( this ) ;
     long lx,ly,ld,le ;
     dc.GetTextExtent( string , &lx , &ly , &ld, &le, fontToUse ) ;
     wxClientDC dc( this ) ;
     long lx,ly,ld,le ;
     dc.GetTextExtent( string , &lx , &ly , &ld, &le, fontToUse ) ;
-    *externalLeading = le ;
-    *descent = ld ;
-    *x = lx ;
-    *y = ly ;
+    if ( externalLeading )
+       *externalLeading = le ;
+    if ( descent )
+       *descent = ld ;
+    if ( x )
+       *x = lx ;
+    if ( y )
+       *y = ly ;
 }
 
 void wxWindow::MacEraseBackground( Rect *rect )
 }
 
 void wxWindow::MacEraseBackground( Rect *rect )
@@ -715,7 +765,7 @@ void wxWindow::MacEraseBackground( Rect *rect )
                                        // if we have the normal colours in the hierarchy but another control etc. -> use it's background
                                        if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
                                        {
                                        // if we have the normal colours in the hierarchy but another control etc. -> use it's background
                                        if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
                                        {
-                                               ApplyThemeBackground                    (kThemeBackgroundTabPane, rect, kThemeStateActive,8,true);
+                                               UMAApplyThemeBackground(kThemeBackgroundTabPane, rect, kThemeStateActive,8,true);
                                                break ;
                                        }
                                }
                                                break ;
                                        }
                                }
@@ -743,10 +793,6 @@ void wxWindow::MacEraseBackground( Rect *rect )
        for (wxNode *node = GetChildren().First(); node; node = node->Next())
        {
                wxWindow *child = (wxWindow*)node->Data();
        for (wxNode *node = GetChildren().First(); node; node = node->Next())
        {
                wxWindow *child = (wxWindow*)node->Data();
-//                     int width ;
-//                     int height ;
-               
-//                     child->GetClientSize( &width , &height ) ;
                
                Rect clientrect = { child->m_x , child->m_y , child->m_x +child->m_width , child->m_y + child->m_height } ;
                SectRect( &clientrect , rect , &clientrect ) ;          
                
                Rect clientrect = { child->m_x , child->m_y , child->m_x +child->m_width , child->m_y + child->m_height } ;
                SectRect( &clientrect , rect , &clientrect ) ;          
@@ -765,26 +811,18 @@ void wxWindow::MacEraseBackground( Rect *rect )
 
 void wxWindow::Refresh(bool eraseBack, const wxRect *rect)
 {
 
 void wxWindow::Refresh(bool eraseBack, const wxRect *rect)
 {
-       wxMacDrawingClientHelper focus( this ) ;
+       wxMacDrawingHelper focus( this ) ;
        if ( focus.Ok() )
        {
        if ( focus.Ok() )
        {
-       int width , height ;
-       GetClientSize( &width , &height ) ;
-       Rect clientrect = { 0 , 0 , height , width } ;
-       ClipRect( &clientrect ) ;
+               Rect clientrect = { 0 , 0 , m_height , m_width } ;
+               ClipRect( &clientrect ) ;
 
 
-    if ( rect )
-    {
-       Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ;
+       if ( rect )
+       {
+               Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ;
                        SectRect( &clientrect , &r , &clientrect ) ;            
                        SectRect( &clientrect , &r , &clientrect ) ;            
-    }
-    InvalRect( &clientrect ) ;
-    /*
-    if ( eraseBack )
-    {
-       MacEraseBackground( &clientrect ) ;
-       }
-       */
+       }
+       InvalWindowRect( GetMacRootWindow() , &clientrect ) ;
        }
 }
 
        }
 }
 
@@ -927,41 +965,222 @@ void wxWindow::SetScrollPos(int orient, int pos, bool refresh)
                }
 }
 
                }
 }
 
-void wxWindow::MacPaint( wxPaintEvent &event ) 
+void  wxWindow::MacCreateRealWindow( const wxString& title,
+           const wxPoint& pos,
+           const wxSize& size,
+           long style,
+           const wxString& name ) 
 {
 {
-    wxPaintDC dc(this);
-    PrepareDC(dc);
+  SetName(name);
+  m_windowStyle = style;
+  m_isShown = FALSE;
 
 
-    if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) )
-    {
-       bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
+  // create frame.
 
 
-               wxPen m_penButton3DShadow( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DSHADOW ), 1, wxSOLID ) ;
-               wxPen m_penButton3DFace( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE ), 1, wxSOLID ) ;
-       
-               wxPen wxPen1 = sunken ? *wxWHITE_PEN : *wxBLACK_PEN;
-               wxPen wxPen2 = sunken ? m_penButton3DShadow : m_penButton3DShadow;
-               wxPen wxPen3 = sunken ? m_penButton3DFace : m_penButton3DShadow;
-               wxPen wxPen4 = sunken ? *wxBLACK_PEN : *wxWHITE_PEN;
+       Rect theBoundsRect;
+
+  m_x = (int)pos.x;
+  m_y = (int)pos.y;
+  if ( m_y < 50 )
+       m_y = 50 ;
+  if ( m_x < 20 )
+       m_x = 20 ;
+       
+  m_width = size.x;
+       if (m_width == -1) 
+               m_width = 20;
+  m_height = size.y;
+       if (m_height == -1) 
+               m_height = 20;
+
+       m_macWindowData = new MacWindowData() ;
+
+       ::SetRect(&theBoundsRect, m_x, m_y , m_x + m_width, m_y + m_height);
+
+       // translate the window attributes in the appropriate window class and attributes
+
+       WindowClass wclass  ;
+       WindowAttributes attr  ;
        
        
-               dc.SetPen(wxPen1);
-               dc.DrawRectangle(0, 0, m_width, m_height);          // outer - right and button
+       if ( HasFlag(wxTINY_CAPTION_HORIZ) ||  HasFlag(wxTINY_CAPTION_VERT) )
+       {
+               wclass = kFloatingWindowClass ;
+               if ( HasFlag(wxTINY_CAPTION_VERT) )
+               {
+                       attr |= kWindowSideTitlebarAttribute ;
+               }
+       }
+       else if ( HasFlag( wxTHICK_FRAME ) )
+       {
+               if ( HasFlag( wxDIALOG_MODAL ) )
+               {
+                       wclass = kMovableModalWindowClass ;
+               }
+               else if ( HasFlag( wxDIALOG_MODELESS ) )
+               {
+                       wclass = kDocumentWindowClass ;
+               }
+               else
+               {
+                       if ( HasFlag( wxCAPTION ) )
+                       {
+                               wclass = kDocumentWindowClass ;
+                       }
+                       else
+                       {
+                               wclass = kModalWindowClass ;
+                       }
+               }
+       }
+       else
+       {
+               wclass = kModalWindowClass ;
+       }
        
        
-           dc.SetPen(wxPen2);
-               dc.DrawRectangle(1, 1, m_width-1, m_height-1);      // outer - left and top
+       attr = kWindowNoAttributes ;
        
        
-           dc.SetPen(wxPen3);
-               dc.DrawRectangle(0, 0, m_width-2, m_height-2);          // inner - right and button
+       if ( HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) )
+       {
+               attr |= kWindowFullZoomAttribute ;
+               attr |= kWindowCollapseBoxAttribute ;
+       }
+       if ( HasFlag( wxRESIZE_BORDER ) )
+       {
+               attr |= kWindowResizableAttribute ;
+       }
+       if ( HasFlag( wxSYSTEM_MENU ) )
+       {
+               attr |= kWindowCloseBoxAttribute ;
+       }
        
        
-           dc.SetPen(wxPen4);
-               dc.DrawLine(0, 0, m_width-3, 0);                 // inner - left and top
-               dc.DrawLine(0, 0, 0, m_height-3);
+       UMACreateNewWindow( wclass , attr , &theBoundsRect , &m_macWindowData->m_macWindow ) ;
+       wxAssociateWinWithMacWindow( m_macWindowData->m_macWindow , this ) ;
+       wxString label ;
+       if( wxApp::s_macDefaultEncodingIsPC )
+               label = wxMacMakeMacStringFromPC( title ) ;
+       else
+               label = title ;
+       UMASetWTitleC( m_macWindowData->m_macWindow , label ) ;
+       UMACreateRootControl( m_macWindowData->m_macWindow , &m_macWindowData->m_macRootControl ) ;
+
+       m_macWindowData->m_macFocus = NULL ;
+}
+
+void wxWindow::MacPaint( wxPaintEvent &event ) 
+{
+}
+
+void wxWindow::MacPaintBorders( ) 
+{
+       if( m_macWindowData )
+               return ;
+               
+       RGBColor white = { 0xFFFF, 0xFFFF , 0xFFFF } ;
+       RGBColor black = { 0x0000, 0x0000 , 0x0000 } ;
+       RGBColor face = { 0xDDDD, 0xDDDD , 0xDDDD } ;
+       RGBColor shadow = { 0x4444, 0x4444 , 0x4444 } ;
+       PenNormal() ;
+
+    if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
+    {
+       bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
+       RGBColor pen1 = sunken ? white : black ;
+       RGBColor pen2 = sunken ? shadow : face ;
+       RGBColor pen3 = sunken ? face : shadow ;
+       RGBColor pen4 = sunken ? black : white ;
+       
+       RGBForeColor( &pen1 ) ;
+       {
+                       Rect rect = { 0 , 0 , m_height , m_width } ;
+               FrameRect( &rect ) ;
+       }
+       RGBForeColor( &pen2 ) ;
+       {
+                       Rect rect = { 1 , 1 , m_height -1 , m_width -1} ;
+               FrameRect( &rect ) ;
+       }
+       RGBForeColor( &pen3 ) ;
+       {
+                       Rect rect = { 0 , 0 , m_height -2 , m_width -2} ;
+               FrameRect( &rect ) ;
+       }
+       RGBForeColor( &pen4 ) ;
+       {
+               MoveTo( 0 , 0 ) ;
+               LineTo( m_width - 3 , 0 ) ;
+               MoveTo( 0 , 0 ) ;
+               LineTo( 0 , m_height - 3 ) ;
+       }
     }
     else if (HasFlag(wxSIMPLE_BORDER))
     {
     }
     else if (HasFlag(wxSIMPLE_BORDER))
     {
-               dc.SetPen(*wxBLACK_PEN);
-               dc.DrawRectangle(0, 0, m_width, m_height);         
+               Rect rect = { 0 , 0 , m_height , m_width } ;
+               RGBForeColor( &black ) ;
+       FrameRect( &rect ) ;
+    }
+/*
+       if ( this->GetParent() )
+       {
+           wxPaintDC dc(GetParent());
+           GetParent()->PrepareDC(dc);
+       
+           if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) )
+           {
+               bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
+       
+                       wxPen m_penButton3DShadow( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DSHADOW ), 1, wxSOLID ) ;
+                       wxPen m_penButton3DFace( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE ), 1, wxSOLID ) ;
+               
+                       wxPen wxPen1 = sunken ? *wxWHITE_PEN : *wxBLACK_PEN;
+                       wxPen wxPen2 = sunken ? m_penButton3DShadow : m_penButton3DShadow;
+                       wxPen wxPen3 = sunken ? m_penButton3DFace : m_penButton3DShadow;
+                       wxPen wxPen4 = sunken ? *wxBLACK_PEN : *wxWHITE_PEN;
+               
+                       dc.SetPen(wxPen1);
+                       dc.DrawRectangle(m_x, m_y, m_width, m_height);          // outer - right and button
+               
+                   dc.SetPen(wxPen2);
+                       dc.DrawRectangle(m_x+1, m_y+1, m_width-1, m_height-1);      // outer - left and top
+               
+                   dc.SetPen(wxPen3);
+                       dc.DrawRectangle(m_x, m_y, m_width-2, m_height-2);          // inner - right and button
+               
+                   dc.SetPen(wxPen4);
+                       dc.DrawLine(m_x, m_y, m_x + m_width-3, m_y);                 // inner - left and top
+                       dc.DrawLine(m_x, m_y, m_x, m_y + m_height-3);
+           }
+           else if (HasFlag(wxDOUBLE_BORDER))
+           {
+               bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
+       
+                       wxPen m_penButton3DShadow( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DSHADOW ), 1, wxSOLID ) ;
+                       wxPen m_penButton3DFace( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE ), 1, wxSOLID ) ;
+               
+                       wxPen wxPen1 = sunken ? *wxWHITE_PEN : *wxBLACK_PEN;
+                       wxPen wxPen2 = sunken ? m_penButton3DShadow : m_penButton3DShadow;
+                       wxPen wxPen3 = sunken ? m_penButton3DFace : m_penButton3DShadow;
+                       wxPen wxPen4 = sunken ? *wxBLACK_PEN : *wxWHITE_PEN;
+               
+                       dc.SetPen(wxPen1);
+                       dc.DrawRectangle(m_x, m_y, m_width, m_height);          // outer - right and button
+               
+                   dc.SetPen(wxPen2);
+                       dc.DrawRectangle(m_x+1, m_y+1, m_width-1, m_height-1);      // outer - left and top
+               
+                   dc.SetPen(wxPen3);
+                       dc.DrawRectangle(m_x, m_y, m_width-2, m_height-2);          // inner - right and button
+               
+                   dc.SetPen(wxPen4);
+                       dc.DrawLine(m_x, m_y, m_x + m_width-3, m_y);                 // inner - left and top
+                       dc.DrawLine(m_x, m_y, m_x, m_y + m_height-3);
+           }
+           else if (HasFlag(wxSIMPLE_BORDER))
+           {
+                       dc.SetPen(*wxBLACK_PEN);
+                       dc.DrawRectangle(m_x, m_y, m_width, m_height);         
+           }
     }
     }
+ */
 }
 
 // New function that will replace some of the above.
 }
 
 // New function that will replace some of the above.
@@ -1011,20 +1230,21 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
        wxMacDrawingClientHelper focus( this ) ;
        if ( focus.Ok() )
        {
        wxMacDrawingClientHelper focus( this ) ;
        if ( focus.Ok() )
        {
-       int width , height ;
-       GetClientSize( &width , &height ) ;
-       Rect scrollrect = { 0 , 0 , height , width } ;
+               int width , height ;
+               GetClientSize( &width , &height ) ;
+
+               Rect scrollrect = { 0 , 0 , height , width } ;
        
        
-       RgnHandle updateRgn = NewRgn() ;
-       ClipRect( &scrollrect ) ;
-    if ( rect )
-    {
-       Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ;
+               RgnHandle updateRgn = NewRgn() ;
+               ClipRect( &scrollrect ) ;
+       if ( rect )
+       {
+               Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ;
                        SectRect( &scrollrect , &r , &scrollrect ) ;            
                        SectRect( &scrollrect , &r , &scrollrect ) ;            
-    }
-       ScrollRect( &scrollrect , dx , dy , updateRgn ) ;
-    InvalRgn( updateRgn ) ;
-    DisposeRgn( updateRgn ) ;
+       }
+               ScrollRect( &scrollrect , dx , dy , updateRgn ) ;
+       InvalWindowRgn( GetMacRootWindow() ,  updateRgn ) ;
+       DisposeRgn( updateRgn ) ;
        }
 }
 
        }
 }
 
@@ -1136,9 +1356,9 @@ void wxWindow::Clear()
        else
        {
                wxClientDC dc(this);
        else
        {
                wxClientDC dc(this);
-    wxBrush brush(GetBackgroundColour(), wxSOLID);
-    dc.SetBackground(brush);
-    dc.Clear();
+       wxBrush brush(GetBackgroundColour(), wxSOLID);
+       dc.SetBackground(brush);
+       dc.Clear();
        }
 }
 
        }
 }
 
@@ -1193,6 +1413,9 @@ void wxWindow::DoSetClientSize(int width, int height)
                if ( height != -1 && m_vScrollBar )
                        height += MAC_SCROLLBAR_SIZE ;
 
                if ( height != -1 && m_vScrollBar )
                        height += MAC_SCROLLBAR_SIZE ;
 
+               width += 2 * MacGetBorderSize(  ) ;
+               height += 2 * MacGetBorderSize(  ) ;
+
                DoSetSize( -1 , -1 , width , height ) ;
        }
 }
                DoSetSize( -1 , -1 , width , height ) ;
        }
 }
@@ -1249,6 +1472,7 @@ bool wxWindow::MacDispatchMouseEvent(wxMouseEvent& event)
                (event.m_x > (m_x + m_width)) || (event.m_y > (m_y + m_height)))
                return FALSE;
        
                (event.m_x > (m_x + m_width)) || (event.m_y > (m_y + m_height)))
                return FALSE;
        
+
        if ( IsKindOf( CLASSINFO ( wxStaticBox ) ) )
                return FALSE ; 
        
        if ( IsKindOf( CLASSINFO ( wxStaticBox ) ) )
                return FALSE ; 
        
@@ -1277,10 +1501,28 @@ bool wxWindow::MacDispatchMouseEvent(wxMouseEvent& event)
        {
                m_cursor.MacInstall() ;
        }
        {
                m_cursor.MacInstall() ;
        }
+
+#if wxUSE_TOOLTIPS
+    if ( event.GetEventType() == wxEVT_MOTION 
+               || event.GetEventType() == wxEVT_ENTER_WINDOW
+               || event.GetEventType() == wxEVT_LEAVE_WINDOW )
+        wxToolTip::RelayEvent( this , event);
+#endif // wxUSE_TOOLTIPS
        GetEventHandler()->ProcessEvent( event ) ;
        return TRUE;
 }
 
        GetEventHandler()->ProcessEvent( event ) ;
        return TRUE;
 }
 
+Point lastWhere ;
+long lastWhen = 0 ;
+
+wxString wxWindow::MacGetToolTipString( wxPoint &pt )
+{
+       if ( m_tooltip )
+       {
+               return m_tooltip->GetTip() ;
+       }
+       return "" ;
+}
 void wxWindow::MacFireMouseEvent( EventRecord *ev )
 {
        wxMouseEvent event(wxEVT_LEFT_DOWN);
 void wxWindow::MacFireMouseEvent( EventRecord *ev )
 {
        wxMouseEvent event(wxEVT_LEFT_DOWN);
@@ -1323,6 +1565,22 @@ void wxWindow::MacFireMouseEvent( EventRecord *ev )
        ::GlobalToLocal( &localwhere ) ;
        ::SetPort( port ) ;
 
        ::GlobalToLocal( &localwhere ) ;
        ::SetPort( port ) ;
 
+       if ( ev->what == mouseDown )
+       {
+               if ( ev->when - lastWhen <= GetDblTime() )
+               {
+                       if ( abs( localwhere.h - lastWhere.h ) < 3 || abs( localwhere.v - lastWhere.v ) < 3 )
+                       {
+                               if ( controlDown )
+                                       event.SetEventType(wxEVT_RIGHT_DCLICK ) ;
+                               else
+                                       event.SetEventType(wxEVT_LEFT_DCLICK ) ;
+                       }
+               }
+               lastWhen = ev->when ;
+               lastWhere = localwhere ;
+       }
+
        event.m_x = localwhere.h;
        event.m_y = localwhere.v;
        event.m_x += m_x;
        event.m_x = localwhere.h;
        event.m_y = localwhere.v;
        event.m_x += m_x;
@@ -1407,7 +1665,7 @@ void wxWindow::MacRedraw( RgnHandle updatergn , long time)
        WindowRef window = GetMacRootWindow() ;
        wxWindow* win = wxFindWinFromMacWindow( window ) ;
        {
        WindowRef window = GetMacRootWindow() ;
        wxWindow* win = wxFindWinFromMacWindow( window ) ;
        {
-               wxMacDrawingClientHelper focus( this ) ;
+               wxMacDrawingHelper focus( this ) ; // was client
                if ( focus.Ok() )
                {
                        WindowRef window = GetMacRootWindow() ;
                if ( focus.Ok() )
                {
                        WindowRef window = GetMacRootWindow() ;
@@ -1446,7 +1704,9 @@ void wxWindow::MacRedraw( RgnHandle updatergn , long time)
                                                        // if we have the normal colours in the hierarchy but another control etc. -> use it's background
                                                        if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
                                                        {
                                                        // if we have the normal colours in the hierarchy but another control etc. -> use it's background
                                                        if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
                                                        {
-                                                               ApplyThemeBackground(kThemeBackgroundTabPane, &(**updatergn).rgnBBox , kThemeStateActive,8,true);
+                                                               Rect box ;
+                                                               GetRegionBounds( updatergn , &box) ;
+                                                               UMAApplyThemeBackground(kThemeBackgroundTabPane, &box , kThemeStateActive,8,true);
                                                                break ;
                                                        }
                                                }
                                                                break ;
                                                        }
                                                }
@@ -1475,32 +1735,39 @@ void wxWindow::MacRedraw( RgnHandle updatergn , long time)
                                EraseRgn( updatergn ) ; 
                        }
                }
                                EraseRgn( updatergn ) ; 
                        }
                }
+
+               m_macUpdateRgn = updatergn ;
+               {
+                       RgnHandle newupdate = NewRgn() ;
+                       wxSize point = GetClientSize() ;
+                       wxPoint origin = GetClientAreaOrigin() ;
+                       SetRectRgn( newupdate , origin.x , origin.y , origin.x + point.x , origin.y+point.y ) ;
+                       SectRgn( newupdate , m_macUpdateRgn , newupdate ) ;
+                       OffsetRgn( newupdate , -origin.x , -origin.y ) ;
+                       m_updateRegion = newupdate ;
+                       DisposeRgn( newupdate ) ;
+               }
+
+               MacPaintBorders() ;
+               wxPaintEvent event;
+               event.m_timeStamp = time ;
+               event.SetEventObject(this);
+               GetEventHandler()->ProcessEvent(event);
+       }
+       {
        }
 
        
        }
 
        
-       m_updateRegion = updatergn ;
-       wxPaintEvent event;
-       event.m_timeStamp = time ;
-       event.SetEventObject(this);
-       
-       wxPaintEvent event2( event ) ;
-       GetEventHandler()->ProcessEvent(event);
-       MacPaint( event2 ) ;
        
        RgnHandle childupdate = NewRgn() ;
 
        for (wxNode *node = GetChildren().First(); node; node = node->Next())
        {
                wxWindow *child = (wxWindow*)node->Data();
        
        RgnHandle childupdate = NewRgn() ;
 
        for (wxNode *node = GetChildren().First(); node; node = node->Next())
        {
                wxWindow *child = (wxWindow*)node->Data();
-               int width ;
-               int height ;
-               
-               child->GetClientSize( &width , &height ) ;
-               
-               SetRectRgn( childupdate , child->m_x , child->m_y , child->m_x +width ,  child->m_y + height ) ;
-               SectRgn( childupdate , m_updateRegion.GetWXHRGN() , childupdate ) ;
+               SetRectRgn( childupdate , child->m_x , child->m_y , child->m_x + child->m_width ,  child->m_y + child->m_height ) ;
+               SectRgn( childupdate , m_macUpdateRgn , childupdate ) ;
                OffsetRgn( childupdate , -child->m_x , -child->m_y ) ;
                OffsetRgn( childupdate , -child->m_x , -child->m_y ) ;
-               if ( child->GetMacRootWindow() == window && child->IsShown() )
+               if ( child->GetMacRootWindow() == window && child->IsShown() && !EmptyRgn( childupdate ) )
                {
                        // because dialogs may also be children
                        child->MacRedraw( childupdate , time ) ;
                {
                        // because dialogs may also be children
                        child->MacRedraw( childupdate , time ) ;
@@ -1516,24 +1783,28 @@ void wxWindow::MacUpdateImmediately()
        if ( window )
        {
                wxWindow* win = wxFindWinFromMacWindow( window ) ;
        if ( window )
        {
                wxWindow* win = wxFindWinFromMacWindow( window ) ;
+               #if TARGET_CARBON
+               AGAPortHelper help( GetWindowPort(window) ) ;
+               #else
+               AGAPortHelper help( (window) ) ;
+               #endif
+               SetOrigin( 0 , 0 ) ;
                BeginUpdate( window ) ;
                if ( win )
                {
                BeginUpdate( window ) ;
                if ( win )
                {
-               #if ! TARGET_CARBON
-                       if ( !EmptyRgn( window->visRgn ) )
-               #endif
+                       RgnHandle               region = NewRgn();
+                       
+                       if ( region )
                        {
                        {
-                               win->MacRedraw( window->visRgn , wxTheApp->sm_lastMessageTime ) ;
-/*
-                               {
-                                       wxMacDrawingHelper help( win ) ;
-                                       SetOrigin( 0 , 0 ) ;
-                                       UMASetThemeWindowBackground( win->m_macWindowData->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
-                                       UMAUpdateControls( window , window->visRgn ) ;
-                                       UMASetThemeWindowBackground( win->m_macWindowData->m_macWindow , win->m_macWindowData->m_macWindowBackgroundTheme , false ) ;
-                               }
-*/
-                       }
+                   GetPortVisibleRegion( GetWindowPort( window ), region );
+
+                               // if windowshade gives incompatibility , take the follwing out
+                   if ( !EmptyRgn( region ) )
+                   {
+                                       win->MacRedraw( region , wxTheApp->sm_lastMessageTime ) ;
+                   }
+                   DisposeRgn( region );
+               }
                }
                EndUpdate( window ) ;
        }
                }
                EndUpdate( window ) ;
        }
@@ -1543,26 +1814,28 @@ void wxWindow::MacUpdate( EventRecord *ev )
 {
        WindowRef window = (WindowRef) ev->message ;
        wxWindow * win = wxFindWinFromMacWindow( window ) ;
 {
        WindowRef window = (WindowRef) ev->message ;
        wxWindow * win = wxFindWinFromMacWindow( window ) ;
-       
+       #if TARGET_CARBON
+       AGAPortHelper help( GetWindowPort(window) ) ;
+       #else
+       AGAPortHelper help( (window) ) ;
+       #endif
+       SetOrigin( 0 , 0 ) ;
        BeginUpdate( window ) ;
        if ( win )
        {
        BeginUpdate( window ) ;
        if ( win )
        {
-               // if windowshade gives incompatibility , take the follwing out
-               #if ! TARGET_CARBON
-               if ( !EmptyRgn( window->visRgn ) )
-               #endif
+               RgnHandle               region = NewRgn();
+               
+               if ( region )
                {
                {
-                       MacRedraw( window->visRgn , ev->when ) ;
-                       /*
-                       {
-                               wxMacDrawingHelper help( this ) ;
-                               SetOrigin( 0 , 0 ) ;
-                               UMASetThemeWindowBackground( m_macWindowData->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
-                               UMAUpdateControls( window , window->visRgn ) ;
-                               UMASetThemeWindowBackground( m_macWindowData->m_macWindow , m_macWindowData->m_macWindowBackgroundTheme , false ) ;
-                       }
-                       */
-               }
+            GetPortVisibleRegion( GetWindowPort( window ), region );
+
+                       // if windowshade gives incompatibility , take the follwing out
+            if ( !EmptyRgn( region ) )
+            {
+                               MacRedraw( region , ev->when ) ;
+            }
+            DisposeRgn( region );
+        }
        }
        EndUpdate( window ) ;
 }
        }
        EndUpdate( window ) ;
 }
@@ -1586,20 +1859,36 @@ WindowRef wxWindow::GetMacRootWindow() const
 void wxWindow::MacCreateScrollBars( long style ) 
 {
        wxASSERT_MSG( m_vScrollBar == NULL && m_hScrollBar == NULL , "attempt to create window twice" ) ;
 void wxWindow::MacCreateScrollBars( long style ) 
 {
        wxASSERT_MSG( m_vScrollBar == NULL && m_hScrollBar == NULL , "attempt to create window twice" ) ;
+       
        bool hasBoth = ( style & wxVSCROLL ) && ( style & wxHSCROLL ) ;
        int adjust = hasBoth ? MAC_SCROLLBAR_SIZE - 1: 0 ;
        bool hasBoth = ( style & wxVSCROLL ) && ( style & wxHSCROLL ) ;
        int adjust = hasBoth ? MAC_SCROLLBAR_SIZE - 1: 0 ;
+       int width, height ;
+       GetClientSize( &width , &height ) ;
        
        
+       wxPoint vPoint(width-MAC_SCROLLBAR_SIZE, 0) ;
+       wxSize vSize(MAC_SCROLLBAR_SIZE, height - adjust) ;
+       wxPoint hPoint(0 , height-MAC_SCROLLBAR_SIZE ) ;
+       wxSize hSize( width - adjust, MAC_SCROLLBAR_SIZE) ;
+       
+       m_vScrollBar = new wxScrollBar(this, wxWINDOW_VSCROLL, vPoint, 
+               vSize , wxVERTICAL);
+
        if ( style & wxVSCROLL )
        {
        if ( style & wxVSCROLL )
        {
-               m_vScrollBar = new wxScrollBar(this, wxWINDOW_VSCROLL, wxPoint(m_width-MAC_SCROLLBAR_SIZE, 0), 
-                       wxSize(MAC_SCROLLBAR_SIZE, m_height - adjust), wxVERTICAL);
-//             m_vScrollBar->PushEventHandler( this ) ;
+               
+       }
+       else
+       {
+               m_vScrollBar->Show(false) ;
        }
        }
+       m_hScrollBar = new wxScrollBar(this, wxWINDOW_HSCROLL, hPoint, 
+               hSize , wxHORIZONTAL);
        if ( style  & wxHSCROLL )
        {
        if ( style  & wxHSCROLL )
        {
-               m_hScrollBar = new wxScrollBar(this, wxWINDOW_HSCROLL, wxPoint(0 , m_height-MAC_SCROLLBAR_SIZE ), 
-                       wxSize( m_width - adjust, MAC_SCROLLBAR_SIZE), wxHORIZONTAL);
-//             m_hScrollBar->PushEventHandler( this ) ;
+       }
+       else
+       {
+               m_hScrollBar->Show(false) ;
        }
        
        // because the create does not take into account the client area origin
        }
        
        // because the create does not take into account the client area origin
@@ -1611,18 +1900,79 @@ void wxWindow::MacRepositionScrollBars()
        bool hasBoth = ( m_hScrollBar && m_hScrollBar->IsShown()) && ( m_vScrollBar && m_vScrollBar->IsShown()) ;
        int adjust = hasBoth ? MAC_SCROLLBAR_SIZE - 1 : 0 ;
        
        bool hasBoth = ( m_hScrollBar && m_hScrollBar->IsShown()) && ( m_vScrollBar && m_vScrollBar->IsShown()) ;
        int adjust = hasBoth ? MAC_SCROLLBAR_SIZE - 1 : 0 ;
        
+       // get real client area
+       
+       int width = m_width ; 
+       int height = m_height ;
+
+       width -= 2 * MacGetBorderSize() ;
+       height -= 2 * MacGetBorderSize() ;
+       
+       wxPoint vPoint(width-MAC_SCROLLBAR_SIZE, 0) ;
+       wxSize vSize(MAC_SCROLLBAR_SIZE, height - adjust) ;
+       wxPoint hPoint(0 , height-MAC_SCROLLBAR_SIZE ) ;
+       wxSize hSize( width - adjust, MAC_SCROLLBAR_SIZE) ;
+       
+       int x = 0 ; 
+       int y = 0 ;
+       int w = m_width ;
+       int h = m_height ;
+       
+       MacClientToRootWindow( &x , &y ) ;
+       MacClientToRootWindow( &w , &h ) ;
+       
+       WindowRef window = NULL ;
+       wxWindow *iter = (wxWindow*)this ;
+       
+       int totW = 10000 , totH = 10000;
+       while( iter )
+       {
+               if ( iter->m_macWindowData )
+               {
+                       totW = iter->m_width ;
+                       totH = iter->m_height ;
+                       break ;
+               }
+
+               iter = iter->GetParent() ;
+       } 
+       
+       if ( x == 0 )
+       {
+               hPoint.x = -1 ;
+               hSize.x += 1 ;
+       }
+       if ( y == 0 )
+       {
+               vPoint.y = -1 ;
+               vSize.y += 1 ;
+       }
+       
+       if ( w-x >= totW )
+       {
+               hSize.x += 1 ;
+               vPoint.x += 1 ;
+       }
+       
+       if ( h-y >= totH )
+       {
+               vSize.y += 1 ;
+               hPoint.y += 1 ;
+       }
+
        if ( m_vScrollBar )
        {
        if ( m_vScrollBar )
        {
-               m_vScrollBar->SetSize( m_width-MAC_SCROLLBAR_SIZE, 0, MAC_SCROLLBAR_SIZE, m_height - adjust , wxSIZE_USE_EXISTING);
+               m_vScrollBar->SetSize( vPoint.x , vPoint.y, vSize.x, vSize.y , wxSIZE_ALLOW_MINUS_ONE);
        }
        if ( m_hScrollBar )
        {
        }
        if ( m_hScrollBar )
        {
-               m_hScrollBar->SetSize( 0 , m_height-MAC_SCROLLBAR_SIZE ,m_width - adjust, MAC_SCROLLBAR_SIZE, wxSIZE_USE_EXISTING);
+               m_hScrollBar->SetSize( hPoint.x , hPoint.y, hSize.x, hSize.y, wxSIZE_ALLOW_MINUS_ONE);
        }
 }
 
 void wxWindow::MacKeyDown( EventRecord *ev ) 
 {
        }
 }
 
 void wxWindow::MacKeyDown( EventRecord *ev ) 
 {
+
 }
 
 
 }
 
 
@@ -1651,7 +2001,8 @@ void wxWindow::MacSuperChangedPosition()
                node = node->Next();
        }
 }
                node = node->Next();
        }
 }
-       
+/*
+
 bool wxWindow::MacSetupFocusPort(  ) 
 {
        Point localOrigin ;
 bool wxWindow::MacSetupFocusPort(  ) 
 {
        Point localOrigin ;
@@ -1699,7 +2050,7 @@ bool wxWindow::MacSetupDrawingClientPort(  )
        MacGetPortClientParams( &localOrigin , &clipRect , &window , &rootwin) ;
        return  MacSetPortDrawingParams( localOrigin, clipRect, window , rootwin ) ; 
 }
        MacGetPortClientParams( &localOrigin , &clipRect , &window , &rootwin) ;
        return  MacSetPortDrawingParams( localOrigin, clipRect, window , rootwin ) ; 
 }
-
+*/
 
 bool wxWindow::MacSetPortFocusParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindow* win ) 
 {
 
 bool wxWindow::MacSetPortFocusParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindow* win ) 
 {
@@ -1714,6 +2065,7 @@ bool wxWindow::MacSetPortFocusParams( const Point & localOrigin, const Rect & cl
        if (currPort != port )
                        ::SetPort(port);
                                
        if (currPort != port )
                        ::SetPort(port);
                                
+//     wxASSERT( port->portRect.left == 0 && port->portRect.top == 0 ) ; 
        ::SetOrigin(-localOrigin.h, -localOrigin.v);
        return true;                    
 }
        ::SetOrigin(-localOrigin.h, -localOrigin.v);
        return true;                    
 }
@@ -1729,14 +2081,16 @@ bool wxWindow::MacSetPortDrawingParams( const Point & localOrigin, const Rect &
        port = UMAGetWindowPort( window) ;
        if (currPort != port )
                        ::SetPort(port);
        port = UMAGetWindowPort( window) ;
        if (currPort != port )
                        ::SetPort(port);
-                               
+//     wxASSERT( port->portRect.left == 0 && port->portRect.top == 0 ) ; 
        ::SetOrigin(-localOrigin.h, -localOrigin.v);
        ::ClipRect(&clipRect);
 
        ::PenNormal() ;
        ::RGBBackColor(& win->GetBackgroundColour().GetPixel() ) ;
        ::RGBForeColor(& win->GetForegroundColour().GetPixel() ) ;
        ::SetOrigin(-localOrigin.h, -localOrigin.v);
        ::ClipRect(&clipRect);
 
        ::PenNormal() ;
        ::RGBBackColor(& win->GetBackgroundColour().GetPixel() ) ;
        ::RGBForeColor(& win->GetForegroundColour().GetPixel() ) ;
-       ::BackPat( &qd.white ) ;
+       Pattern whiteColor ;
+       
+       ::BackPat( GetQDGlobalsWhite( &whiteColor) ) ;
        ::UMASetThemeWindowBackground(  win->m_macWindowData->m_macWindow , win->m_macWindowData->m_macWindowBackgroundTheme ,  false ) ;
        return true;                    
 }
        ::UMASetThemeWindowBackground(  win->m_macWindowData->m_macWindow , win->m_macWindowData->m_macWindowBackgroundTheme ,  false ) ;
        return true;                    
 }
@@ -1771,10 +2125,10 @@ void wxWindow::MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *w
        }
 }
 
        }
 }
 
-void wxWindow::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindow** rootwin ) 
+void wxWindow::MacDoGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindow** rootwin ) 
 {
 {
-       int width , height ;
-       GetClientSize( &width , &height ) ;
+//     int width , height ;
+//     GetClientSize( &width , &height ) ;
        
        if ( m_macWindowData )
        {
        
        if ( m_macWindowData )
        {
@@ -1791,7 +2145,7 @@ void wxWindow::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, Window
        {
                wxASSERT( GetParent() != NULL ) ;
                
        {
                wxASSERT( GetParent() != NULL ) ;
                
-               GetParent()->MacGetPortClientParams( localOrigin , clipRect , window, rootwin) ;
+               GetParent()->MacDoGetPortClientParams( localOrigin , clipRect , window, rootwin) ;
 
                localOrigin->h += m_x;
                localOrigin->v += m_y;
 
                localOrigin->h += m_x;
                localOrigin->v += m_y;
@@ -1800,12 +2154,58 @@ void wxWindow::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, Window
                Rect myClip;
                myClip.left = 0;
                myClip.top = 0;
                Rect myClip;
                myClip.left = 0;
                myClip.top = 0;
-               myClip.right = width;
-               myClip.bottom = height;
+               myClip.right = m_width ;//width;
+               myClip.bottom = m_height ;// height;
                SectRect(clipRect, &myClip, clipRect);
        }
 }
 
                SectRect(clipRect, &myClip, clipRect);
        }
 }
 
+void wxWindow::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindow** rootwin ) 
+{
+       MacDoGetPortClientParams( localOrigin , clipRect , window , rootwin ) ;
+
+       int width , height ;
+       GetClientSize( &width , &height ) ;
+       wxPoint client ;
+       client = GetClientAreaOrigin( ) ;
+       
+       localOrigin->h += client.x;
+       localOrigin->v += client.y;
+       OffsetRect(clipRect, -client.x, -client.y);
+
+       Rect myClip;
+       myClip.left = 0;
+       myClip.top = 0;
+       myClip.right = width;
+       myClip.bottom = height;
+       SectRect(clipRect, &myClip, clipRect);
+}
+
+long wxWindow::MacGetBorderSize( ) const
+{
+       if( m_macWindowData )
+               return 0 ;
+
+    if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER )
+    {
+               return 2 ;
+    }
+    else if (  m_windowStyle &wxDOUBLE_BORDER)
+    {
+               return 2 ;
+    }
+    else if (m_windowStyle &wxSIMPLE_BORDER)
+    {
+       return 1 ;
+    }
+       return 0 ;
+}
+
+long wxWindow::MacRemoveBordersFromStyle( long style ) 
+{
+       return style & ~( wxDOUBLE_BORDER | wxSUNKEN_BORDER | wxRAISED_BORDER | wxBORDER | wxSTATIC_BORDER ) ;
+}
+/*
 wxMacFocusHelper::wxMacFocusHelper( wxWindow * theWindow ) 
 {
        m_ok = false ;
 wxMacFocusHelper::wxMacFocusHelper( wxWindow * theWindow ) 
 {
        m_ok = false ;
@@ -1829,12 +2229,13 @@ wxMacFocusHelper::~wxMacFocusHelper()
 {
        if ( m_ok )
        {
 {
        if ( m_ok )
        {
+               SetPort( m_currentPort ) ;
                SetOrigin( 0 , 0 ) ;
        }
        if ( m_formerPort != m_currentPort )
                SetPort( m_formerPort ) ;
 }
                SetOrigin( 0 , 0 ) ;
        }
        if ( m_formerPort != m_currentPort )
                SetPort( m_formerPort ) ;
 }
-
+*/
 wxMacDrawingHelper::wxMacDrawingHelper( wxWindow * theWindow ) 
 {
        m_ok = false ;
 wxMacDrawingHelper::wxMacDrawingHelper( wxWindow * theWindow ) 
 {
        m_ok = false ;
@@ -1861,15 +2262,18 @@ wxMacDrawingHelper::~wxMacDrawingHelper()
 {
        if ( m_ok )
        {
 {
        if ( m_ok )
        {
+               SetPort( m_currentPort ) ;
                SetPenState( &m_savedPenState ) ;
                SetOrigin( 0 , 0 ) ;
                SetPenState( &m_savedPenState ) ;
                SetOrigin( 0 , 0 ) ;
-               ClipRect( &m_currentPort->portRect ) ;
+               Rect portRect ;
+               GetPortBounds( m_currentPort , &portRect ) ;
+               ClipRect( &portRect ) ;
        }
                
        if ( m_formerPort != m_currentPort )
                SetPort( m_formerPort ) ;
 }
        }
                
        if ( m_formerPort != m_currentPort )
                SetPort( m_formerPort ) ;
 }
-
+/*
 wxMacFocusClientHelper::wxMacFocusClientHelper( wxWindow * theWindow ) 
 {
        m_ok = false ;
 wxMacFocusClientHelper::wxMacFocusClientHelper( wxWindow * theWindow ) 
 {
        m_ok = false ;
@@ -1894,11 +2298,13 @@ wxMacFocusClientHelper::~wxMacFocusClientHelper()
 {
        if ( m_ok )
        {
 {
        if ( m_ok )
        {
+               SetPort( m_currentPort ) ;
                SetOrigin( 0 , 0 ) ;
        }
        if ( m_formerPort != m_currentPort )
                SetPort( m_formerPort ) ;
 }
                SetOrigin( 0 , 0 ) ;
        }
        if ( m_formerPort != m_currentPort )
                SetPort( m_formerPort ) ;
 }
+*/
 
 wxMacDrawingClientHelper::wxMacDrawingClientHelper( wxWindow * theWindow ) 
 {
 
 wxMacDrawingClientHelper::wxMacDrawingClientHelper( wxWindow * theWindow ) 
 {
@@ -1927,9 +2333,12 @@ wxMacDrawingClientHelper::~wxMacDrawingClientHelper()
 {
        if ( m_ok )
        {
 {
        if ( m_ok )
        {
+               SetPort( m_currentPort ) ;
                SetPenState( &m_savedPenState ) ;
                SetOrigin( 0 , 0 ) ;
                SetPenState( &m_savedPenState ) ;
                SetOrigin( 0 , 0 ) ;
-               ClipRect( &m_currentPort->portRect ) ;
+               Rect portRect ;
+               GetPortBounds( m_currentPort , &portRect ) ;
+               ClipRect( &portRect ) ;
        }
                
        if ( m_formerPort != m_currentPort )
        }
                
        if ( m_formerPort != m_currentPort )
index df3424b88fca86cc1a7756b8c463cb9926cce626..c3d4ce9709f224f7356a82070aa006f3d1e27c50 100644 (file)
 
 #include "wx/checkbox.h"
 
 
 #include "wx/checkbox.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
 IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
+#endif
 
 #include <wx/mac/uma.h>
 
 
 #include <wx/mac/uma.h>
 
index 7387e3e4719c555bb3ecfe8271e469c978185811..2f43152c2a1ceae6beb1ea7bd062f1ce918100d2 100644 (file)
@@ -23,7 +23,9 @@
 // implementation
 // ============================================================================
 
 // implementation
 // ============================================================================
 
+#if !USE_SHARED_LIBRARY
   IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox)
   IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox)
+#endif
 
 // ----------------------------------------------------------------------------
 // implementation of wxCheckListBox class
 
 // ----------------------------------------------------------------------------
 // implementation of wxCheckListBox class
index 343f3d239ebda7f1e14c6489559f5c0c09e34f8c..1c36eef12d4d13502c256e7bcfbac7672778fe66 100644 (file)
@@ -17,7 +17,9 @@
 #include "wx/choice.h"
 #include "wx/mac/uma.h"
 
 #include "wx/choice.h"
 #include "wx/mac/uma.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
+#endif
 
 bool wxChoice::Create(wxWindow *parent, wxWindowID id,
            const wxPoint& pos,
 
 bool wxChoice::Create(wxWindow *parent, wxWindowID id,
            const wxPoint& pos,
@@ -27,13 +29,12 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
            const wxValidator& validator,
            const wxString& name)
 {
            const wxValidator& validator,
            const wxString& name)
 {
-    m_noStrings = n;
 
                Rect bounds ;
                Str255 title ;
        
                MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
 
                Rect bounds ;
                Str255 title ;
        
                MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
-       
+
                m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0 , 
                kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ; 
        
                m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0 , 
                kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ; 
        
@@ -41,11 +42,15 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
                SetControlData( m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
                for ( int i = 0 ; i < n ; i++ )
                {
                SetControlData( m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
                for ( int i = 0 ; i < n ; i++ )
                {
-                       appendmenu( m_macPopUpMenuHandle , choices[i] ) ;
+                       Str255 label;
+                       wxMenuItem::MacBuildMenuString( label , NULL , NULL , choices[i] ,false);
+                       AppendMenu( m_macPopUpMenuHandle , label ) ;
+                       m_strings.Add( choices[i] ) ;
                }
                SetControlMinimum( m_macControl , 0 ) ;
                }
                SetControlMinimum( m_macControl , 0 ) ;
-               SetControlMaximum( m_macControl , m_noStrings) ;
-               SetControlValue( m_macControl , 1 ) ;
+               SetControlMaximum( m_macControl , Number()) ;
+               if ( n > 0 )
+                       SetControlValue( m_macControl , 1 ) ;
 
                MacPostControlCreate() ;
 
 
                MacPostControlCreate() ;
 
@@ -54,27 +59,28 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
 
 void wxChoice::Append(const wxString& item)
 {
 
 void wxChoice::Append(const wxString& item)
 {
-       appendmenu( m_macPopUpMenuHandle , item ) ;
-    m_noStrings ++;
-       SetControlMaximum( m_macControl , m_noStrings) ;
+       Str255 label;
+       wxMenuItem::MacBuildMenuString( label , NULL , NULL , item ,false);
+       AppendMenu( m_macPopUpMenuHandle , label ) ;
+       m_strings.Add( item ) ;
+       SetControlMaximum( m_macControl , Number()) ;
 }
 
 void wxChoice::Delete(int n)
 {
 }
 
 void wxChoice::Delete(int n)
 {
-       wxASSERT( n < m_noStrings ) ;
     ::DeleteMenuItem( m_macPopUpMenuHandle , n + 1) ;
     ::DeleteMenuItem( m_macPopUpMenuHandle , n + 1) ;
-    m_noStrings --;
-       SetControlMaximum( m_macControl , m_noStrings) ;
+    m_strings.Remove( n ) ;
+       SetControlMaximum( m_macControl , Number()) ;
 }
 
 void wxChoice::Clear()
 {
 }
 
 void wxChoice::Clear()
 {
-    for ( int i = 0 ; i < m_noStrings ; i++ )
+    for ( int i = 0 ; i < Number() ; i++ )
     {
        ::DeleteMenuItem( m_macPopUpMenuHandle , 1 ) ;
        }
     {
        ::DeleteMenuItem( m_macPopUpMenuHandle , 1 ) ;
        }
-    m_noStrings = 0;
-       SetControlMaximum( m_macControl , m_noStrings) ;
+    m_strings.Clear() ;
+       SetControlMaximum( m_macControl , Number()) ;
 }
 
 int wxChoice::GetSelection() const
 }
 
 int wxChoice::GetSelection() const
@@ -99,7 +105,7 @@ void wxChoice::SetSelection(int n)
 
 int wxChoice::FindString(const wxString& s) const
 {
 
 int wxChoice::FindString(const wxString& s) const
 {
-    for( int i = 0 ; i < m_noStrings ; i++ )
+    for( int i = 0 ; i < Number() ; i++ )
     {
        if ( GetString( i ) == s )
                return i ; 
     {
        if ( GetString( i ) == s )
                return i ; 
@@ -109,10 +115,7 @@ int wxChoice::FindString(const wxString& s) const
 
 wxString wxChoice::GetString(int n) const
 {
 
 wxString wxChoice::GetString(int n) const
 {
-       Str255 text ;
-    ::GetMenuItemText( m_macPopUpMenuHandle , n+1 , text ) ;
-    p2cstr( text ) ;
-    return wxString( text );
+       return m_strings[n] ;
 }
 
 void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags)
 }
 
 void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags)
index 36f4c0f4d9e72a4450050f5a0a9877009d768a43..ca5b79339632c428ac59338d65addc48cbb23b22 100644 (file)
 #include "wx/metafile.h"
 #include "wx/clipbrd.h"
 
 #include "wx/metafile.h"
 #include "wx/clipbrd.h"
 
+#define wxUSE_DATAOBJ 1
+
 #include <string.h>
 
 // open/close
 #include <string.h>
 
 // open/close
+
+bool clipboard_opened = false ;
+
 bool wxOpenClipboard()
 {
 bool wxOpenClipboard()
 {
+       clipboard_opened = true ;
     return TRUE;
 }
 
 bool wxCloseClipboard()
 {
     return TRUE;
 }
 
 bool wxCloseClipboard()
 {
+       clipboard_opened = false ;
     return TRUE;
 }
 
 bool wxIsClipboardOpened()
 {
     return TRUE;
 }
 
 bool wxIsClipboardOpened()
 {
-     return TRUE;
+     return clipboard_opened;
 }
 
 }
 
-// get/set data
-
 bool wxEmptyClipboard()
 {
 bool wxEmptyClipboard()
 {
-       ZeroScrap() ;
+       
+#if TARGET_CARBON
+       OSStatus err ;
+       err = ClearCurrentScrap( );
+#else
+       OSErr err ;
+       err = ZeroScrap( );
+#endif
+       if ( err )
+       {
+        wxLogSysError(_("Failed to empty the clipboard."));
+               return FALSE ;
+       }
     return TRUE;
 }
 
     return TRUE;
 }
 
-bool wxSetClipboardData(wxDataFormat dataFormat,const void *data,int width , int height)
+// get/set data
+
+// clipboard formats
+
+bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat)
 {
 {
-    return FALSE;
+#if TARGET_CARBON
+       OSStatus err = noErr;
+       ScrapRef scrapRef;
+       
+       err = GetCurrentScrap( &scrapRef );
+       if ( err != noTypeErr && err != memFullErr )    
+       {
+               ScrapFlavorFlags        flavorFlags;
+               Size                            byteCount;
+               
+               if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
+               {
+                       if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
+                       {
+                               return TRUE ;
+                       }
+               }
+       }
+       return FALSE;
+       
+#else
+       long offset ;
+       if ( GetScrap( NULL , dataFormat.GetFormatId() , &offset ) > 0 )
+       {
+               return TRUE ;
+       }
+     return FALSE;
+#endif
 }
 
 }
 
-void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
+bool wxSetClipboardData(wxDataFormat dataFormat,const void *data,int width , int height)
 {
 {
-    return NULL;
-}
+#if !TARGET_CARBON
+       OSErr err = noErr ;
+#else
+       OSStatus err = noErr ;
+#endif
+       
+    switch (dataFormat.GetType())
+    {
+        case wxDF_BITMAP:
+            {
+               /*
+                wxBitmap *bitmap = (wxBitmap *)data;
+
+                HDC hdcMem = CreateCompatibleDC((HDC) NULL);
+                HDC hdcSrc = CreateCompatibleDC((HDC) NULL);
+                HBITMAP old = (HBITMAP)
+                    ::SelectObject(hdcSrc, (HBITMAP)bitmap->GetHBITMAP());
+                HBITMAP hBitmap = CreateCompatibleBitmap(hdcSrc,
+                                                         bitmap->GetWidth(),
+                                                         bitmap->GetHeight());
+                if (!hBitmap)
+                {
+                    SelectObject(hdcSrc, old);
+                    DeleteDC(hdcMem);
+                    DeleteDC(hdcSrc);
+                    return FALSE;
+                }
+
+                HBITMAP old1 = (HBITMAP) SelectObject(hdcMem, hBitmap);
+                BitBlt(hdcMem, 0, 0, bitmap->GetWidth(), bitmap->GetHeight(),
+                       hdcSrc, 0, 0, SRCCOPY);
+
+                // Select new bitmap out of memory DC
+                SelectObject(hdcMem, old1);
+
+                // Set the data
+                handle = ::SetClipboardData(CF_BITMAP, hBitmap);
+
+                // Clean up
+                SelectObject(hdcSrc, old);
+                DeleteDC(hdcSrc);
+                DeleteDC(hdcMem);
+                */
+                break;
+            }
 
 
+        case wxDF_DIB:
+            {
+               /*
+#if wxUSE_IMAGE_LOADING_IN_MSW
+                wxBitmap *bitmap = (wxBitmap *)data;
+                HBITMAP hBitmap = (HBITMAP)bitmap->GetHBITMAP();
+                // NULL palette means to use the system one
+                HANDLE hDIB = wxBitmapToDIB(hBitmap, (HPALETTE)NULL); 
+                handle = SetClipboardData(CF_DIB, hDIB);
+#endif // wxUSE_IMAGE_LOADING_IN_MSW
+*/
+                break;
+            }
 
 
-// clipboard formats
+#if wxUSE_METAFILE
+        case wxDF_METAFILE:
+            {
+                wxMetafile *wxMF = (wxMetafile *)data;
+                               PicHandle pict = wxMF->GetHMETAFILE() ;
+                               HLock( (Handle) pict ) ;
+#if !TARGET_CARBON
+                               err = PutScrap( GetHandleSize(  (Handle) pict ) , 'PICT' , *pict ) ;
+#else
+                               ScrapRef        scrap;
+                               err = GetCurrentScrap (&scrap); 
+                               if ( !err )
+                               {
+                                       err = PutScrapFlavor (scrap, 'PICT', 0, GetHandleSize((Handle) pict), *pict);
+                               }
+#endif
+                               HUnlock(  (Handle) pict ) ;
+                break;
+            }
+#endif
+        case wxDF_SYLK:
+        case wxDF_DIF:
+        case wxDF_TIFF:
+        case wxDF_PALETTE:
+        default:
+            {
+                wxLogError(_("Unsupported clipboard format."));
+                return FALSE;
+            }
 
 
-bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat)
-{
-     return FALSE;
+        case wxDF_OEMTEXT:
+            dataFormat = wxDF_TEXT;
+            // fall through
+
+        case wxDF_TEXT:
+            {
+               wxString mac ;
+               if ( wxApp::s_macDefaultEncodingIsPC )
+               {
+                       mac = wxMacMakeMacStringFromPC((char *)data) ;
+               }
+               else
+               {
+                       mac = (char *)data ;
+               }
+#if !TARGET_CARBON
+                               err = PutScrap( mac.Length() , 'TEXT' , mac.c_str() ) ;
+#else
+                               ScrapRef        scrap;
+                               err = GetCurrentScrap (&scrap); 
+                               if ( !err )
+                               {
+                                       err = PutScrapFlavor (scrap, 'TEXT', 0, mac.Length(), mac.c_str());
+                               }
+#endif
+                break;
+            }
+    }
+
+    if ( err )
+    {
+        wxLogSysError(_("Failed to set clipboard data."));
+
+        return FALSE;
+    }
+
+    return TRUE;
 }
 
 wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat)
 }
 
 wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat)
@@ -80,11 +246,17 @@ bool wxGetClipboardFormatName(wxDataFormat dataFormat, wxChar *formatName, int m
     return FALSE;
 }
 
     return FALSE;
 }
 
+void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
+{
+    return NULL;
+}
+
+
 /*
  * Generalized clipboard implementation by Matthew Flatt
  */
 
 /*
  * Generalized clipboard implementation by Matthew Flatt
  */
 
-IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject)
+IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxClipboardBase)
 
 wxClipboard::wxClipboard()
 {
 
 wxClipboard::wxClipboard()
 {
@@ -143,9 +315,9 @@ bool wxClipboard::AddData( wxDataObject *data )
 #if wxUSE_DATAOBJ
     wxCHECK_MSG( wxIsClipboardOpened(), FALSE, wxT("clipboard not open") );
 
 #if wxUSE_DATAOBJ
     wxCHECK_MSG( wxIsClipboardOpened(), FALSE, wxT("clipboard not open") );
 
-    wxDataFormat format = data->GetFormat();
+    wxDataFormat format = data->GetPreferredFormat();
 
 
-    switch ( format )
+    switch ( format.GetType() )
     {
         case wxDF_TEXT:
         case wxDF_OEMTEXT:
     {
         case wxDF_TEXT:
         case wxDF_OEMTEXT:
@@ -160,10 +332,10 @@ bool wxClipboard::AddData( wxDataObject *data )
         {
             wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data;
             wxBitmap bitmap(bitmapDataObject->GetBitmap());
         {
             wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data;
             wxBitmap bitmap(bitmapDataObject->GetBitmap());
-            return wxSetClipboardData(data->GetFormat(), &bitmap);
+            return wxSetClipboardData(format, &bitmap);
         }
 
         }
 
-#if wxUSE_METAFILE
+#if 0 // wxUSE_METAFILE
         case wxDF_METAFILE:
         {
             wxMetafileDataObject* metaFileDataObject = 
         case wxDF_METAFILE:
         {
             wxMetafileDataObject* metaFileDataObject = 
@@ -176,11 +348,12 @@ bool wxClipboard::AddData( wxDataObject *data )
 #endif // wxUSE_METAFILE
 
         default:
 #endif // wxUSE_METAFILE
 
         default:
-            return wxSetClipboardData(data);
+ //           return wxSetClipboardData(data);
+                               break ;
     }
 #else // !wxUSE_DATAOBJ
     }
 #else // !wxUSE_DATAOBJ
-    return FALSE;
 #endif 
 #endif 
+    return FALSE;
 }
 
 void wxClipboard::Close()
 }
 
 void wxClipboard::Close()
@@ -188,7 +361,7 @@ void wxClipboard::Close()
     wxCloseClipboard();
 }
 
     wxCloseClipboard();
 }
 
-bool wxClipboard::IsSupported( wxDataFormat format )
+bool wxClipboard::IsSupported( const wxDataFormat &format )
 {
     return wxIsClipboardFormatAvailable(format);
 }
 {
     return wxIsClipboardFormatAvailable(format);
 }
@@ -198,7 +371,7 @@ bool wxClipboard::GetData( wxDataObject& data )
 #if wxUSE_DATAOBJ
     wxCHECK_MSG( wxIsClipboardOpened(), FALSE, wxT("clipboard not open") );
 
 #if wxUSE_DATAOBJ
     wxCHECK_MSG( wxIsClipboardOpened(), FALSE, wxT("clipboard not open") );
 
-    wxDataFormat format = data.GetFormat();
+    wxDataFormat format = data.GetPreferredFormat();
     switch ( format )
     {
         case wxDF_TEXT:
     switch ( format )
     {
         case wxDF_TEXT:
@@ -219,7 +392,7 @@ bool wxClipboard::GetData( wxDataObject& data )
         case wxDF_DIB:
         {
             wxBitmapDataObject& bitmapDataObject = (wxBitmapDataObject &)data;
         case wxDF_DIB:
         {
             wxBitmapDataObject& bitmapDataObject = (wxBitmapDataObject &)data;
-            wxBitmap* bitmap = (wxBitmap *)wxGetClipboardData(data->GetFormat());
+            wxBitmap* bitmap = (wxBitmap *)wxGetClipboardData(format );
             if ( !bitmap )
                 return FALSE;
 
             if ( !bitmap )
                 return FALSE;
 
@@ -228,7 +401,7 @@ bool wxClipboard::GetData( wxDataObject& data )
 
             return TRUE;
         }
 
             return TRUE;
         }
-#if wxUSE_METAFILE
+#if 0 // wxUSE_METAFILE
         case wxDF_METAFILE:
         {
             wxMetafileDataObject& metaFileDataObject = (wxMetafileDataObject &)data;
         case wxDF_METAFILE:
         {
             wxMetafileDataObject& metaFileDataObject = (wxMetafileDataObject &)data;
index e91938f8ad7d402d7e4285767a95d6aa11646d19..c6037a9f964eb9959db27a0dc3f02957e76028e4 100644 (file)
@@ -16,7 +16,9 @@
 
 #include "wx/mac/colordlg.h"
 
 
 #include "wx/mac/colordlg.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
 IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
+#endif
 
 /*
  * wxColourDialog
 
 /*
  * wxColourDialog
index 68abfa77bd2bec2d26134546ad9cbb0a76007813..cc549b5f1144e11e602a5fad4b94f8132ab95a14 100644 (file)
@@ -16,7 +16,9 @@
 #include "wx/gdicmn.h"
 #include "wx/colour.h"
 
 #include "wx/gdicmn.h"
 #include "wx/colour.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
 IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
+#endif
 
 // Colour
 
 
 // Colour
 
index d1fd686a8566ec255f14ac730bd162916010a243..1689c1549076bf34bb11a4c973778aab0c593fb9 100644 (file)
@@ -16,7 +16,9 @@
 #include "wx/combobox.h"
 #include "wx/mac/uma.h"
 
 #include "wx/combobox.h"
 #include "wx/mac/uma.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
+#endif
 
 // right now we don't support editable comboboxes
 
 
 // right now we don't support editable comboboxes
 
@@ -44,7 +46,9 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
                SetControlData( m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
                for ( int i = 0 ; i < n ; i++ )
                {
                SetControlData( m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
                for ( int i = 0 ; i < n ; i++ )
                {
-                       appendmenu( m_macPopUpMenuHandle , choices[i] ) ;
+                       Str255 label;
+                       wxMenuItem::MacBuildMenuString( label , NULL , NULL , choices[i] ,false);
+                       AppendMenu( m_macPopUpMenuHandle , label ) ;
                }
                SetControlMinimum( m_macControl , 0 ) ;
                SetControlMaximum( m_macControl , m_noStrings) ;
                }
                SetControlMinimum( m_macControl , 0 ) ;
                SetControlMaximum( m_macControl , m_noStrings) ;
@@ -125,7 +129,9 @@ void wxComboBox::SetSelection(long from, long to)
 
 void wxComboBox::Append(const wxString& item)
 {
 
 void wxComboBox::Append(const wxString& item)
 {
-       appendmenu( m_macPopUpMenuHandle , item ) ;
+       Str255 label;
+       wxMenuItem::MacBuildMenuString( label , NULL , NULL , item ,false);
+       AppendMenu( m_macPopUpMenuHandle , label ) ;
     m_noStrings ++;
        SetControlMaximum( m_macControl , m_noStrings) ;
 }
     m_noStrings ++;
        SetControlMaximum( m_macControl , m_noStrings) ;
 }
index f6fa56cb91b0ef5859aa363bb0c6d858e35bdf95..161d1b71b19d575af43efb753e0e506d861d1563 100644 (file)
 #include "wx/control.h"
 #include "wx/notebook.h"
 #include "wx/tabctrl.h"
 #include "wx/control.h"
 #include "wx/notebook.h"
 #include "wx/tabctrl.h"
+#include "wx/radiobox.h"
 #include "wx/spinbutt.h"
 
 #include "wx/spinbutt.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
 
 IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
 
-BEGIN_EVENT_TABLE(wxControl, wxControlBase)
+BEGIN_EVENT_TABLE(wxControl, wxWindow)
        EVT_MOUSE_EVENTS( wxControl::OnMouseEvent ) 
        EVT_CHAR( wxControl::OnKeyDown ) 
        EVT_PAINT( wxControl::OnPaint ) 
 END_EVENT_TABLE()
        EVT_MOUSE_EVENTS( wxControl::OnMouseEvent ) 
        EVT_CHAR( wxControl::OnKeyDown ) 
        EVT_PAINT( wxControl::OnPaint ) 
 END_EVENT_TABLE()
+#endif
 
 #include <wx/mac/uma.h>
 
 
 #include <wx/mac/uma.h>
 
@@ -32,6 +35,7 @@ END_EVENT_TABLE()
 
 ControlActionUPP wxMacLiveScrollbarActionUPP = NULL ;
 
 
 ControlActionUPP wxMacLiveScrollbarActionUPP = NULL ;
 
+pascal void wxMacLiveScrollbarActionProc( ControlHandle control , ControlPartCode partCode ) ;
 pascal void wxMacLiveScrollbarActionProc( ControlHandle control , ControlPartCode partCode )
 {
        if ( partCode != 0)
 pascal void wxMacLiveScrollbarActionProc( ControlHandle control , ControlPartCode partCode )
 {
        if ( partCode != 0)
@@ -46,9 +50,9 @@ pascal void wxMacLiveScrollbarActionProc( ControlHandle control , ControlPartCod
 
 wxControl::wxControl()
 {
 
 wxControl::wxControl()
 {
-               m_macControl = NULL ;
-               m_macHorizontalBorder = 0 ; // additional pixels around the real control
-               m_macVerticalBorder = 0 ;
+       m_macControl = NULL ;
+       m_macHorizontalBorder = 0 ; // additional pixels around the real control
+       m_macVerticalBorder = 0 ;
     m_backgroundColour = *wxWHITE;
     m_foregroundColour = *wxBLACK;
 #if WXWIN_COMPATIBILITY
     m_backgroundColour = *wxWHITE;
     m_foregroundColour = *wxBLACK;
 #if WXWIN_COMPATIBILITY
@@ -61,6 +65,24 @@ wxControl::wxControl()
        }
 }
 
        }
 }
 
+bool wxControl::Create(wxWindow *parent, wxWindowID id,
+                       const wxPoint& pos,
+                       const wxSize& size, long style,
+                       const wxValidator& validator,
+                       const wxString& name)
+{
+       m_macControl = NULL ;
+       m_macHorizontalBorder = 0 ; // additional pixels around the real control
+       m_macVerticalBorder = 0 ;
+    bool rval = wxWindow::Create(parent, id, pos, size, style, name);
+    if (rval) {
+#if wxUSE_VALIDATORS
+        SetValidator(validator);
+#endif
+    }
+    return rval;
+}
+
 wxControl::~wxControl()
 {
     m_isBeingDeleted = TRUE;
 wxControl::~wxControl()
 {
     m_isBeingDeleted = TRUE;
@@ -79,21 +101,6 @@ wxControl::~wxControl()
     }
 }
 
     }
 }
 
-bool wxControl::Create(wxWindow *parent, wxWindowID id,
-                       const wxPoint& pos,
-                       const wxSize& size, long style,
-                       const wxValidator& validator,
-                       const wxString& name)
-{
-    bool rval = wxWindow::Create(parent, id, pos, size, style, name);
-    if (rval) {
-#if wxUSE_VALIDATORS
-        SetValidator(validator);
-#endif
-    }
-    return rval;
-}
-
 void wxControl::SetLabel(const wxString& title)
 {
        m_label = title ;
 void wxControl::SetLabel(const wxString& title)
 {
        m_label = title ;
@@ -222,7 +229,7 @@ void wxControl::MacPostControlCreate()
        {
                // no font
        }
        {
                // no font
        }
-       else if ( IsKindOf( CLASSINFO( wxStaticBox ) ) )
+       else if ( IsKindOf( CLASSINFO( wxStaticBox ) ) || IsKindOf( CLASSINFO( wxRadioBox ) ) || IsKindOf( CLASSINFO( wxButton ) ) )
        {
                ControlFontStyleRec             controlstyle ;
                controlstyle.flags = kControlUseFontMask ;
        {
                ControlFontStyleRec             controlstyle ;
                controlstyle.flags = kControlUseFontMask ;
@@ -275,14 +282,16 @@ void wxControl::MacAdjustControlRect()
                {
                        if ( IsKindOf( CLASSINFO( wxButton ) ) )
                        {
                {
                        if ( IsKindOf( CLASSINFO( wxButton ) ) )
                        {
-                               m_width = m_label.Length() * 8 + 12 + 2 * m_macHorizontalBorder;
+                               m_width = m_label.Length() * 8 + 12 ;
                        }
                        else if ( IsKindOf( CLASSINFO( wxStaticText ) ) )
                        {
                                m_width = m_label.Length() * 8 ;
                        }
                        else
                        }
                        else if ( IsKindOf( CLASSINFO( wxStaticText ) ) )
                        {
                                m_width = m_label.Length() * 8 ;
                        }
                        else
-                               m_width = bestsize.right - bestsize.left + 2 * m_macHorizontalBorder;
+                               m_width = bestsize.right - bestsize.left ;
+                       
+                       m_width += 2 * m_macHorizontalBorder ;
                }
                if ( m_height == -1 )
                {
                }
                if ( m_height == -1 )
                {
@@ -296,7 +305,7 @@ void wxControl::MacAdjustControlRect()
                wxMacDrawingHelper helper ( wxFindWinFromMacWindow( GetMacRootWindow() ) ) ;
                if ( helper.Ok() )
                {
                wxMacDrawingHelper helper ( wxFindWinFromMacWindow( GetMacRootWindow() ) ) ;
                if ( helper.Ok() )
                {
-           UMASizeControl( m_macControl , m_width - 2 * m_macHorizontalBorder, m_height -  2 * m_macVerticalBorder ) ;
+               UMASizeControl( m_macControl , m_width - 2 * m_macHorizontalBorder, m_height -  2 * m_macVerticalBorder ) ;
                }
        }
 }
                }
        }
 }
@@ -312,8 +321,10 @@ void wxControl::MacSuperChangedPosition()
 {
        if ( m_macControl )
        {
 {
        if ( m_macControl )
        {
-               int former_mac_x = (**m_macControl).contrlRect.left ;
-               int former_mac_y = (**m_macControl).contrlRect.top ;
+               Rect contrlRect ;               
+               GetControlBounds( m_macControl , &contrlRect ) ; 
+               int former_mac_x = contrlRect.left ;
+               int former_mac_y = contrlRect.top ;
                int mac_x = m_x ;
                int mac_y = m_y ;
                GetParent()->MacClientToRootWindow( & mac_x , & mac_y ) ;
                int mac_x = m_x ;
                int mac_y = m_y ;
                GetParent()->MacClientToRootWindow( & mac_x , & mac_y ) ;
@@ -327,12 +338,12 @@ void wxControl::MacSuperChangedPosition()
                {
                        {
                                Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
                {
                        {
                                Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
-                               InvalRect( &inval ) ;
+                               InvalWindowRect( rootwindow , &inval ) ;
                        }
                        }
-               UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y + m_macVerticalBorder ) ;
+                       UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y + m_macVerticalBorder ) ;
                        {
                                Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
                        {
                                Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
-                               InvalRect( &inval ) ;
+                               InvalWindowRect( rootwindow , &inval ) ;
                        }
                }
                if ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
                        }
                }
                if ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
@@ -378,7 +389,7 @@ void wxControl::MacSuperEnabled( bool enabled )
                }
        }
        wxWindow::MacSuperEnabled( enabled ) ;
                }
        }
        wxWindow::MacSuperEnabled( enabled ) ;
-       */
+*/
 }
 
 void  wxControl::MacSuperShown( bool show ) 
 }
 
 void  wxControl::MacSuperShown( bool show ) 
@@ -418,8 +429,10 @@ void  wxControl::DoSetSize(int x, int y,
        int former_w = m_width ;
        int former_h = m_height ;
        
        int former_w = m_width ;
        int former_h = m_height ;
        
-       int former_mac_x = (**m_macControl).contrlRect.left ;
-       int former_mac_y = (**m_macControl).contrlRect.top ;
+       Rect contrlRect ;               
+       GetControlBounds( m_macControl , &contrlRect ) ; 
+       int former_mac_x = contrlRect.left ;
+       int former_mac_y = contrlRect.top ;
        
   int currentX, currentY;
   GetPosition(&currentX, &currentY);
        
   int currentX, currentY;
   GetPosition(&currentX, &currentY);
@@ -430,9 +443,9 @@ void  wxControl::DoSetSize(int x, int y,
   int actualHeight = height;
   int actualX = x;
   int actualY = y;
   int actualHeight = height;
   int actualX = x;
   int actualY = y;
-  if (x == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+  if (x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
       actualX = currentX;
       actualX = currentX;
-  if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+  if (y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
       actualY = currentY;
   if (width == -1)
       actualWidth = currentW ;
       actualY = currentY;
   if (width == -1)
       actualWidth = currentW ;
@@ -443,7 +456,8 @@ void  wxControl::DoSetSize(int x, int y,
                return ;
                
        AdjustForParentClientOrigin(actualX, actualY, sizeFlags);
                return ;
                
        AdjustForParentClientOrigin(actualX, actualY, sizeFlags);
-       wxMacDrawingHelper focus( wxFindWinFromMacWindow( GetMacRootWindow() ) ) ;
+       WindowRef macrootwindow = GetMacRootWindow() ;
+       wxMacDrawingHelper focus( wxFindWinFromMacWindow( macrootwindow ) ) ;
 
        int mac_x = actualX ;
        int mac_y = actualY ;
 
        int mac_x = actualX ;
        int mac_y = actualY ;
@@ -453,12 +467,12 @@ void  wxControl::DoSetSize(int x, int y,
        {
                {
                        Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
        {
                {
                        Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
-                       InvalRect( &inval ) ;
+                       InvalWindowRect( macrootwindow, &inval ) ;
                }
                }
-       UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y  + m_macVerticalBorder ) ;
+               UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y  + m_macVerticalBorder ) ;
                {
                        Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
                {
                        Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
-                       InvalRect( &inval ) ;
+                       InvalWindowRect(macrootwindow, &inval ) ;
                }
        }
 
                }
        }
 
@@ -477,15 +491,15 @@ void  wxControl::DoSetSize(int x, int y,
        {
                {
                        Rect inval = { mac_y , mac_x , mac_y + former_h , mac_x + former_w } ;
        {
                {
                        Rect inval = { mac_y , mac_x , mac_y + former_h , mac_x + former_w } ;
-                       InvalRect( &inval ) ;
+                       InvalWindowRect( macrootwindow, &inval ) ;
                }
                m_width = actualWidth ;
                m_height = actualHeight ;
 
                }
                m_width = actualWidth ;
                m_height = actualHeight ;
 
-       UMASizeControl( m_macControl ,  m_width - 2 * m_macHorizontalBorder, m_height -  2 * m_macVerticalBorder ) ;
+               UMASizeControl( m_macControl ,  m_width - 2 * m_macHorizontalBorder, m_height -  2 * m_macVerticalBorder ) ;
                {
                        Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
                {
                        Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
-                       InvalRect( &inval ) ;
+                       InvalWindowRect( macrootwindow , &inval ) ;
                }
 
                MacRepositionScrollBars() ;
                }
 
                MacRepositionScrollBars() ;
@@ -555,6 +569,47 @@ void wxControl::Refresh(bool eraseBack, const wxRect *rect)
   }
 }
 
   }
 }
 
+void wxControl::MacRedrawControl()
+{
+       if ( m_macControl )
+       {
+               WindowRef window = GetMacRootWindow() ;
+               if ( window )
+               {
+                       wxWindow* win = wxFindWinFromMacWindow( window ) ;
+                       if ( win )
+                       {
+                               wxMacDrawingHelper help( win ) ;
+                               // the mac control manager always assumes to have the origin at 0,0
+                               SetOrigin( 0 , 0 ) ;
+                               
+                               bool                    hasTabBehind = false ;
+                               wxWindow* parent = GetParent() ;
+                               while ( parent )
+                               {
+                                       if( parent->MacGetWindowData() )
+                                       {
+                                               UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
+                                               break ;
+                                       }
+                                       
+                                       if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) ||  parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
+                                       {
+                                               if ( ((wxControl*)parent)->m_macControl )
+                                                       SetUpControlBackground( ((wxControl*)parent)->m_macControl , -1 , true ) ;
+                                               break ;
+                                       }
+                                       
+                                       parent = parent->GetParent() ;
+                               } 
+                               
+                               UMADrawControl( m_macControl ) ;
+                               UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
+                       }
+               }
+       }
+}
+
 void wxControl::OnPaint(wxPaintEvent& event)
 {
        if ( m_macControl )
 void wxControl::OnPaint(wxPaintEvent& event)
 {
        if ( m_macControl )
@@ -566,6 +621,7 @@ void wxControl::OnPaint(wxPaintEvent& event)
                        if ( win )
                        {
                                wxMacDrawingHelper help( win ) ;
                        if ( win )
                        {
                                wxMacDrawingHelper help( win ) ;
+                               // the mac control manager always assumes to have the origin at 0,0
                                SetOrigin( 0 , 0 ) ;
                                
                                bool                    hasTabBehind = false ;
                                SetOrigin( 0 , 0 ) ;
                                
                                bool                    hasTabBehind = false ;
@@ -629,7 +685,7 @@ void  wxControl::OnMouseEvent( wxMouseEvent &event )
                return ;
        }
                
                return ;
        }
                
-       if (event.GetEventType() == wxEVT_LEFT_DOWN )
+       if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
        {
                        
                int x = event.m_x ;
        {
                        
                int x = event.m_x ;
index dee7c92b5f128a56414063d82a3aa8ce27d7c8f1..fa0bbf76b29f7000d68470e8dfcaa34a1372fcbe 100644 (file)
 #include "wx/cursor.h"
 #include "wx/icon.h"
 
 #include "wx/cursor.h"
 #include "wx/icon.h"
 
+#if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap)
 IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap)
+#endif
 
 const short kwxCursorHandId = 9 ;
 const short kwxCursorSizeWEId = 10 ;
 const short kwxCursorSizeNSId = 11 ;
 
 const short kwxCursorHandId = 9 ;
 const short kwxCursorSizeWEId = 10 ;
 const short kwxCursorSizeNSId = 11 ;
+#if !TARGET_CARBON
 Cursor*                MacArrowCursorPtr = &qd.arrow ;
 CursHandle     MacArrowCursor = &MacArrowCursorPtr ;
 Cursor*                MacArrowCursorPtr = &qd.arrow ;
 CursHandle     MacArrowCursor = &MacArrowCursorPtr ;
+#else
+bool           MacArrowInstalled = false ;
+Cursor                 MacArrow ;
+Cursor*                MacArrowCursorPtr = &MacArrow ;
+CursHandle     MacArrowCursor = &MacArrowCursorPtr ;
+#endif
 CursHandle     gMacCurrentCursor = NULL ;
 
 wxCursorRefData::wxCursorRefData()
 {
 CursHandle     gMacCurrentCursor = NULL ;
 
 wxCursorRefData::wxCursorRefData()
 {
+#if TARGET_CARBON
+       if ( !MacArrowInstalled )
+       {
+               MacArrowCursorPtr = GetQDGlobalsArrow( &MacArrow ) ;
+               MacArrowInstalled = true ;
+       }
+#endif
     m_width = 32; 
     m_height = 32;
     m_hCursor = NULL ;
     m_width = 32; 
     m_height = 32;
     m_hCursor = NULL ;
@@ -34,8 +50,8 @@ wxCursorRefData::wxCursorRefData()
 
 wxCursorRefData::~wxCursorRefData()
 {
 
 wxCursorRefData::~wxCursorRefData()
 {
-       if ( m_hCursor && ( m_hCursor != MacArrowCursor ) )
-               ::DisposeHandle( (Handle) m_hCursor ) ;
+//     if ( m_hCursor && ( m_hCursor != MacArrowCursor ) )
+//             ::ReleaseResource( (Handle) m_hCursor ) ;
 }
 
 // Cursors
 }
 
 // Cursors
index fab57c49fef17f87d70ee7667be89d140b02688a..cb3ff34b9c5e33380e2012d2f04d090f1af07689 100644 (file)
@@ -102,8 +102,8 @@ const wxChar *wxFrameNameStr = wxT("frame");
 const wxChar *wxGaugeNameStr = wxT("gauge");
 const wxChar *wxStaticBoxNameStr = wxT("groupBox");
 const wxChar *wxListBoxNameStr = wxT("listBox");
 const wxChar *wxGaugeNameStr = wxT("gauge");
 const wxChar *wxStaticBoxNameStr = wxT("groupBox");
 const wxChar *wxListBoxNameStr = wxT("listBox");
-const wxChar *wxStaticTextNameStr = wxT("message");
-const wxChar *wxStaticBitmapNameStr = wxT("message");
+const wxChar *wxStaticTextNameStr = wxT("statictext");
+const wxChar *wxStaticBitmapNameStr = wxT("staticbitmap");
 const wxChar *wxMultiTextNameStr = wxT("multitext");
 const wxChar *wxPanelNameStr = wxT("panel");
 const wxChar *wxRadioBoxNameStr = wxT("radioBox");
 const wxChar *wxMultiTextNameStr = wxT("multitext");
 const wxChar *wxPanelNameStr = wxT("panel");
 const wxChar *wxRadioBoxNameStr = wxT("radioBox");
@@ -134,5 +134,17 @@ const wxChar *wxDirDialogDefaultFolderStr = wxT("/");
 const wxChar *wxFloatToStringStr = wxT("%.2f");
 const wxChar *wxDoubleToStringStr = wxT("%.2f");
 
 const wxChar *wxFloatToStringStr = wxT("%.2f");
 const wxChar *wxDoubleToStringStr = wxT("%.2f");
 
+#if wxUSE_SHARED_LIBRARY
+///// Event tables (also must be in one, statically-linked file for shared libraries)
+
+// This is the base, wxEvtHandler 'bootstrap' code which is expanded manually here
+const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; }
+
+const wxEventTable wxEvtHandler::sm_eventTable =
+       { NULL, &wxEvtHandler::sm_eventTableEntries[0] };
+
+const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { { 0, 0, 0, NULL } };
+#endif
+
 const wxSize wxDefaultSize(-1, -1);
 const wxPoint wxDefaultPosition(-1, -1);
 const wxSize wxDefaultSize(-1, -1);
 const wxPoint wxDefaultPosition(-1, -1);
index fbaf93061d047c52b5cc810e653988511e50e13c..67f938b414edce2d0a2b403b55adb0c43627ab05 100644 (file)
 
 wxDataFormat::wxDataFormat()
 {
 
 wxDataFormat::wxDataFormat()
 {
-    m_vType = wxDF_INVALID;
-    m_vFormat = 0;
+    m_type = wxDF_INVALID;
+    m_format = 0;
 }
 
 }
 
-wxDataFormat::wxDataFormat(
-  wxDataFormatId                    vType
-)
+wxDataFormat::wxDataFormat(  wxDataFormatId   vType )
 {
 {
-    PrepareFormats();
     SetType(vType);
 }
 
     SetType(vType);
 }
 
-wxDataFormat::wxDataFormat(
-  const wxChar*                     zId
-)
+wxDataFormat::wxDataFormat(  const wxChar*  zId)
 {
 {
-    PrepareFormats();
     SetId(zId);
 }
 
     SetId(zId);
 }
 
-wxDataFormat::wxDataFormat(
-  const wxString&                   rId
-)
+wxDataFormat::wxDataFormat(  const wxString&   rId)
 {
 {
-    PrepareFormats();
     SetId(rId);
 }
 
     SetId(rId);
 }
 
-wxDataFormat::wxDataFormat(
-  NativeFormat                      vFormat
-)
+wxDataFormat::wxDataFormat( NativeFormat vFormat)
 {
 {
-    PrepareFormats();
     SetId(vFormat);
 }
 
     SetId(vFormat);
 }
 
-void wxDataFormat::SetType(
-  wxDataFormatId                    vType
-)
+void wxDataFormat::SetType(  wxDataFormatId  Type )
 {
 {
-    m_vType = vType;
-
-    if (m_vType == wxDF_TEXT)
-        m_vFormat = 0;
-    else
-    if (m_vType == wxDF_BITMAP)
-        m_vFormat = 0;
-    else
-    if (m_vType == wxDF_FILENAME)
-        m_vFormat = 0;
+    m_type = Type;
+
+    if (m_type == wxDF_TEXT)
+        m_format = 'TEXT';
+    else if (m_type == wxDF_BITMAP || m_type == wxDF_METAFILE )
+        m_format = 'PICT';
+    else if (m_type == wxDF_FILENAME)
+        m_format = 'SPEC';
     else
     {
        wxFAIL_MSG( wxT("invalid dataformat") );
     else
     {
        wxFAIL_MSG( wxT("invalid dataformat") );
@@ -102,56 +86,37 @@ void wxDataFormat::SetType(
 
 wxDataFormatId wxDataFormat::GetType() const
 {
 
 wxDataFormatId wxDataFormat::GetType() const
 {
-    return m_vType;
+    return m_type;
 }
 
 wxString wxDataFormat::GetId() const
 {
 }
 
 wxString wxDataFormat::GetId() const
 {
-    wxString                        sRet("");  // TODO: gdk_atom_name( m_format ) );
+    wxString sRet("");  // TODO: to name of ( m_format ) );
     return sRet;
 }
 
     return sRet;
 }
 
-void wxDataFormat::SetId(
-  NativeFormat                      vFormat
-)
+void wxDataFormat::SetId(  NativeFormat  format )
 {
 {
-    m_vFormat = vFormat;
-// TODO:
-/*
-    if (m_format == g_textAtom)
+    m_format = format;
+
+    if (m_format == 'TEXT')
         m_type = wxDF_TEXT;
     else
         m_type = wxDF_TEXT;
     else
-    if (m_format == g_pngAtom)
+    if (m_format == 'PICT')
         m_type = wxDF_BITMAP;
     else
         m_type = wxDF_BITMAP;
     else
-    if (m_format == g_fileAtom)
+    if (m_format == 'SPEC')
         m_type = wxDF_FILENAME;
     else
         m_type = wxDF_PRIVATE;
         m_type = wxDF_FILENAME;
     else
         m_type = wxDF_PRIVATE;
-*/
 }
 
 }
 
-void wxDataFormat::SetId(
-  const wxChar*                     zId
-)
+void wxDataFormat::SetId( const wxChar* zId )
 {
     wxString                        tmp(zId);
 
 {
     wxString                        tmp(zId);
 
-    m_vType = wxDF_PRIVATE;
-    m_vFormat = 0;// TODO: get the format gdk_atom_intern( wxMBSTRINGCAST tmp.mbc_str(), FALSE );
-}
-
-void wxDataFormat::PrepareFormats()
-{
-// TODO:
-/*
-    if (!g_textAtom)
-        g_textAtom = gdk_atom_intern( "STRING", FALSE );
-    if (!g_pngAtom)
-        g_pngAtom = gdk_atom_intern( "image/png", FALSE );
-    if (!g_fileAtom)
-        g_fileAtom = gdk_atom_intern( "file:ALL", FALSE );
-*/
+    m_type = wxDF_PRIVATE;
+    m_format = 0;// TODO: get the format gdk_atom_intern( wxMBSTRINGCAST tmp.mbc_str(), FALSE );
 }
 
 //-------------------------------------------------------------------------
 }
 
 //-------------------------------------------------------------------------
index ecbb3ca70366564e1087d724907571bf8c4d56f0..1682209492529b1cfe5abd1cacf95ab92cad9d54 100644 (file)
 #endif
 
 #include "wx/dc.h"
 #endif
 
 #include "wx/dc.h"
+#include "wx/mac/uma.h"
 
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
 IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
+#endif
 
 //-----------------------------------------------------------------------------
 // constants
 
 //-----------------------------------------------------------------------------
 // constants
@@ -34,7 +37,7 @@ long wxDC::m_macCurrentPortId = 1 ;
 // wxDC
 //-----------------------------------------------------------------------------
 
 // wxDC
 //-----------------------------------------------------------------------------
 
-wxDC::wxDC(void)
+wxDC::wxDC()
 {
   m_ok = FALSE;
   m_optimize = FALSE;
 {
   m_ok = FALSE;
   m_optimize = FALSE;
@@ -42,8 +45,8 @@ wxDC::wxDC(void)
   m_colour = TRUE;
   m_clipping = FALSE;
   
   m_colour = TRUE;
   m_clipping = FALSE;
   
-  m_mm_to_pix_x = 1.0;
-  m_mm_to_pix_y = 1.0;
+  m_mm_to_pix_x = mm2pt;
+  m_mm_to_pix_y = mm2pt;
   
   m_logicalOriginX = 0;
   m_logicalOriginY = 0;
   
   m_logicalOriginX = 0;
   m_logicalOriginY = 0;
@@ -102,20 +105,32 @@ wxDC::wxDC(void)
 
 wxDC::~wxDC(void)
 {
 
 wxDC::~wxDC(void)
 {
+       if ( !m_macPortHelper.IsCleared() )
+       {
+       GrafPtr port ;
+       GetPort( &port ) ;
+       SetPort( m_macPortHelper.GetCurrentPort() ) ;
+       SetOrigin( 0 , 0 ) ;
+       SetPort( port ) ;
+       }
+       /*
        if ( m_macPort )
        {
        if ( m_macPort )
        {
+               ::SetPort( m_macPort ) ;
                ::SetOrigin( 0 , 0 ) ;
                ::ClipRect( &m_macPort->portRect ) ;
                ::PenNormal() ;
                ::SetPort( m_macOrigPort ) ;
        }
                ::SetOrigin( 0 , 0 ) ;
                ::ClipRect( &m_macPort->portRect ) ;
                ::PenNormal() ;
                ::SetPort( m_macOrigPort ) ;
        }
+       */
        ++m_macCurrentPortId ;
 };
 
 void wxDC::MacSetupPort() const
 {
        ++m_macCurrentPortId ;
 };
 
 void wxDC::MacSetupPort() const
 {
+       AGAPortHelper* help = &m_macPortHelper ;
+       help->Setup( m_macPort ) ;
        m_macPortId = ++m_macCurrentPortId ;
        m_macPortId = ++m_macCurrentPortId ;
-       ::SetPort(m_macPort);
        ::SetOrigin(-m_macLocalOrigin.h, -m_macLocalOrigin.v);
        ::ClipRect(&m_macClipRect);
 
        ::SetOrigin(-m_macLocalOrigin.h, -m_macLocalOrigin.v);
        ::ClipRect(&m_macClipRect);
 
@@ -124,8 +139,10 @@ void wxDC::MacSetupPort() const
        m_macPenInstalled = false ;     
 }
 
        m_macPenInstalled = false ;     
 }
 
-void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
+void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask )
 {
 {
+       float scale = 1.0 ;
+       
   if (!Ok()) 
        return;
   MacVerifySetup() ;
   if (!Ok()) 
        return;
   MacVerifySetup() ;
@@ -140,7 +157,7 @@ void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
     {
                        if ( bmap->m_bitmapType == kMacBitmapTypePict )
                        { 
     {
                        if ( bmap->m_bitmapType == kMacBitmapTypePict )
                        { 
-               Rect bitmaprect = { 0 , 0 , bmap->m_height , bmap->m_width } ;
+               Rect bitmaprect = { 0 , 0 , bmap->m_height * scale , bmap->m_width * scale} ;
                                ::OffsetRect( &bitmaprect , xx1 , yy1 ) ;
                                ::DrawPicture( bmap->m_hPict , &bitmaprect ) ;
                        }
                                ::OffsetRect( &bitmaprect , xx1 , yy1 ) ;
                                ::DrawPicture( bmap->m_hPict , &bitmaprect ) ;
                        }
@@ -165,20 +182,21 @@ void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
                                                source.bottom = bmap->m_height ;
                                                dest.top = YLOG2DEV(y) ;
                                                dest.left = XLOG2DEV(x) ;
                                                source.bottom = bmap->m_height ;
                                                dest.top = YLOG2DEV(y) ;
                                                dest.left = XLOG2DEV(x) ;
-                                               dest.bottom = YLOG2DEV(y + bmap->m_height )  ;
-                                               dest.right = XLOG2DEV(x + bmap->m_width ) ;
+                                               dest.bottom = YLOG2DEV(y + bmap->m_height * scale)  ;
+                                               dest.right = XLOG2DEV(x + bmap->m_width * scale ) ;
        
                                                if ( useMask && bmp.GetMask() )
                                                {
                                                        if ( LockPixels( GetGWorldPixMap( bmp.GetMask()->GetMaskBitmap( ) ) ) )
                                                        {
        
                                                if ( useMask && bmp.GetMask() )
                                                {
                                                        if ( LockPixels( GetGWorldPixMap( bmp.GetMask()->GetMaskBitmap( ) ) ) )
                                                        {
-                                                               CopyMask( &GrafPtr( bmapworld )->portBits , &GrafPtr( bmp.GetMask()->GetMaskBitmap( ) )->portBits , &GrafPtr( m_macPort )->portBits ,
+                                                               CopyMask( GetPortBitMapForCopyBits( bmapworld ) , GetPortBitMapForCopyBits( bmp.GetMask()->GetMaskBitmap( ) ) ,
+                                                                GetPortBitMapForCopyBits( m_macPort ) ,
                                                                        &source, &source , &dest ) ;
                                                                UnlockPixels( GetGWorldPixMap( bmp.GetMask()->GetMaskBitmap( ) )  ) ;
                                                        }
                                                }
                                                else
                                                                        &source, &source , &dest ) ;
                                                                UnlockPixels( GetGWorldPixMap( bmp.GetMask()->GetMaskBitmap( ) )  ) ;
                                                        }
                                                }
                                                else
-                                                       CopyBits( &GrafPtr( bmapworld )->portBits , &GrafPtr( m_macPort )->portBits ,
+                                                       CopyBits( GetPortBitMapForCopyBits( bmapworld ) , GetPortBitMapForCopyBits( m_macPort ),
                                                                &source, &dest, srcCopy, NULL ) ;
 
                                                UnlockPixels( bmappixels ) ;
                                                                &source, &dest, srcCopy, NULL ) ;
 
                                                UnlockPixels( bmappixels ) ;
@@ -192,7 +210,7 @@ void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
        }
 }
 
        }
 }
 
-void wxDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
+void wxDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y )
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -213,69 +231,9 @@ void wxDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
        }
 };
 
        }
 };
 
-void wxDC::DrawPoint( wxPoint& point ) 
-{ 
-  DrawPoint( point.x, point.y ); 
-};
-
-void wxDC::DrawPolygon( wxList *list, long xoffset, long yoffset, int fillStyle )
-{
-  int n = list->Number();
-  wxPoint *points = new wxPoint[n];
-
-  int i = 0;
-  for( wxNode *node = list->First(); node; node = node->Next() )
-  {
-    wxPoint *point = (wxPoint *)node->Data();
-    points[i].x = point->x;
-    points[i++].y = point->y;
-  };
-  DrawPolygon( n, points, xoffset, yoffset, fillStyle );
-  delete[] points;
-};
-
-void wxDC::DrawLines( wxList *list, long xoffset, long yoffset )
-{
-  int n = list->Number();
-  wxPoint *points = new wxPoint[n];
-
-  int i = 0;
-  for( wxNode *node = list->First(); node; node = node->Next() ) 
-  {
-    wxPoint *point = (wxPoint *)node->Data();
-    points[i].x = point->x;
-    points[i++].y = point->y;
-  };
-  DrawLines( n, points, xoffset, yoffset );
-  delete []points;
-};
-
-void wxDC::DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 )
+void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
 {
 {
-  wxList list;
-  list.Append( (wxObject*)new wxPoint(x1, y1) );
-  list.Append( (wxObject*)new wxPoint(x2, y2) );
-  list.Append( (wxObject*)new wxPoint(x3, y3) );
-  DrawSpline(&list);
-  wxNode *node = list.First();
-  while (node)
-  {
-    wxPoint *p = (wxPoint*)node->Data();
-    delete p;
-    node = node->Next();
-  };
-};
-
-void wxDC::DrawSpline( int n, wxPoint points[] )
-{
-  wxList list;
-  for (int i = 0; i < n; i++) list.Append( (wxObject*)&points[i] );
-  DrawSpline( &list );
-};
-
-void wxDC::SetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
-{
-  MacVerifySetup() ;
+       MacVerifySetup() ;
        if( m_clipping )
        {
                m_clipX1 = wxMax( m_clipX1 , x ) ;
        if( m_clipping )
        {
                m_clipX1 = wxMax( m_clipX1 , x ) ;
@@ -300,13 +258,24 @@ void wxDC::SetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord heigh
        
        Rect clip = { y1 , x1 , y2 , x2 } ;
        
        
        Rect clip = { y1 , x1 , y2 , x2 } ;
        
-  ::ClipRect( &clip ) ;
+       ::ClipRect( &clip ) ;
 
 };
 
 
 };
 
-void wxDC::SetClippingRegion(const wxRect& rect)
-{ 
-       SetClippingRegion(rect.x, rect.y, rect.width, rect.height); 
+void wxDC::DoSetClippingRegionAsRegion( const wxRegion &region  )
+{
+    wxCHECK_RET( Ok(), wxT("invalid window dc") );
+
+       MacVerifySetup() ;
+    if (region.Empty())
+    {
+        DestroyClippingRegion();
+        return;
+    }
+
+    wxCoord xx, yy, ww, hh;
+    region.GetBox( xx, yy, ww, hh );
+    wxDC::DoSetClippingRegion( xx, yy, ww, hh );
 }
 
 void wxDC::DestroyClippingRegion(void)
 }
 
 void wxDC::DestroyClippingRegion(void)
@@ -316,48 +285,14 @@ void wxDC::DestroyClippingRegion(void)
 //     Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
        ::ClipRect(&m_macClipRect);
 };
 //     Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
        ::ClipRect(&m_macClipRect);
 };
-
-void wxDC::GetClippingBox( wxCoord *x, wxCoord *y, wxCoord *width, wxCoord *height ) const
-{
-  if (m_clipping)
-  {
-    if (x) *x = m_clipX1;
-    if (y) *y = m_clipY1;
-    if (width) *width = (m_clipX2 - m_clipX1);
-    if (height) *height = (m_clipY2 - m_clipY1);
-  }
-  else
-   *x = *y = *width = *height = 0;
-};
-
-void wxDC::GetClippingBox( long *x, long *y, long *width, long *height ) const
-{
-  if (m_clipping)
-  {
-    if (x) *x = m_clipX1;
-    if (y) *y = m_clipY1;
-    if (width) *width = (m_clipX2 - m_clipX1);
-    if (height) *height = (m_clipY2 - m_clipY1);
-  }
-  else
-   *x = *y = *width = *height = 0;
-};
-
-void wxDC::GetClippingBox(wxRect& rect) const
-{
-  // Necessary to use intermediate variables for 16-bit compilation
-  wxCoord x, y, w, h;
-  GetClippingBox(&x, &y, &w, &h);
-  rect.x = x; rect.y = y; rect.width = w; rect.height = h;
-}
     
     
-void wxDC::GetSize( int* width, int* height ) const
+void wxDC::DoGetSize( int* width, int* height ) const
 {
   *width = m_maxX-m_minX;
   *height = m_maxY-m_minY;
 };
 
 {
   *width = m_maxX-m_minX;
   *height = m_maxY-m_minY;
 };
 
-void wxDC::GetSizeMM( long* width, long* height ) const
+void wxDC::DoGetSizeMM( int* width, int* height ) const
 {
   int w = 0;
   int h = 0;
 {
   int w = 0;
   int h = 0;
@@ -416,12 +351,6 @@ void wxDC::SetUserScale( double x, double y )
   ComputeScaleAndOrigin();
 };
 
   ComputeScaleAndOrigin();
 };
 
-void wxDC::GetUserScale( double *x, double *y )
-{
-  if (x) *x = m_userScaleX;
-  if (y) *y = m_userScaleY;
-};
-
 void wxDC::SetLogicalScale( double x, double y )
 {
   // allow negative ?
 void wxDC::SetLogicalScale( double x, double y )
 {
   // allow negative ?
@@ -430,40 +359,20 @@ void wxDC::SetLogicalScale( double x, double y )
   ComputeScaleAndOrigin();
 };
 
   ComputeScaleAndOrigin();
 };
 
-void wxDC::GetLogicalScale( double *x, double *y )
-{
-  if (x) *x = m_logicalScaleX;
-  if (y) *y = m_logicalScaleY;
-};
-
-void wxDC::SetLogicalOrigin( long x, long y )
+void wxDC::SetLogicalOrigin( wxCoord x, wxCoord y )
 {
   m_logicalOriginX = x * m_signX;   // is this still correct ?
   m_logicalOriginY = y * m_signY;
   ComputeScaleAndOrigin();
 };
 
 {
   m_logicalOriginX = x * m_signX;   // is this still correct ?
   m_logicalOriginY = y * m_signY;
   ComputeScaleAndOrigin();
 };
 
-void wxDC::GetLogicalOrigin( long *x, long *y )
-{
-  if (x) *x = m_logicalOriginX;
-  if (y) *y = m_logicalOriginY;
-};
-
-void wxDC::SetDeviceOrigin( long x, long y )
+void wxDC::SetDeviceOrigin( wxCoord x, wxCoord y )
 {
   m_externalDeviceOriginX = x;
   m_externalDeviceOriginY = y;
   ComputeScaleAndOrigin();
 };
 {
   m_externalDeviceOriginX = x;
   m_externalDeviceOriginY = y;
   ComputeScaleAndOrigin();
 };
-
-void wxDC::GetDeviceOrigin( long *x, long *y )
-{
-//  if (x) *x = m_externalDeviceOriginX;
-//  if (y) *y = m_externalDeviceOriginY;
-  if (x) *x = m_deviceOriginX;
-  if (y) *y = m_deviceOriginY;
-};
-
+/*
 void wxDC::SetInternalDeviceOrigin( long x, long y )
 {
   m_internalDeviceOriginX = x;
 void wxDC::SetInternalDeviceOrigin( long x, long y )
 {
   m_internalDeviceOriginX = x;
@@ -476,53 +385,14 @@ void wxDC::GetInternalDeviceOrigin( long *x, long *y )
   if (x) *x = m_internalDeviceOriginX;
   if (y) *y = m_internalDeviceOriginY;
 };
   if (x) *x = m_internalDeviceOriginX;
   if (y) *y = m_internalDeviceOriginY;
 };
-
+*/
 void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
 {
   m_signX = (xLeftRight ?  1 : -1);
   m_signY = (yBottomUp  ? -1 :  1);
   ComputeScaleAndOrigin();
 };
 void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
 {
   m_signX = (xLeftRight ?  1 : -1);
   m_signY = (yBottomUp  ? -1 :  1);
   ComputeScaleAndOrigin();
 };
-
-long wxDC::DeviceToLogicalX(long x) const
-{
-  return XDEV2LOG(x);
-};
-
-long wxDC::DeviceToLogicalY(long y) const
-{
-  return YDEV2LOG(y);
-};
-
-long wxDC::DeviceToLogicalXRel(long x) const
-{
-  return XDEV2LOGREL(x);
-};
-
-long wxDC::DeviceToLogicalYRel(long y) const
-{
-  return YDEV2LOGREL(y);
-};
-
-long wxDC::LogicalToDeviceX(long x) const
-{
-  return XLOG2DEV(x);
-};
-
-long wxDC::LogicalToDeviceY(long y) const
-{
-  return YLOG2DEV(y);
-};
-
-long wxDC::LogicalToDeviceXRel(long x) const
-{
-  return XLOG2DEVREL(x);
-};
-
-long wxDC::LogicalToDeviceYRel(long y) const
-{
-  return YLOG2DEVREL(y);
-};
+/*
     
 void wxDC::CalcBoundingBox( long x, long y )
 {
     
 void wxDC::CalcBoundingBox( long x, long y )
 {
@@ -531,6 +401,16 @@ void wxDC::CalcBoundingBox( long x, long y )
   if (x > m_maxX) m_maxX = x;
   if (y > m_maxY) m_maxY = y;
 };
   if (x > m_maxX) m_maxX = x;
   if (y > m_maxY) m_maxY = y;
 };
+*/
+wxSize wxDC::GetPPI() const
+{
+    return wxSize(72, 72);
+}
+
+int wxDC::GetDepth() const
+{
+       return wxDisplayDepth() ;
+}
 
 void wxDC::ComputeScaleAndOrigin(void)
 {
 
 void wxDC::ComputeScaleAndOrigin(void)
 {
@@ -547,12 +427,7 @@ void wxDC::ComputeScaleAndOrigin(void)
   // CMB: if scale has changed call SetPen to recalulate the line width 
   if (m_scaleX != origScaleX || m_scaleY != origScaleY)
   {
   // CMB: if scale has changed call SetPen to recalulate the line width 
   if (m_scaleX != origScaleX || m_scaleY != origScaleY)
   {
-    // this is a bit artificial, but we need to force wxDC to think
-    // the pen has changed
-    wxPen* pen = & GetPen();
-    wxPen tempPen;
-    m_pen = tempPen;
-    SetPen(* pen);
+       // TODO : set internal flags for recalc
   }
 };
 
   }
 };
 
@@ -634,16 +509,17 @@ void  wxDC::SetLogicalFunction( int function )
        m_macPenInstalled = false ;
 }
 
        m_macPenInstalled = false ;
 }
 
-void  wxDC::FloodFill( long x1, long y1, const wxColour& col, int style )
+void  wxDC::DoFloodFill( wxCoord x, wxCoord y, const wxColour& col,
+                             int style )
 {
 }
 
 {
 }
 
-bool  wxDC::GetPixel( long x1, long y1, wxColour *col ) const 
+bool  wxDC::DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const 
 {
        return true ;
 }
 
 {
        return true ;
 }
 
-void  wxDC::DrawLine( long x1, long y1, long x2, long y2 )
+void  wxDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -664,19 +540,22 @@ void  wxDC::DrawLine( long x1, long y1, long x2, long y2 )
   };
 }
 
   };
 }
 
-void  wxDC::CrossHair( long x, long y )
+void  wxDC::DoCrossHair( wxCoord x, wxCoord y )
 {
 }
 
 {
 }
 
-void  wxDC::DrawArc( long x1, long y1, long x2, long y2, long xc, long yc )
+void  wxDC::DoDrawArc( wxCoord x1, wxCoord y1,
+                           wxCoord x2, wxCoord y2,
+                           wxCoord xc, wxCoord yc )
 {
 }
 
 {
 }
 
-void  wxDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
+void  wxDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
+                                   double sa, double ea )
 {
 }
 
 {
 }
 
-void  wxDC::DrawPoint( long x, long y )
+void  wxDC::DoDrawPoint( wxCoord x, wxCoord y )
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -694,7 +573,8 @@ void  wxDC::DrawPoint( long x, long y )
   };
 }
 
   };
 }
 
-void  wxDC::DrawLines( int n, wxPoint points[], long xoffset , long yoffset  )
+void  wxDC::DoDrawLines(int n, wxPoint points[],
+                             wxCoord xoffset, wxCoord yoffset)
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -719,8 +599,9 @@ void  wxDC::DrawLines( int n, wxPoint points[], long xoffset , long yoffset  )
   }
 }
 
   }
 }
 
-void  wxDC::DrawPolygon( int n, wxPoint points[], long xoffset , long yoffset , 
-                              int fillStyle )
+void  wxDC::DoDrawPolygon(int n, wxPoint points[],
+                               wxCoord xoffset, wxCoord yoffset,
+                               int fillStyle )
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -754,7 +635,7 @@ void  wxDC::DrawPolygon( int n, wxPoint points[], long xoffset , long yoffset ,
   KillPoly( polygon ) ;
 }
 
   KillPoly( polygon ) ;
 }
 
-void  wxDC::DrawRectangle( long x, long y, long width, long height )
+void  wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -797,7 +678,9 @@ void  wxDC::DrawRectangle( long x, long y, long width, long height )
        };
 }
 
        };
 }
 
-void  wxDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius  )
+void  wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
+                                        wxCoord width, wxCoord height,
+                                        double radius)
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -843,7 +726,7 @@ void  wxDC::DrawRoundedRectangle( long x, long y, long width, long height, doubl
        };
 }
 
        };
 }
 
-void  wxDC::DrawEllipse( long x, long y, long width, long height )
+void  wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -1001,7 +884,7 @@ static void wx_spline_draw_point_array(wxDC *dc)
   }
 }
 
   }
 }
 
-void  wxDC::DrawSpline( wxList *points )
+void  wxDC::DoDrawSpline(wxList *points)
 {
     wxPoint *p;
     double           cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
 {
     wxPoint *p;
     double           cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
@@ -1059,8 +942,8 @@ bool  wxDC::CanDrawBitmap(void) const
 }
 
 
 }
 
 
-bool  wxDC::Blit( long xdest, long ydest, long width, long height,
-       wxDC *source, long xsrc, long ysrc, int logical_func , bool useMask )
+bool  wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
+                        wxDC *source, wxCoord xsrc, wxCoord ysrc, int logical_func , bool useMask )
 {
   if (!Ok()) return FALSE;
   MacVerifySetup() ;
 {
   if (!Ok()) return FALSE;
   MacVerifySetup() ;
@@ -1069,8 +952,8 @@ bool  wxDC::Blit( long xdest, long ydest, long width, long height,
        PixMapHandle    bmappixels =  GetGWorldPixMap( sourcePort ) ; 
        RGBColor                white = { 0xFFFF, 0xFFFF,0xFFFF} ;
        RGBColor                black = { 0,0,0} ;
        PixMapHandle    bmappixels =  GetGWorldPixMap( sourcePort ) ; 
        RGBColor                white = { 0xFFFF, 0xFFFF,0xFFFF} ;
        RGBColor                black = { 0,0,0} ;
-               RGBForeColor( &m_textForegroundColour.GetPixel() ) ;
-               RGBBackColor( &m_textBackgroundColour.GetPixel() ) ;
+       RGBForeColor( &m_textForegroundColour.GetPixel() ) ;
+       RGBBackColor( &m_textBackgroundColour.GetPixel() ) ;
 
        if ( LockPixels(bmappixels) )
        {
 
        if ( LockPixels(bmappixels) )
        {
@@ -1094,7 +977,7 @@ bool  wxDC::Blit( long xdest, long ydest, long width, long height,
        logical_func == wxXOR ? srcXor :
   //   logical_func == wxOR_REVERSE ? MERGEPAINT :
   //   logical_func == wxAND_REVERSE ? SRCERASE :
        logical_func == wxXOR ? srcXor :
   //   logical_func == wxOR_REVERSE ? MERGEPAINT :
   //   logical_func == wxAND_REVERSE ? SRCERASE :
-       logical_func == wxSRC_OR ? srcOr :
+  //   logical_func == wxSRC_OR ? srcOr :
   //   logical_func == wxSRC_AND ? SRCAND :
                srcCopy );
 
   //   logical_func == wxSRC_AND ? SRCAND :
                srcCopy );
 
@@ -1103,14 +986,15 @@ bool  wxDC::Blit( long xdest, long ydest, long width, long height,
                        wxASSERT( mode == srcCopy ) ;
                        if ( LockPixels( GetGWorldPixMap( source->m_macMask ) ) )
                        {
                        wxASSERT( mode == srcCopy ) ;
                        if ( LockPixels( GetGWorldPixMap( source->m_macMask ) ) )
                        {
-                               CopyMask( &GrafPtr( sourcePort )->portBits , &GrafPtr( source->m_macMask )->portBits , &GrafPtr( m_macPort )->portBits ,
+                               CopyMask( GetPortBitMapForCopyBits( sourcePort ) , GetPortBitMapForCopyBits( source->m_macMask ) , 
+                               GetPortBitMapForCopyBits( m_macPort ) ,
                                        &srcrect, &srcrect , &dstrect ) ;
                                UnlockPixels( GetGWorldPixMap( source->m_macMask )  ) ;
                        }
                }
                else
                {
                                        &srcrect, &srcrect , &dstrect ) ;
                                UnlockPixels( GetGWorldPixMap( source->m_macMask )  ) ;
                        }
                }
                else
                {
-               CopyBits( &GrafPtr( sourcePort )->portBits , &GrafPtr( m_macPort )->portBits ,
+                       CopyBits( GetPortBitMapForCopyBits( sourcePort ) , GetPortBitMapForCopyBits( m_macPort ) ,
                                &srcrect, &dstrect, mode, NULL ) ;
                }
                UnlockPixels( bmappixels ) ;
                                &srcrect, &dstrect, mode, NULL ) ;
                }
                UnlockPixels( bmappixels ) ;
@@ -1123,7 +1007,11 @@ bool  wxDC::Blit( long xdest, long ydest, long width, long height,
   return TRUE;
 }
 
   return TRUE;
 }
 
-void  wxDC::DrawText( const wxString &string, long x, long y, bool use16)
+void  wxDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
+                                   double angle)
+{
+}
+void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -1161,14 +1049,14 @@ void  wxDC::DrawText( const wxString &string, long x, long y, bool use16)
 
                if ( wxApp::s_macDefaultEncodingIsPC )
                {
 
                if ( wxApp::s_macDefaultEncodingIsPC )
                {
-                       macText = wxMacMakeMacStringFromPC( string ) ;
+                       macText = wxMacMakeMacStringFromPC( strtext ) ;
                        text = macText ;
                        length = macText.Length() ;
                }
                else
                {
                        text = macText ;
                        length = macText.Length() ;
                }
                else
                {
-                       text = string ;
-                       length = string.Length() ;
+                       text = strtext ;
+                       length = strtext.Length() ;
                }
                
                int laststop = 0 ;
                }
                
                int laststop = 0 ;
@@ -1200,9 +1088,9 @@ bool  wxDC::CanGetTextExtent(void) const
        return true ;
 }
 
        return true ;
 }
 
-void  wxDC::GetTextExtent( const wxString &string, long *width, long *height,
-                     long *descent, long *externalLeading ,
-                     wxFont *theFont , bool use16  ) const
+void  wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height,
+                     wxCoord *descent, wxCoord *externalLeading ,
+                     wxFont *theFont ) const
 {
   if (!Ok()) 
        return;
 {
   if (!Ok()) 
        return;
@@ -1217,11 +1105,8 @@ void  wxDC::GetTextExtent( const wxString &string, long *width, long *height,
        
                if ( font )
                {
        
                if ( font )
                {
-               long yy1 = YLOG2DEV(0);
-                       long yy2 = YLOG2DEV(font->m_macFontSize);
-       
                        ::TextFont( font->m_macFontNum ) ;
                        ::TextFont( font->m_macFontNum ) ;
-                       ::TextSize( abs( yy2-yy1) ) ;
+                       ::TextSize( YLOG2DEVREL( font->m_macFontSize) ) ;
                        ::TextFace( font->m_macFontStyle ) ;
                }
        }
                        ::TextFace( font->m_macFontStyle ) ;
                }
        }
@@ -1233,9 +1118,12 @@ void  wxDC::GetTextExtent( const wxString &string, long *width, long *height,
        FontInfo fi ;
        ::GetFontInfo( &fi ) ;
 
        FontInfo fi ;
        ::GetFontInfo( &fi ) ;
 
-       *height = fi.descent + fi.ascent ;
-       *descent = fi.descent ;
-       *externalLeading = fi.leading ;
+       if ( height )
+               *height = YDEV2LOGREL( fi.descent + fi.ascent ) ;
+       if ( descent )
+               *descent =YDEV2LOGREL( fi.descent );
+       if ( externalLeading )
+               *externalLeading = YDEV2LOGREL( fi.leading ) ;
        
        const char *text = NULL ;
        int length = 0 ;
        
        const char *text = NULL ;
        int length = 0 ;
@@ -1255,24 +1143,28 @@ void  wxDC::GetTextExtent( const wxString &string, long *width, long *height,
        int laststop = 0 ;
        int i = 0 ;
        int curwidth = 0 ;
        int laststop = 0 ;
        int i = 0 ;
        int curwidth = 0 ;
-       *width = 0 ;
-       
-       while( i < length )
+       if ( width )
        {
        {
-               if( text[i] == 13 || text[i] == 10)
+               *width = 0 ;
+       
+               while( i < length )
                {
                {
-                       *height += fi.descent + fi.ascent + fi.leading;
-                       curwidth = ::TextWidth( text , laststop , i - laststop ) ;
-                       if ( curwidth > *width )
-                               *width = curwidth ;
-                       laststop = i+1 ;
+                       if( text[i] == 13 || text[i] == 10)
+                       {
+                               if ( height )
+                                       *height += YDEV2LOGREL( fi.descent + fi.ascent + fi.leading ) ;
+                               curwidth = ::TextWidth( text , laststop , i - laststop ) ;
+                               if ( curwidth > *width )
+                                       *width = XDEV2LOGREL( curwidth ) ;
+                               laststop = i+1 ;
+                       }
+                       i++ ;
                }
                }
-               i++ ;
+                               
+               curwidth = ::TextWidth( text , laststop , i - laststop ) ;
+               if ( curwidth > *width )
+                       *width = XDEV2LOGREL( curwidth ) ;
        }
        }
-                       
-       curwidth = ::TextWidth( text , laststop , i - laststop ) ;
-       if ( curwidth > *width )
-               *width = curwidth ;
 
        if ( theFont )
        {
 
        if ( theFont )
        {
@@ -1292,7 +1184,7 @@ wxCoord   wxDC::GetCharWidth(void) const
        FontInfo fi ;
        ::GetFontInfo( &fi ) ;
 
        FontInfo fi ;
        ::GetFontInfo( &fi ) ;
 
-       return (fi.descent + fi.ascent) / 2 ;
+       return YDEV2LOGREL((fi.descent + fi.ascent) / 2) ;
 }
 
 wxCoord   wxDC::GetCharHeight(void) const
 }
 
 wxCoord   wxDC::GetCharHeight(void) const
@@ -1307,7 +1199,7 @@ wxCoord   wxDC::GetCharHeight(void) const
        FontInfo fi ;
        ::GetFontInfo( &fi ) ;
 
        FontInfo fi ;
        ::GetFontInfo( &fi ) ;
 
-       return fi.descent + fi.ascent ;
+       return YDEV2LOGREL( fi.descent + fi.ascent );
 }
 
 void  wxDC::Clear(void)
 }
 
 void  wxDC::Clear(void)
@@ -1332,7 +1224,8 @@ void wxDC::MacInstallFont() const
 
        if ( m_macFontInstalled )
                return ;
 
        if ( m_macFontInstalled )
                return ;
-               
+       Pattern blackColor ;
+       
        wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
 
        if ( font )
        wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
 
        if ( font )
@@ -1377,7 +1270,7 @@ void wxDC::MacInstallFont() const
                        mode = patCopy ;
                        break ;
                case wxINVERT:     // NOT dst
                        mode = patCopy ;
                        break ;
                case wxINVERT:     // NOT dst
-                       ::PenPat(&qd.black);
+                       ::PenPat(GetQDGlobalsBlack(&blackColor));
                        mode = patXor ;
                        break ;
                case wxXOR:        // src XOR dst
                        mode = patXor ;
                        break ;
                case wxXOR:        // src XOR dst
@@ -1403,8 +1296,8 @@ void wxDC::MacInstallFont() const
                case wxNAND:       // (NOT src) OR (NOT dst)
                case wxOR:         // src OR dst
                case wxSET:        // 1
                case wxNAND:       // (NOT src) OR (NOT dst)
                case wxOR:         // src OR dst
                case wxSET:        // 1
-               case wxSRC_OR:     // source _bitmap_ OR destination
-               case wxSRC_AND:     // source _bitmap_ AND destination
+//             case wxSRC_OR:     // source _bitmap_ OR destination
+//             case wxSRC_AND:     // source _bitmap_ AND destination
                        break ;
        }
        ::PenMode( mode ) ;
                        break ;
        }
        ::PenMode( mode ) ;
@@ -1447,6 +1340,8 @@ void wxDC::MacInstallPen() const
        return;
   MacVerifySetup() ;
 
        return;
   MacVerifySetup() ;
 
+       Pattern  blackColor;
+
        if ( m_macPenInstalled )
                return ;
 
        if ( m_macPenInstalled )
                return ;
 
@@ -1460,7 +1355,7 @@ void wxDC::MacInstallPen() const
        int penStyle = m_pen.GetStyle();
        
        if (penStyle == wxSOLID)
        int penStyle = m_pen.GetStyle();
        
        if (penStyle == wxSOLID)
-               ::PenPat(&qd.black);
+               ::PenPat(GetQDGlobalsBlack(&blackColor));
        else if (IS_HATCH(penStyle))
        {
                Pattern pat ;
        else if (IS_HATCH(penStyle))
        {
                Pattern pat ;
@@ -1469,7 +1364,7 @@ void wxDC::MacInstallPen() const
        }
        else
        {
        }
        else
        {
-               ::PenPat(&qd.black);
+               ::PenPat(GetQDGlobalsBlack(&blackColor));
        }
 
        short mode = patCopy ;
        }
 
        short mode = patCopy ;
@@ -1482,7 +1377,7 @@ void wxDC::MacInstallPen() const
                        mode = patCopy ;
                        break ;
                case wxINVERT:     // NOT dst
                        mode = patCopy ;
                        break ;
                case wxINVERT:     // NOT dst
-                       ::PenPat(&qd.black);
+                       ::PenPat(GetQDGlobalsBlack(&blackColor));
                        mode = patXor ;
                        break ;
                case wxXOR:        // src XOR dst
                        mode = patXor ;
                        break ;
                case wxXOR:        // src XOR dst
@@ -1508,8 +1403,8 @@ void wxDC::MacInstallPen() const
                case wxNAND:       // (NOT src) OR (NOT dst)
                case wxOR:         // src OR dst
                case wxSET:        // 1
                case wxNAND:       // (NOT src) OR (NOT dst)
                case wxOR:         // src OR dst
                case wxSET:        // 1
-               case wxSRC_OR:     // source _bitmap_ OR destination
-               case wxSRC_AND:     // source _bitmap_ AND destination
+//             case wxSRC_OR:     // source _bitmap_ OR destination
+//             case wxSRC_AND:     // source _bitmap_ AND destination
                        break ;
        }
        ::PenMode( mode ) ;
                        break ;
        }
        ::PenMode( mode ) ;
@@ -1523,7 +1418,7 @@ void wxDC::MacInstallBrush() const
   if (!Ok()) 
        return;
   MacVerifySetup() ;
   if (!Ok()) 
        return;
   MacVerifySetup() ;
-
+       Pattern  blackColor, whiteColor ;
        if ( m_macBrushInstalled )
                return ;
 
        if ( m_macBrushInstalled )
                return ;
 
@@ -1534,7 +1429,7 @@ void wxDC::MacInstallBrush() const
 
        int brushStyle = m_brush.GetStyle();
        if (brushStyle == wxSOLID)
 
        int brushStyle = m_brush.GetStyle();
        if (brushStyle == wxSOLID)
-               ::PenPat(&qd.black);
+               ::PenPat(GetQDGlobalsBlack(&blackColor));
        else if (IS_HATCH(brushStyle))
        {
                Pattern pat ;
        else if (IS_HATCH(brushStyle))
        {
                Pattern pat ;
@@ -1543,7 +1438,7 @@ void wxDC::MacInstallBrush() const
        }
        else
        {
        }
        else
        {
-               ::PenPat(&qd.black);
+               ::PenPat(GetQDGlobalsBlack(&blackColor));
        }
 
        
        }
 
        
@@ -1551,7 +1446,7 @@ void wxDC::MacInstallBrush() const
        
        brushStyle = m_backgroundBrush.GetStyle();
        if (brushStyle == wxSOLID)
        
        brushStyle = m_backgroundBrush.GetStyle();
        if (brushStyle == wxSOLID)
-               ::BackPat(&qd.white);
+               ::BackPat(GetQDGlobalsWhite(&whiteColor));
        else if (IS_HATCH(brushStyle))
        {
                Pattern pat ;
        else if (IS_HATCH(brushStyle))
        {
                Pattern pat ;
@@ -1560,7 +1455,7 @@ void wxDC::MacInstallBrush() const
        }
        else
        {
        }
        else
        {
-               ::BackPat(&qd.white);
+               ::BackPat(GetQDGlobalsWhite(&whiteColor));
        }
        
        short mode = patCopy ;
        }
        
        short mode = patCopy ;
@@ -1573,7 +1468,7 @@ void wxDC::MacInstallBrush() const
                        mode = patCopy ;
                        break ;
                case wxINVERT:     // NOT dst
                        mode = patCopy ;
                        break ;
                case wxINVERT:     // NOT dst
-                       ::PenPat(&qd.black);
+                       ::PenPat(GetQDGlobalsBlack(&blackColor));
                        mode = patXor ;
                        break ;
                case wxXOR:        // src XOR dst
                        mode = patXor ;
                        break ;
                case wxXOR:        // src XOR dst
@@ -1599,8 +1494,8 @@ void wxDC::MacInstallBrush() const
                case wxNAND:       // (NOT src) OR (NOT dst)
                case wxOR:         // src OR dst
                case wxSET:        // 1
                case wxNAND:       // (NOT src) OR (NOT dst)
                case wxOR:         // src OR dst
                case wxSET:        // 1
-               case wxSRC_OR:     // source _bitmap_ OR destination
-               case wxSRC_AND:     // source _bitmap_ AND destination
+//             case wxSRC_OR:     // source _bitmap_ OR destination
+//             case wxSRC_AND:     // source _bitmap_ AND destination
                        break ;
        }
        ::PenMode( mode ) ;
                        break ;
        }
        ::PenMode( mode ) ;
@@ -1609,4 +1504,47 @@ void wxDC::MacInstallBrush() const
        m_macFontInstalled = false ;
 }
 
        m_macFontInstalled = false ;
 }
 
+// ---------------------------------------------------------------------------
+// coordinates transformations
+// ---------------------------------------------------------------------------
 
 
+
+wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
+{
+    return ((wxDC *)this)->XDEV2LOG(x);
+}
+
+wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
+{
+    return ((wxDC *)this)->YDEV2LOG(y);
+}
+
+wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
+{
+    return ((wxDC *)this)->XDEV2LOGREL(x);
+}
+
+wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
+{
+    return ((wxDC *)this)->YDEV2LOGREL(y);
+}
+
+wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
+{
+    return ((wxDC *)this)->XLOG2DEV(x);
+}
+
+wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
+{
+    return ((wxDC *)this)->YLOG2DEV(y);
+}
+
+wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
+{
+    return ((wxDC *)this)->XLOG2DEVREL(x);
+}
+
+wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
+{
+    return ((wxDC *)this)->YLOG2DEVREL(y);
+}
index 12100b81cdef2320b31f5b789f8db2b4825eac2a..6f3a6b35179c9db23d8be0503173d5c1bb85f2f8 100644 (file)
 // wxPaintDC
 //-----------------------------------------------------------------------------
 
 // wxPaintDC
 //-----------------------------------------------------------------------------
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
 IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
 IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
 IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
 IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
 IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
+#endif
 
 /*
  * wxWindowDC
 
 /*
  * wxWindowDC
@@ -38,11 +40,11 @@ IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
 
 #include <wx/mac/uma.h>
 
 
 #include <wx/mac/uma.h>
 
-wxWindowDC::wxWindowDC(void)
+wxWindowDC::wxWindowDC(
 {
 }
 
 {
 }
 
-wxWindowDC::wxWindowDC(wxWindow *the_canvas)
+wxWindowDC::wxWindowDC(wxWindow *the_canvas) 
 {
        WindowRef windowref ;
        wxWindow* rootwindow ;
 {
        WindowRef windowref ;
        wxWindow* rootwindow ;
@@ -51,11 +53,16 @@ wxWindowDC::wxWindowDC(wxWindow *the_canvas)
        
        the_canvas->MacGetPortParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
        m_macPort = UMAGetWindowPort( windowref ) ;
        
        the_canvas->MacGetPortParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
        m_macPort = UMAGetWindowPort( windowref ) ;
+       m_minY = m_minX =  0;
+       wxSize size = the_canvas->GetSize() ;
+       m_maxX = size.x  ;
+       m_maxY = size.y ; 
+
        MacSetupPort() ;
        m_ok = TRUE ;
 }
 
        MacSetupPort() ;
        m_ok = TRUE ;
 }
 
-wxWindowDC::~wxWindowDC(void)
+wxWindowDC::~wxWindowDC()
 {
 }
 
 {
 }
 
@@ -63,7 +70,7 @@ wxWindowDC::~wxWindowDC(void)
  * wxClientDC
  */
 
  * wxClientDC
  */
 
-wxClientDC::wxClientDC(void)
+wxClientDC::wxClientDC()
 {
 }
 
 {
 }
 
@@ -75,12 +82,16 @@ wxClientDC::wxClientDC(wxWindow *window)
        window->MacGetPortClientParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
        m_macPort = UMAGetWindowPort( windowref ) ;
        MacSetupPort() ;
        window->MacGetPortClientParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
        m_macPort = UMAGetWindowPort( windowref ) ;
        MacSetupPort() ;
+       m_minY = m_minX =  0;
+       wxSize size = window->GetSize() ;
+       m_maxX = size.x  ;
+       m_maxY = size.y ; 
        m_ok = TRUE ;
        SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID));
        SetFont( window->GetFont() ) ;
 }
 
        m_ok = TRUE ;
        SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID));
        SetFont( window->GetFont() ) ;
 }
 
-wxClientDC::~wxClientDC(void)
+wxClientDC::~wxClientDC()
 {
 }
 
 {
 }
 
@@ -88,7 +99,7 @@ wxClientDC::~wxClientDC(void)
  * wxPaintDC
  */
 
  * wxPaintDC
  */
 
-wxPaintDC::wxPaintDC(void)
+wxPaintDC::wxPaintDC()
 {
 }
 
 {
 }
 
@@ -104,6 +115,10 @@ wxPaintDC::wxPaintDC(wxWindow *window)
        m_ok = TRUE ;
        long x , y ,w , h ;
        window->GetUpdateRegion().GetBox( x , y , w , h ) ;
        m_ok = TRUE ;
        long x , y ,w , h ;
        window->GetUpdateRegion().GetBox( x , y , w , h ) ;
+       m_minY = m_minX =  0;
+       wxSize size = window->GetSize() ;
+       m_maxX = size.x  ;
+       m_maxY = size.y ; 
        SetClippingRegion( x , y , w , h ) ;
        SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID));
        SetFont(window->GetFont() ) ;
        SetClippingRegion( x , y , w , h ) ;
        SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID));
        SetFont(window->GetFont() ) ;
index fe88bf806cfa070d3f05e15e107f8f80ede1df6d..a56c7b5c49b033b771acc2b887c094a266dd4dfb 100644 (file)
@@ -33,10 +33,20 @@ wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
 
 wxMemoryDC::~wxMemoryDC(void)
 {
 
 wxMemoryDC::~wxMemoryDC(void)
 {
+       if ( m_selected.Ok() )
+       {
+               wxBitmapRefData * bmap = (wxBitmapRefData*) (m_selected.GetRefData()) ;
+               UnlockPixels( GetGWorldPixMap(  (CGrafPtr) bmap->m_hBitmap ) ) ;
+       }
 };
 
 void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
 {
 };
 
 void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
 {
+       if ( m_selected.Ok() )
+       {
+               wxBitmapRefData * bmap = (wxBitmapRefData*) (m_selected.GetRefData()) ;
+               UnlockPixels( GetGWorldPixMap(  (CGrafPtr) bmap->m_hBitmap ) ) ;
+       }
   m_selected = bitmap;
   if (m_selected.Ok())
   {
   m_selected = bitmap;
   if (m_selected.Ok())
   {
@@ -44,6 +54,7 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
                if ( bmap->m_hBitmap )
                {
                        m_macPort = (GrafPtr) bmap->m_hBitmap ;
                if ( bmap->m_hBitmap )
                {
                        m_macPort = (GrafPtr) bmap->m_hBitmap ;
+                       LockPixels( GetGWorldPixMap(  (CGrafPtr)  m_macPort ) ) ;
                        wxMask * mask = bitmap.GetMask() ;
                        if ( mask )
                        {
                        wxMask * mask = bitmap.GetMask() ;
                        if ( mask )
                        {
index 449f44e2060e3205e4f7c729e25675d028c4d35d..257c74206b6a7707bae2d3479b742e1376374e50 100644 (file)
 
 #include "wx/dcprint.h"
 #include "math.h"
 
 #include "wx/dcprint.h"
 #include "math.h"
+#include "wx/mac/uma.h"
 
 
 
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_CLASS(wxPrinterDC, wxDC)
 IMPLEMENT_CLASS(wxPrinterDC, wxDC)
+#endif
 
 GrafPtr macPrintFormerPort = NULL ;
 
 wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
 {
 
 GrafPtr macPrintFormerPort = NULL ;
 
 wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
 {
+#if !TARGET_CARBON
        OSErr err ;
        wxString message ;
        
        m_printData = printdata ;
        m_printData.ConvertToNative() ;
        
        OSErr err ;
        wxString message ;
        
        m_printData = printdata ;
        m_printData.ConvertToNative() ;
        
-       ::PrOpen() ;
+       ::UMAPrOpen() ;
        err = PrError() ;
        if ( err )
        {
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
        err = PrError() ;
        if ( err )
        {
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               PrClose() ;
+               UMAPrClose() ;
        }
        
        if ( ::PrValidate( m_printData.m_macPrintInfo ) )
        {
        }
        
        if ( ::PrValidate( m_printData.m_macPrintInfo ) )
        {
+               ::PrStlDialog( m_printData.m_macPrintInfo ) ;
                // the driver has changed in the mean time, should we pop up a page setup dialog ?
        }
        err = PrError() ;
                // the driver has changed in the mean time, should we pop up a page setup dialog ?
        }
        err = PrError() ;
@@ -57,20 +62,31 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
        {
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
        {
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               PrClose() ;
+               UMAPrClose() ;
        }
        ::GetPort( &macPrintFormerPort ) ;
        m_macPrintPort = ::PrOpenDoc( m_printData.m_macPrintInfo , NULL , NULL ) ;
        }
        ::GetPort( &macPrintFormerPort ) ;
        m_macPrintPort = ::PrOpenDoc( m_printData.m_macPrintInfo , NULL , NULL ) ;
+       err = PrError() ;
+       if ( err )
+       {
+               message.Printf( "Print Error %d", err ) ;
+               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+               UMAPrClose() ;
+       }
        // sets current port
        m_macPort = (GrafPtr ) m_macPrintPort ;
        m_ok = TRUE ;
        m_minY = m_minX = 0 ;
        m_maxX = (**m_printData.m_macPrintInfo).rPaper.right - (**m_printData.m_macPrintInfo).rPaper.left ;
        m_maxY = (**m_printData.m_macPrintInfo).rPaper.bottom - (**m_printData.m_macPrintInfo).rPaper.top ;
        // sets current port
        m_macPort = (GrafPtr ) m_macPrintPort ;
        m_ok = TRUE ;
        m_minY = m_minX = 0 ;
        m_maxX = (**m_printData.m_macPrintInfo).rPaper.right - (**m_printData.m_macPrintInfo).rPaper.left ;
        m_maxY = (**m_printData.m_macPrintInfo).rPaper.bottom - (**m_printData.m_macPrintInfo).rPaper.top ;
+#else
+#pragma warning "TODO:printing support for carbon"
+#endif
 }
 
 wxPrinterDC::~wxPrinterDC(void)
 {
 }
 
 wxPrinterDC::~wxPrinterDC(void)
 {
+#if !TARGET_CARBON
        if ( m_ok )
        {
                OSErr err ;
        if ( m_ok )
        {
                OSErr err ;
@@ -91,11 +107,16 @@ wxPrinterDC::~wxPrinterDC(void)
                {
                        message.Printf( "Print Error %d", err ) ;
                        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
                {
                        message.Printf( "Print Error %d", err ) ;
                        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-                       PrClose() ;
+                       UMAPrClose() ;
                }
                }
-               ::PrClose() ;
-         ::SetPort( macPrintFormerPort ) ;
+               ::UMAPrClose() ;
+//       ::SetPort( macPrintFormerPort ) ;
+               ::SetPort( LMGetWMgrPort() ) ;
+               m_macPortHelper.Clear() ;
        }
        }
+#else
+#pragma warning "TODO:printing support for carbon"
+#endif
 }
 
 bool wxPrinterDC::StartDoc( const wxString& WXUNUSED(message) ) 
 }
 
 bool wxPrinterDC::StartDoc( const wxString& WXUNUSED(message) ) 
@@ -109,13 +130,30 @@ void wxPrinterDC::EndDoc(void)
 
 void wxPrinterDC::StartPage(void) 
 {
 
 void wxPrinterDC::StartPage(void) 
 {
+#if !TARGET_CARBON
        if ( !m_ok )
                return ;
        if ( !m_ok )
                return ;
+
+       m_logicalFunction = wxCOPY;
+//  m_textAlignment = wxALIGN_TOP_LEFT;
+       m_backgroundMode = wxTRANSPARENT;
+  
+       m_textForegroundColour = *wxBLACK;
+       m_textBackgroundColour = *wxWHITE;
+       m_pen = *wxBLACK_PEN;
+       m_font = *wxNORMAL_FONT;
+       m_brush = *wxTRANSPARENT_BRUSH;
+       m_backgroundBrush = *wxWHITE_BRUSH;
+    
+       m_macFontInstalled = false ;
+       m_macBrushInstalled = false ;
+       m_macPenInstalled = false ;
+
                
        OSErr err ;
        wxString message ;
 
                
        OSErr err ;
        wxString message ;
 
-  PrOpenPage( m_macPrintPort , NULL ) ;
+       PrOpenPage( m_macPrintPort , NULL ) ;
        SetOrigin(  - (**m_printData.m_macPrintInfo).rPaper.left , - (**m_printData.m_macPrintInfo).rPaper.top ) ;
        Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
        ::ClipRect( &clip ) ;
        SetOrigin(  - (**m_printData.m_macPrintInfo).rPaper.left , - (**m_printData.m_macPrintInfo).rPaper.top ) ;
        Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
        ::ClipRect( &clip ) ;
@@ -126,14 +164,18 @@ void wxPrinterDC::StartPage(void)
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
                ::PrClosePage(  m_macPrintPort) ;
                ::PrCloseDoc( m_macPrintPort  ) ;
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
                ::PrClosePage(  m_macPrintPort) ;
                ::PrCloseDoc( m_macPrintPort  ) ;
-               ::PrClose() ;
+               ::UMAPrClose() ;
                ::SetPort( macPrintFormerPort ) ;
                m_ok = FALSE ;
        }
                ::SetPort( macPrintFormerPort ) ;
                m_ok = FALSE ;
        }
+#else
+#pragma warning "TODO:printing support for carbon"
+#endif
 }
 
 void wxPrinterDC::EndPage(void) 
 {
 }
 
 void wxPrinterDC::EndPage(void) 
 {
+#if !TARGET_CARBON
        if ( !m_ok )
                return ;
 
        if ( !m_ok )
                return ;
 
@@ -147,8 +189,12 @@ void wxPrinterDC::EndPage(void)
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
                ::PrCloseDoc( m_macPrintPort  ) ;
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
                ::PrCloseDoc( m_macPrintPort  ) ;
-               ::PrClose() ;
+               ::UMAPrClose() ;
                ::SetPort( macPrintFormerPort ) ;
                m_ok = FALSE ;
        }
                ::SetPort( macPrintFormerPort ) ;
                m_ok = FALSE ;
        }
+#else
+#pragma warning "TODO:printing support for carbon"
+#endif
+
 }
 }
index 1d802afba448d938bd239e659616e413a051eba8..c47126248e7ab604fd8899f72bedb5a242004294 100644 (file)
 #endif
 
 #include "wx/dcscreen.h"
 #endif
 
 #include "wx/dcscreen.h"
+#include "wx/mac/uma.h"
 
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
+#endif
 
 // Create a DC representing the whole screen
 wxScreenDC::wxScreenDC()
 {
 
 // Create a DC representing the whole screen
 wxScreenDC::wxScreenDC()
 {
+#if TARGET_CARBON
+       m_macPort = GetQDGlobalsThePort() ;
+#else
        m_macPort = LMGetWMgrPort() ;
        m_macPort = LMGetWMgrPort() ;
+#endif
        MacSetupPort() ;
        m_ok = TRUE ;
        MacSetupPort() ;
        m_ok = TRUE ;
+       BitMap screenBits;
+       GetQDGlobalsScreenBits( &screenBits );
+       m_minX = screenBits.bounds.left ;
+ #if TARGET_CARBON
+       SInt16 height ;
+       GetThemeMenuBarHeight( &height ) ;
+       m_minY = screenBits.bounds.top + height ;
+ #else
+       m_minY = screenBits.bounds.top + LMGetMBarHeight() ;
+ #endif
+       m_maxX = screenBits.bounds.right  ;
+       m_maxY = screenBits.bounds.bottom ; 
 }
 
 wxScreenDC::~wxScreenDC()
 }
 
 wxScreenDC::~wxScreenDC()
index d75706f6a3594dcc43354f4efa09bff5ca0a9384..760c07680a91543be3bb019f8eba670f2e08b247 100644 (file)
@@ -27,6 +27,7 @@ wxList wxModalDialogs;
 wxList wxModelessWindows;  // Frames and modeless dialogs
 extern wxList wxPendingDelete;
 
 wxList wxModelessWindows;  // Frames and modeless dialogs
 extern wxList wxPendingDelete;
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxPanel)
 
 BEGIN_EVENT_TABLE(wxDialog, wxPanel)
 IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxPanel)
 
 BEGIN_EVENT_TABLE(wxDialog, wxPanel)
@@ -39,11 +40,11 @@ BEGIN_EVENT_TABLE(wxDialog, wxPanel)
   EVT_CLOSE(wxDialog::OnCloseWindow)
 END_EVENT_TABLE()
 
   EVT_CLOSE(wxDialog::OnCloseWindow)
 END_EVENT_TABLE()
 
+#endif
 
 wxDialog::wxDialog()
 {
 
 wxDialog::wxDialog()
 {
-  m_isShown = FALSE;
-  m_modalShowing = FALSE;
+       m_isShown = FALSE;
     SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
 }
 
     SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
 }
 
@@ -54,15 +55,8 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
            long style,
            const wxString& name)
 {
            long style,
            const wxString& name)
 {
-  m_windowStyle = style;
-  m_isShown = FALSE;
-  m_modalShowing = FALSE;
 
 
-#if wxUSE_TOOLTIPS
-    m_hwndToolTip = 0;
-#endif
   SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
   SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
-  SetName(name);
   
   if (!parent)
     wxTopLevelWindows.Append(this);
   
   if (!parent)
     wxTopLevelWindows.Append(this);
@@ -74,59 +68,26 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
   else
        m_windowId = id;
 
   else
        m_windowId = id;
 
-       Rect theBoundsRect;
-
-  m_x = (int)pos.x;
-  m_y = (int)pos.y;
-  if ( m_y < 50 )
-       m_y = 50 ;
-  if ( m_x < 20 )
-       m_x = 20 ;
-       
-  m_width = size.x;
-       if (m_width == -1) 
-               m_width = 20;
-  m_height = size.y;
-       if (m_height == -1) 
-               m_height = 20;
-
-       ::SetRect(&theBoundsRect, m_x, m_y, m_x + m_width, m_y + m_height);
-       m_macWindowData = new MacWindowData() ;
-
-       WindowClass wclass = kMovableModalWindowClass ;
-       WindowAttributes attr = kWindowNoAttributes ;
-       
-       if ( ( m_windowStyle & wxMINIMIZE_BOX ) || ( m_windowStyle & wxMAXIMIZE_BOX ) )
-       {
-               attr |= kWindowFullZoomAttribute ;
-               attr |= kWindowResizableAttribute ;
-       }
+       MacCreateRealWindow( title , pos , size , MacRemoveBordersFromStyle(style)  , name ) ;
 
 
-       UMACreateNewWindow( wclass , attr , &theBoundsRect , &m_macWindowData->m_macWindow ) ;
-       wxAssociateWinWithMacWindow( m_macWindowData->m_macWindow , this ) ;
-       wxString label ;
-       if( wxApp::s_macDefaultEncodingIsPC )
-               label = wxMacMakeMacStringFromPC( title ) ;
-       else
-               label = title ;
-       UMASetWTitleC( m_macWindowData->m_macWindow , label ) ;
        m_macWindowData->m_macWindowBackgroundTheme = kThemeBrushDialogBackgroundActive ;
        m_macWindowData->m_macWindowBackgroundTheme = kThemeBrushDialogBackgroundActive ;
-       UMACreateRootControl( m_macWindowData->m_macWindow , &m_macWindowData->m_macRootControl ) ;
-       m_macWindowData->m_macFocus = NULL ;
   return TRUE;
 }
 
 void wxDialog::SetModal(bool flag)
 {
   return TRUE;
 }
 
 void wxDialog::SetModal(bool flag)
 {
-       if ( flag )
-               m_windowStyle |= wxDIALOG_MODAL ;
-       else
-               if ( m_windowStyle & wxDIALOG_MODAL )
-                       m_windowStyle -= wxDIALOG_MODAL ;
-  
-  wxModelessWindows.DeleteObject(this);
-  if (!flag)
-    wxModelessWindows.Append(this);
+  if ( flag )
+    {
+        m_windowStyle |= wxDIALOG_MODAL;
+
+        wxModelessWindows.DeleteObject(this);
+    }
+    else
+    {
+        m_windowStyle &= ~wxDIALOG_MODAL;
+
+        wxModelessWindows.Append(this);
+    }
 }
 
 wxDialog::~wxDialog()
 }
 
 wxDialog::~wxDialog()
@@ -134,10 +95,10 @@ wxDialog::~wxDialog()
        m_isBeingDeleted = TRUE ;
     wxTopLevelWindows.DeleteObject(this);
 
        m_isBeingDeleted = TRUE ;
     wxTopLevelWindows.DeleteObject(this);
 
-  m_modalShowing = FALSE;
+       Show(FALSE);
 
 
-  if ( (GetWindowStyleFlag() & wxDIALOG_MODAL) != wxDIALOG_MODAL )
-    wxModelessWindows.DeleteObject(this);
+    if ( !IsModal() )
+       wxModelessWindows.DeleteObject(this);
 
     // If this is the last top-level window, exit.
     if (wxTheApp && (wxTopLevelWindows.Number() == 0))
 
     // If this is the last top-level window, exit.
     if (wxTheApp && (wxTopLevelWindows.Number() == 0))
@@ -184,19 +145,20 @@ void wxDialog::DoSetClientSize(int width, int height)
        wxWindow::DoSetClientSize( width , height ) ;
 }
 
        wxWindow::DoSetClientSize( width , height ) ;
 }
 
-void wxDialog::GetPosition(int *x, int *y) const
+void wxDialog::DoGetPosition(int *x, int *y) const
 {
 {
-       DoGetPosition( x , y ) ;
+       wxWindow::DoGetPosition( x , y ) ;
 }
 
 }
 
-bool wxDialog::IsShown() const
+bool wxDialog::IsModal() const
 {
 {
-  return m_isShown;
+    return (GetWindowStyleFlag() & wxDIALOG_MODAL) != 0;
 }
 
 }
 
-bool wxDialog::IsModal() const
+
+bool wxDialog::IsModalShowing() const
 {
 {
-    return wxModalDialogs.Find((wxDialog *)this) != 0; // const_cast
+    return wxModalDialogs.Find((wxDialog *)this) != NULL; // const_cast
 }
 
 
 }
 
 
@@ -204,122 +166,77 @@ extern bool s_macIsInModalLoop ;
 
 bool wxDialog::Show(bool show)
 {
 
 bool wxDialog::Show(bool show)
 {
-  m_isShown = show;
-
-  if (show)
-    InitDialog();
+    if ( !wxDialogBase::Show(show) )
+    {
+        // nothing to do
+        return FALSE;
+    }
 
 
-  bool modal =  ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL) ;
+    if ( show )
+    {
+        // usually will result in TransferDataToWindow() being called
+        InitDialog();
+    }
 
 
-#if WXGARBAGE_COLLECTION_ON /* MATTHEW: GC */
-  if (!modal) 
-  {
-    if (show) 
+    if ( IsModal() )
     {
     {
-      if (!wxModelessWindows.Find(this))
-        wxModelessWindows.Append(this);
-    } 
-    else
-      wxModelessWindows.DeleteObject(this);
-  }
-  if (show) 
-  {
-    if (!wxTopLevelWindows.Find(this))
-       wxTopLevelWindows.Append(this);
-  } 
-  else
-       wxTopLevelWindows.DeleteObject(this);
-#endif
+        if ( show )
+        {
+            DoShowModal();
+        }
+        else // end of modal dialog
+        {
+            // this will cause IsModalShowing() return FALSE and our local
+            // message loop will terminate
+            wxModalDialogs.DeleteObject(this);
+        }
+    }
 
 
-       if ( modal )
-       {
-               s_macIsInModalLoop = true ;
-               if (show)
-               {
-               if (m_modalShowing)
-               {
-//                     BringWindowToTop((HWND) GetHWND());
-                       return TRUE;
-               }
-
-               m_modalShowing = TRUE;
-               // if we don't do it, some window might be deleted while we have pointers
-               // to them in our disabledWindows list and the program will crash when it
-               // will try to reenable them after the modal dialog end
-               wxTheApp->DeletePendingObjects();
-
-               UMAShowWindow( m_macWindowData->m_macWindow ) ;
-               UMASelectWindow( m_macWindowData->m_macWindow ) ;
-
-       if (!wxModalDialogs.Member(this))
-               wxModalDialogs.Append(this);
-
-       while (wxModalDialogs.Member(this) )
-       {
-               wxTheApp->MacDoOneEvent() ;
-       }
-         }
-         else
-         {
-       wxModalDialogs.DeleteObject(this);
-       UMAHideWindow( m_macWindowData->m_macWindow ) ;
-         }
-         s_macIsInModalLoop = false ;
-       }
-       else // !modal
-       {
-         if (show)
-         {
-       UMAShowWindow( m_macWindowData->m_macWindow ) ;
-       UMASelectWindow( m_macWindowData->m_macWindow ) ;
-         }
-         else
-         {
-       UMAHideWindow( m_macWindowData->m_macWindow ) ;
-         }
-       }
-       return TRUE ;
+    return TRUE;
 }
 
 }
 
-void wxDialog::SetTitle(const wxString& title)
+void wxDialog::DoShowModal()
 {
 {
-       wxWindow::SetTitle( title ) ;
-}
+    wxCHECK_RET( !IsModalShowing(), _T("DoShowModal() called twice") );
 
 
-wxString wxDialog::GetTitle() const
-{
-       return wxWindow::GetTitle() ;
-}
+    wxModalDialogs.Append(this);
 
 
-void wxDialog::Centre(int direction)
-{
-  int x_offset,y_offset ;
-  int display_width, display_height;
-  int  width, height, x, y;
-  wxWindow *parent = GetParent();
-  if ((direction & wxCENTER_FRAME) && parent)
-  {
-      parent->GetPosition(&x_offset,&y_offset) ;
-      parent->GetSize(&display_width,&display_height) ;
-  }
-  else
-  {
-    wxDisplaySize(&display_width, &display_height);
-    x_offset = 0 ;
-    y_offset = 0 ;
-  }
+       wxWindow *parent = GetParent();
+
+    // remember where the focus was
+    wxWindow *winFocus = FindFocus();
+    if ( !winFocus )
+    {
+        winFocus = parent;
+    }
+    if ( !winFocus )
+    {
+        winFocus = wxTheApp->GetTopWindow();
+    }
+       // TODO : test whether parent gets disabled
+
+       s_macIsInModalLoop = true ;
 
 
-  GetSize(&width, &height);
-  GetPosition(&x, &y);
+       while ( IsModalShowing() )
+       {
+               while ( !wxTheApp->Pending() && wxTheApp->ProcessIdle() )
+               {
+               }
+               wxTheApp->MacDoOneEvent() ;
+       }
+       
+       s_macIsInModalLoop = false ;
 
 
-  if (direction & wxHORIZONTAL)
-    x = (int)((display_width - width)/2);
-  if (direction & wxVERTICAL)
-    y = (int)((display_height - height)/2);
+    // TODO probably reenable the parent window if any
 
 
-  SetSize(x+x_offset, y+y_offset, width, height);
+    // and restore focus
+    if ( winFocus )
+    {
+        winFocus->SetFocus();
+    }
 }
 
 }
 
+
 // Replacement for Show(TRUE) for modal dialogs - returns return code
 int wxDialog::ShowModal()
 {
 // Replacement for Show(TRUE) for modal dialogs - returns return code
 int wxDialog::ShowModal()
 {
@@ -328,6 +245,8 @@ int wxDialog::ShowModal()
   return GetReturnCode();
 }
 
   return GetReturnCode();
 }
 
+// NB: this function (surprizingly) may be called for both modal and modeless
+//     dialogs and should work for both of them
 void wxDialog::EndModal(int retCode)
 {
   SetReturnCode(retCode);
 void wxDialog::EndModal(int retCode)
 {
   SetReturnCode(retCode);
@@ -339,13 +258,7 @@ void wxDialog::OnOK(wxCommandEvent& event)
 {
   if ( Validate() && TransferDataFromWindow() )
   {
 {
   if ( Validate() && TransferDataFromWindow() )
   {
-        if ( IsModal() )
-            EndModal(wxID_OK);
-        else
-        {
-            SetReturnCode(wxID_OK);
-            this->Show(FALSE);
-        }
+      EndModal(wxID_OK);
   }
 }
 
   }
 }
 
@@ -358,20 +271,7 @@ void wxDialog::OnApply(wxCommandEvent& event)
 
 void wxDialog::OnCancel(wxCommandEvent& event)
 {
 
 void wxDialog::OnCancel(wxCommandEvent& event)
 {
-    if ( IsModal() )
         EndModal(wxID_CANCEL);
         EndModal(wxID_CANCEL);
-    else
-    {
-        SetReturnCode(wxID_CANCEL);
-        this->Show(FALSE);
-    }
-}
-
-void wxDialog::OnPaint(wxPaintEvent& event)
-{
-  // No: if you call the default procedure, it makes
-  // the following painting code not work.
-//  wxWindow::OnPaint(event);
 }
 
 void wxDialog::OnCloseWindow(wxCloseEvent& event)
 }
 
 void wxDialog::OnCloseWindow(wxCloseEvent& event)
@@ -407,30 +307,16 @@ void wxDialog::OnCloseWindow(wxCloseEvent& event)
 // Destroy the window (delayed, if a managed window)
 bool wxDialog::Destroy()
 {
 // Destroy the window (delayed, if a managed window)
 bool wxDialog::Destroy()
 {
-  if (!wxPendingDelete.Member(this))
+    wxCHECK_MSG( !wxPendingDelete.Member(this), FALSE,
+                 _T("wxDialog destroyed twice") );
+
     wxPendingDelete.Append(this);
   return TRUE;
 }
 
     wxPendingDelete.Append(this);
   return TRUE;
 }
 
-void wxDialog::OnSize(wxSizeEvent& WXUNUSED(event))
-{
-  // if we're using constraints - do use them
-  #if wxUSE_CONSTRAINTS
-    if ( GetAutoLayout() )
-    {
-      Layout();
-    }
-  #endif
-}
-
 void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& event)
 {
   SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
   Refresh();
 }
 
 void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& event)
 {
   SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
   Refresh();
 }
 
-void wxDialog::Fit()
-{
-  wxWindow::Fit();
-}
-
index ec94a4e1ec5f0216a21113491258943ccb740bfd..f0b6664010a3bffeae63ceb7b33953e4be98c48f 100644 (file)
@@ -147,6 +147,7 @@ bool wxDirData::Read(wxString *filename)
                if ( err != noErr )
                        break ;
                        
                if ( err != noErr )
                        break ;
                        
+               p2cstr( m_name ) ;
                if ( ( m_CPB.dirInfo.ioFlAttrib & ioDirMask) != 0 && (m_flags & wxDIR_DIRS) ) //  we have a directory
                        break ;
                        
                if ( ( m_CPB.dirInfo.ioFlAttrib & ioDirMask) != 0 && (m_flags & wxDIR_DIRS) ) //  we have a directory
                        break ;
                        
@@ -156,17 +157,37 @@ bool wxDirData::Read(wxString *filename)
         if ( ( m_CPB.hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible ) && !(m_flags & wxDIR_HIDDEN) ) // its hidden but we don't want it
                        continue ;
 
         if ( ( m_CPB.hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible ) && !(m_flags & wxDIR_HIDDEN) ) // its hidden but we don't want it
                        continue ;
 
+               wxString file( m_name ) ;
+               if ( m_filespec.IsEmpty() || m_filespec == "*.*" )
+               {
+               }
+               else if ( m_filespec.Length() > 1 && m_filespec.Left(1) =="*" )
+               {
+                       if ( file.Right( m_filespec.Length() - 1 ).Upper() != m_filespec.Mid(1).Upper() )
+                       {
+                               continue ;
+                       }
+               }
+               else if ( m_filespec.Length() > 1 && m_filespec.Right(1) == "*" )
+               {
+                       if ( file.Left( m_filespec.Length() - 1 ).Upper() != m_filespec.Left( m_filespec.Length() - 1 ).Upper() )
+                       {
+                               continue ;
+                       }
+               }
+               else if ( file.Upper() != m_filespec.Upper() )
+               {
+                       continue ;
+               }
+
                break ;
        }
        if ( err != noErr )
        {
                return FALSE ;
        }
                break ;
        }
        if ( err != noErr )
        {
                return FALSE ;
        }
-       FSSpec spec ;
-       
-       FSMakeFSSpecCompat(m_CPB.hFileInfo.ioVRefNum, m_dirId, m_name,&spec) ;
-                                                                 
-       *filename = wxMacFSSpec2UnixFilename( &spec ) ;
+
+       *filename = (char*) m_name ;
 
     return TRUE;
 }
 
     return TRUE;
 }
index 344b8b32b93e6e9a1691f257393f263bd27213ae..02bbef6a204bad2100a085c8786858f9820e07b6 100644 (file)
 
 #include "wx/cmndata.h"
 
 
 #include "wx/cmndata.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_CLASS(wxDirDialog, wxDialog)
 IMPLEMENT_CLASS(wxDirDialog, wxDialog)
-
-enum {
-       kSelectItem = 10,                       // select button item number
-       kSFGetFolderDlgID = 250,        // dialog resource number
-       kStrListID = 250,                       // our strings
-       kSelectStrNum = 1,                      // word 'Select: ' for button
-       kDesktopStrNum = 2,                     // word 'Desktop' for button
-       kSelectNoQuoteStrNum = 3,       // word 'Select: ' for button
-       
-       kUseQuotes = true,                      // parameter for SetButtonName
-       kDontUseQuotes = false
-};
+#endif
 
 // the data we need to pass to our standard file hook routine
 // includes a pointer to the dialog, a pointer to the standard
 
 // the data we need to pass to our standard file hook routine
 // includes a pointer to the dialog, a pointer to the standard
@@ -48,6 +38,21 @@ struct UserDataRec {
 typedef struct UserDataRec
        UserDataRec, *UserDataRecPtr;
 
 typedef struct UserDataRec
        UserDataRec, *UserDataRecPtr;
 
+#if !TARGET_CARBON
+
+enum {
+       kSelectItem = 10,                       // select button item number
+       kSFGetFolderDlgID = 250,        // dialog resource number
+       kStrListID = 250,                       // our strings
+       kSelectStrNum = 1,                      // word 'Select: ' for button
+       kDesktopStrNum = 2,                     // word 'Desktop' for button
+       kSelectNoQuoteStrNum = 3,       // word 'Select: ' for button
+       
+       kUseQuotes = true,                      // parameter for SetButtonName
+       kDontUseQuotes = false
+};
+
+
 static void GetLabelString(StringPtr theStr, short stringNum)
 {
        GetIndString(theStr, kStrListID, stringNum);
 static void GetLabelString(StringPtr theStr, short stringNum)
 {
        GetIndString(theStr, kStrListID, stringNum);
@@ -302,6 +307,7 @@ static pascal short SFGetFolderDialogHook(short item, DialogPtr theDlgPtr, Ptr d
        
        return item;
 }
        
        return item;
 }
+#endif
 
 void StandardGetFolder( ConstStr255Param message , ConstStr255Param path , FileFilterYDUPP fileFilter, StandardFileReply *theSFR)
 {
 
 void StandardGetFolder( ConstStr255Param message , ConstStr255Param path , FileFilterYDUPP fileFilter, StandardFileReply *theSFR)
 {
@@ -321,7 +327,7 @@ void StandardGetFolder( ConstStr255Param message , ConstStr255Param path , FileF
        
        // set initial contents of Select button to a space
        
        
        // set initial contents of Select button to a space
        
-       CopyPStr("\p ", theSFR->sfFile.name);
+       memcpy(theSFR->sfFile.name, "\p ", 2);
        
        // point the user data parameter at the reply record so we can get to it later
        
        
        // point the user data parameter at the reply record so we can get to it later
        
@@ -329,6 +335,8 @@ void StandardGetFolder( ConstStr255Param message , ConstStr255Param path , FileF
        
        // display the dialog
        
        
        // display the dialog
        
+       #if !TARGET_CARBON
+       
        dlgHookUPP = NewDlgHookYDProc(SFGetFolderDialogHook);
        myModalFilterUPP = NewModalFilterYDProc(SFGetFolderModalDialogFilter);
        
        dlgHookUPP = NewDlgHookYDProc(SFGetFolderDialogHook);
        myModalFilterUPP = NewModalFilterYDProc(SFGetFolderModalDialogFilter);
        
@@ -350,6 +358,8 @@ void StandardGetFolder( ConstStr255Param message , ConstStr255Param path , FileF
                                        
        DisposeRoutineDescriptor(dlgHookUPP);
        DisposeRoutineDescriptor(myModalFilterUPP);
                                        
        DisposeRoutineDescriptor(dlgHookUPP);
        DisposeRoutineDescriptor(myModalFilterUPP);
+       #else
+       #endif
        
        // if cancel wasn't pressed and no fatal error occurred...
        
        
        // if cancel wasn't pressed and no fatal error occurred...
        
@@ -445,14 +455,18 @@ int wxDirDialog::ShowModal()
                strcpy((char *)path, m_path ) ;
                c2pstr((char *)path ) ;
 
                strcpy((char *)path, m_path ) ;
                c2pstr((char *)path ) ;
 
-               FileFilterYDUPP         invisiblesExcludedCustomFilterUPP;
                StandardFileReply       reply ;
                StandardFileReply       reply ;
+               FileFilterYDUPP         invisiblesExcludedCustomFilterUPP = 0 ;
+               #if !TARGET_CARBON
                invisiblesExcludedCustomFilterUPP = 
                        NewFileFilterYDProc(OnlyVisibleFoldersCustomFileFilter);
                invisiblesExcludedCustomFilterUPP = 
                        NewFileFilterYDProc(OnlyVisibleFoldersCustomFileFilter);
+               #endif
 
                StandardGetFolder( prompt , path , invisiblesExcludedCustomFilterUPP, &reply);
        
 
                StandardGetFolder( prompt , path , invisiblesExcludedCustomFilterUPP, &reply);
        
+               #if !TARGET_CARBON
                DisposeRoutineDescriptor(invisiblesExcludedCustomFilterUPP);
                DisposeRoutineDescriptor(invisiblesExcludedCustomFilterUPP);
+               #endif
                if ( reply.sfGood == false )
                {
                        m_path = "" ;
                if ( reply.sfGood == false )
                {
                        m_path = "" ;
index 32088eef0f6deea25207f69117d2fdeb92a3f6da..cebcd3aab05bc848c17998b5c1049cbc3c660020 100644 (file)
@@ -18,6 +18,8 @@
 #include "wx/app.h"
 #include "wx/gdicmn.h"
 
 #include "wx/app.h"
 #include "wx/gdicmn.h"
 
+#if wxUSE_DRAG_AND_DROP
+
 // ----------------------------------------------------------------------------
 // global
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // global
 // ----------------------------------------------------------------------------
@@ -131,3 +133,4 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
     return wxDragError;
 };
 
     return wxDragError;
 };
 
+#endif
\ No newline at end of file
index ee50e2e6bd98a197d2fc6bc1ca25d54ae33fbc73..7837183e2aef2d18e0fea4344eec463399db25de 100644 (file)
@@ -1,6 +1,6 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        filedlg.cpp
 /////////////////////////////////////////////////////////////////////////////
 // Name:        filedlg.cpp
-// Purpose:     wxFileDialog
+// Purpose:     wxFileDialog 
 // Author:      AUTHOR
 // Modified by:
 // Created:     ??/??/98
 // Author:      AUTHOR
 // Modified by:
 // Created:     ??/??/98
@@ -19,7 +19,9 @@
 #include "wx/filedlg.h"
 #include "wx/intl.h"
 
 #include "wx/filedlg.h"
 #include "wx/intl.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_CLASS(wxFileDialog, wxDialog)
 IMPLEMENT_CLASS(wxFileDialog, wxDialog)
+#endif
 
 // begin wxmac
 
 
 // begin wxmac
 
@@ -43,6 +45,27 @@ OSType gfiltersmac[] =
        '****'
 } ;
 
        '****'
 } ;
 
+// the data we need to pass to our standard file hook routine
+// includes a pointer to the dialog, a pointer to the standard
+// file reply record (so we can inspect the current selection)
+// and a copy of the "previous" file spec of the reply record
+// so we can see if the selection has changed
+
+const int kwxMacFileTypes = 10 ;
+
+struct OpenUserDataRec {
+       StandardFileReply       *sfrPtr;
+       FSSpec                          oldSelectionFSSpec;
+       char                            filter[kwxMacFileTypes][10] ;
+       OSType                          filtermactypes[kwxMacFileTypes] ;
+       int                                     numfilters ;
+       DialogPtr                       theDlgPtr;
+};
+typedef struct OpenUserDataRec
+       OpenUserDataRec, *OpenUserDataRecPtr;
+
+#if !TARGET_CARBON
+
 static void wxMacSetupStandardFile(short newVRefNum, long newDirID) 
 { 
        enum 
 static void wxMacSetupStandardFile(short newVRefNum, long newDirID) 
 { 
        enum 
@@ -97,25 +120,6 @@ enum {
        kDontUseQuotes = false
 };
 
        kDontUseQuotes = false
 };
 
-// the data we need to pass to our standard file hook routine
-// includes a pointer to the dialog, a pointer to the standard
-// file reply record (so we can inspect the current selection)
-// and a copy of the "previous" file spec of the reply record
-// so we can see if the selection has changed
-
-const int kwxMacFileTypes = 10 ;
-
-struct OpenUserDataRec {
-       StandardFileReply       *sfrPtr;
-       FSSpec                          oldSelectionFSSpec;
-       char                            filter[kwxMacFileTypes][10] ;
-       OSType                          filtermactypes[kwxMacFileTypes] ;
-       int                                     numfilters ;
-       DialogPtr                       theDlgPtr;
-};
-typedef struct OpenUserDataRec
-       OpenUserDataRec, *OpenUserDataRecPtr;
-
 static void GetLabelString(StringPtr theStr, short stringNum)
 {
        GetIndString(theStr, kStrListID, stringNum);
 static void GetLabelString(StringPtr theStr, short stringNum)
 {
        GetIndString(theStr, kStrListID, stringNum);
@@ -185,6 +189,7 @@ static pascal Boolean SFGetFolderModalDialogFilter(DialogPtr theDlgPtr, EventRec
                
        return false;
 }
                
        return false;
 }
+#endif
 
 void ExtendedOpenFile( ConstStr255Param message , ConstStr255Param path , const char *filter , FileFilterYDUPP fileFilter, StandardFileReply *theSFR)
 {
 
 void ExtendedOpenFile( ConstStr255Param message , ConstStr255Param path , const char *filter , FileFilterYDUPP fileFilter, StandardFileReply *theSFR)
 {
@@ -204,7 +209,7 @@ void ExtendedOpenFile( ConstStr255Param message , ConstStr255Param path , const
        
        // set initial contents of Select button to a space
        
        
        // set initial contents of Select button to a space
        
-       CopyPStr("\p ", theSFR->sfFile.name);
+       memcpy( theSFR->sfFile.name , "\p " , 2 ) ;
        
        // point the user data parameter at the reply record so we can get to it later
        
        
        // point the user data parameter at the reply record so we can get to it later
        
@@ -240,6 +245,8 @@ void ExtendedOpenFile( ConstStr255Param message , ConstStr255Param path , const
                myData.numfilters = 0 ;
        }
        // display the dialog
                myData.numfilters = 0 ;
        }
        // display the dialog
+
+#if !TARGET_CARBON
        
        dlgHookUPP = NULL ;
 //     dlgHookUPP = NewDlgHookYDProc(SFGetFolderDialogHook);
        
        dlgHookUPP = NULL ;
 //     dlgHookUPP = NewDlgHookYDProc(SFGetFolderDialogHook);
@@ -263,7 +270,8 @@ void ExtendedOpenFile( ConstStr255Param message , ConstStr255Param path , const
                                        
        DisposeRoutineDescriptor(dlgHookUPP);
        DisposeRoutineDescriptor(myModalFilterUPP);
                                        
        DisposeRoutineDescriptor(dlgHookUPP);
        DisposeRoutineDescriptor(myModalFilterUPP);
-       
+#else
+#endif 
        // if cancel wasn't pressed and no fatal error occurred...
        
        if (theSFR->sfGood)
        // if cancel wasn't pressed and no fatal error occurred...
        
        if (theSFR->sfGood)
@@ -454,8 +462,12 @@ int wxFileDialog::ShowModal()
        
                strcpy((char *)filename, m_fileName) ;
                c2pstr((char *)filename ) ;
        
                strcpy((char *)filename, m_fileName) ;
                c2pstr((char *)filename ) ;
+               #if !TARGET_CARBON
                
                StandardPutFile( prompt , filename , &reply ) ;
                
                StandardPutFile( prompt , filename , &reply ) ;
+       
+               #else
+               #endif
                if ( reply.sfGood == false )
                {
                        m_path = "" ;
                if ( reply.sfGood == false )
                {
                        m_path = "" ;
@@ -479,14 +491,17 @@ int wxFileDialog::ShowModal()
                strcpy((char *)path, m_path ) ;
                c2pstr((char *)path ) ;
 
                strcpy((char *)path, m_path ) ;
                c2pstr((char *)path ) ;
 
-               FileFilterYDUPP         crossPlatformFileFilterUPP;
                StandardFileReply       reply ;
                StandardFileReply       reply ;
+               FileFilterYDUPP crossPlatformFileFilterUPP = 0 ;
+               #if !TARGET_CARBON
                crossPlatformFileFilterUPP = 
                        NewFileFilterYDProc(CrossPlatformFileFilter);
                crossPlatformFileFilterUPP = 
                        NewFileFilterYDProc(CrossPlatformFileFilter);
+               #endif
 
                ExtendedOpenFile( prompt , path , m_wildCard , crossPlatformFileFilterUPP, &reply);
 
                ExtendedOpenFile( prompt , path , m_wildCard , crossPlatformFileFilterUPP, &reply);
-       
-               DisposeRoutineDescriptor(crossPlatformFileFilterUPP);
+               #if !TARGET_CARBON
+               DisposeFileFilterYDUPP(crossPlatformFileFilterUPP);
+               #endif
                if ( reply.sfGood == false )
                {
                        m_path = "" ;
                if ( reply.sfGood == false )
                {
                        m_path = "" ;
index a5df9049a20fa3b8ea2d01e50130f4fd920d1a42..4f26c04f914e3bfab6d22d3655d28981ec364b68 100644 (file)
@@ -18,7 +18,9 @@
 #include "wx/font.h"
 #include "wx/gdicmn.h"
 
 #include "wx/font.h"
 #include "wx/gdicmn.h"
 
+#if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
 IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
+#endif
 
 
 
 
 
 
@@ -77,7 +79,7 @@ void wxFontRefData::MacFindFont()
                                ::GetFNum( "\pTimes" , &m_macFontNum) ;
                                break ;
                        case wxSWISS :
                                ::GetFNum( "\pTimes" , &m_macFontNum) ;
                                break ;
                        case wxSWISS :
-                               ::GetFNum( "\pHelvetica" , &m_macFontNum) ;
+                               ::GetFNum( "\pGeneva" , &m_macFontNum) ;
                                break ;
                        case wxMODERN :
                                ::GetFNum( "\pMonaco" , &m_macFontNum) ;
                                break ;
                        case wxMODERN :
                                ::GetFNum( "\pMonaco" , &m_macFontNum) ;
index 9a0843d64bc0aba3ca60e6ea408328178ee18bfd..d775c24c169eeefdea89bd141b3df424f2226783 100644 (file)
@@ -17,7 +17,9 @@
 #include "wx/mac/fontdlg.h"
 #include "wx/cmndata.h"
 
 #include "wx/mac/fontdlg.h"
 #include "wx/cmndata.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
 IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
+#endif
 
 /*
  * wxFontDialog
 
 /*
  * wxFontDialog
index c5a0f583d673221edbb9fe943360501c6eb14444..4f61d13ff40a7a10b9f71a77498c6c8b71e5b6d7 100644 (file)
 // ----------------------------------------------------------------------------
 
 // convert to/from the string representation: format is
 // ----------------------------------------------------------------------------
 
 // convert to/from the string representation: format is
-//      encodingid;facename[;charset]
+//      facename[;charset]
 
 bool wxNativeEncodingInfo::FromString(const wxString& s)
 {
     wxStringTokenizer tokenizer(s, _T(";"));
 
 
 bool wxNativeEncodingInfo::FromString(const wxString& s)
 {
     wxStringTokenizer tokenizer(s, _T(";"));
 
-    wxString encid = tokenizer.GetNextToken();
-    long enc;
-    if ( !encid.ToLong(&enc) )
-        return FALSE;
-    encoding = (wxFontEncoding)enc;
-
     facename = tokenizer.GetNextToken();
     if ( !facename )
         return FALSE;
     facename = tokenizer.GetNextToken();
     if ( !facename )
         return FALSE;
@@ -85,10 +79,7 @@ bool wxNativeEncodingInfo::FromString(const wxString& s)
 
 wxString wxNativeEncodingInfo::ToString() const
 {
 
 wxString wxNativeEncodingInfo::ToString() const
 {
-    wxString s;
-    
-    s << (long)encoding << _T(';') << facename;
-
+    wxString s(facename);
     if ( charset != 0 )
     {
         s << _T(';') << charset;
     if ( charset != 0 )
     {
         s << _T(';') << charset;
@@ -159,8 +150,6 @@ bool wxGetNativeFontEncoding(wxFontEncoding encoding,
             return FALSE;
     }
 
             return FALSE;
     }
 
-    info->encoding = encoding;
-
     return TRUE;
 }
 
     return TRUE;
 }
 
index cded59c604887d003c26c948ada38447adf10940..b5498fec48450d102bf501997a0d0485eb4d28e5 100644 (file)
@@ -14,7 +14,7 @@
 #endif
 
 #include "wx/frame.h"
 #endif
 
 #include "wx/frame.h"
-#include "wx/statusbr.h"
+#include "wx/mac/statusbr.h"
 #include "wx/toolbar.h"
 #include "wx/menuitem.h"
 #include "wx/menu.h"
 #include "wx/toolbar.h"
 #include "wx/menuitem.h"
 #include "wx/menu.h"
 extern wxList wxModelessWindows;
 extern wxList wxPendingDelete;
 
 extern wxList wxModelessWindows;
 extern wxList wxPendingDelete;
 
-BEGIN_EVENT_TABLE(wxFrame, wxWindow)
-  EVT_SIZE(wxFrame::OnSize)
+#if !USE_SHARED_LIBRARY
+BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
+//  EVT_SIZE(wxFrame::OnSize)
   EVT_ACTIVATE(wxFrame::OnActivate)
   EVT_ACTIVATE(wxFrame::OnActivate)
-  EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
// EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
   EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
   EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
-  EVT_IDLE(wxFrame::OnIdle)
-  EVT_CLOSE(wxFrame::OnCloseWindow)
+//  EVT_IDLE(wxFrame::OnIdle)
+//  EVT_CLOSE(wxFrame::OnCloseWindow)
 END_EVENT_TABLE()
 
 IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
 END_EVENT_TABLE()
 
 IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
+#endif
 
 #if wxUSE_NATIVE_STATUSBAR
 bool wxFrame::m_useNativeStatusBar = TRUE;
 
 #if wxUSE_NATIVE_STATUSBAR
 bool wxFrame::m_useNativeStatusBar = TRUE;
@@ -45,17 +47,43 @@ bool wxFrame::m_useNativeStatusBar = TRUE;
 bool wxFrame::m_useNativeStatusBar = FALSE;
 #endif
 
 bool wxFrame::m_useNativeStatusBar = FALSE;
 #endif
 
-wxFrame::wxFrame()
+#define WX_MAC_STATUSBAR_HEIGHT 15 
+// ----------------------------------------------------------------------------
+// creation/destruction
+// ----------------------------------------------------------------------------
+
+void wxFrame::Init()
 {
 {
-#if wxUSE_TOOLBAR
-  m_frameToolBar = NULL ;
+    m_iconized = FALSE;
+
+#if wxUSE_TOOLTIPS
+    m_hwndToolTip = 0;
 #endif
 #endif
+}
 
 
-       // in order to be able to give size events on show
-  m_frameMenuBar = NULL;
-  m_frameStatusBar = NULL;
-  m_iconized = FALSE;
-  m_isShown = FALSE;
+wxPoint wxFrame::GetClientAreaOrigin() const
+{
+       // on mac we are at position -1,-1 with the control
+    wxPoint pt(0, 0);
+
+#if wxUSE_TOOLBAR
+    if ( GetToolBar() )
+    {
+        int w, h;
+        GetToolBar()->GetSize(& w, & h);
+
+        if ( GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL )
+        {
+            pt.x += w - 1;
+        }
+        else
+        {
+            pt.y += h - 1 ;
+        }
+    }
+#endif // wxUSE_TOOLBAR
+
+    return pt;
 }
 
 bool wxFrame::Create(wxWindow *parent,
 }
 
 bool wxFrame::Create(wxWindow *parent,
@@ -66,13 +94,7 @@ bool wxFrame::Create(wxWindow *parent,
            long style,
            const wxString& name)
 {
            long style,
            const wxString& name)
 {
-  if (!parent)
-    wxTopLevelWindows.Append(this);
-
-  SetName(name);
-  m_windowStyle = style;
   m_frameMenuBar = NULL;
   m_frameMenuBar = NULL;
-  m_isShown = FALSE;
 
 #if wxUSE_TOOLBAR
   m_frameToolBar = NULL ;
 
 #if wxUSE_TOOLBAR
   m_frameToolBar = NULL ;
@@ -88,74 +110,24 @@ bool wxFrame::Create(wxWindow *parent,
 
   if (parent) parent->AddChild(this);
 
 
   if (parent) parent->AddChild(this);
 
-  wxModelessWindows.Append(this);
-
-  // create frame.
-
-       Rect theBoundsRect;
-
-  m_x = (int)pos.x;
-  m_y = (int)pos.y;
-  if ( m_y < 50 )
-       m_y = 50 ;
-  if ( m_x < 20 )
-       m_x = 20 ;
-       
-  m_width = size.x;
-       if (m_width == -1) 
-               m_width = 20;
-  m_height = size.y;
-       if (m_height == -1) 
-               m_height = 20;
+  if (!parent)
+    wxTopLevelWindows.Append(this);
 
 
-       m_macWindowData = new MacWindowData() ;
+  MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
+  
+       m_macWindowData->m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
 
 
-       ::SetRect(&theBoundsRect, m_x, m_y, m_x + m_width, m_y + m_height);
+  wxModelessWindows.Append(this);
 
 
-       WindowClass wclass = kDocumentWindowClass ;
-       WindowAttributes attr = kWindowNoAttributes ;
-       
-       if ( ( m_windowStyle & wxMINIMIZE_BOX ) || ( m_windowStyle & wxMAXIMIZE_BOX ) )
-       {
-               attr |= kWindowFullZoomAttribute ;
-               attr |= kWindowResizableAttribute ;
-       }
-       if ( m_windowStyle & wxSTAY_ON_TOP )
-       {
-               wclass = kFloatingWindowClass ;
-               
-//                     if ( m_windowStyle & wxCAPTION )
-//                             attr |= kHasPaletteTitlebarMask ;
-       }
-       else
-       {
-       }
-       if ( m_windowStyle & wxSYSTEM_MENU )
-       {
-               attr |= kWindowCloseBoxAttribute ;
-       }
-       UMACreateNewWindow( wclass , attr , &theBoundsRect , &m_macWindowData->m_macWindow ) ;
-       wxAssociateWinWithMacWindow( m_macWindowData->m_macWindow , this ) ;
-       wxString label ;
-       if( wxApp::s_macDefaultEncodingIsPC )
-               label = wxMacMakeMacStringFromPC( title ) ;
-       else
-               label = title ;
-       UMASetWTitleC( m_macWindowData->m_macWindow , label ) ;
-       UMACreateRootControl( m_macWindowData->m_macWindow , &m_macWindowData->m_macRootControl ) ;
-       m_macWindowData->m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
-       m_macWindowData->m_macFocus = NULL ;
   return TRUE;
 }
 
 wxFrame::~wxFrame()
 {
   return TRUE;
 }
 
 wxFrame::~wxFrame()
 {
+  m_isBeingDeleted = TRUE;
   wxTopLevelWindows.DeleteObject(this);
 
   wxTopLevelWindows.DeleteObject(this);
 
-  if (m_frameStatusBar)
-    delete m_frameStatusBar;
-  if (m_frameMenuBar)
-    delete m_frameMenuBar;
+  DeleteAllBars();
 
 /* Check if it's the last top-level window */
 
 
 /* Check if it's the last top-level window */
 
@@ -173,11 +145,21 @@ wxFrame::~wxFrame()
 }
 
 
 }
 
 
-void wxFrame::Iconize(bool iconize)
+bool wxFrame::Enable(bool enable)
 {
 {
-    // TODO
-}
+    if ( !wxWindow::Enable(enable) )
+        return FALSE;
 
 
+       if ( m_frameMenuBar && m_frameMenuBar == wxMenuBar::MacGetInstalledMenuBar() )
+       {
+               for ( int i = 0 ; i < m_frameMenuBar->GetMenuCount() ; ++ i )
+               {
+                       m_frameMenuBar->EnableTop( i , enable ) ;
+               }
+       }
+
+    return TRUE;
+}
 // Equivalent to maximize/restore in Windows
 void wxFrame::Maximize(bool maximize)
 {
 // Equivalent to maximize/restore in Windows
 void wxFrame::Maximize(bool maximize)
 {
@@ -190,6 +172,11 @@ bool wxFrame::IsIconized() const
     return FALSE;
 }
 
     return FALSE;
 }
 
+void wxFrame::Iconize(bool iconize)
+{
+    // TODO
+}
+
 // Is the frame maximized?
 bool wxFrame::IsMaximized(void) const
 {
 // Is the frame maximized?
 bool wxFrame::IsMaximized(void) const
 {
@@ -197,10 +184,14 @@ bool wxFrame::IsMaximized(void) const
     return FALSE;
 }
 
     return FALSE;
 }
 
+void wxFrame::Restore()
+{
+    // TODO
+}
+
 void wxFrame::SetIcon(const wxIcon& icon)
 {
 void wxFrame::SetIcon(const wxIcon& icon)
 {
-  m_icon = icon;
-  // TODO
+   wxFrameBase::SetIcon(icon);
 }
 
 wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
 }
 
 wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
@@ -208,61 +199,12 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
 {
     wxStatusBar *statusBar = NULL;
 
 {
     wxStatusBar *statusBar = NULL;
 
-    statusBar = new wxStatusBar(this, id, wxPoint(0, 0), wxSize(100, 17),
-        style, name);
-
-    // Set the height according to the font and the border size
-    // we shouldn't do this on the mac, because we have to fit the grow box
-    /*
-    wxClientDC dc(statusBar);
-    dc.SetFont(statusBar->GetFont());
-
-    long x, y;
-    dc.GetTextExtent("X", &x, &y);
-
-    int height = (int)( (y  * 1.1) + 2* statusBar->GetBorderY());
-
-    statusBar->SetSize(-1, -1, 100, height);
-
-               */
+    statusBar = new wxStatusBar(this, id, style, name);
 
     statusBar->SetFieldsCount(number);
     return statusBar;
 }
 
 
     statusBar->SetFieldsCount(number);
     return statusBar;
 }
 
-wxStatusBar* wxFrame::CreateStatusBar(int number, long style, wxWindowID id,
-    const wxString& name)
-{
-  // Calling CreateStatusBar twice is an error.
-  wxCHECK_MSG( m_frameStatusBar == NULL, FALSE, 
-               "recreating status bar in wxFrame" );
-
-  m_frameStatusBar = OnCreateStatusBar(number, style, id,
-    name);
-  if ( m_frameStatusBar )
-  {
-    PositionStatusBar();
-    return m_frameStatusBar;
-  }
-  else
-    return NULL;
-}
-
-void wxFrame::SetStatusText(const wxString& text, int number)
-{
-  wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" );
-
-  m_frameStatusBar->SetStatusText(text, number);
-}
-
-void wxFrame::SetStatusWidths(int n, const int widths_field[])
-{
-  wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" );
-
-  m_frameStatusBar->SetStatusWidths(n, widths_field);
-  PositionStatusBar();
-}
-
 void wxFrame::PositionStatusBar()
 {
   if (m_frameStatusBar )
 void wxFrame::PositionStatusBar()
 {
   if (m_frameStatusBar )
@@ -274,7 +216,7 @@ void wxFrame::PositionStatusBar()
 
     // Since we wish the status bar to be directly under the client area,
     // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
 
     // Since we wish the status bar to be directly under the client area,
     // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
-    m_frameStatusBar->SetSize(0, h, w, sh);
+    m_frameStatusBar->SetSize(0, h, w, WX_MAC_STATUSBAR_HEIGHT );
    }
 }
 
    }
 }
 
@@ -282,43 +224,15 @@ void wxFrame::SetMenuBar(wxMenuBar *menuBar)
 {
     if (!menuBar)
     {
 {
     if (!menuBar)
     {
-        m_frameMenuBar = NULL;
         return;
     }
   
         return;
     }
   
+    m_frameMenuBar = NULL;
     m_frameMenuBar = menuBar;
     m_frameMenuBar = menuBar;
-               // TODO : we move this into the app code
     m_frameMenuBar->MacInstallMenuBar() ;
     m_frameMenuBar->MacInstallMenuBar() ;
+    m_frameMenuBar->Attach(this);
 }
 
 }
 
-void wxFrame::Fit()
-{
-  // Work out max. size
-  wxNode *node = GetChildren().First();
-  int max_width = 0;
-  int max_height = 0;
-  while (node)
-  {
-    // Find a child that's a subwindow, but not a dialog box.
-    wxWindow *win = (wxWindow *)node->Data();
-
-    if (!win->IsKindOf(CLASSINFO(wxFrame)) &&
-         !win->IsKindOf(CLASSINFO(wxDialog)))
-    {
-      int width, height;
-      int x, y;
-      win->GetSize(&width, &height);
-      win->GetPosition(&x, &y);
-
-      if ((x + width) > max_width)
-        max_width = x + width;
-      if ((y + height) > max_height)
-        max_height = y + height;
-    }
-    node = node->Next();
-  }
-  SetClientSize(max_width, max_height);
-}
 
 // Responds to colour changes, and passes event on to children.
 void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
 
 // Responds to colour changes, and passes event on to children.
 void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
@@ -337,217 +251,55 @@ void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
     wxWindow::OnSysColourChanged(event);
 }
 
     wxWindow::OnSysColourChanged(event);
 }
 
-// Default resizing behaviour - if only ONE subwindow,
-// resize to client rectangle size
-void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) )
-{
-    DoMenuUpdates();
-}
-
-
-// update all menus
-void wxFrame::DoMenuUpdates()
-{
-    wxMenuBar* bar = GetMenuBar();
-
-    if ( bar != NULL )
-    {
-        int nCount = bar->GetMenuCount();
-        for (int n = 0; n < nCount; n++)
-            DoMenuUpdates(bar->GetMenu(n), (wxWindow*) NULL);
-    }
-}
-
-// update a menu and all submenus recursively
-void wxFrame::DoMenuUpdates(wxMenu* menu, wxWindow* WXUNUSED(focusWin))
-{
-    wxEvtHandler* evtHandler = GetEventHandler();
-    wxMenuItemList::Node* node = menu->GetMenuItems().GetFirst();
-    while (node)
-    {
-        wxMenuItem* item = node->GetData();
-        if ( !item->IsSeparator() )
-        {
-            wxWindowID id = item->GetId();
-            wxUpdateUIEvent event(id);
-            event.SetEventObject( this );
-
-            if (evtHandler->ProcessEvent(event))
-            {
-                if (event.GetSetText())
-                    menu->SetLabel(id, event.GetText());
-                if (event.GetSetChecked())
-                    menu->Check(id, event.GetChecked());
-                if (event.GetSetEnabled())
-                    menu->Enable(id, event.GetEnabled());
-            }
-
-            if (item->GetSubMenu())
-                DoMenuUpdates(item->GetSubMenu(), (wxWindow*) NULL);
-        }
-        node = node->GetNext();
-    }
-}
-
-void wxFrame::OnSize(wxSizeEvent& event)
-{
-  // if we're using constraints - do use them
-  #if wxUSE_CONSTRAINTS
-    if ( GetAutoLayout() ) {
-      Layout();
-      return;
-    }
-  #endif
-
-  // do we have _exactly_ one child?
-  wxWindow *child = NULL;
-  for ( wxNode *node = GetChildren().First(); node; node = node->Next() )
-  {
-    wxWindow *win = (wxWindow *)node->Data();
-    if ( !win->IsKindOf(CLASSINFO(wxFrame))  &&
-         !win->IsKindOf(CLASSINFO(wxDialog)) && 
-         (win != GetStatusBar()) 
-#if wxUSE_TOOLBAR
-         &&
-         (win != GetToolBar()) 
-#endif
-         )
-    {
-      if ( child )
-        return;     // it's our second subwindow - nothing to do
-      child = win;
-    }
-  }
-
-  if ( child ) {
-    // we have exactly one child - set it's size to fill the whole frame
-    int clientW, clientH;
-    GetClientSize(&clientW, &clientH);
-
-    int x = 0;
-    int y = 0;
-
-    child->SetSize(x, y, clientW, clientH);
-  }
-}
 
 // Default activation behaviour - set the focus for the first child
 // subwindow found.
 void wxFrame::OnActivate(wxActivateEvent& event)
 {
 
 // Default activation behaviour - set the focus for the first child
 // subwindow found.
 void wxFrame::OnActivate(wxActivateEvent& event)
 {
-  for(wxNode *node = GetChildren().First(); node; node = node->Next())
-  {
-    // Find a child that's a subwindow, but not a dialog box.
-    wxWindow *child = (wxWindow *)node->Data();
-    if (!child->IsKindOf(CLASSINFO(wxFrame)) &&
-         !child->IsKindOf(CLASSINFO(wxDialog)))
+    if ( !event.GetActive() )
     {
     {
-      child->SetFocus();
-      return;
+        event.Skip();
+        return;
     }
     }
-  }
-}
-
-// The default implementation for the close window event.
-void wxFrame::OnCloseWindow(wxCloseEvent& event)
-{
-    this->Destroy();
-}
-
-// Destroy the window (delayed, if a managed window)
-bool wxFrame::Destroy()
-{
-  if (!wxPendingDelete.Member(this))
-    wxPendingDelete.Append(this);
-  return TRUE;
-}
 
 
-// Default menu selection behaviour - display a help string
-void wxFrame::OnMenuHighlight(wxMenuEvent& event)
-{
-  if (GetStatusBar())
-  {
-    if (event.GetMenuId() == -1)
-      SetStatusText("");
-    else
+    for ( wxWindowList::Node *node = GetChildren().GetFirst();
+          node;
+          node = node->GetNext() )
     {
     {
-      wxMenuBar *menuBar = GetMenuBar();
-      if (menuBar)
-      {
-        wxString helpString(menuBar->GetHelpString(event.GetMenuId()));
-        if (helpString != "")
-          SetStatusText(helpString);
-      }
-    }
-  }
-}
-
-wxMenuBar *wxFrame::GetMenuBar() const
-{
-  return m_frameMenuBar;
-}
+        // FIXME all this is totally bogus - we need to do the same as wxPanel,
+        //       but how to do it without duplicating the code?
 
 
+        // restore focus
+        wxWindow *child = node->GetData();
 
 
-// Call this to simulate a menu command
-void wxFrame::Command(int id)
-{
-  ProcessCommand(id);
-}
-
-void wxFrame::ProcessCommand(int id)
-{
-  wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, id);
-  commandEvent.SetInt( id );
-  commandEvent.SetEventObject( this );
-
-  wxMenuBar *bar = GetMenuBar() ;
-  if (!bar)
-    return;
-
-/* TODO: check the menu item if required
-  wxMenuItem *item = bar->FindItemForId(id) ;
-  if (item && item->IsCheckable())
-  {
-    bar->Check(id,!bar->Checked(id)) ;
-  }
-*/
-
-  GetEventHandler()->ProcessEvent(commandEvent);
-}
-
-// Checks if there is a toolbar, and returns the first free client position
-wxPoint wxFrame::GetClientAreaOrigin() const
-{
-    wxPoint pt(0, 0);
+        if ( !child->IsTopLevel()
 #if wxUSE_TOOLBAR
 #if wxUSE_TOOLBAR
-    if (GetToolBar())
-    {
-        int w, h;
-        GetToolBar()->GetSize(& w, & h);
-
-        if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL)
+             && !wxDynamicCast(child, wxToolBar)
+#endif // wxUSE_TOOLBAR
+#if wxUSE_STATUSBAR
+             && !wxDynamicCast(child, wxStatusBar)
+#endif // wxUSE_STATUSBAR
+           )
         {
         {
-            pt.x += w;
-        }
-        else
-        {
-            pt.y += h;
+            child->SetFocus();
+            return;
         }
     }
         }
     }
-#endif
-    return pt;
 }
 
 void wxFrame::DoGetClientSize(int *x, int *y) const
 {
        wxWindow::DoGetClientSize( x , y ) ;
 
 }
 
 void wxFrame::DoGetClientSize(int *x, int *y) const
 {
        wxWindow::DoGetClientSize( x , y ) ;
 
+#if wxUSE_STATUSBAR
   if ( GetStatusBar() )
   {
     int statusX, statusY;
     GetStatusBar()->GetClientSize(&statusX, &statusY);
   if ( GetStatusBar() )
   {
     int statusX, statusY;
     GetStatusBar()->GetClientSize(&statusX, &statusY);
-    *y -= statusY;
+    // right now this is a constant, this might change someday
+    *y -= WX_MAC_STATUSBAR_HEIGHT ;
   }
   }
+#endif // wxUSE_STATUSBAR
 
   wxPoint pt(GetClientAreaOrigin());
   *y -= pt.y;
 
   wxPoint pt(GetClientAreaOrigin());
   *y -= pt.y;
@@ -576,39 +328,20 @@ void wxFrame::DoSetClientSize(int clientwidth, int clientheight)
 #if wxUSE_TOOLBAR
 wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
 {
 #if wxUSE_TOOLBAR
 wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
 {
-    wxCHECK_MSG( m_frameToolBar == NULL, FALSE,
-               "recreating toolbar in wxFrame" );
-
-    wxToolBar* toolBar = OnCreateToolBar(style, id, name);
-    if (toolBar)
+    if ( wxFrameBase::CreateToolBar(style, id, name) )
     {
     {
-        SetToolBar(toolBar);
         PositionToolBar();
         PositionToolBar();
-        return toolBar;
-    }
-    else
-    {
-        return NULL;
     }
     }
-}
 
 
-wxToolBar* wxFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& name)
-{
-    return new wxToolBar(this, id, wxDefaultPosition, wxDefaultSize, style, name);
+    return m_frameToolBar;
 }
 
 void wxFrame::PositionToolBar()
 {
     int cw, ch;
 
 }
 
 void wxFrame::PositionToolBar()
 {
     int cw, ch;
 
-    // TODO: we actually need to use the low-level client size, before
-    // the toolbar/status bar were added.
-    // So DEFINITELY replace the line below with something appropriate.
-
-   //  GetClientSize(& cw, &ch);
-
-               cw = m_width ;
-               ch = m_height ;
+       cw = m_width ;
+       ch = m_height ;
 
     if ( GetStatusBar() )
     {
 
     if ( GetStatusBar() )
     {
@@ -627,12 +360,12 @@ void wxFrame::PositionToolBar()
             // Use the 'real' position. wxSIZE_NO_ADJUSTMENTS
             // means, pretend we don't have toolbar/status bar, so we
             // have the original client size.
             // Use the 'real' position. wxSIZE_NO_ADJUSTMENTS
             // means, pretend we don't have toolbar/status bar, so we
             // have the original client size.
-            GetToolBar()->SetSize(0, 0, tw, ch, wxSIZE_NO_ADJUSTMENTS);
+            GetToolBar()->SetSize(-1, -1, tw, ch + 2 , wxSIZE_NO_ADJUSTMENTS | wxSIZE_ALLOW_MINUS_ONE );
         }
         else
         {
             // Use the 'real' position
         }
         else
         {
             // Use the 'real' position
-            GetToolBar()->SetSize(0, 0, cw, th, wxSIZE_NO_ADJUSTMENTS);
+            GetToolBar()->SetSize(-1, -1, cw + 2, th, wxSIZE_NO_ADJUSTMENTS | wxSIZE_ALLOW_MINUS_ONE );
         }
     }
 }
         }
     }
 }
index be0d0d0a3c904d1983126b5abc2aa3339f81f55a..67d5dd9c845ff2db660fd5d9efcc6d6cb1a65adf 100644 (file)
@@ -15,7 +15,9 @@
 
 #include "wx/gauge.h"
 
 
 #include "wx/gauge.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
+#endif
 
 #include <wx/mac/uma.h>
 
 
 #include <wx/mac/uma.h>
 
@@ -31,15 +33,13 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
        Rect bounds ;
        Str255 title ;
        m_rangeMax = range ;
        Rect bounds ;
        Str255 title ;
        m_rangeMax = range ;
-       m_macHorizontalBorder = 2 ; // additional pixels around the real control
-       m_macVerticalBorder = 2 ;
        
        if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
        {
                size = wxSize( 200 , 16 ) ;
        }
        
        
        if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
        {
                size = wxSize( 200 , 16 ) ;
        }
        
-       MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
+       MacPreControlCreate( parent , id ,  "" , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , range, 
                kControlProgressBarProc , (long) this ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , range, 
                kControlProgressBarProc , (long) this ) ;
@@ -66,7 +66,7 @@ void wxGauge::SetRange(int r)
 void wxGauge::SetValue(int pos)
 {
     m_gaugePos = pos;
 void wxGauge::SetValue(int pos)
 {
     m_gaugePos = pos;
-   ::SetControlValue( m_macControl , m_gaugePos ) ;
+       ::SetControlValue( m_macControl , m_gaugePos ) ;
 }
 
 int wxGauge::GetShadowWidth() const
 }
 
 int wxGauge::GetShadowWidth() const
index 46b1aa871fc57fd8ed02bd1ad813ad4655bfb5bd..63697c835427fdea399f1bf61d3a3b046d4af9c9 100644 (file)
@@ -15,6 +15,8 @@
 
 #include "wx/gdiobj.h"
 
 
 #include "wx/gdiobj.h"
 
+#if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
 IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
+#endif
 
 // TODO: Nothing to do, unless you want to.
 
 // TODO: Nothing to do, unless you want to.
index b7f0babfa212b608402e9a04bf273570e904b878..086762c6462598ee2843740606907910b37c451e 100644 (file)
@@ -17,7 +17,9 @@
 
 #include <string.h>
 
 
 #include <string.h>
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxXXXXHelpController, wxHelpControllerBase)
 IMPLEMENT_DYNAMIC_CLASS(wxXXXXHelpController, wxHelpControllerBase)
+#endif
 
 wxXXXXHelpController::wxXXXXHelpController()
 {
 
 wxXXXXHelpController::wxXXXXHelpController()
 {
index 2fb0616ba868dd7be6f3d61460c6c464f2489fed..4ec1f1b5e95bc4dc2386b4965e9b28ac87ec1c84 100644 (file)
@@ -15,7 +15,9 @@
 
 #include "wx/icon.h"
 
 
 #include "wx/icon.h"
 
+#if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
 IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
+#endif
 
 /*
  * Icons
 
 /*
  * Icons
@@ -58,6 +60,14 @@ wxIcon::wxIcon(const char WXUNUSED(bits)[], int WXUNUSED(width), int WXUNUSED(he
 {
 }
 
 {
 }
 
+wxIcon::wxIcon( const char **bits, int width, int height )
+{
+}
+
+wxIcon::wxIcon( char **bits, int width, int height )
+{
+}
+
 wxIcon::wxIcon(const wxString& icon_file, long flags,
     int desiredWidth, int desiredHeight)
 
 wxIcon::wxIcon(const wxString& icon_file, long flags,
     int desiredWidth, int desiredHeight)
 
@@ -96,20 +106,23 @@ bool  wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo
        c2pstr( (char*) theName ) ;
        
        Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
        c2pstr( (char*) theName ) ;
        
        Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
-       GetResInfo( resHandle , &theId , &theType , theName ) ;
-       ReleaseResource( resHandle ) ;
-       
-       CIconHandle theIcon = (CIconHandle ) GetCIcon( theId ) ;
-       if ( theIcon )
+       if ( resHandle != 0L )
        {
        {
-               M_ICONHANDLERDATA->m_hIcon = theIcon ;
-               M_ICONHANDLERDATA->m_width =  32 ;
-               M_ICONHANDLERDATA->m_height = 32 ;
+               GetResInfo( resHandle , &theId , &theType , theName ) ;
+               ReleaseResource( resHandle ) ;
                
                
-               M_ICONHANDLERDATA->m_depth = 8 ;
-               M_ICONHANDLERDATA->m_ok = true ;
-               M_ICONHANDLERDATA->m_numColors = 256 ;
-               return TRUE ;
+               CIconHandle theIcon = (CIconHandle ) GetCIcon( theId ) ;
+               if ( theIcon )
+               {
+                       M_ICONHANDLERDATA->m_hIcon = theIcon ;
+                       M_ICONHANDLERDATA->m_width =  32 ;
+                       M_ICONHANDLERDATA->m_height = 32 ;
+                       
+                       M_ICONHANDLERDATA->m_depth = 8 ;
+                       M_ICONHANDLERDATA->m_ok = true ;
+                       M_ICONHANDLERDATA->m_numColors = 256 ;
+                       return TRUE ;
+               }
        }
        return FALSE ;
        }
        return FALSE ;
-}
+}
\ No newline at end of file
index cb4b9ff01c4da817ba0904b0416fcaf1b6a7782e..4cb47b4e693ba6a9a223ded7a417fd4336e80087 100644 (file)
@@ -15,7 +15,9 @@
 
 #include "wx/stubs/imaglist.h"
 
 
 #include "wx/stubs/imaglist.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject)
 IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject)
+#endif
 
 wxImageList::wxImageList()
 {
 
 wxImageList::wxImageList()
 {
index 683219907daebbe2602fd2a00fd2aebbd5dad4ce..8daa77eb88452c813c9c9be2c15555233361527e 100644 (file)
@@ -53,7 +53,9 @@ static void DisposeExtLDEFInfo( ListHandle lh)
        ExtLDEFInfo* info = (ExtLDEFInfo* )  (**lh).refCon ;
        if ( info )
        {
        ExtLDEFInfo* info = (ExtLDEFInfo* )  (**lh).refCon ;
        if ( info )
        {
+       #if !TARGET_CARBON
                DisposeRoutineDescriptor( (RoutineDescriptor*) info->drawProc ) ;
                DisposeRoutineDescriptor( (RoutineDescriptor*) info->drawProc ) ;
+       #endif
                free( (void*) (**lh).refCon ) ;
        }
 }
                free( (void*) (**lh).refCon ) ;
        }
 }
index c518ad035ccb495731dd670ffaf0ce91a5874f3e..6564af7b7777ee1a33213e0a7cea0433eb16561a 100644 (file)
 #include "wx/utils.h"
 #include "extldef.h"
 
 #include "wx/utils.h"
 #include "extldef.h"
 
+#if !USE_SHARED_LIBRARY
   IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
 
 BEGIN_EVENT_TABLE(wxListBox, wxControl)
        EVT_SIZE( wxListBox::OnSize ) 
 END_EVENT_TABLE()
   IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
 
 BEGIN_EVENT_TABLE(wxListBox, wxControl)
        EVT_SIZE( wxListBox::OnSize ) 
 END_EVENT_TABLE()
+#endif
 
 #include <wx/mac/uma.h>
 
 
 #include <wx/mac/uma.h>
 
@@ -41,6 +43,7 @@ wxListBox::wxListBox()
 {
   m_noItems = 0;
   m_selected = 0;
 {
   m_noItems = 0;
   m_selected = 0;
+  m_macList = NULL ;
 }
 
 bool wxListBox::Create(wxWindow *parent, wxWindowID id,
 }
 
 bool wxListBox::Create(wxWindow *parent, wxWindowID id,
@@ -56,8 +59,6 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
 
        Rect bounds ;
        Str255 title ;
 
        Rect bounds ;
        Str255 title ;
-       m_macHorizontalBorder = 5 ; // additional pixels around the real control
-       m_macVerticalBorder = 5 ;
        
        MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
 
        
        MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
 
@@ -67,6 +68,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
        long    result ;
        UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxListHandleTag , sizeof( ListHandle ) , (char*) &m_macList  , &result ) ;
 
        long    result ;
        UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxListHandleTag , sizeof( ListHandle ) , (char*) &m_macList  , &result ) ;
 
+       HLock( (Handle) m_macList ) ;
        NewExtLDEFInfo( m_macList , MacDrawStringCell , (long) this ) ;
        (**m_macList).selFlags = 0 ;
        if ( style & wxLB_MULTIPLE )
        NewExtLDEFInfo( m_macList , MacDrawStringCell , (long) this ) ;
        (**m_macList).selFlags = 0 ;
        if ( style & wxLB_MULTIPLE )
@@ -109,7 +111,11 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
 wxListBox::~wxListBox()
 {
        Free() ;
 wxListBox::~wxListBox()
 {
        Free() ;
-       DisposeExtLDEFInfo( m_macList ) ;
+       if ( m_macList )
+       {
+               DisposeExtLDEFInfo( m_macList ) ;
+               m_macList = NULL ;
+       }
 }
 
 void wxListBox::Free()
 }
 
 void wxListBox::Free()
@@ -156,7 +162,7 @@ void wxListBox::Delete(int N)
 #endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
        m_stringArray.Remove( N ) ;
        m_dataArray.Remove( N ) ;
 #endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
        m_stringArray.Remove( N ) ;
        m_dataArray.Remove( N ) ;
-       m_noItems --;
+       m_noItems --;
        
        MacDelete( N ) ;
 }
        
        MacDelete( N ) ;
 }
@@ -236,19 +242,29 @@ int wxListBox::FindString(const wxString& st) const
        {
                wxString search = s.Left( s.Length() - 1 ) ;
                int len = search.Length() ;
        {
                wxString search = s.Left( s.Length() - 1 ) ;
                int len = search.Length() ;
-    for ( int i = 0 ; i < m_noItems ; ++ i )
-    {
-       if ( equalstring( m_stringArray[i].Left( len ) , search , false , false ) )
-               return i ;
-    }
+       Str255 s1 , s2 ;
+           strcpy( (char*) s2 , search.c_str() ) ;
+           c2pstr( (char*) s2 ) ;
+       for ( int i = 0 ; i < m_noItems ; ++ i )
+           {
+               strcpy( (char*) s1 , m_stringArray[i].Left( len ).c_str() ) ;
+               c2pstr( (char*) s1 ) ;
+               if ( EqualString( s1 , s2 , false , false ) )
+                       return i ;
+           }
        }
        else
        {
        }
        else
        {
-    for ( int i = 0 ; i < m_noItems ; ++ i )
-    {
-       if ( equalstring( m_stringArray[i] , s , false , false ) )
-               return i ;
-    }
+       Str255 s1 , s2 ;
+           strcpy( (char*) s2 , s.c_str() ) ;
+           c2pstr( (char*) s2 ) ;
+           for ( int i = 0 ; i < m_noItems ; ++ i )
+           {
+               strcpy( (char*) s1 , m_stringArray[i].c_str() ) ;
+               c2pstr( (char*) s1 ) ;
+               if ( EqualString( s1 , s2 , false , false ) )
+                       return i ;
+           }
    }
    return -1;
 }
    }
    return -1;
 }
@@ -308,7 +324,7 @@ void wxListBox::DoSetItemClientData(int N, void *Client_data)
        if ( m_dataArray.GetCount() > N )
        {
        m_dataArray[N] = (char*) Client_data ;
        if ( m_dataArray.GetCount() > N )
        {
        m_dataArray[N] = (char*) Client_data ;
-       }
+    }
     else
     {
        m_dataArray.Add( (char*) Client_data ) ;
     else
     {
        m_dataArray.Add( (char*) Client_data ) ;
@@ -379,7 +395,14 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
 
 void wxListBox::SetString(int N, const wxString& s)
 {
 
 void wxListBox::SetString(int N, const wxString& s)
 {
-       m_stringArray[N] = s ;
+       wxString str ;
+       if( wxApp::s_macDefaultEncodingIsPC )
+       {
+               str = wxMacMakeMacStringFromPC( s )  ;
+       }
+       else
+               str = s ;
+       m_stringArray[N] = str ;
        MacSet( N , s ) ;
 }
 
        MacSet( N , s ) ;
 }
 
@@ -539,7 +562,7 @@ void wxListBox::MacScrollTo( int n )
 void wxListBox::OnSize( const wxSizeEvent &event)
 {
        Point pt = (**m_macList).cellSize ;
 void wxListBox::OnSize( const wxSizeEvent &event)
 {
        Point pt = (**m_macList).cellSize ;
-       pt.h =  m_width - 15 /* scrollbar */ - m_macHorizontalBorder * 2 ;
+       pt.h =  m_width - 15  ;
        LCellSize( pt , m_macList ) ;
 }
 
        LCellSize( pt , m_macList ) ;
 }
 
index 2c11981bf2621628487b9d2ef9283c4895f9bb4d..d1d844565201ff29c49e1f4de52ee49ec1495579 100644 (file)
 #include "wx/stubs/textctrl.h"
 #include "wx/stubs/listctrl.h"
 
 #include "wx/stubs/textctrl.h"
 #include "wx/stubs/listctrl.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject)
 
 IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject)
 
+#endif
 
 wxListCtrl::wxListCtrl()
 {
 
 wxListCtrl::wxListCtrl()
 {
index 8672b2f8973cd7e74390e3fe7863f4a06dde6737..887f726504c62372d91931ae79baa126d0e637ad 100644 (file)
@@ -19,6 +19,7 @@
 
 extern wxList wxModelessWindows;
 
 
 extern wxList wxModelessWindows;
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
 IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
 IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
 IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
 IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
 IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
@@ -33,6 +34,7 @@ BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
   EVT_SCROLL(wxMDIClientWindow::OnScroll)
 END_EVENT_TABLE()
 
   EVT_SCROLL(wxMDIClientWindow::OnScroll)
 END_EVENT_TABLE()
 
+#endif
 
 // Parent frame
 
 
 // Parent frame
 
@@ -61,7 +63,7 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
     else
         m_windowId = (int)NewControlId();
 
     else
         m_windowId = (int)NewControlId();
 
-    // TODO: create MDI parent frame
+       // this window does not exist really
 
     wxModelessWindows.Append(this);
 
 
     wxModelessWindows.Append(this);
 
@@ -75,7 +77,7 @@ wxMDIParentFrame::~wxMDIParentFrame()
 // Get size *available for subwindows* i.e. excluding menu bar.
 void wxMDIParentFrame::DoGetClientSize(int *x, int *y) const
 {
 // Get size *available for subwindows* i.e. excluding menu bar.
 void wxMDIParentFrame::DoGetClientSize(int *x, int *y) const
 {
-   wxFrame::DoGetClientSize( x , y ) ;
+       wxDisplaySize( x , y ) ;
 }
 
 void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
 }
 
 void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
@@ -175,7 +177,9 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
 
     if (parent) parent->AddChild(this);
 
 
     if (parent) parent->AddChild(this);
 
-    // TODO: create child frame
+       MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
+  
+       m_macWindowData->m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
 
     wxModelessWindows.Append(this);
     return FALSE;
 
     wxModelessWindows.Append(this);
     return FALSE;
index 427db90852fd76c82b19f57c160a7b38ebd20c00..9a66f806d2a33aa0cdb10eba2d5f9afe160aea1c 100644 (file)
 // ----------------------
 #include <string.h>
 
 // ----------------------
 #include <string.h>
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
 IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler)
 IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
 IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler)
+#endif
 
 // the (popup) menu title has this special id
 static const int idMenuTitle = -2;
 
 // the (popup) menu title has this special id
 static const int idMenuTitle = -2;
@@ -47,145 +49,6 @@ const short kwxMacAppleMenuId = 1 ;
 // implementation
 // ============================================================================
 
 // implementation
 // ============================================================================
 
-//
-// Helper Functions to get Mac Menus the way they should be ;-)
-//
-
-void wxMacCtoPString(const char* theCString, Str255 thePString);
-
-// remove inappropriate characters, if useShortcuts is false, the ampersand will not auto-generate a mac menu-shortcut
-
-void wxMacBuildMenuString(StringPtr outMacItemText, char *outMacShortcutChar , short *outMacModifiers , const char *inItemText , bool useShortcuts )
-{
-       char *p = (char *) &outMacItemText[1] ;
-       short macModifiers = 0 ;
-       char macShortCut = 0 ;
-       const char *inItemName ;
-       wxString inItemTextMac ;
-       
-       if (wxApp::s_macDefaultEncodingIsPC)
-       {
-               inItemTextMac =  wxMacMakeMacStringFromPC( inItemText ) ;
-               inItemName = inItemTextMac ;
-       }
-       else
-       {
-               inItemName = inItemText ;
-       }
-       
-       if ( useShortcuts && !wxApp::s_macSupportPCMenuShortcuts )
-               useShortcuts = false ;
-       
-       // we have problems with a leading hypen - it will be taken as a separator
-       
-       while ( *inItemName == '-' )
-               inItemName++ ;
-               
-       while( *inItemName )
-       {
-               switch ( *inItemName )
-               {
-                       // special characters for macintosh menus -> use some replacement
-                       case ';' :
-                               *p++ = ',' ;
-                               break ;
-                       case '^' :
-                               *p++ = ' ' ;
-                               break ;
-                       case '!' :
-                               *p++ = ' ' ;
-                               break ;
-                       case '<' :
-                               *p++ = ' ' ;
-                               break ;
-                       case '/' :
-                               *p++ = '|' ;
-                               break ;
-                       case '(' :
-                               *p++ = '[' ;
-                               break ;
-                       case ')' :      
-                               *p++ = ']' ;
-                               break ;
-                       // shortcuts
-                       case '&' :
-                               {
-                                       ++inItemName ;
-                                       if ( *inItemName )
-                                       {
-                                               *p++ = *inItemName ;
-                                               if ( useShortcuts )
-                                                       macShortCut = *inItemName ;
-                                       }
-                                       else
-                                               --inItemName ;
-                               }
-                               break ;
-                       // win-like accelerators
-                       case '\t' :
-                               {
-                                       ++inItemName ;
-                                       while( *inItemName )
-                                       {
-                                               if (strncmp("Ctrl", inItemName, 4) == 0) 
-                                               {
-                                                       inItemName = inItemName + 5;
-                                                       macShortCut = *inItemName;
-                                               }
-                                               else if  (strncmp("Cntrl", inItemName, 5) == 0) 
-                                               {
-                                                       inItemName = inItemName + 6;
-                                                       macShortCut = *inItemName;
-                                               }
-                                               else if (strncmp("Alt", inItemName, 3) == 0) 
-                                               {
-                                                       inItemName = inItemName + 4;
-                                                       macModifiers |= kMenuOptionModifier ;
-                                                       macShortCut = *inItemName ;
-                                               }
-                                               else if (strncmp("Shift", inItemName, 5) == 0) 
-                                               {
-                                                       inItemName = inItemName + 6;
-                                                       macModifiers |= kMenuShiftModifier ;
-                                                       macShortCut = *inItemName ;
-                                               }
-                                               else if (strncmp("F", inItemName, 1) == 0) 
-                                               {
-                                                       inItemName += strlen( inItemName ) ;
-                                                       // no function keys at the moment
-                                                       // macModifiers |= kMenuShiftModifier ;
-                                                       // macShortCut = *inItemName ;
-                                               }
-                                               else
-                                               {
-                                                       break ;
-                                               }
-                                       }
-
-                                       if ( *inItemName == 0 )
-                                               --inItemName ;
-                                               
-                               }
-                               break ;
-                       default :
-                               *p++ = *inItemName ;
-               }
-               ++inItemName ;
-       }
-
-       outMacItemText[0] = (p - (char *)outMacItemText) - 1;
-       if ( outMacShortcutChar )
-               *outMacShortcutChar = macShortCut ;
-       if ( outMacModifiers )
-               *outMacModifiers = macModifiers ;
-       if ( macShortCut )
-       {
-                       int pos = outMacItemText[0] ;
-                       outMacItemText[++pos] = '/';
-                       outMacItemText[++pos] = toupper( macShortCut );
-                       outMacItemText[0] = pos ;
-       }
-}
 
 // Menus
 
 
 // Menus
 
@@ -199,10 +62,10 @@ void wxMenu::Init()
 
     // create the menu
        Str255  label;
 
     // create the menu
        Str255  label;
-       wxMacBuildMenuString( label, NULL , NULL , m_title , false );
+       wxMenuItem::MacBuildMenuString( label, NULL , NULL , m_title , false );
        m_macMenuId = s_macNextMenuId++; 
     wxCHECK_RET( s_macNextMenuId < 236 , "menu ids > 235 cannot be used for submenus on mac" );
        m_macMenuId = s_macNextMenuId++; 
     wxCHECK_RET( s_macNextMenuId < 236 , "menu ids > 235 cannot be used for submenus on mac" );
-       m_hMenu = ::NewMenu(m_macMenuId, label);
+       m_hMenu = UMANewMenu(m_macMenuId, label);
 
     if ( !m_hMenu )
     {
 
     if ( !m_hMenu )
     {
@@ -220,7 +83,7 @@ void wxMenu::Init()
 wxMenu::~wxMenu()
 {
        if (m_hMenu)
 wxMenu::~wxMenu()
 {
        if (m_hMenu)
-               ::DisposeMenu(m_hMenu);
+               UMADisposeMenu(m_hMenu);
 
 #if wxUSE_ACCEL
     // delete accels
 
 #if wxUSE_ACCEL
     // delete accels
@@ -310,38 +173,28 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
                        Str255 label;
                        wxASSERT_MSG( pSubMenu->m_hMenu != NULL , "invalid submenu added");
                    pSubMenu->m_menuParent = this ;
                        Str255 label;
                        wxASSERT_MSG( pSubMenu->m_hMenu != NULL , "invalid submenu added");
                    pSubMenu->m_menuParent = this ;
-                       wxMacBuildMenuString( label , NULL , NULL , pItem->GetText() ,false);
-               
-                       // hardcoded adding of the submenu combination for mac
+                       wxMenuItem::MacBuildMenuString( label , NULL , NULL , pItem->GetText() ,false);
                
                
-                       int theEnd = label[0] + 1; 
-                       if (theEnd > 251) 
-                               theEnd = 251; // mac allows only 255 characters
-                       label[theEnd++] = '/';
-                       label[theEnd++] = hMenuCmd; 
-                       label[theEnd++] = '!';
-                       label[theEnd++] = pSubMenu->m_macMenuId; 
-                       label[theEnd] = 0x00;
-                       label[0] = theEnd;
-
                        if (wxMenuBar::MacGetInstalledMenuBar() == m_menuBar) 
                        {
                        if (wxMenuBar::MacGetInstalledMenuBar() == m_menuBar) 
                        {
-                               ::InsertMenu( pSubMenu->m_hMenu , -1 ) ;
+                               UMAInsertMenu( pSubMenu->m_hMenu , -1 ) ;
                        }
                        
                        if ( pos == (size_t)-1 )
                        {
                        }
                        
                        if ( pos == (size_t)-1 )
                        {
-                               MacAppendMenu(m_hMenu, label);
+                               UMAAppendSubMenuItem(m_hMenu, label, pSubMenu->m_macMenuId);
                        }
                        else
                        {
                        }
                        else
                        {
-                               MacInsertMenuItem(m_hMenu, label , pos);
+                               UMAInsertSubMenuItem(m_hMenu, label , pos, pSubMenu->m_macMenuId);
                        }
                }
                else
                {
                        Str255 label ;
                        }
                }
                else
                {
                        Str255 label ;
-                       wxMacBuildMenuString( label , NULL , NULL , pItem->GetText(), pItem->GetId() == wxApp::s_macAboutMenuItemId);
+                       UInt8 modifiers ;
+                       SInt16 key ;
+                       wxMenuItem::MacBuildMenuString( label, &key  , &modifiers , pItem->GetText(), pItem->GetId() == wxApp::s_macAboutMenuItemId);
                        if ( label[0] == 0 )
                        {
                                // we cannot add empty menus on mac
                        if ( label[0] == 0 )
                        {
                                // we cannot add empty menus on mac
@@ -350,17 +203,17 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
                        }
                        if ( pos == (size_t)-1 )
                        {
                        }
                        if ( pos == (size_t)-1 )
                        {
-                               MacAppendMenu(m_hMenu, label);
+                               UMAAppendMenuItem(m_hMenu, label,key,modifiers);
                        }
                        else
                        {
                        }
                        else
                        {
-                               MacInsertMenuItem(m_hMenu, label , pos);
+                               UMAInsertMenuItem(m_hMenu, label , pos,key,modifiers);
                        }
                        if ( pItem->GetId() == idMenuTitle ) 
                        {
                                if ( pos == (size_t)-1 )
                                {
                        }
                        if ( pItem->GetId() == idMenuTitle ) 
                        {
                                if ( pos == (size_t)-1 )
                                {
-                                       UMADisableMenuItem( m_hMenu , CountMItems( m_hMenu ) ) ;
+                                       UMADisableMenuItem( m_hMenu , CountMenuItems( m_hMenu ) ) ;
                                }
                                else
                                {
                                }
                                else
                                {
@@ -452,113 +305,9 @@ void wxMenu::SetTitle(const wxString& label)
 {
        Str255 title ;
     m_title = label ;
 {
        Str255 title ;
     m_title = label ;
-       wxMacBuildMenuString( title, NULL , NULL , label , false );
+       wxMenuItem::MacBuildMenuString( title, NULL , NULL , label , false );
        UMASetMenuTitle( m_hMenu , title ) ;
 }
        UMASetMenuTitle( m_hMenu , title ) ;
 }
-
-/*
-
-void wxMenu::SetLabel(int id, const wxString& label)
-{
-    Str255 maclabel ;
-   int index ;
-    wxMenuItem *item = FindItemForId(id) ;
-    if (item==NULL)
-        return;
-
-    index = MacGetIndexFromItem( item ) ;
-    if (index < 1)
-               return;
-
-    if (item->GetSubMenu()==NULL)
-    {
-               wxMacBuildMenuString( maclabel , NULL , NULL , label , false );
-               ::SetMenuItemText( m_hMenu , index , maclabel ) ;
-    }
-    else
-    {
-               wxMacBuildMenuString( maclabel , NULL , NULL , label , false );
-               ::SetMenuItemText( m_hMenu , index , maclabel ) ;
-    }
-    item->SetName(label);
-}
-
-wxString wxMenu::GetLabel(int Id) const
-{
-    wxMenuItem *pItem = FindItemForId(Id) ;
-    return pItem->GetName() ;
-}
-
-// Finds the item id matching the given string, -1 if not found.
-int wxMenu::FindItem (const wxString& itemString) const
-{
-    char buf1[200];
-    char buf2[200];
-    wxStripMenuCodes ((char *)(const char *)itemString, buf1);
-
-    for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
-    {
-      wxMenuItem *item = (wxMenuItem *) node->Data ();
-      if (item->GetSubMenu())
-      {
-        int ans = item->GetSubMenu()->FindItem(itemString);
-        if (ans > -1)
-          return ans;
-      }
-      if ( !item->IsSeparator() )
-      {
-        wxStripMenuCodes((char *)item->GetName().c_str(), buf2);
-        if (strcmp(buf1, buf2) == 0)
-          return item->GetId();
-      }
-    }
-
-    return -1;
-}
-
-wxMenuItem *wxMenu::FindItemForId(int itemId, wxMenu ** itemMenu) const
-{
-    if (itemMenu)
-        *itemMenu = NULL;
-    for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
-    {
-        wxMenuItem *item = (wxMenuItem *) node->Data ();
-
-        if (item->GetId() == itemId)
-        {
-            if (itemMenu)
-                *itemMenu = (wxMenu *) this;
-            return item;
-        }
-
-        if (item->GetSubMenu())
-        {
-            wxMenuItem *ans = item->GetSubMenu()->FindItemForId (itemId, itemMenu);
-            if (ans)
-                return ans;
-        }
-    }
-
-    if (itemMenu)
-        *itemMenu = NULL;
-    return NULL;
-}
-
-void wxMenu::SetHelpString(int itemId, const wxString& helpString)
-{
-    wxMenuItem *item = FindItemForId (itemId);
-    if (item)
-        item->SetHelp(helpString);
-}
-
-wxString wxMenu::GetHelpString (int itemId) const
-{
-    wxMenuItem *item = FindItemForId (itemId);
-    wxString str("");
-    return (item == NULL) ? str : item->GetHelp();
-}
-*/
-
 bool wxMenu::ProcessCommand(wxCommandEvent & event)
 {
     bool processed = FALSE;
 bool wxMenu::ProcessCommand(wxCommandEvent & event)
 {
     bool processed = FALSE;
@@ -678,7 +427,10 @@ bool wxMenu::MacMenuSelect( wxEvtHandler* handler, long when , int macMenuId, in
                if (node) 
                {
                        wxMenuItem *pItem = (wxMenuItem*)node->Data();
                if (node) 
                {
                        wxMenuItem *pItem = (wxMenuItem*)node->Data();
-       
+
+                       if (pItem->IsCheckable())
+                               pItem->Check(! pItem->IsChecked());
+
                        wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, pItem->GetId());
                        event.m_timeStamp = when;
                        event.SetEventObject(handler);
                        wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, pItem->GetId());
                        event.m_timeStamp = when;
                        event.SetEventObject(handler);
@@ -892,7 +644,8 @@ void wxMenuBar::MacInstallMenuBar()
        int pos ;
                        wxMenu* menu = m_menus[i] , *subMenu = NULL ;
                
        int pos ;
                        wxMenu* menu = m_menus[i] , *subMenu = NULL ;
                
-                       
+#if !TARGET_CARBON
+                       /* the help menu does not exist in CARBON anymore */                    
                        if( m_titles[i] == "?" || m_titles[i] == "&?"  || m_titles[i] == wxApp::s_macHelpMenuTitleName )
                        {
                                MenuHandle mh = NULL ;
                        if( m_titles[i] == "?" || m_titles[i] == "&?"  || m_titles[i] == wxApp::s_macHelpMenuTitleName )
                        {
                                MenuHandle mh = NULL ;
@@ -906,8 +659,8 @@ void wxMenuBar::MacInstallMenuBar()
                                                formerHelpMenuItems = CountMenuItems( mh ) ;
                                }
                                        
                                                formerHelpMenuItems = CountMenuItems( mh ) ;
                                }
                                        
-                       for (pos = 0 , node = menu->GetMenuItems().First(); node; node = node->Next(), pos++) 
-                       {
+                               for (pos = 0 , node = menu->GetMenuItems().First(); node; node = node->Next(), pos++) 
+                               {
                                        item = (wxMenuItem *)node->Data();
                                        subMenu = item->GetSubMenu() ;
                                        if (subMenu)                    
                                        item = (wxMenuItem *)node->Data();
                                        subMenu = item->GetSubMenu() ;
                                        if (subMenu)                    
@@ -919,12 +672,14 @@ void wxMenuBar::MacInstallMenuBar()
                                                if ( item->IsSeparator() )
                                                {
                                                        if ( mh )
                                                if ( item->IsSeparator() )
                                                {
                                                        if ( mh )
-                                                               ::AppendMenu(mh, "\p-" );
+                                                               UMAAppendMenuItem(mh, "\p-" );
                                                }
                                                else
                                                {
                                                        Str255 label ;
                                                }
                                                else
                                                {
                                                        Str255 label ;
-                                                       wxMacBuildMenuString( label , NULL , NULL , item->GetText(), item->GetId() != wxApp::s_macAboutMenuItemId); // no shortcut in about menu
+                                                       UInt8 modifiers ;
+                                                       SInt16 key ;
+                                                       wxMenuItem::MacBuildMenuString( label, &key , &modifiers  , item->GetText(), item->GetId() != wxApp::s_macAboutMenuItemId); // no shortcut in about menu
                                                        if ( label[0] == 0 )
                                                        {
                                                                // we cannot add empty menus on mac
                                                        if ( label[0] == 0 )
                                                        {
                                                                // we cannot add empty menus on mac
@@ -933,36 +688,36 @@ void wxMenuBar::MacInstallMenuBar()
                                                        }
                                                        if ( item->GetId() == wxApp::s_macAboutMenuItemId )
                                                        { 
                                                        }
                                                        if ( item->GetId() == wxApp::s_macAboutMenuItemId )
                                                        { 
-                                                                       ::SetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , label );
-                       //                                      ::EnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
-                                                                       ::EnableItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
+                                                                       UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , label );
+                                                                       UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
                                                        }
                                                        else
                                                        {
                                                                if ( mh )
                                                        }
                                                        else
                                                        {
                                                                if ( mh )
-                                                                       ::AppendMenu(mh, label );
+                                                                       UMAAppendMenuItem(mh, label , key , modifiers );
                                                        }
                                                }
                                        }
                                }
                        }
                        else
                                                        }
                                                }
                                        }
                                }
                        }
                        else
+#endif
                        {
                        {
-                               wxMacBuildMenuString( label, NULL , NULL , m_titles[i] , false );
+                               wxMenuItem::MacBuildMenuString( label, NULL , NULL , m_titles[i] , false );
                                UMASetMenuTitle( menu->GetHMenu() , label ) ;
                                UMASetMenuTitle( menu->GetHMenu() , label ) ;
-                       for (pos = 0, node = menu->GetMenuItems().First(); node; node = node->Next(), pos++) 
-                       {
+                               for (pos = 0, node = menu->GetMenuItems().First(); node; node = node->Next(), pos++) 
+                               {
                                        item = (wxMenuItem *)node->Data();
                                        subMenu = item->GetSubMenu() ;
                                        if (subMenu)                    
                                        {
                                        item = (wxMenuItem *)node->Data();
                                        subMenu = item->GetSubMenu() ;
                                        if (subMenu)                    
                                        {
-                                               ::InsertMenu( subMenu->GetHMenu() , -1 ) ;
+                                               UMAInsertMenu( subMenu->GetHMenu() , -1 ) ;
                                        }
                                }
                                        }
                                }
-                               ::InsertMenu(m_menus[i]->GetHMenu(), 0);
+                               UMAInsertMenu(m_menus[i]->GetHMenu(), 0);
                        }
                }
                        }
                }
-               ::DrawMenuBar() ;
+               UMADrawMenuBar() ;
 
        s_macInstalledMenuBar = this;
 }
 
        s_macInstalledMenuBar = this;
 }
@@ -1037,18 +792,18 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
     {
                if (s_macInstalledMenuBar == this)
                {
     {
                if (s_macInstalledMenuBar == this)
                {
-                       ::DeleteMenu( menuOld->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
+                       UMADeleteMenu( menuOld->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
                        {
                                Str255  label;
                        {
                                Str255  label;
-                               wxMacBuildMenuString( label, NULL , NULL , title , false );
+                               wxMenuItem::MacBuildMenuString( label, NULL , NULL , title , false );
                                UMASetMenuTitle( menu->GetHMenu() , label ) ;
                                if ( pos == m_menus.GetCount() - 1)
                                {
                                UMASetMenuTitle( menu->GetHMenu() , label ) ;
                                if ( pos == m_menus.GetCount() - 1)
                                {
-                                       ::InsertMenu( menu->GetHMenu() , 0 ) ;
+                                       UMAInsertMenu( menu->GetHMenu() , 0 ) ;
                                }
                                else
                                {
                                }
                                else
                                {
-                                       ::InsertMenu( menu->GetHMenu() , m_menus[pos+1]->MacGetMenuId() ) ;
+                                       UMAInsertMenu( menu->GetHMenu() , m_menus[pos+1]->MacGetMenuId() ) ;
                                }
                        }
                }
                                }
                        }
                }
@@ -1206,6 +961,16 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
     return TRUE;
 }
 
     return TRUE;
 }
 
+void wxMenuBar::Attach(wxFrame *frame)
+{
+//    wxASSERT_MSG( !IsAttached(), wxT("menubar already attached!") );
+
+    m_menuBarFrame = frame;
+
+#if wxUSE_ACCEL
+    RebuildAccelTable();
+#endif // wxUSE_ACCEL
+}
 // ---------------------------------------------------------------------------
 // wxMenuBar searching for menu items
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 // wxMenuBar searching for menu items
 // ---------------------------------------------------------------------------
index 22b07f575d83e385089483cb25107422a66b9e17..153c750c4476b660df8e9d4026eb57b286702cde 100644 (file)
 // dynamic classes implementation
 // ----------------------------------------------------------------------------
 
 // dynamic classes implementation
 // ----------------------------------------------------------------------------
 
+#if !USE_SHARED_LIBRARY
   IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
   IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
-
-void wxMacBuildMenuString(StringPtr outMacItemText, char *outMacShortcutChar , short *outMacModifiers , const char *inItemName , bool useShortcuts ) ;
-
-wxString wxMenuItemBase::GetLabelFromText(const wxString& text)
-{
-    return wxStripMenuCodes(text);
-}
+#endif  //USE_SHARED_LIBRARY
 
 // ----------------------------------------------------------------------------
 // wxMenuItem
 // ----------------------------------------------------------------------------
 
 
 // ----------------------------------------------------------------------------
 // wxMenuItem
 // ----------------------------------------------------------------------------
 
+//
+// Helper Functions to get Mac Menus the way they should be ;-)
+//
+
+void wxMacCtoPString(const char* theCString, Str255 thePString);
+
+// remove inappropriate characters, if useShortcuts is false, the ampersand will not auto-generate a mac menu-shortcut
+
+wxMenuItem::MacBuildMenuString(StringPtr outMacItemText, SInt16 *outMacShortcutChar , UInt8 *outMacModifiers , const char *inItemText , bool useShortcuts )
+{
+       char *p = (char *) &outMacItemText[1] ;
+       short macModifiers = 0 ;
+       char macShortCut = 0 ;
+       const char *inItemName ;
+       wxString inItemTextMac ;
+       
+       if (wxApp::s_macDefaultEncodingIsPC)
+       {
+               inItemTextMac =  wxMacMakeMacStringFromPC( inItemText ) ;
+               inItemName = inItemTextMac ;
+       }
+       else
+       {
+               inItemName = inItemText ;
+       }
+       
+       if ( useShortcuts && !wxApp::s_macSupportPCMenuShortcuts )
+               useShortcuts = false ;
+       
+       // we have problems with a leading hypen - it will be taken as a separator
+       
+       while ( *inItemName == '-' )
+               inItemName++ ;
+               
+       while( *inItemName )
+       {
+               switch ( *inItemName )
+               {
+                       // special characters for macintosh menus -> use some replacement
+                       case ';' :
+                               *p++ = ',' ;
+                               break ;
+                       case '^' :
+                               *p++ = ' ' ;
+                               break ;
+                       case '!' :
+                               *p++ = ' ' ;
+                               break ;
+                       case '<' :
+                               *p++ = '[' ;
+                               break ;
+                       case '>' :
+                               *p++ = ']' ;
+                               break ;
+                       case '/' :
+                               *p++ = '|' ;
+                               break ;
+                       case '(' :
+                               *p++ = '[' ;
+                               break ;
+                       case ')' :      
+                               *p++ = ']' ;
+                               break ;
+                       // shortcuts
+                       case '&' :
+                               {
+                                       ++inItemName ;
+                                       if ( *inItemName )
+                                       {
+                                               *p++ = *inItemName ;
+                                               if ( useShortcuts )
+                                                       macShortCut = *inItemName ;
+                                       }
+                                       else
+                                               --inItemName ;
+                               }
+                               break ;
+                       // win-like accelerators
+                       case '\t' :
+                               {
+                                       ++inItemName ;
+                                       while( *inItemName )
+                                       {
+                                               if (strncmp("Ctrl", inItemName, 4) == 0) 
+                                               {
+                                                       inItemName = inItemName + 5;
+                                                       macShortCut = *inItemName;
+                                               }
+                                               else if (strncmp("Cntrl", inItemName, 5) == 0) 
+                                               {
+                                                       inItemName = inItemName + 6;
+                                                       macShortCut = *inItemName;
+                                               }
+                                               else if (strncmp("Alt", inItemName, 3) == 0) 
+                                               {
+                                                       inItemName = inItemName + 4;
+                                                       macModifiers |= kMenuOptionModifier ;
+                                                       macShortCut = *inItemName ;
+                                               }
+                                               else if (strncmp("Shift", inItemName, 5) == 0) 
+                                               {
+                                                       inItemName = inItemName + 6;
+                                                       macModifiers |= kMenuShiftModifier ;
+                                                       macShortCut = *inItemName ;
+                                               }
+                                               else if (strncmp("F", inItemName, 1) == 0) 
+                                               {
+                                                       inItemName += strlen( inItemName ) ;
+                                                       // no function keys at the moment
+                                                       // macModifiers |= kMenuShiftModifier ;
+                                                       // macShortCut = *inItemName ;
+                                               }
+                                               else
+                                               {
+                                                       break ;
+                                               }
+                                       }
+
+                                       if ( *inItemName == 0 )
+                                               --inItemName ;
+                                               
+                               }
+                               break ;
+                       default :
+                               *p++ = *inItemName ;
+               }
+               ++inItemName ;
+       }
+
+       outMacItemText[0] = (p - (char *)outMacItemText) - 1;
+       if ( outMacShortcutChar )
+               *outMacShortcutChar = macShortCut ;
+       if ( outMacModifiers )
+               *outMacModifiers = macModifiers ;
+               
+       return 0 ;
+}
+
 // ctor & dtor
 // -----------
 
 // ctor & dtor
 // -----------
 
@@ -184,8 +317,8 @@ void wxMenuItem::SetText(const wxString& text)
                if ( index >= 1 )
                {
                        Str255 label;
                if ( index >= 1 )
                {
                        Str255 label;
-                       wxMacBuildMenuString( label , NULL , NULL , text ,false);
-                       ::SetMenuItemText( m_parentMenu->GetHMenu() , index , label ) ; // checkmark
+                       MacBuildMenuString( label , NULL , NULL , text ,false);
+                       UMASetMenuItemText( m_parentMenu->GetHMenu() , index , label ) ; // checkmark
                }
        }
 
                }
        }
 
@@ -204,6 +337,12 @@ void wxMenuItem::SetCheckable(bool checkable)
 // wxMenuItemBase
 // ----------------------------------------------------------------------------
 
 // wxMenuItemBase
 // ----------------------------------------------------------------------------
 
+/* static */
+wxString wxMenuItemBase::GetLabelFromText(const wxString& text)
+{
+    return wxStripMenuCodes(text);
+}
+
 wxMenuItem *wxMenuItemBase::New(wxMenu *parentMenu,
                                 int id,
                                 const wxString& name,
 wxMenuItem *wxMenuItemBase::New(wxMenu *parentMenu,
                                 int id,
                                 const wxString& name,
index 5742ba4ce62e1148ccf4f8e04818a9df9c898d65..fc6c64b825e3a284dfa572c6b0c6d921cd4041f7 100644 (file)
 
 extern bool wxClipboardIsOpen;
 
 
 extern bool wxClipboardIsOpen;
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxMetafile, wxObject)
 IMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC)
 IMPLEMENT_DYNAMIC_CLASS(wxMetafile, wxObject)
 IMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC)
+#endif
 
 /*
  * Metafiles
 
 /*
  * Metafiles
@@ -57,7 +59,7 @@ wxMetafileRefData::~wxMetafileRefData(void)
 {
     if (m_metafile)
     {
 {
     if (m_metafile)
     {
-                               KillPicture( m_metafile ) ;
+               KillPicture( m_metafile ) ;
         m_metafile = 0;
     }
 }
         m_metafile = 0;
     }
 }
@@ -83,7 +85,7 @@ bool wxMetaFile::SetClipboard(int width, int height)
 {
     if (!m_refData)
         return FALSE;
 {
     if (!m_refData)
         return FALSE;
-/*
+
     bool alreadyOpen=wxClipboardOpen();
     if (!alreadyOpen)
     {
     bool alreadyOpen=wxClipboardOpen();
     if (!alreadyOpen)
     {
@@ -92,11 +94,19 @@ bool wxMetaFile::SetClipboard(int width, int height)
     }
     bool success = wxSetClipboardData(wxDF_METAFILE, this, width,height);
     if (!alreadyOpen) wxCloseClipboard();
     }
     bool success = wxSetClipboardData(wxDF_METAFILE, this, width,height);
     if (!alreadyOpen) wxCloseClipboard();
-    return (bool) success;
-    */
+           return (bool) success;
+
     return TRUE ;
 }
 
     return TRUE ;
 }
 
+void wxMetafile::SetHMETAFILE(PicHandle mf)
+{
+    if (!m_refData)
+        m_refData = new wxMetafileRefData;
+
+    M_METAFILEDATA->m_metafile = mf;
+}
+
 bool wxMetaFile::Play(wxDC *dc)
 {
   if (!m_refData)
 bool wxMetaFile::Play(wxDC *dc)
 {
   if (!m_refData)
@@ -142,11 +152,11 @@ wxMetaFileDC::wxMetaFileDC(const wxString& file)
 
   wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
 
 
   wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
 
-       m_metaFile = new wxMetaFile("") ;
-       Rect r={0,0,100,100} ;
+  m_metaFile = new wxMetaFile("") ;
+  Rect r={0,0,1000,1000} ;
        
        
-       m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
-       ::GetPort( &m_macPort ) ;       
+  m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
+  ::GetPort( &m_macPort ) ;    
   m_ok = TRUE ;
 
   SetMapMode(wxMM_TEXT); 
   m_ok = TRUE ;
 
   SetMapMode(wxMM_TEXT); 
@@ -184,5 +194,4 @@ wxMetaFile *wxMetaFileDC::Close()
        return m_metaFile;
 }
 
        return m_metaFile;
 }
 
-
 #endif
 #endif
index cbe09b7d812883ed928eef6dc9cb3744e6caeda2..4f6f5e5fcbb6005644fb9f5e23ed542f19fb71f9 100644 (file)
@@ -15,6 +15,8 @@
 
 #include "wx/minifram.h"
 
 
 #include "wx/minifram.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame, wxFrame)
 IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame, wxFrame)
+#endif
 
 
 
 
index f8b0d0a891a5ed5096fbe14bf4f1059e36fce039..635877693ff3b419594150fdba7dacc44f37a81b 100644 (file)
 
 #define        __COMPILINGMOREFILES
 
 
 #define        __COMPILINGMOREFILES
 
-#include "MoreFile.h"
-#include "MoreExtr.h"
-#include "MoreDesk.h"
-#include "FileCopy.h"
-#include "Director.h"
+#include "morefile.h"
+#include "moreextr.h"
+#include "moredesk.h"
+#include "filecopy.h"
+#include "director.h"
 
 /*****************************************************************************/
 
 
 /*****************************************************************************/
 
@@ -52,9 +52,14 @@ enum
 ** stack space used when recursively calling CopyLevel and to hold
 ** global information that might be needed at any time. */
 
 ** stack space used when recursively calling CopyLevel and to hold
 ** global information that might be needed at any time. */
 
-#if PRAGMA_ALIGN_SUPPORTED
-#pragma options align=mac68k
+#if PRAGMA_STRUCT_ALIGN
+    #pragma options align=mac68k
+#elif PRAGMA_STRUCT_PACKPUSH
+    #pragma pack(push, 2)
+#elif PRAGMA_STRUCT_PACK
+    #pragma pack(2)
 #endif
 #endif
+
 struct EnumerateGlobals
 {
        Ptr                     copyBuffer;                     /* pointer to buffer used for file copy operations */
 struct EnumerateGlobals
 {
        Ptr                     copyBuffer;                     /* pointer to buffer used for file copy operations */
@@ -67,8 +72,12 @@ struct EnumerateGlobals
        Str63           itemName;                       /* the name of the current item */
        CInfoPBRec      myCPB;                          /* the parameter block used for PBGetCatInfo calls */
 };
        Str63           itemName;                       /* the name of the current item */
        CInfoPBRec      myCPB;                          /* the parameter block used for PBGetCatInfo calls */
 };
-#if PRAGMA_ALIGN_SUPPORTED
-#pragma options align=reset
+#if PRAGMA_STRUCT_ALIGN
+    #pragma options align=reset
+#elif PRAGMA_STRUCT_PACKPUSH
+    #pragma pack(pop)
+#elif PRAGMA_STRUCT_PACK
+    #pragma pack()
 #endif
 
 typedef struct EnumerateGlobals EnumerateGlobals;
 #endif
 
 typedef struct EnumerateGlobals EnumerateGlobals;
@@ -79,9 +88,14 @@ typedef EnumerateGlobals *EnumerateGlobalsPtr;
 ** stack space used when recursively calling GetLevelSize and to hold
 ** global information that might be needed at any time. */
 
 ** stack space used when recursively calling GetLevelSize and to hold
 ** global information that might be needed at any time. */
 
-#if PRAGMA_ALIGN_SUPPORTED
-#pragma options align=mac68k
+#if PRAGMA_STRUCT_ALIGN
+    #pragma options align=mac68k
+#elif PRAGMA_STRUCT_PACKPUSH
+    #pragma pack(push, 2)
+#elif PRAGMA_STRUCT_PACK
+    #pragma pack(2)
 #endif
 #endif
+
 struct PreflightGlobals
 {
        OSErr                   result;                         /* temporary holder of results - saves 2 bytes of stack each level */
 struct PreflightGlobals
 {
        OSErr                   result;                         /* temporary holder of results - saves 2 bytes of stack each level */
@@ -95,8 +109,12 @@ struct PreflightGlobals
        unsigned long   tempBlocks;                     /* temporary storage for calculations (save some stack space)  */
        CopyFilterProcPtr copyFilterProc;       /* pointer to filter function */
 };
        unsigned long   tempBlocks;                     /* temporary storage for calculations (save some stack space)  */
        CopyFilterProcPtr copyFilterProc;       /* pointer to filter function */
 };
-#if PRAGMA_ALIGN_SUPPORTED
-#pragma options align=reset
+#if PRAGMA_STRUCT_ALIGN
+    #pragma options align=reset
+#elif PRAGMA_STRUCT_PACKPUSH
+    #pragma pack(pop)
+#elif PRAGMA_STRUCT_PACK
+    #pragma pack()
 #endif
 
 typedef struct PreflightGlobals PreflightGlobals;
 #endif
 
 typedef struct PreflightGlobals PreflightGlobals;
@@ -196,6 +214,9 @@ static      void    GetLevelSize(long currentDirID,
        } while ( theGlobals->result == noErr );
 }
 
        } while ( theGlobals->result == noErr );
 }
 
+
+#if !TARGET_CARBON
+
 /*****************************************************************************/
 
 static OSErr   PreflightDirectoryCopySpace(short srcVRefNum,
 /*****************************************************************************/
 
 static OSErr   PreflightDirectoryCopySpace(short srcVRefNum,
@@ -213,7 +234,8 @@ static      OSErr   PreflightDirectoryCopySpace(short srcVRefNum,
        if ( error == noErr )
        {
                /* Convert freeBytes to free disk blocks (512-byte blocks) */
        if ( error == noErr )
        {
                /* Convert freeBytes to free disk blocks (512-byte blocks) */
-               dstFreeBlocks = (pb.ioVFreeBytes.hi << 23) + (pb.ioVFreeBytes.lo >> 9);
+               // dstFreeBlocks = (pb.ioVFreeBytes.hi << 23) + (pb.ioVFreeBytes.lo >> 9);
+               dstFreeBlocks = pb.ioVFreeBytes >> 9 ;
                
                /* get allocation block size (always multiple of 512) and divide by 512
                  to get number of 512-byte blocks per allocation block */
                
                /* get allocation block size (always multiple of 512) and divide by 512
                  to get number of 512-byte blocks per allocation block */
@@ -237,7 +259,7 @@ static      OSErr   PreflightDirectoryCopySpace(short srcVRefNum,
 
        return ( error );
 }
 
        return ( error );
 }
-
+#endif
 /*****************************************************************************/
 
 static void    CopyLevel(long sourceDirID,
 /*****************************************************************************/
 
 static void    CopyLevel(long sourceDirID,
index a042fd721dc84b71b13bfe7e282dae679c38486d..a05335a63be541e486c8d9e034d8b6a33b91d71b 100644 (file)
@@ -25,7 +25,7 @@
 #include <Types.h>
 #include <Files.h>
 
 #include <Types.h>
 #include <Files.h>
 
-#include "Optim.h"
+#include "optim.h"
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
@@ -488,6 +488,6 @@ pascal      OSErr   FSpDirectoryCopy(const FSSpec *srcSpec,
 }
 #endif
 
 }
 #endif
 
-#include "OptimEnd.h"
+#include "optimend.h"
 
 #endif /* __DIRECTORYCOPY__ */
 
 #endif /* __DIRECTORYCOPY__ */
index b35e20eb01dacc30eb8dd491a5b6768d37e7385a..b6a538acb538657c6497bf95ded97fae2a5e1467 100644 (file)
@@ -37,8 +37,8 @@
 
 #define        __COMPILINGMOREFILES
 
 
 #define        __COMPILINGMOREFILES
 
-#include "MoreExtr.h"
-#include "FSpCompa.h"
+#include "moreextr.h"
+#include "fspcompa.h"
 
 /*****************************************************************************/
 
 
 /*****************************************************************************/
 
index 1dbc11f22bc371e4aa1418333bbcc77596c12dc2..d808ad8b93d4ca157d2fa5616f817de035f1982f 100644 (file)
@@ -25,7 +25,7 @@
 #include <Types.h>
 #include <Files.h>
 
 #include <Types.h>
 #include <Files.h>
 
-#include "Optim.h"
+#include "optim.h"
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
@@ -482,7 +482,7 @@ pascal      void    FSpCreateResFileCompat(const FSSpec *spec,
 }
 #endif
 
 }
 #endif
 
-#include "OptimEnd.h"
+#include "optimend.h"
 
 #endif /* __FSPCOMPAT__ */
 
 
 #endif /* __FSPCOMPAT__ */
 
index 8843c9b9883a79f312fafc99fa61ada9a328b75f..acb9c92d11d4ba155e247ddfb0f3e78bbea0a65a 100644 (file)
 #include <Errors.h>
 #include <Memory.h>
 #include <Files.h>
 #include <Errors.h>
 #include <Memory.h>
 #include <Files.h>
+#include <Math64.h>
 
 #define        __COMPILINGMOREFILES
 
 
 #define        __COMPILINGMOREFILES
 
-#include "MoreFile.h"
-#include "MoreExtr.h"
-#include "MoreDesk.h"
-#include "FileCopy.h"
+#include "morefile.h"
+#include "moreextr.h"
+#include "moredesk.h"
+#include "filecopy.h"
 
 /*****************************************************************************/
 
 
 /*****************************************************************************/
 
@@ -160,6 +161,8 @@ static      OSErr   CheckForForks(short vRefNum,
 
 /*****************************************************************************/
 
 
 /*****************************************************************************/
 
+#if !TARGET_CARBON
+
 static OSErr   PreflightFileCopySpace(short srcVRefNum,
                                                                           long srcDirID,
                                                                           ConstStr255Param srcName,
 static OSErr   PreflightFileCopySpace(short srcVRefNum,
                                                                           long srcDirID,
                                                                           ConstStr255Param srcName,
@@ -182,7 +185,8 @@ static      OSErr   PreflightFileCopySpace(short srcVRefNum,
                dstBlksPerAllocBlk = ((unsigned long)pb.xPB.ioVAlBlkSiz >> 9);
                
                /* Convert freeBytes to free disk blocks (512-byte blocks) */
                dstBlksPerAllocBlk = ((unsigned long)pb.xPB.ioVAlBlkSiz >> 9);
                
                /* Convert freeBytes to free disk blocks (512-byte blocks) */
-               dstFreeBlocks = (pb.xPB.ioVFreeBytes.hi << 23) + (pb.xPB.ioVFreeBytes.lo >> 9);
+               // dstFreeBlocks = (pb.xPB.ioVFreeBytes.hi << 23) + (pb.xPB.ioVFreeBytes.lo >> 9);
+               dstFreeBlocks = pb.xPB.ioVFreeBytes >> 9 ;
                
                /* Now, get the size of the file's data resource forks */
                pb.hPB.fileParam.ioNamePtr = (StringPtr)srcName;
                
                /* Now, get the size of the file's data resource forks */
                pb.hPB.fileParam.ioNamePtr = (StringPtr)srcName;
@@ -243,7 +247,7 @@ static      OSErr   PreflightFileCopySpace(short srcVRefNum,
        
        return ( error );
 }
        
        return ( error );
 }
-
+#endif
 /*****************************************************************************/
 
 pascal OSErr   FileCopy(short srcVRefNum,
 /*****************************************************************************/
 
 pascal OSErr   FileCopy(short srcVRefNum,
index 5f4c008e25a68acf8cb1e0e8418e4dcd0017fd33..257a73315cf9dd8b0b6904dd684cf04e365c2ca6 100644 (file)
@@ -25,7 +25,7 @@
 #include <Types.h>
 #include <Files.h>
 
 #include <Types.h>
 #include <Files.h>
 
-#include "Optim.h"
+#include "optim.h"
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
@@ -215,6 +215,6 @@ pascal      OSErr   FSpFileCopy(const FSSpec *srcSpec,
 }
 #endif
 
 }
 #endif
 
-#include "OptimEnd.h"
+#include "optimend.h"
 
 #endif /* __FILECOPY__ */
 
 #endif /* __FILECOPY__ */
index 3ad50b412d90decfd62e68a662a2cb72a7173ec0..7e54d6c5fa00da063071d9e3a559fe770da367b8 100644 (file)
@@ -28,8 +28,8 @@
 
 #define        __COMPILINGMOREFILES
 
 
 #define        __COMPILINGMOREFILES
 
-#include "FSpCompa.h"
-#include "FullPath.h"
+#include "fspcompa.h"
+#include "fullpath.h"
 
 /*
        IMPORTANT NOTE:
 
 /*
        IMPORTANT NOTE:
@@ -180,7 +180,11 @@ pascal     OSErr   FSpGetFullPath(const FSSpec *spec,
        if ( result == noErr )
        {
                /* Return the length */
        if ( result == noErr )
        {
                /* Return the length */
+#if TARGET_CARBON
+               *fullPathLength = GetHandleSize(*fullPath);
+#else
                *fullPathLength = InlineGetHandleSize(*fullPath);
                *fullPathLength = InlineGetHandleSize(*fullPath);
+#endif
                result = realResult;    // return realResult in case it was fnfErr
        }
        else
                result = realResult;    // return realResult in case it was fnfErr
        }
        else
index 3594a174eb41efbc0ae5528acb49190ffed2024c..cf18a9741ce07390adb2fdd10af7f936a22afde7 100644 (file)
@@ -25,7 +25,7 @@
 #include <Types.h>
 #include <Files.h>
 
 #include <Types.h>
 #include <Files.h>
 
-#include "Optim.h"
+#include "optim.h"
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
@@ -238,5 +238,6 @@ pascal OSErr LocationFromFullPath(short fullPathLength,
 }
 #endif
 
 }
 #endif
 
-#include "OptimEnd.h"
+#include "optimend.h"
 
 
+#endif /* __FULLPATH__ */
\ No newline at end of file
index 6b7e52a78c4b0fbd76cbe4857d0102f5576e1f21..4786b80c015799f9afc835ab042dd27b5963b78c 100644 (file)
@@ -22,8 +22,8 @@
 
 #define        __COMPILINGMOREFILES
 
 
 #define        __COMPILINGMOREFILES
 
-#include "MoreExtr.h"
-#include "IterateD.h"
+#include "moreextr.h"
+#include "iterated.h"
 
 /*
 **     Type definitions
 
 /*
 **     Type definitions
 ** stack space used when recursively calling IterateDirectoryLevel
 ** and to hold global information that might be needed at any time.
 */
 ** stack space used when recursively calling IterateDirectoryLevel
 ** and to hold global information that might be needed at any time.
 */
-#if PRAGMA_ALIGN_SUPPORTED
-#pragma options align=mac68k
+#if PRAGMA_STRUCT_ALIGN
+    #pragma options align=mac68k
+#elif PRAGMA_STRUCT_PACKPUSH
+    #pragma pack(push, 2)
+#elif PRAGMA_STRUCT_PACK
+    #pragma pack(2)
 #endif
 #endif
+
 struct IterateGlobals
 {
        IterateFilterProcPtr    iterateFilter;  /* pointer to IterateFilterProc */
 struct IterateGlobals
 {
        IterateFilterProcPtr    iterateFilter;  /* pointer to IterateFilterProc */
@@ -47,8 +52,13 @@ struct IterateGlobals
        unsigned short                  currentLevel;   /* The current level IterateLevel is on */
        void                                    *yourDataPtr;   /* A pointer to caller data the filter may need to access */
 };
        unsigned short                  currentLevel;   /* The current level IterateLevel is on */
        void                                    *yourDataPtr;   /* A pointer to caller data the filter may need to access */
 };
-#if PRAGMA_ALIGN_SUPPORTED
-#pragma options align=reset
+
+#if PRAGMA_STRUCT_ALIGN
+    #pragma options align=reset
+#elif PRAGMA_STRUCT_PACKPUSH
+    #pragma pack(pop)
+#elif PRAGMA_STRUCT_PACK
+    #pragma pack()
 #endif
 
 typedef struct IterateGlobals IterateGlobals;
 #endif
 
 typedef struct IterateGlobals IterateGlobals;
index ec36ee43bf7fe56250525a3c1ca05a46a3c1356c..46fafb9fe1a462a7a0c845bf55b541cf039d8b77 100644 (file)
@@ -22,7 +22,7 @@
 #include <Types.h>
 #include <Files.h>
 
 #include <Types.h>
 #include <Files.h>
 
-#include "Optim.h"
+#include "optim.h"
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
@@ -166,6 +166,6 @@ pascal      OSErr   FSpIterateDirectory(const FSSpec *spec,
 }
 #endif
 
 }
 #endif
 
-#include "OptimEnd.h"
+#include "optimend.h"
 
 #endif /* __ITERATEDIRECTORY__ */
 
 #endif /* __ITERATEDIRECTORY__ */
index 74a59fd8d1320f6cf1339948999d3a4d2ee48efc..5c74005ffd0506e606c85f0af74e65d8b4e41eae 100644 (file)
 
 #define        __COMPILINGMOREFILES
 
 
 #define        __COMPILINGMOREFILES
 
-#include "MoreFile.h"
-#include "MoreExtr.h"
-#include "Search.h"
-#include "MoreDesk.h"
+#include "morefile.h"
+#include "moreextr.h"
+#include "mfsearch.h"
+#include "moredesk.h"
 
 /*****************************************************************************/
 
 
 /*****************************************************************************/
 
@@ -80,8 +80,12 @@ enum
 
 /* local data structures */
 
 
 /* local data structures */
 
-#if PRAGMA_ALIGN_SUPPORTED
-#pragma options align=mac68k
+#if PRAGMA_STRUCT_ALIGN
+    #pragma options align=mac68k
+#elif PRAGMA_STRUCT_PACKPUSH
+    #pragma pack(push, 2)
+#elif PRAGMA_STRUCT_PACK
+    #pragma pack(2)
 #endif
 
 struct IDRec
 #endif
 
 struct IDRec
@@ -129,8 +133,12 @@ struct APPLRec
 typedef struct APPLRec APPLRec;
 typedef APPLRec *APPLRecPtr;
 
 typedef struct APPLRec APPLRec;
 typedef APPLRec *APPLRecPtr;
 
-#if PRAGMA_ALIGN_SUPPORTED
-#pragma options align=reset
+#if PRAGMA_STRUCT_ALIGN
+    #pragma options align=reset
+#elif PRAGMA_STRUCT_PACKPUSH
+    #pragma pack(pop)
+#elif PRAGMA_STRUCT_PACK
+    #pragma pack()
 #endif
 
 /*****************************************************************************/
 #endif
 
 /*****************************************************************************/
@@ -309,7 +317,11 @@ static     OSErr   GetAPPLFromDesktopFile(ConstStr255Param volName,
                                applResHandle = Get1Resource(kAPPLResType, 0);
                                if ( applResHandle != NULL )
                                {
                                applResHandle = Get1Resource(kAPPLResType, 0);
                                if ( applResHandle != NULL )
                                {
+#if !TARGET_CARBON
                                        applSize = InlineGetHandleSize((Handle)applResHandle);
                                        applSize = InlineGetHandleSize((Handle)applResHandle);
+#else
+                                       applSize = GetHandleSize((Handle)applResHandle);
+#endif
                                        if ( applSize != 0 )    /* make sure the APPL resource isn't empty */
                                        {
                                                foundCreator = false;
                                        if ( applSize != 0 )    /* make sure the APPL resource isn't empty */
                                        {
                                                foundCreator = false;
@@ -1105,7 +1117,11 @@ static   OSErr   GetCommentFromDesktopFile(short vRefNum,
                                                commentHandle = (StringHandle)Get1Resource(kFCMTResType,commentID);
                                                if ( commentHandle != NULL )
                                                {
                                                commentHandle = (StringHandle)Get1Resource(kFCMTResType,commentID);
                                                if ( commentHandle != NULL )
                                                {
+#if !TARGET_CARBON
                                                        if ( InlineGetHandleSize((Handle)commentHandle) > 0 )
                                                        if ( InlineGetHandleSize((Handle)commentHandle) > 0 )
+#else
+                                                       if ( GetHandleSize((Handle)commentHandle) > 0 )
+#endif
                                                        {
                                                                BlockMoveData(*commentHandle, comment, *commentHandle[0] + 1);
                                                        }
                                                        {
                                                                BlockMoveData(*commentHandle, comment, *commentHandle[0] + 1);
                                                        }
index be2bfd341d5c370e4cbf73f482a19e7e96d49017..ee8dbb4f80ade0124095688ea556bc8f5e137085 100644 (file)
@@ -29,7 +29,7 @@
 #include <Types.h>
 #include <Files.h>
 
 #include <Types.h>
 #include <Files.h>
 
-#include "Optim.h"
+#include "optim.h"
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
@@ -536,6 +536,6 @@ pascal      OSErr   FSpDTCopyComment(const FSSpec *srcSpec,
 }
 #endif
 
 }
 #endif
 
-#include "OptimEnd.h"
+#include "optimend.h"
 
 #endif /* __MOREDESKTOPMGR__ */
 
 #endif /* __MOREDESKTOPMGR__ */
index cc64cd6a156824ad45243a80d98a39a1c0b1f802..26b7c2c3930c30ec03dc384c3a5f178136d220dd 100644 (file)
 #include <Script.h>
 #include <Script.h>
 #include <stddef.h>
 #include <Script.h>
 #include <Script.h>
 #include <stddef.h>
+#include <Math64.h>
 
 #define        __COMPILINGMOREFILES
 
 
 #define        __COMPILINGMOREFILES
 
-#include "MoreFile.h"
-#include "MoreExtr.h"
-#include "MoreDesk.h"
-#include "FSpCompa.h"
+#include "morefile.h"
+#include "moreextr.h"
+#include "moredesk.h"
+#include "fspcompa.h"
 
 /*****************************************************************************/
 
 
 /*****************************************************************************/
 
 ** stack space used when recursively calling DeleteLevel and to hold
 ** global information that might be needed at any time. */
 
 ** stack space used when recursively calling DeleteLevel and to hold
 ** global information that might be needed at any time. */
 
-#if PRAGMA_ALIGN_SUPPORTED
-#pragma options align=mac68k
+#if PRAGMA_STRUCT_ALIGN
+    #pragma options align=mac68k
+#elif PRAGMA_STRUCT_PACKPUSH
+    #pragma pack(push, 2)
+#elif PRAGMA_STRUCT_PACK
+    #pragma pack(2)
 #endif
 struct DeleteEnumGlobals
 {
 #endif
 struct DeleteEnumGlobals
 {
@@ -59,8 +64,12 @@ struct DeleteEnumGlobals
        Str63                   itemName;                       /* the name of the current item */
        UniversalFMPB   myPB;                           /* the parameter block used for PBGetCatInfo calls */
 };
        Str63                   itemName;                       /* the name of the current item */
        UniversalFMPB   myPB;                           /* the parameter block used for PBGetCatInfo calls */
 };
-#if PRAGMA_ALIGN_SUPPORTED
-#pragma options align=reset
+#if PRAGMA_STRUCT_ALIGN
+    #pragma options align=reset
+#elif PRAGMA_STRUCT_PACKPUSH
+    #pragma pack(pop)
+#elif PRAGMA_STRUCT_PACK
+    #pragma pack()
 #endif
 
 typedef struct DeleteEnumGlobals DeleteEnumGlobals;
 #endif
 
 typedef struct DeleteEnumGlobals DeleteEnumGlobals;
@@ -82,7 +91,11 @@ pascal       void    TruncPString(StringPtr destination,
                        /* a multi-byte character. */
                        while (maxLength != 0)
                        {
                        /* a multi-byte character. */
                        while (maxLength != 0)
                        {
+#if TARGET_CARBON
+                               charType = CharacterByteType((Ptr)&source[1], maxLength,smAllScripts);
+#else
                                charType = CharByte((Ptr)&source[1], maxLength);
                                charType = CharByte((Ptr)&source[1], maxLength);
+#endif
                                if ( (charType == smSingleByte) || (charType == smLastByte) )
                                        break;  /* source[maxLength] is now a valid last character */ 
                                --maxLength;
                                if ( (charType == smSingleByte) || (charType == smLastByte) )
                                        break;  /* source[maxLength] is now a valid last character */ 
                                --maxLength;
@@ -221,6 +234,9 @@ pascal      OSErr   GetVolumeInfoNoName(ConstStr255Param pathname,
 **     the parameter block is always returned as NULL (since it might point
 **     to the local tempPathname).
 */
 **     the parameter block is always returned as NULL (since it might point
 **     to the local tempPathname).
 */
+
+#if !TARGET_CARBON
+
 pascal OSErr   XGetVolumeInfoNoName(ConstStr255Param pathname,
                                                                        short vRefNum,
                                                                        XVolumeParamPtr pb)
 pascal OSErr   XGetVolumeInfoNoName(ConstStr255Param pathname,
                                                                        short vRefNum,
                                                                        XVolumeParamPtr pb)
@@ -275,6 +291,8 @@ pascal      OSErr   XGetVolumeInfoNoName(ConstStr255Param pathname,
        return ( error );
 }
 
        return ( error );
 }
 
+#endif
+
 /*****************************************************************************/
 
 pascal OSErr GetCatInfoNoName(short vRefNum,
 /*****************************************************************************/
 
 pascal OSErr GetCatInfoNoName(short vRefNum,
@@ -323,6 +341,7 @@ pascal      OSErr   DetermineVRefNum(ConstStr255Param pathname,
 
 /*****************************************************************************/
 
 
 /*****************************************************************************/
 
+#if !TARGET_CARBON
 pascal OSErr   HGetVInfo(short volReference,
                                                  StringPtr volName,
                                                  short *vRefNum,
 pascal OSErr   HGetVInfo(short volReference,
                                                  StringPtr volName,
                                                  short *vRefNum,
@@ -402,7 +421,7 @@ pascal      OSErr   HGetVInfo(short volReference,
        
        return ( result );
 }
        
        return ( result );
 }
-
+#endif
 /*****************************************************************************/
 
 /*
 /*****************************************************************************/
 
 /*
@@ -421,7 +440,12 @@ pascal     OSErr   HGetVInfo(short volReference,
 #undef pascal
 #endif
 
 #undef pascal
 #endif
 
+#if !TARGET_CARBON
+
 #if GENERATINGCFM
 #if GENERATINGCFM
+
+#if UNIVERSAL_INTERFACES_VERSION < 0x0301
+
 pascal OSErr PBXGetVolInfoSync(XVolumeParamPtr paramBlock)
 {
        enum
 pascal OSErr PBXGetVolInfoSync(XVolumeParamPtr paramBlock)
 {
        enum
@@ -444,10 +468,16 @@ pascal OSErr PBXGetVolInfoSync(XVolumeParamPtr paramBlock)
 }
 #endif
 
 }
 #endif
 
+#endif
+
+#endif
+
 #if    __WANTPASCALELIMINATION
 #define        pascal  
 #endif
 
 #if    __WANTPASCALELIMINATION
 #define        pascal  
 #endif
 
+#if !TARGET_CARBON
+
 /*****************************************************************************/
 
 pascal OSErr   XGetVInfo(short volReference,
 /*****************************************************************************/
 
 pascal OSErr   XGetVInfo(short volReference,
@@ -476,8 +506,8 @@ pascal      OSErr   XGetVInfo(short volReference,
                        *vRefNum = pb.ioVRefNum;
                        
                        /* return the freeBytes and totalBytes */
                        *vRefNum = pb.ioVRefNum;
                        
                        /* return the freeBytes and totalBytes */
-                       *totalBytes = pb.ioVTotalBytes;
-                       *freeBytes = pb.ioVFreeBytes;
+                       *totalBytes = UInt64ToUnsignedWide(pb.ioVTotalBytes);
+                       *freeBytes = UInt64ToUnsignedWide(pb.ioVFreeBytes);
                }
        }
        else
                }
        }
        else
@@ -495,7 +525,7 @@ pascal      OSErr   XGetVInfo(short volReference,
        }
        return ( result );
 }
        }
        return ( result );
 }
-
+#endif
 /*****************************************************************************/
 
 pascal OSErr   CheckVolLock(ConstStr255Param pathname,
 /*****************************************************************************/
 
 pascal OSErr   CheckVolLock(ConstStr255Param pathname,
@@ -522,6 +552,8 @@ pascal      OSErr   CheckVolLock(ConstStr255Param pathname,
 
 /*****************************************************************************/
 
 
 /*****************************************************************************/
 
+#if !TARGET_CARBON
+
 pascal OSErr GetDriverName(short driverRefNum,
                                                        Str255 driverName)
 {
 pascal OSErr GetDriverName(short driverRefNum,
                                                        Str255 driverName)
 {
@@ -554,7 +586,9 @@ pascal      OSErr GetDriverName(short driverRefNum,
        return ( result );
 }
 
        return ( result );
 }
 
+#endif
 /*****************************************************************************/
 /*****************************************************************************/
+#if !TARGET_CARBON
 
 pascal OSErr   FindDrive(ConstStr255Param pathname,
                                                  short vRefNum,
 
 pascal OSErr   FindDrive(ConstStr255Param pathname,
                                                  short vRefNum,
@@ -619,8 +653,10 @@ pascal     OSErr   FindDrive(ConstStr255Param pathname,
        
        return ( result );
 }
        
        return ( result );
 }
+#endif 
 
 /*****************************************************************************/
 
 /*****************************************************************************/
+#if !TARGET_CARBON
 
 pascal OSErr   GetDiskBlocks(ConstStr255Param pathname,
                                                          short vRefNum,
 
 pascal OSErr   GetDiskBlocks(ConstStr255Param pathname,
                                                          short vRefNum,
@@ -757,6 +793,7 @@ pascal      OSErr   GetDiskBlocks(ConstStr255Param pathname,
        
        return ( result );
 }
        
        return ( result );
 }
+#endif
 
 /*****************************************************************************/
 
 
 /*****************************************************************************/
 
@@ -777,6 +814,7 @@ pascal      OSErr   GetVolFileSystemID(ConstStr255Param pathname,
 }
 
 /*****************************************************************************/
 }
 
 /*****************************************************************************/
+#if !TARGET_CARBON
 
 pascal OSErr   GetVolState(ConstStr255Param pathname,
                                                        short vRefNum,
 
 pascal OSErr   GetVolState(ConstStr255Param pathname,
                                                        short vRefNum,
@@ -875,8 +913,9 @@ pascal      OSErr   GetVolState(ConstStr255Param pathname,
        
        return ( error );
 }
        
        return ( error );
 }
-
+#endif
 /*****************************************************************************/
 /*****************************************************************************/
+#if !TARGET_CARBON
 
 pascal OSErr   UnmountAndEject(ConstStr255Param pathname,
                                                                short vRefNum)
 
 pascal OSErr   UnmountAndEject(ConstStr255Param pathname,
                                                                short vRefNum)
@@ -952,6 +991,7 @@ pascal      OSErr   UnmountAndEject(ConstStr255Param pathname,
        
        return ( error );
 }
        
        return ( error );
 }
+#endif
 
 /*****************************************************************************/
 
 
 /*****************************************************************************/
 
@@ -1011,6 +1051,8 @@ pascal    OSErr SetDefault(short newVRefNum,
 
 /*****************************************************************************/
 
 
 /*****************************************************************************/
 
+#if !TARGET_CARBON
+
 pascal OSErr RestoreDefault(short oldVRefNum,
                                                         long oldDirID)
 {
 pascal OSErr RestoreDefault(short oldVRefNum,
                                                         long oldDirID)
 {
@@ -1038,7 +1080,7 @@ pascal    OSErr RestoreDefault(short oldVRefNum,
        
        return ( error );
 }
        
        return ( error );
 }
-
+#endif
 /*****************************************************************************/
 
 pascal OSErr GetDInfo(short vRefNum,
 /*****************************************************************************/
 
 pascal OSErr GetDInfo(short vRefNum,
index 927a824d98620445615d7733208b8c5fd710ea5c..c0fd7a006b107d63323d2911480556d0eeb58c0e 100644 (file)
@@ -30,7 +30,7 @@
 #define false 0
 #endif
 
 #define false 0
 #endif
 
-#include "Optim.h"
+#include "optim.h"
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
@@ -215,8 +215,12 @@ enum
        
 /*****************************************************************************/
 
        
 /*****************************************************************************/
 
-#if PRAGMA_ALIGN_SUPPORTED
-#pragma options align=mac68k
+#if PRAGMA_STRUCT_ALIGN
+    #pragma options align=mac68k
+#elif PRAGMA_STRUCT_PACKPUSH
+    #pragma pack(push, 2)
+#elif PRAGMA_STRUCT_PACK
+    #pragma pack(2)
 #endif
 
 /*
 #endif
 
 /*
@@ -322,8 +326,12 @@ struct MyAFPXVolMountInfo
 typedef struct MyAFPXVolMountInfo MyAFPXVolMountInfo;
 typedef MyAFPXVolMountInfo *MyAFPXVolMountInfoPtr, **MyAFPXVolMountInfoHandle;
 
 typedef struct MyAFPXVolMountInfo MyAFPXVolMountInfo;
 typedef MyAFPXVolMountInfo *MyAFPXVolMountInfoPtr, **MyAFPXVolMountInfoHandle;
 
-#if PRAGMA_ALIGN_SUPPORTED
-#pragma options align=reset
+#if PRAGMA_STRUCT_ALIGN
+    #pragma options align=reset
+#elif PRAGMA_STRUCT_PACKPUSH
+    #pragma pack(pop)
+#elif PRAGMA_STRUCT_PACK
+    #pragma pack()
 #endif
 
 /*****************************************************************************/
 #endif
 
 /*****************************************************************************/
@@ -3136,6 +3144,6 @@ pascal    OSErr   GetUGEntries(short objType,
 }
 #endif
 
 }
 #endif
 
-#include "OptimEnd.h"
+#include "optimend.h"
 
 #endif /* __MOREFILESEXTRAS__ */
 
 #endif /* __MOREFILESEXTRAS__ */
index 16795680b6bc13c5f5d892517c8b9e0692adcfb4..581e1b742a24c7846f0c90b68adf55286f611028 100644 (file)
@@ -25,8 +25,8 @@
 
 #define        __COMPILINGMOREFILES
 
 
 #define        __COMPILINGMOREFILES
 
-#include "MoreFile.h"
-#include "MoreExtr.h"
+#include "morefile.h"
+#include "moreextr.h"
 
 /*****************************************************************************/
 
 
 /*****************************************************************************/
 
index e4d4bb8a7f58654a493a0aa1f4283cd86724adda..a2b069279c531a41b9f9879e1fa7274e00e00da1 100644 (file)
@@ -30,7 +30,7 @@
 #define false 0
 #endif
 
 #define false 0
 #endif
 
-#include "Optim.h"
+#include "optim.h"
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
@@ -1239,6 +1239,6 @@ pascal    OSErr   GetUGEntry(short objType,
 }
 #endif
 
 }
 #endif
 
-#include "OptimEnd.h"
+#include "optimend.h"
 
 #endif /* __MOREFILES__ */
 
 #endif /* __MOREFILES__ */
index d09caf71c0a1084db474911bc64486da3eb80618..ff5a1d5d5732458fc0e0198a07e9d160f87d97dd 100644 (file)
 **     File:   Optimization.h
 */
 
 **     File:   Optimization.h
 */
 
+#if TARGET_CARBON
 
 
-#ifndef __MACOSSEVENFIVEONEORLATER
-       #define __MACOSSEVENFIVEONEORLATER 0
-#endif
-
-#ifndef __MACOSSEVENFIVEORLATER
-       #define __MACOSSEVENFIVEORLATER __MACOSSEVENFIVEONEORLATER
-#endif
-
-#ifndef __MACOSSEVENORLATER
-       #if GENERATINGCFM
-               #define __MACOSSEVENORLATER 1
-       #else
-               #define __MACOSSEVENORLATER __MACOSSEVENFIVEORLATER
+       #define __MACOSSEVENFIVEONEORLATER 1
+       
+       #define __MACOSSEVENORLATER 1   
+       
+       #ifndef __WANTPASCALELIMINATION
+               #define __WANTPASCALELIMINATION 0
        #endif
        #endif
-#endif
-
-
-#ifndef        __WANTPASCALELIMINATION
-       #define __WANTPASCALELIMINATION 0
-#endif
-
-#if    __WANTPASCALELIMINATION
-       #define pascal  
-#endif
-
+       
+       #if     __WANTPASCALELIMINATION
+               #define pascal  
+       #endif
+       
+       
+       #ifndef __USEPRAGMAINTERNAL
+               #define __USEPRAGMAINTERNAL     0
+       #endif
+       
+       #if     __USEPRAGMAINTERNAL
+               #if defined(__MWERKS__)
+                       #pragma internal on
+               #endif
+       #endif
+#else
 
 
-#ifndef __USEPRAGMAINTERNAL
-       #define __USEPRAGMAINTERNAL     0
-#endif
+       // we have a basic requirements of 7.5.3 Rev 2 or 7.6
+       
+       #define __MACOSSEVENFIVEONEORLATER 1
 
 
-#if    __USEPRAGMAINTERNAL
-       #if defined(__MWERKS__)
-               #pragma internal on
+       #ifndef __MACOSSEVENFIVEONEORLATER
+               #define __MACOSSEVENFIVEONEORLATER 0
+       #endif
+       
+       #ifndef __MACOSSEVENFIVEORLATER
+               #define __MACOSSEVENFIVEORLATER __MACOSSEVENFIVEONEORLATER
+       #endif
+       
+       #ifndef __MACOSSEVENORLATER
+               #if GENERATINGCFM
+                       #define __MACOSSEVENORLATER 1
+               #else
+                       #define __MACOSSEVENORLATER __MACOSSEVENFIVEORLATER
+               #endif
+       #endif
+       
+       
+       #ifndef __WANTPASCALELIMINATION
+               #define __WANTPASCALELIMINATION 0
+       #endif
+       
+       #if     __WANTPASCALELIMINATION
+               #define pascal  
+       #endif
+       
+       
+       #ifndef __USEPRAGMAINTERNAL
+               #define __USEPRAGMAINTERNAL     0
+       #endif
+       
+       #if     __USEPRAGMAINTERNAL
+               #if defined(__MWERKS__)
+                       #pragma internal on
+               #endif
        #endif
 #endif
        #endif
 #endif
-
index cf229e520008140529f009f37dd7cbfedda33d15..bbdea6abf8c6174e57eb2c0298becf39b22a93e3 100644 (file)
@@ -16,7 +16,9 @@
 #include "wx/msgdlg.h"
 #include "wx/mac/uma.h"
 
 #include "wx/msgdlg.h"
 #include "wx/mac/uma.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_CLASS(wxMessageDialog, wxDialog)
 IMPLEMENT_CLASS(wxMessageDialog, wxDialog)
+#endif
 
 #define kMacOKAlertResourceID 128
 #define kMacYesNoAlertResourceID 129
 
 #define kMacOKAlertResourceID 128
 #define kMacYesNoAlertResourceID 129
@@ -70,7 +72,6 @@ int wxMessageDialog::ShowModal()
        Str255 pascalTitle ;
        Str255 pascalText ;
        
        Str255 pascalTitle ;
        Str255 pascalText ;
        
-       
        if (wxApp::s_macDefaultEncodingIsPC)
        {
                strcpy( (char*) pascalTitle , wxMacMakeMacStringFromPC( m_caption ) ) ;
        if (wxApp::s_macDefaultEncodingIsPC)
        {
                strcpy( (char*) pascalTitle , wxMacMakeMacStringFromPC( m_caption ) ) ;
index 676f54739aa1b8b2be49a6e394ad455461566535..85a9fd16d8346f140ac9127f71b2217f94747e27 100644 (file)
@@ -15,7 +15,9 @@
 
 #include "wx/palette.h"
 
 
 #include "wx/palette.h"
 
+#if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject)
 IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject)
+#endif
 
 /*
  * Palette
 
 /*
  * Palette
index 65da06087d46a85e349477da4755290109648f0a..1e3ced2a3a484c777157da7da10c70737831a760 100644 (file)
@@ -17,7 +17,9 @@
 #include "wx/utils.h"
 #include "wx/pen.h"
 
 #include "wx/utils.h"
 #include "wx/pen.h"
 
+#if !USE_SHARED_LIBRARIES
 IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject)
 IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject)
+#endif
 
 wxPenRefData::wxPenRefData()
 {
 
 wxPenRefData::wxPenRefData()
 {
@@ -26,7 +28,7 @@ wxPenRefData::wxPenRefData()
     m_join = wxJOIN_ROUND ;
     m_cap = wxCAP_ROUND ;
     m_nbDash = 0 ;
     m_join = wxJOIN_ROUND ;
     m_cap = wxCAP_ROUND ;
     m_nbDash = 0 ;
-    m_dash = (wxMACDash*)NULL;
+    m_dash = ;
 /* TODO: null data
     m_hPen = 0;
 */
 /* TODO: null data
     m_hPen = 0;
 */
@@ -76,7 +78,7 @@ wxPen::wxPen(const wxColour& col, int Width, int Style)
     M_PENDATA->m_join = wxJOIN_ROUND ;
     M_PENDATA->m_cap = wxCAP_ROUND ;
     M_PENDATA->m_nbDash = 0 ;
     M_PENDATA->m_join = wxJOIN_ROUND ;
     M_PENDATA->m_cap = wxCAP_ROUND ;
     M_PENDATA->m_nbDash = 0 ;
-    M_PENDATA->m_dash = (wxMACDash*)NULL;
+    M_PENDATA->m_dash = ;
 
     RealizeResource();
 
 
     RealizeResource();
 
@@ -94,7 +96,7 @@ wxPen::wxPen(const wxBitmap& stipple, int Width)
     M_PENDATA->m_join = wxJOIN_ROUND ;
     M_PENDATA->m_cap = wxCAP_ROUND ;
     M_PENDATA->m_nbDash = 0 ;
     M_PENDATA->m_join = wxJOIN_ROUND ;
     M_PENDATA->m_cap = wxCAP_ROUND ;
     M_PENDATA->m_nbDash = 0 ;
-    M_PENDATA->m_dash = (wxMACDash*)NULL;
+    M_PENDATA->m_dash = ;
 
     RealizeResource();
 
 
     RealizeResource();
 
@@ -168,7 +170,7 @@ void wxPen::SetDashes(int nb_dashes, const wxDash *Dash)
     Unshare();
 
     M_PENDATA->m_nbDash = nb_dashes;
     Unshare();
 
     M_PENDATA->m_nbDash = nb_dashes;
-    M_PENDATA->m_dash = (wxMACDash *)Dash;
+    M_PENDATA->m_dash = (wxDash *)Dash;
   
     RealizeResource();
 }
   
     RealizeResource();
 }
index a1f8f6b196b18553f4bd2bd2d6f18399588c1072..a5c41e0737c7f70706688537975e782ce4109a90 100644 (file)
 #include "wx/object.h"
 #include "wx/printdlg.h"
 #include "wx/dcprint.h"
 #include "wx/object.h"
 #include "wx/printdlg.h"
 #include "wx/dcprint.h"
+#include "wx/mac/uma.h"
 
 // Use generic page setup dialog: use your own native one if one exists.
 
 
 // Use generic page setup dialog: use your own native one if one exists.
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog)
 IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
 IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog)
 IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
+#endif
 
 wxPrintDialog::wxPrintDialog()
 {
 
 wxPrintDialog::wxPrintDialog()
 {
@@ -64,15 +67,17 @@ wxPrintDialog::~wxPrintDialog()
 int wxPrintDialog::ShowModal()
 {
        int result = wxID_CANCEL ;
 int wxPrintDialog::ShowModal()
 {
        int result = wxID_CANCEL ;
+       #if !TARGET_CARBON
+       
        OSErr err ;
        wxString message ;
        OSErr err ;
        wxString message ;
-       ::PrOpen() ;
+       ::UMAPrOpen() ;
        err = PrError() ;
        
        if ( !err )
        {
                m_printDialogData.ConvertToNative() ;
        err = PrError() ;
        
        if ( !err )
        {
                m_printDialogData.ConvertToNative() ;
-               if  ( m_printDialogData.m_macPrintInfo && ::PrJobDialog( m_printDialogData.m_macPrintInfo ) )
+               if  ( ::PrJobDialog( m_printDialogData.GetPrintData().m_macPrintInfo ) )
                {
                        m_printDialogData.ConvertFromNative() ;
                        result = wxID_OK ;
                {
                        m_printDialogData.ConvertFromNative() ;
                        result = wxID_OK ;
@@ -84,8 +89,10 @@ int wxPrintDialog::ShowModal()
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message  , "", wxICON_HAND | wxOK) ;
        }
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message  , "", wxICON_HAND | wxOK) ;
        }
-       ::PrClose() ;
-
+       ::UMAPrClose() ;
+       #else
+       #pragma warning "TODO:Printing for carbon"
+       #endif
        return result ;
 }
 
        return result ;
 }
 
@@ -127,15 +134,17 @@ wxPageSetupDialog::~wxPageSetupDialog()
 int wxPageSetupDialog::ShowModal()
 {
        int result = wxID_CANCEL ;
 int wxPageSetupDialog::ShowModal()
 {
        int result = wxID_CANCEL ;
+#if !TARGET_CARBON
+
        OSErr err ;
        wxString message ;
        OSErr err ;
        wxString message ;
-       ::PrOpen() ;
+       ::UMAPrOpen() ;
        err = PrError() ;
        
        if ( !err )
        {
                m_pageSetupData.ConvertToNative() ;
        err = PrError() ;
        
        if ( !err )
        {
                m_pageSetupData.ConvertToNative() ;
-               if  ( m_pageSetupData.m_macPageSetupInfo && ::PrStlDialog( m_pageSetupData.m_macPageSetupInfo ) )
+               if  ( ::PrStlDialog( m_pageSetupData.GetPrintData().m_macPrintInfo ) )
                {
                        m_pageSetupData.ConvertFromNative() ;
                        result = wxID_OK ;
                {
                        m_pageSetupData.ConvertFromNative() ;
                        result = wxID_OK ;
@@ -147,8 +156,10 @@ int wxPageSetupDialog::ShowModal()
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
        }
                message.Printf( "Print Error %d", err ) ;
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
        }
-       ::PrClose() ;
-
+       ::UMAPrClose() ;
+#else
+#pragma warning "TODO:printing for carbon"
+#endif
        return result ;
 }
 
        return result ;
 }
 
index 0d4862cfa241c17ab35c59b818c7356f89de8d24..08a6bf77adc5cff8fed862dd499249361a3e0c25 100644 (file)
 
 #include <stdlib.h>
 
 
 #include <stdlib.h>
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxMacPrinter, wxPrinterBase)
 IMPLEMENT_CLASS(wxMacPrintPreview, wxPrintPreviewBase)
 IMPLEMENT_DYNAMIC_CLASS(wxMacPrinter, wxPrinterBase)
 IMPLEMENT_CLASS(wxMacPrintPreview, wxPrintPreviewBase)
+#endif
 
 /*
  * Printer
 
 /*
  * Printer
@@ -92,31 +94,16 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
   else
     m_printDialogData.EnablePageNumbers(FALSE);
 
   else
     m_printDialogData.EnablePageNumbers(FALSE);
 
-  // Create a suitable device context  
  // Create a suitable device context  
   wxDC *dc = NULL;
   if (prompt)
   {
  // Create a suitable device context  
   wxDC *dc = NULL;
   if (prompt)
   {
-               PrOpen() ;
-               m_printDialogData.ConvertToNative() ; // make sure we have a valid handle
-               if ( m_printDialogData.m_macPrintInfo )
-               {
-                       // todo incorporate the changes from a global page setup
-                       if  ( ::PrStlDialog( m_printDialogData.m_macPrintInfo ) ) // we should have the page setup dialog
-                       {
-                               PrClose() ;
-                       wxPrintDialog dialog(parent, & m_printDialogData);
-                       if (dialog.ShowModal() == wxID_OK)
-                       {
-                         dc = dialog.GetPrintDC();
-                         m_printDialogData = dialog.GetPrintData();
-                       }
-                       }
-                       else
-                       {
-                               PrClose() ;
-                       }
-               }
+        wxPrintDialog dialog(parent, & m_printDialogData);
+        if (dialog.ShowModal() == wxID_OK)
+               {
+                    dc = dialog.GetPrintDC();
+                    m_printDialogData = dialog.GetPrintData();
+               }
   }
   else
   {
   }
   else
   {
@@ -140,7 +127,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
   printout->SetDC(dc);
 
   int w, h;
   printout->SetDC(dc);
 
   int w, h;
-  long ww, hh;
+  wxCoord ww, hh;
   dc->GetSize(&w, &h);
   printout->SetPageSizePixels((int)w, (int)h);
   dc->GetSizeMM(&ww, &hh);
   dc->GetSize(&w, &h);
   printout->SetPageSizePixels((int)w, (int)h);
   dc->GetSizeMM(&ww, &hh);
@@ -278,50 +265,35 @@ bool wxMacPrintPreview::Print(bool interactive)
 
 void wxMacPrintPreview::DetermineScaling(void)
 {
 
 void wxMacPrintPreview::DetermineScaling(void)
 {
-/*
-    HDC dc = ::GetDC(NULL);
-    int screenWidth = ::GetDeviceCaps(dc, HORZSIZE);
-//    int screenHeight = ::GetDeviceCaps(dc, VERTSIZE);
-    int screenXRes = ::GetDeviceCaps(dc, HORZRES);
-//    int screenYRes = ::GetDeviceCaps(dc, VERTRES);
-    int logPPIScreenX = ::GetDeviceCaps(dc, LOGPIXELSX);
-    int logPPIScreenY = ::GetDeviceCaps(dc, LOGPIXELSY);
-    m_previewPrintout->SetPPIScreen(logPPIScreenX, logPPIScreenY);
-
-    ::ReleaseDC(NULL, dc);
+       int screenWidth , screenHeight ;
+       wxDisplaySize( &screenWidth , &screenHeight ) ;
+       
+       m_previewPrintout->SetPPIScreen( 72 , 72 ) ;
+       m_previewPrintout->SetPPIPrinter( 72 , 72 ) ;
+       m_previewPrintout->SetPageSizeMM( 8 * 25.6 , 11 * 25.6 ) ;
+       m_previewPrintout->SetPageSizePixels( 8 * 72 , 11 * 72 ) ;
+    m_pageWidth = 8 * 72 ;
+    m_pageHeight = 11 * 72 ;
+    m_previewScale = 1 ;
 
     // Get a device context for the currently selected printer
 
     // Get a device context for the currently selected printer
-    wxPrinterDC printerDC("", "", "", FALSE, m_printDialogData.GetOrientation());
-
-    int printerWidth = 150;
-    int printerHeight = 250;
-    int printerXRes = 1500;
-    int printerYRes = 2500;
-
-    if (printerDC.GetHDC())
+    wxPrinterDC printerDC(m_printDialogData.GetPrintData());
+    if (printerDC.Ok())
     {
     {
-      printerWidth = ::GetDeviceCaps((HDC) printerDC.GetHDC(), HORZSIZE);
-      printerHeight = ::GetDeviceCaps((HDC) printerDC.GetHDC(), VERTSIZE);
-      printerXRes = ::GetDeviceCaps((HDC) printerDC.GetHDC(), HORZRES);
-      printerYRes = ::GetDeviceCaps((HDC) printerDC.GetHDC(), VERTRES);
-
-      int logPPIPrinterX = ::GetDeviceCaps((HDC) printerDC.GetHDC(), LOGPIXELSX);
-      int logPPIPrinterY = ::GetDeviceCaps((HDC) printerDC.GetHDC(), LOGPIXELSY);
-
-      m_previewPrintout->SetPPIPrinter(logPPIPrinterX, logPPIPrinterY);
-      m_previewPrintout->SetPageSizeMM(printerWidth, printerHeight);
-      
-      if (logPPIPrinterX == 0 || logPPIPrinterY == 0 || printerWidth == 0 || printerHeight == 0)
-        m_isOk = FALSE;
-    }
-    else
-      m_isOk = FALSE;
-
-    m_pageWidth = printerXRes;
-    m_pageHeight = printerYRes;
-
+               int x , y ;
+               wxCoord ww, hh;
+               printerDC.GetSizeMM(&ww, &hh);
+               printerDC.GetSize( &x , &y ) ;
+               m_previewPrintout->SetPageSizeMM((int)ww, (int)hh);
+               m_previewPrintout->SetPageSizePixels( x , y) ;
+               m_pageWidth = x ;
+               m_pageHeight =  y ;
+               m_isOk = true ;
+
+       }
     // At 100%, the page should look about page-size on the screen.
     // At 100%, the page should look about page-size on the screen.
-    m_previewScale = (float)((float)screenWidth/(float)printerWidth);
-    m_previewScale = m_previewScale * (float)((float)screenXRes/(float)printerYRes);
-*/
+    // m_previewScale = (float)((float)screenWidth/(float)printerWidth);
+    // m_previewScale = m_previewScale * (float)((float)screenXRes/(float)printerXRes);
+    
+    m_previewScale = 1 ;
 }
 }
index 416ba0b18f8e20ad9690ef5395b1ff4340b96ce7..1f74fae6d21774cfdc4b900d3f616e3b0862b39f 100644 (file)
@@ -20,7 +20,9 @@
 #include "wx/radiobox.h"
 #include <wx/mac/uma.h>
 
 #include "wx/radiobox.h"
 #include <wx/mac/uma.h>
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
+#endif
 
 #pragma mark -
 #pragma mark ### Constructors & destructor ###
 
 #pragma mark -
 #pragma mark ### Constructors & destructor ###
@@ -93,7 +95,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
        Rect bounds ;
        Str255 title ;
        
        Rect bounds ;
        Str255 title ;
        
-       MacPreControlCreate( parent , id ,  label , pos , size ,style, *((wxValidator*)NULL) , name , &bounds , title ) ;
+       MacPreControlCreate( parent , id ,  label , pos , size ,style, val , name , &bounds , title ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1, 
                kControlGroupBoxTextTitleProc , (long) this ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1, 
                kControlGroupBoxTextTitleProc , (long) this ) ;
@@ -435,9 +437,9 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
        x_offset = x;
        y_offset = y;
        GetPosition(&x_current, &y_current);
        x_offset = x;
        y_offset = y;
        GetPosition(&x_current, &y_current);
-       if ((x == -1) || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+       if ((x == -1) && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
                x_offset = x_current;
                x_offset = x_current;
-       if ((y == -1) || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+       if ((y == -1)&& !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
                y_offset = y_current;
 
 // define size
                y_offset = y_current;
 
 // define size
@@ -490,7 +492,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
        
        
        x_start = charWidth;
        
        
        x_start = charWidth;
-       y_start = charHeight*3/2;
+       y_start = 15 ;
        x_offset = x_start;
        y_offset = y_start;
        
        x_offset = x_start;
        y_offset = y_start;
        
@@ -507,7 +509,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
                else
                        {
                                x_offset = x_start;
                else
                        {
                                x_offset = x_start;
-                       y_offset += maxHeight + charHeight/2;
+                       y_offset += maxHeight ; /*+ charHeight/2;*/
                                }
                        }
 
                                }
                        }
 
@@ -515,7 +517,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
                current=current->NextInCycle();
                
                if (m_windowStyle & wxRA_SPECIFY_ROWS)
                current=current->NextInCycle();
                
                if (m_windowStyle & wxRA_SPECIFY_ROWS)
-                       y_offset += maxHeight + charHeight/2;
+                       y_offset += maxHeight ; /*+ charHeight/2;*/
                else
                        x_offset += maxWidth + charWidth;
                }
                else
                        x_offset += maxWidth + charWidth;
                }
index f5f95dfab2ed077ed0129df18750e82cc96a650e..9a93378c0cbb1ccdcb2d40d4b8868c76838556bc 100644 (file)
@@ -15,7 +15,9 @@
 
 #include "wx/radiobut.h"
 
 
 #include "wx/radiobut.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
+#endif
 
 #include <wx/mac/uma.h>
 
 
 #include <wx/mac/uma.h>
 
@@ -48,7 +50,8 @@ void wxRadioButton::SetValue(bool val)
        
    ::SetControlValue( m_macControl , val ) ;
    
        
    ::SetControlValue( m_macControl , val ) ;
    
-   if (val) {
+   if (val) 
+   {
                cycle=this->NextInCycle();
                if (cycle!=NULL) {
                        while (cycle!=this) {
                cycle=this->NextInCycle();
                if (cycle!=NULL) {
                        while (cycle!=this) {
@@ -94,4 +97,3 @@ wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)
                return(cycle);
        }
 }  
                return(cycle);
        }
 }  
-
index 5c01ddd438b31c848d782db2e7d34e2c1d59fcc2..afe12ce60332d74ceabf9d43c6f806b81230d09c 100644 (file)
 
 #include "wx/region.h"
 #include "wx/gdicmn.h"
 
 #include "wx/region.h"
 #include "wx/gdicmn.h"
+#include "wx/mac/uma.h"
 
 
+#if !USE_SHARED_LIBRARY
        IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
        IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)
        IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
        IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)
+#endif
 
 //-----------------------------------------------------------------------------
 // wxRegionRefData implementation
 
 //-----------------------------------------------------------------------------
 // wxRegionRefData implementation
@@ -195,7 +198,8 @@ void wxRegion::GetBox(long& x, long& y, long&w, long &h) const
 {
        if (m_refData) 
        {
 {
        if (m_refData) 
        {
-               Rect box = (**M_REGION).rgnBBox ;
+               Rect box ;
+               GetRegionBounds( M_REGION , &box ) ;
         x = box.left ;
         y = box.top ;
         w = box.right - box.left ;
         x = box.left ;
         y = box.top ;
         w = box.right - box.left ;
@@ -329,7 +333,8 @@ void wxRegionIterator::Reset(const wxRegion& region)
     {
        // we cannot dissolve it into rects on mac
         m_rects = new wxRect[1];
     {
        // we cannot dissolve it into rects on mac
         m_rects = new wxRect[1];
-        Rect rect = (**OTHER_M_REGION( region )).rgnBBox ;
+               Rect rect ;
+               GetRegionBounds( OTHER_M_REGION( region ) , &rect ) ;
         m_rects[0].x = rect.left;
         m_rects[0].y = rect.top;
         m_rects[0].width = rect.right - rect.left;
         m_rects[0].x = rect.left;
         m_rects[0].y = rect.top;
         m_rects[0].width = rect.right - rect.left;
index 2db4a175bb25a42339c81534f792deb339ef20f5..92d6dd1fafe7b9b1f1c27a2b6774ab810d21420f 100644 (file)
 #include "wx/scrolbar.h"
 #include "wx/mac/uma.h"
 
 #include "wx/scrolbar.h"
 #include "wx/mac/uma.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
 
 BEGIN_EVENT_TABLE(wxScrollBar, wxControl)
 END_EVENT_TABLE()
 
 IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
 
 BEGIN_EVENT_TABLE(wxScrollBar, wxControl)
 END_EVENT_TABLE()
 
+#endif
 
 extern ControlActionUPP wxMacLiveScrollbarActionUPP ;
 
 
 extern ControlActionUPP wxMacLiveScrollbarActionUPP ;
 
index 2d72222ab892d3586c16aa80572c4541ab447158..b13b5733ccc9f314816194d8f03ae89ffdd01628 100644 (file)
@@ -74,7 +74,6 @@ wxColour wxSystemSettings::GetSystemColour(int index)
                        break ;
                case wxSYS_COLOUR_INFOBK :
                case wxSYS_COLOUR_APPWORKSPACE: 
                        break ;
                case wxSYS_COLOUR_INFOBK :
                case wxSYS_COLOUR_APPWORKSPACE: 
-               case wxSYS_COLOUR_LISTBOX:
                        return *wxWHITE ;
                        break ;
        }
                        return *wxWHITE ;
                        break ;
        }
index 9218d560bb8dbe1d6d4e2d679d28f9ad80dd4966..936ccddb477dfede68c3a6e1bb809583925c08cf 100644 (file)
 #include "wx/slider.h"
 #include "wx/mac/uma.h"
 
 #include "wx/slider.h"
 #include "wx/mac/uma.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
 
 BEGIN_EVENT_TABLE(wxSlider, wxControl)
 END_EVENT_TABLE()
 IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
 
 BEGIN_EVENT_TABLE(wxSlider, wxControl)
 END_EVENT_TABLE()
+#endif
 
 
 
 
 
 
index 944f72dc1011d0c644f103637b94056f4afeeef1..f5ac7bc9bb64660f145224c52fd2c841ed8e6bc5 100644 (file)
 // wxWin macros
 // ----------------------------------------------------------------------------
 
 // wxWin macros
 // ----------------------------------------------------------------------------
 
+#if !USE_SHARED_LIBRARY
     IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
     IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent);
     IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
     IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent);
+#endif
 
 bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
             long style, const wxString& name)
 
 bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
             long style, const wxString& name)
index ce1e5d1ec871626e1548e19a3b8ded38da41bc91..fa75e68fd5aff8980aa7deb3085125c9d8a84e53 100644 (file)
@@ -15,7 +15,9 @@
 
 #include "wx/statbmp.h"
 
 
 #include "wx/statbmp.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
+#endif
 
 /*
  * wxStaticBitmap
 
 /*
  * wxStaticBitmap
@@ -28,11 +30,12 @@ END_EVENT_TABLE()
 bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
            const wxBitmap& bitmap,
            const wxPoint& pos,
 bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
            const wxBitmap& bitmap,
            const wxPoint& pos,
-           const wxSize& size,
+           const wxSize& s,
            long style,
            const wxString& name)
 {
     SetName(name);
            long style,
            const wxString& name)
 {
     SetName(name);
+       wxSize size = s ;
 
     m_backgroundColour = parent->GetBackgroundColour() ;
     m_foregroundColour = parent->GetForegroundColour() ;
 
     m_backgroundColour = parent->GetBackgroundColour() ;
     m_foregroundColour = parent->GetForegroundColour() ;
@@ -47,9 +50,8 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
     m_windowStyle = style;
 
     bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
     m_windowStyle = style;
 
     bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
+       SetSizeOrDefault( size ) ;
     
     
-       SetSizeOrDefault() ;
-       
     return ret;
 }
 
     return ret;
 }
 
index ea7ca9dfbbad0aec9a119692f7e34d4e5693b794..e0d8257d0f19ead27aaae78cb869c60810bde958 100644 (file)
 #include "wx/statbox.h"
 #include "wx/mac/uma.h"
 
 #include "wx/statbox.h"
 #include "wx/mac/uma.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
 
 BEGIN_EVENT_TABLE(wxStaticBox, wxControl)
        EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
 END_EVENT_TABLE()
 
 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
 
 BEGIN_EVENT_TABLE(wxStaticBox, wxControl)
        EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
 END_EVENT_TABLE()
 
+#endif
 
 /*
  * Static box
 
 /*
  * Static box
@@ -37,7 +39,7 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
        Rect bounds ;
        Str255 title ;
        
        Rect bounds ;
        Str255 title ;
        
-       MacPreControlCreate( parent , id ,  label , pos , size ,style, *((wxValidator*)NULL) , name , &bounds , title ) ;
+       MacPreControlCreate( parent , id ,  label , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1, 
                kControlGroupBoxTextTitleProc , (long) this ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1, 
                kControlGroupBoxTextTitleProc , (long) this ) ;
index b249fc0e11b8be216d0363d123a1e9c8a4701907..22653f651e02c6b0370599febc420f63e240260c 100644 (file)
@@ -18,7 +18,9 @@
 
 #include <stdio.h>
 
 
 #include <stdio.h>
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
+#endif
 
 #include <wx/mac/uma.h>
 
 
 #include <wx/mac/uma.h>
 
@@ -51,69 +53,208 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
     return ret;
 }
 
     return ret;
 }
 
-void wxStaticText::OnPaint( wxPaintEvent &event ) 
+void wxStaticText::OnDraw( wxDC &dc )
 {
 {
-    wxPaintDC dc(this);
     PrepareDC(dc);
     dc.Clear() ;
     PrepareDC(dc);
     dc.Clear() ;
-    dc.DrawText( m_label , 0 , 0 ) ;
-}
+    
+    int x = 0 ;
+    int y = 0 ;
+    wxString text = m_label ;
+    wxString paragraph ;
+       int i = 0 ;
+       int laststop = 0 ;
+       long width, height ;
 
 
-wxSize wxStaticText::DoGetBestSize() const
-{
-       int x , y  ;
-       GetTextExtent( m_label , &x , &y ) ;
-       return wxSize( x , y ) ;
+       while( i < text.Length() )
+       {
+               if( text[i] == 13 || text[i] == 10)
+               {
+                       paragraph = text.Mid( laststop , i - laststop ) ;
+                       while( paragraph.Length() > 0 )
+                       {
+                               dc.GetTextExtent( paragraph , &width , &height ) ;
+                               if ( width > m_width )
+                               {
+                                       for ( int p = paragraph.Length() -1 ; p > 0 ; --p )
+                                       {
+                                               if ( paragraph[p]=='.' )
+                                               {
+                                                       dc.GetTextExtent( paragraph.Left(p+1) , &width , &height ) ;
+                                                       if ( width <= m_width )
+                                                       {       
+                                                               int pos = x ;
+                                                               if ( HasFlag( wxALIGN_CENTER ) )
+                                                               {
+                                                                       pos += ( m_width - width ) / 2 ;
+                                                               }
+                                                               else if ( HasFlag( wxALIGN_RIGHT ) )
+                                                               {
+                                                                       pos += ( m_width - width ) ;
+                                                               }               
+                                                       dc.DrawText( paragraph.Left(p+1), pos , y) ;
+                                                       y += height ;
+                                                               paragraph = paragraph.Mid(p+1) ;
+                                                               break ;
+                                                       }
+                                               }
+                                               if ( paragraph[p]==' ' )
+                                               {
+                                                       dc.GetTextExtent( paragraph.Left(p) , &width , &height ) ;
+                                                       if ( width <= m_width )
+                                                       {
+                                                               int pos = x ;
+                                                               if ( HasFlag( wxALIGN_CENTER ) )
+                                                               {
+                                                                       pos += ( m_width - width ) / 2 ;
+                                                               }
+                                                               else if ( HasFlag( wxALIGN_RIGHT ) )
+                                                               {
+                                                                       pos += ( m_width - width ) ;
+                                                               }               
+                                                       dc.DrawText( paragraph.Left(p), pos , y) ;
+                                                       y += height ;
+                                                               paragraph = paragraph.Mid(p+1) ;
+                                                               break ;
+                                                       }
+                                               }
+                                       }
+                               }
+                               else
+                               {
+                               dc.DrawText( paragraph, x , y) ;
+                               paragraph="";
+                               y += height ;
+                               }
+                       }
+                       laststop = i+1 ;
+               }
+               ++i ;
+       }
+       paragraph = text.Mid( laststop , text.Length() - laststop ) ;
+       while( paragraph.Length() > 0 )
+       {
+               dc.GetTextExtent( paragraph , &width , &height ) ;
+               if ( width > m_width )
+               {
+                       for ( int p = paragraph.Length() -1 ; p > 0 ; --p )
+                       {
+                               if ( paragraph[p]=='.' )
+                               {
+                                       dc.GetTextExtent( paragraph.Left(p+1) , &width , &height ) ;
+                                       if ( width <= m_width )
+                                       {
+                                               int pos = x ;
+                                               if ( HasFlag( wxALIGN_CENTER ) )
+                                               {
+                                                       pos += ( m_width - width ) / 2 ;
+                                               }
+                                               else if ( HasFlag( wxALIGN_RIGHT ) )
+                                               {
+                                                       pos += ( m_width - width ) ;
+                                               }               
+                                               dc.DrawText( paragraph.Left(p+1), pos , y) ;
+                                               y += height ;
+                                               paragraph = paragraph.Mid(p+1) ;
+                                               break ;
+                                       }
+                               }
+                               if ( paragraph[p]==' ' )
+                               {
+                                       dc.GetTextExtent( paragraph.Left(p) , &width , &height ) ;
+                                       if ( width <= m_width )
+                                       {
+                                               int pos = x ;
+                                               if ( HasFlag( wxALIGN_CENTER ) )
+                                               {
+                                                       pos += ( m_width - width ) / 2 ;
+                                               }
+                                               else if ( HasFlag( wxALIGN_RIGHT ) )
+                                               {
+                                                       pos += ( m_width - width ) ;
+                                               }               
+                                               dc.DrawText( paragraph.Left(p), pos , y) ;
+                                               y += height ;
+                                               paragraph = paragraph.Mid(p+1) ;
+                                               break ;
+                                       }
+                               }
+                       }
+               }
+               else
+               {
+                       int pos = x ;
+                       if ( HasFlag( wxALIGN_CENTER ) )
+                       {
+                               pos += ( m_width - width ) / 2 ;
+                       }
+                       else if ( HasFlag( wxALIGN_RIGHT ) )
+                       {
+                               pos += ( m_width - width ) ;
+                       }               
+                       dc.DrawText( paragraph, pos , y) ;
+                       paragraph="";
+                       y += height ;
+               }
+       }
 }
 
 }
 
-void wxStaticText::SetLabel(const wxString& st , bool resize )
-{
-       SetTitle( st ) ;
-       m_label = st ;
-       if ( resize )
-               SetSizeOrDefault() ;
-       else
-               Refresh() ;
-}
-/*
-void wxStaticText::SetSize(int x, int y, int width, int height, int sizeFlags)
+void wxStaticText::OnPaint( wxPaintEvent &event ) 
 {
 {
-    wxControl::SetSize( x , y , width , height , sizeFlags ) ;
+    wxPaintDC dc(this);
+    OnDraw( dc ) ;
 }
 
 }
 
-bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
-           const wxString& label,
-           const wxPoint& pos,
-           const wxSize& size,
-           long style,
-           const wxString& name)
+wxSize wxStaticText::DoGetBestSize() const
 {
 {
-       Rect bounds ;
-       Str255 title ;
-       
-       MacPreControlCreate( parent , id ,  label , pos , size ,style, *((wxValidator*)NULL) , name , &bounds , title ) ;
+       int x , y  ;
+   int widthTextMax = 0, widthLine,
+        heightTextTotal = 0, heightLineDefault = 0, heightLine = 0;
 
 
-       m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1, 
-               kControlStaticTextProc , (long) this ) ;
-       ::UMASetControlData( m_macControl, kControlLabelPart, kControlStaticTextTextTag , (long) title[0] , (char*) &title[1] ) ;
-       
-       MacPostControlCreate() ;
+    wxString curLine;
+    for ( const wxChar *pc = m_label; ; pc++ ) {
+        if ( *pc == wxT('\n') || *pc == wxT('\0') ) {
+            if ( !curLine ) {
+                // we can't use GetTextExtent - it will return 0 for both width
+                // and height and an empty line should count in height
+                // calculation
+                if ( !heightLineDefault )
+                    heightLineDefault = heightLine;
+                if ( !heightLineDefault )
+                    GetTextExtent(_T("W"), NULL, &heightLineDefault);
+
+                heightTextTotal += heightLineDefault;
+            }
+            else {
+                GetTextExtent(curLine, &widthLine, &heightLine);
+                if ( widthLine > widthTextMax )
+                    widthTextMax = widthLine;
+                heightTextTotal += heightLine;
+            }
+
+            if ( *pc == wxT('\n') ) {
+               curLine.Empty();
+            }
+            else {
+               // the end of string
+               break;
+            }
+        }
+        else {
+            curLine += *pc;
+        }
+    }
 
 
-  return TRUE;
+    return wxSize(widthTextMax, heightTextTotal);
 }
 
 }
 
-void wxStaticText::SetLabel(const wxString& st , bool resize )
+void wxStaticText::SetLabel(const wxString& st )
 {
        SetTitle( st ) ;
 {
        SetTitle( st ) ;
-       wxString label ;
+       m_label = st ;
+       if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
+               SetSizeOrDefault() ;
        
        
-       if( wxApp::s_macDefaultEncodingIsPC )
-               label = wxMacMakeMacStringFromPC( st ) ;
-       else
-               label = st ;
-               
-       ::UMASetControlData( m_macControl, kControlLabelPart, kControlStaticTextTextTag , (long) label.Length() , (char*)(const char*) label ) ;
-       Refresh() ;
+    wxClientDC dc(this);
+    OnDraw( dc ) ;
 }
 }
-*/
-
index ed13c3ac8aa2a0ef896c7e9ac9566288c2616127..54821412688f56487af8752ba8fe91edbe432c4c 100644 (file)
 #include "wx/tabctrl.h"
 #include "wx/mac/uma.h"
 
 #include "wx/tabctrl.h"
 #include "wx/mac/uma.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl, wxControl)
 
 BEGIN_EVENT_TABLE(wxTabCtrl, wxControl)
 END_EVENT_TABLE()
 IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl, wxControl)
 
 BEGIN_EVENT_TABLE(wxTabCtrl, wxControl)
 END_EVENT_TABLE()
+#endif
 
 wxTabCtrl::wxTabCtrl()
 {
 
 wxTabCtrl::wxTabCtrl()
 {
@@ -35,7 +37,7 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
 
   m_imageList = NULL;
        
 
   m_imageList = NULL;
        
-       MacPreControlCreate( parent , id ,  "" , pos , size ,style, *((wxValidator*)NULL) , name , &bounds , title ) ;
+       MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1, 
                kControlTabSmallProc , (long) this ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1, 
                kControlTabSmallProc , (long) this ) ;
index c1b98861b03d6f1c41cdfb7833064da1af5a547c..af3919bb7bd4ca122df4e2cf3dbfcc9c3a4fd069 100644 (file)
 
 #include "wx/mac/uma.h"
 
 
 #include "wx/mac/uma.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
 
 BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
        EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
        EVT_CHAR(wxTextCtrl::OnChar)
 IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
 
 BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
        EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
        EVT_CHAR(wxTextCtrl::OnChar)
+    EVT_MENU(wxID_CUT, wxTextCtrl::OnCut)
+    EVT_MENU(wxID_COPY, wxTextCtrl::OnCopy)
+    EVT_MENU(wxID_PASTE, wxTextCtrl::OnPaste)
+    EVT_MENU(wxID_UNDO, wxTextCtrl::OnUndo)
+    EVT_MENU(wxID_REDO, wxTextCtrl::OnRedo)
+
+    EVT_UPDATE_UI(wxID_CUT, wxTextCtrl::OnUpdateCut)
+    EVT_UPDATE_UI(wxID_COPY, wxTextCtrl::OnUpdateCopy)
+    EVT_UPDATE_UI(wxID_PASTE, wxTextCtrl::OnUpdatePaste)
+    EVT_UPDATE_UI(wxID_UNDO, wxTextCtrl::OnUpdateUndo)
+    EVT_UPDATE_UI(wxID_REDO, wxTextCtrl::OnUpdateRedo)
 END_EVENT_TABLE()
 END_EVENT_TABLE()
+#endif
 
 // Text item
 wxTextCtrl::wxTextCtrl()
 
 // Text item
 wxTextCtrl::wxTextCtrl()
-#ifndef NO_TEXT_WINDOW_STREAM
- :streambuf()
-#endif
 {
 {
-    m_fileName = "";
 }
 
 }
 
+const short kVerticalMargin = 2 ;
+const short kHorizontalMargin = 2 ;
+
 bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
                   const wxString& st,
            const wxPoint& pos,
 bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
                   const wxString& st,
            const wxPoint& pos,
@@ -61,25 +73,40 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
            const wxValidator& validator,
            const wxString& name)
 {
            const wxValidator& validator,
            const wxString& name)
 {
-       m_macHorizontalBorder = 2 ; // additional pixels around the real control
-       m_macVerticalBorder = 2 ;
+    // base initialization
+    if ( !CreateBase(parent, id, pos, size, style, validator, name) )
+        return FALSE;
 
        wxSize mySize = size ;
 
        wxSize mySize = size ;
+       if ( UMAHasAppearance() )
+       {
+               m_macHorizontalBorder = 5 ; // additional pixels around the real control
+               m_macVerticalBorder = 5 ;
+       }
+       else
+       {
+               m_macHorizontalBorder = 0 ; // additional pixels around the real control
+               m_macVerticalBorder = 0 ;
+       }
+
 
        Rect bounds ;
        Str255 title ;
 
        Rect bounds ;
        Str255 title ;
-       
+
        if ( mySize.y == -1 )
        {
                if ( UMAHasAppearance() )
        if ( mySize.y == -1 )
        {
                if ( UMAHasAppearance() )
-                       mySize.y = 16 ;
+                       mySize.y = 13 ;
                else
                        mySize.y = 24 ;
                else
                        mySize.y = 24 ;
+               
+               mySize.y += 2 * m_macVerticalBorder ;
        }
        }
+
        MacPreControlCreate( parent , id ,  "" , pos , mySize ,style, validator , name , &bounds , title ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1, 
        MacPreControlCreate( parent , id ,  "" , pos , mySize ,style, validator , name , &bounds , title ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1, 
-               kControlEditTextProc , (long) this ) ;
+               ( style & wxTE_PASSWORD ) ? kControlEditTextPasswordProc : kControlEditTextProc , (long) this ) ;
        MacPostControlCreate() ;
 
        wxString value ;
        MacPostControlCreate() ;
 
        wxString value ;
@@ -88,7 +115,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
                value = wxMacMakeMacStringFromPC( st ) ;
        else
                value = st ;
                value = wxMacMakeMacStringFromPC( st ) ;
        else
                value = st ;
-       UMASetControlData( m_macControl, 0, kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ;
+       UMASetControlData( m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ;
 
   return TRUE;
 }
 
   return TRUE;
 }
@@ -96,7 +123,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
 wxString wxTextCtrl::GetValue() const
 {
        Size actualsize;
 wxString wxTextCtrl::GetValue() const
 {
        Size actualsize;
-       UMAGetControlData( m_macControl, 0, kControlEditTextTextTag , 32767 , wxBuffer , &actualsize) ;
+       UMAGetControlData( m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , 32767 , wxBuffer , &actualsize) ;
        wxBuffer[actualsize] = 0 ;
        if( wxApp::s_macDefaultEncodingIsPC )
                return wxMacMakePCStringFromMac( wxBuffer ) ;
        wxBuffer[actualsize] = 0 ;
        if( wxApp::s_macDefaultEncodingIsPC )
                return wxMacMakePCStringFromMac( wxBuffer ) ;
@@ -104,6 +131,18 @@ wxString wxTextCtrl::GetValue() const
        return wxString(wxBuffer);
 }
 
        return wxString(wxBuffer);
 }
 
+void wxTextCtrl::GetSelection(long* from, long* to) const
+{
+   ControlEditTextSelectionRec selection ;
+   TEHandle teH ;
+   long size ;
+   
+   UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
+
+    *from = (**teH).selStart;
+    *to = (**teH).selEnd;
+}
+
 void wxTextCtrl::SetValue(const wxString& st)
 {
        wxString value ;
 void wxTextCtrl::SetValue(const wxString& st)
 {
        wxString value ;
@@ -112,44 +151,116 @@ void wxTextCtrl::SetValue(const wxString& st)
                value = wxMacMakeMacStringFromPC( st ) ;
        else
                value = st ;
                value = wxMacMakeMacStringFromPC( st ) ;
        else
                value = st ;
-       UMASetControlData( m_macControl, 0, kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ;
+       UMASetControlData( m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ;
        Refresh() ;
 //     MacInvalidateControl() ;
 }
 
        Refresh() ;
 //     MacInvalidateControl() ;
 }
 
-void wxTextCtrl::SetSize(int x, int y, int width, int height, int sizeFlags)
-{
-    wxControl::SetSize( x , y , width , height , sizeFlags ) ;
-}
-
 // Clipboard operations
 void wxTextCtrl::Copy()
 {
 // Clipboard operations
 void wxTextCtrl::Copy()
 {
-   TEHandle teH ;
-   long size ;
+    if (CanCopy())
+    {
+               TEHandle teH ;
+               long size ;
    
    
-   UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
-       TECopy( teH ) ;
+                UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
+               TECopy( teH ) ;
+#if TARGET_CARBON
+               OSStatus err ;
+               err = ClearCurrentScrap( );
+#else
+               OSErr err ;
+               err = ZeroScrap( );
+#endif
+               TEToScrap() ;
+       }
 }
 
 void wxTextCtrl::Cut()
 {
 }
 
 void wxTextCtrl::Cut()
 {
-   TEHandle teH ;
-   long size ;
+    if (CanCut())
+    {
+               TEHandle teH ;
+               long size ;
    
    
-   UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
-       TECut( teH ) ;
-//     MacInvalidateControl() ;
+               UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
+               TECut( teH ) ;
+#if TARGET_CARBON
+               OSStatus err ;
+               err = ClearCurrentScrap( );
+#else
+               OSErr err ;
+               err = ZeroScrap( );
+#endif
+               TEToScrap() ;
+               //      MacInvalidateControl() ;
+       }
 }
 
 void wxTextCtrl::Paste()
 {
 }
 
 void wxTextCtrl::Paste()
 {
-   TEHandle teH ;
-   long size ;
+    if (CanPaste())
+    {
+               TEHandle teH ;
+               long size ;
    
    
-   UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
-       TEPaste( teH ) ;
+               UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
+               TEFromScrap() ;
+               TEPaste( teH ) ;
 //     MacInvalidateControl() ;
 //     MacInvalidateControl() ;
+       }
+}
+
+bool wxTextCtrl::CanCopy() const
+{
+    // Can copy if there's a selection
+    long from, to;
+    GetSelection(& from, & to);
+    return (from != to);
+}
+
+bool wxTextCtrl::CanCut() const
+{
+    // Can cut if there's a selection
+    long from, to;
+    GetSelection(& from, & to);
+    return (from != to);
+}
+
+bool wxTextCtrl::CanPaste() const
+{
+    if (!IsEditable())
+        return FALSE;
+
+       long offset ;
+#if TARGET_CARBON
+       OSStatus err = noErr;
+       ScrapRef scrapRef;
+       
+       err = GetCurrentScrap( &scrapRef );
+       if ( err != noTypeErr && err != memFullErr )    
+       {
+               ScrapFlavorFlags        flavorFlags;
+               Size                            byteCount;
+               
+               if (( err = GetScrapFlavorFlags( scrapRef, 'TEXT', &flavorFlags )) == noErr)
+               {
+                       if (( err = GetScrapFlavorSize( scrapRef, 'TEXT', &byteCount )) == noErr)
+                       {
+                               return TRUE ;
+                       }
+               }
+       }
+       return FALSE;
+       
+#else
+       if ( GetScrap( NULL , 'TEXT' , &offset ) > 0 )
+       {
+               return TRUE ;
+       }
+#endif
+       return FALSE ;
 }
 
 void wxTextCtrl::SetEditable(bool editable)
 }
 
 void wxTextCtrl::SetEditable(bool editable)
@@ -243,65 +354,10 @@ void wxTextCtrl::SetSelection(long from, long to)
 
 bool wxTextCtrl::LoadFile(const wxString& file)
 {
 
 bool wxTextCtrl::LoadFile(const wxString& file)
 {
-    if (!wxFileExists(file))
-        return FALSE;
-
-    m_fileName = file;
-
-    Clear();
-
-#ifndef __WXMAC__
-    ifstream input((char*) (const char*) file, ios::nocreate | ios::in);
-#else
-    ifstream input((char*) (const char*) file, ios::in);
-#endif
-    if (!input.bad())
+    if ( wxTextCtrlBase::LoadFile(file) )
     {
     {
-        struct stat stat_buf;
-        if (stat(file, &stat_buf) < 0)
-            return FALSE;
-        // This may need to be a bigger buffer than the file size suggests,
-        // if it's a UNIX file. Give it an extra 1000 just in case.
-        char *tmp_buffer = (char*)malloc((size_t)(stat_buf.st_size+1+1000));
-        long no_lines = 0;
-        long pos = 0;
-        while (!input.eof() && input.peek() != EOF)
-        {
-            input.getline(wxBuffer, 500);
-               int len = strlen(wxBuffer);
-               wxBuffer[len] = 13;
-               wxBuffer[len+1] = 10;
-               wxBuffer[len+2] = 0;
-               strcpy(tmp_buffer+pos, wxBuffer);
-               pos += strlen(wxBuffer);
-               no_lines++;
-         }
-
-         // TODO add line
-
-         free(tmp_buffer);
-
-         return TRUE;
+        return TRUE;
     }
     }
-    return FALSE;
-}
-
-// If file is null, try saved file name first
-// Returns TRUE if succeeds.
-bool wxTextCtrl::SaveFile(const wxString& file)
-{
-    wxString theFile(file);
-    if (theFile == "")
-        theFile = m_fileName;
-    if (theFile == "")
-        return FALSE;
-    m_fileName = theFile;
-
-    ofstream output((char*) (const char*) theFile);
-    if (output.bad())
-           return FALSE;
-
-    // TODO get and save text
 
     return FALSE;
 }
 
     return FALSE;
 }
@@ -329,18 +385,8 @@ void wxTextCtrl::AppendText(const wxString& text)
 
 void wxTextCtrl::Clear()
 {
 
 void wxTextCtrl::Clear()
 {
-    TEHandle teH ;
-    long size ;
-       ControlEditTextSelectionRec selection ;
-   
-       selection.selStart = 0 ;
-       selection.selEnd = 32767 ;
-   
-    UMASetControlData( m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ;
-   
-    UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
-               TECut( teH ) ;
-//     MacInvalidateControl() ;
+       UMASetControlData( m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , 0 , (char*) ((const char*)NULL) ) ;
+       Refresh() ;
 }
 
 bool wxTextCtrl::IsModified() const
 }
 
 bool wxTextCtrl::IsModified() const
@@ -348,6 +394,73 @@ bool wxTextCtrl::IsModified() const
     return TRUE;
 }
 
     return TRUE;
 }
 
+bool wxTextCtrl::IsEditable() const
+{
+    return IsEnabled();
+}
+
+bool wxTextCtrl::AcceptsFocus() const
+{
+    // we don't want focus if we can't be edited
+    return IsEditable() && wxControl::AcceptsFocus();
+}
+
+wxSize wxTextCtrl::DoGetBestSize() const
+{
+    int wText = 100 ;
+       
+    int hText ;
+               if ( UMAHasAppearance() )
+                       hText = 13 ;
+               else
+                       hText = 24 ;
+       hText += 2 * m_macHorizontalBorder ;
+/*
+    int cx, cy;
+    wxGetCharSize(GetHWND(), &cx, &cy, &GetFont());
+
+    int wText = DEFAULT_ITEM_WIDTH;
+
+    int hText = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
+
+    return wxSize(wText, hText);
+*/
+    if ( m_windowStyle & wxTE_MULTILINE )
+    {
+        hText *= wxMin(GetNumberOfLines(), 5);
+    }
+    //else: for single line control everything is ok
+    return wxSize(wText, hText);
+}
+
+// ----------------------------------------------------------------------------
+// Undo/redo
+// ----------------------------------------------------------------------------
+
+void wxTextCtrl::Undo()
+{
+    if (CanUndo())
+    {
+    }
+}
+
+void wxTextCtrl::Redo()
+{
+    if (CanRedo())
+    {
+    }
+}
+
+bool wxTextCtrl::CanUndo() const
+{
+    return FALSE ;
+}
+
+bool wxTextCtrl::CanRedo() const
+{
+    return FALSE ;
+}
+
 // Makes 'unmodified'
 void wxTextCtrl::DiscardEdits()
 {
 // Makes 'unmodified'
 void wxTextCtrl::DiscardEdits()
 {
@@ -366,9 +479,9 @@ long wxTextCtrl::XYToPosition(long x, long y) const
     return 0;
 }
 
     return 0;
 }
 
-void wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
+bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
 {
 {
-    // TODO
+    return FALSE ;
 }
 
 void wxTextCtrl::ShowPosition(long pos)
 }
 
 void wxTextCtrl::ShowPosition(long pos)
@@ -407,204 +520,125 @@ void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event)
 
 void wxTextCtrl::OnChar(wxKeyEvent& event)
 {
 
 void wxTextCtrl::OnChar(wxKeyEvent& event)
 {
-    switch( event.KeyCode() )
+    switch ( event.KeyCode() )
     {
         case WXK_RETURN:
     {
         case WXK_RETURN:
-        {
-            if ( !(m_windowStyle & wxTE_MULTILINE) )
-            {
+               if (m_windowStyle & wxPROCESS_ENTER)
+               {
                 wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
                 event.SetEventObject( this );
                 if ( GetEventHandler()->ProcessEvent(event) )
                     return;
                 wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
                 event.SetEventObject( this );
                 if ( GetEventHandler()->ProcessEvent(event) )
                     return;
+               } 
+            if ( !(m_windowStyle & wxTE_MULTILINE) )
+            {
+                       wxWindow *parent = GetParent();
+                       wxPanel *panel = wxDynamicCast(parent, wxPanel);
+                       while ( parent != NULL && panel == NULL )
+                       {
+                               parent = parent->GetParent() ;
+                               panel = wxDynamicCast(parent, wxPanel);
+                       }
+                       if ( panel && panel->GetDefaultItem() )
+                       {
+                               wxButton *def = panel->GetDefaultItem() ;
+                               wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
+                                       event.SetEventObject(def);
+                                       def->Command(event);
+                               event.Skip() ;
+                       return ;
+                       }
             }
             //else: multiline controls need Enter for themselves
 
             break;
             }
             //else: multiline controls need Enter for themselves
 
             break;
-        }
+
         case WXK_TAB:
             // always produce navigation event - even if we process TAB
             // ourselves the fact that we got here means that the user code
             // decided to skip processing of this TAB - probably to let it
             // do its default job.
         case WXK_TAB:
             // always produce navigation event - even if we process TAB
             // ourselves the fact that we got here means that the user code
             // decided to skip processing of this TAB - probably to let it
             // do its default job.
-            //
-            // NB: Notice that Ctrl-Tab is handled elsewhere and Alt-Tab is
-            //     handled by Windows
             {
                 wxNavigationKeyEvent eventNav;
                 eventNav.SetDirection(!event.ShiftDown());
             {
                 wxNavigationKeyEvent eventNav;
                 eventNav.SetDirection(!event.ShiftDown());
-                eventNav.SetWindowChange(FALSE);
+                eventNav.SetWindowChange(event.ControlDown());
                 eventNav.SetEventObject(this);
 
                 eventNav.SetEventObject(this);
 
-                if ( GetEventHandler()->ProcessEvent(eventNav) )
+                if ( GetParent()->GetEventHandler()->ProcessEvent(eventNav) )
                     return;
                     return;
+                       event.Skip() ;
+                return ;
             }
             break;
             }
             break;
-
-        default:
-            event.Skip();
-            return;
     }
 
     }
 
-    // don't just call event.Skip() because this will cause TABs and ENTERs
-    // be passed upwards and we don't always want this - instead process it
-    // right here
-
-    // FIXME
-    event.Skip();
-}
-// The streambuf code was partly taken from chapter 3 by Jerry Schwarz of
-// AT&T's "C++ Lanuage System Release 3.0 Library Manual" - Stein Somers
-
-//=========================================================================
-// Called then the buffer is full (gcc 2.6.3) 
-// or when "endl" is output (Borland 4.5)
-//=========================================================================
-// Class declaration using multiple inheritance doesn't work properly for
-// Borland. See note in wb_text.h.
-#ifndef NO_TEXT_WINDOW_STREAM
-int wxTextCtrl::overflow(int c)
-{
-  // Make sure there is a holding area
-  if ( allocate()==EOF )
-  {
-    wxError("Streambuf allocation failed","Internal error");
-    return EOF;
-  }
-  
-  // Verify that there are no characters in get area
-  if ( gptr() && gptr() < egptr() )
-  {
-     wxError("Who's trespassing my get area?","Internal error");
-     return EOF;
-  }
-
-  // Reset get area
-  setg(0,0,0);
-
-  // Make sure there is a put area
-  if ( ! pptr() )
-  {
-/* This doesn't seem to be fatal so comment out error message */
-//    wxError("Put area not opened","Internal error");
-    setp( base(), base() );
-  }
-
-  // Determine how many characters have been inserted but no consumed
-  int plen = pptr() - pbase();
-
-  // Now Jerry relies on the fact that the buffer is at least 2 chars
-  // long, but the holding area "may be as small as 1" ???
-  // And we need an additional \0, so let's keep this inefficient but
-  // safe copy.
-
-  // If c!=EOF, it is a character that must also be comsumed
-  int xtra = c==EOF? 0 : 1;
-
-  // Write temporary C-string to wxTextWindow
-  {
-  char *txt = new char[plen+xtra+1];
-  memcpy(txt, pbase(), plen);
-  txt[plen] = (char)c;     // append c
-  txt[plen+xtra] = '\0';   // append '\0' or overwrite c
-    // If the put area already contained \0, output will be truncated there
-  AppendText(txt);
-    delete[] txt;
-  }
-
-  // Reset put area
-  setp(pbase(), epptr());
-
-#if defined(__WATCOMC__)
-  return __NOT_EOF;
-#elif defined(zapeof)     // HP-UX (all cfront based?)
-  return zapeof(c);
-#else
-  return c!=EOF ? c : 0;  // this should make everybody happy
-#endif
+       EventRecord *ev = wxTheApp->MacGetCurrentEvent() ;
+       short keycode ;
+       short keychar ;
+       keychar = short(ev->message & charCodeMask);
+       keycode = short(ev->message & keyCodeMask) >> 8 ;
+       UMAHandleControlKey( m_macControl , keycode , keychar , ev->modifiers ) ;
+       if ( keychar >= 0x20 || event.KeyCode() == WXK_RETURN)
+       {
+        wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
+        event.SetString( GetValue() ) ;
+        event.SetEventObject( this );
+        GetEventHandler()->ProcessEvent(event);
+       }
+
 }
 
 }
 
-//=========================================================================
-// called then "endl" is output (gcc) or then explicit sync is done (Borland)
-//=========================================================================
-int wxTextCtrl::sync()
-{
-  // Verify that there are no characters in get area
-  if ( gptr() && gptr() < egptr() )
-  {
-     wxError("Who's trespassing my get area?","Internal error");
-     return EOF;
-  }
-
-  if ( pptr() && pptr() > pbase() ) return overflow(EOF);
-
-  return 0;
-/* OLD CODE
-  int len = pptr() - pbase();
-  char *txt = new char[len+1];
-  strncpy(txt, pbase(), len);
-  txt[len] = '\0';
-  (*this) << txt;
-  setp(pbase(), epptr());
-  delete[] txt;
-  return 0;
-*/
+// ----------------------------------------------------------------------------
+// standard handlers for standard edit menu events
+// ----------------------------------------------------------------------------
+
+void wxTextCtrl::OnCut(wxCommandEvent& event)
+{
+    Cut();
 }
 
 }
 
-//=========================================================================
-// Should not be called by a "ostream". Used by a "istream"
-//=========================================================================
-int wxTextCtrl::underflow()
+void wxTextCtrl::OnCopy(wxCommandEvent& event)
 {
 {
-  return EOF;
+    Copy();
 }
 }
-#endif
 
 
-wxTextCtrl& wxTextCtrl::operator<<(const wxString& s)
+void wxTextCtrl::OnPaste(wxCommandEvent& event)
 {
 {
-    AppendText(s);
-    return *this;
+    Paste();
 }
 
 }
 
-wxTextCtrl& wxTextCtrl::operator<<(float f)
+void wxTextCtrl::OnUndo(wxCommandEvent& event)
 {
 {
-    wxString str;
-    str.Printf("%.2f", f);
-    AppendText(str);
-    return *this;
+    Undo();
 }
 
 }
 
-wxTextCtrl& wxTextCtrl::operator<<(double d)
+void wxTextCtrl::OnRedo(wxCommandEvent& event)
 {
 {
-    wxString str;
-    str.Printf("%.2f", d);
-    AppendText(str);
-    return *this;
+    Redo();
 }
 
 }
 
-wxTextCtrl& wxTextCtrl::operator<<(int i)
+void wxTextCtrl::OnUpdateCut(wxUpdateUIEvent& event)
 {
 {
-    wxString str;
-    str.Printf("%d", i);
-    AppendText(str);
-    return *this;
+    event.Enable( CanCut() );
 }
 
 }
 
-wxTextCtrl& wxTextCtrl::operator<<(long i)
+void wxTextCtrl::OnUpdateCopy(wxUpdateUIEvent& event)
 {
 {
-    wxString str;
-    str.Printf("%ld", i);
-    AppendText(str);
-    return *this;
+    event.Enable( CanCopy() );
 }
 
 }
 
-wxTextCtrl& wxTextCtrl::operator<<(const char c)
+void wxTextCtrl::OnUpdatePaste(wxUpdateUIEvent& event)
 {
 {
-    char buf[2];
+    event.Enable( CanPaste() );
+}
 
 
-    buf[0] = c;
-    buf[1] = 0;
-    AppendText(buf);
-    return *this;
+void wxTextCtrl::OnUpdateUndo(wxUpdateUIEvent& event)
+{
+    event.Enable( CanUndo() );
+}
+
+void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event)
+{
+    event.Enable( CanRedo() );
 }
 
 }
 
index d845d50108efea892a4dff22c4d4c0e09344fb30..3d0bb31c08e718579e87b0449ec457dad83e404b 100644 (file)
 
 #include "wx/timer.h"
 
 
 #include "wx/timer.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
 IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
+#endif
+
+static void wxProcessTimer( unsigned long event , void *data ) ;
+
+pascal void MacTimerProc( TMTask * t )
+{
+       MacTimerInfo * tm = (MacTimerInfo*)  t ;
+       wxMacAddEvent( tm->m_table , wxProcessTimer, 0 , (void*) tm->m_timer , TRUE ) ;
+}
+
+void wxProcessTimer( unsigned long event , void *data )
+{
+       if ( !data )
+               return ;
+               
+       wxTimer* timer = (wxTimer*) data ;
+       if ( timer->IsOneShot() )
+               timer->Stop() ;
+               
+    timer->Notify();
+
+    if ( timer->m_info.m_task.tmAddr && !timer->IsOneShot() )
+    {
+           PrimeTime( (QElemPtr)  &timer->m_info.m_task , timer->GetInterval() ) ;
+    }
+}
 
 wxTimer::wxTimer()
 {
 
 wxTimer::wxTimer()
 {
-    m_milli = 0 ;
-    m_id = 0;
-    m_oneShot = FALSE;
+       m_info.m_task.tmAddr = NULL ;
+       m_info.m_task.tmWakeUp = 0 ;
+       m_info.m_task.tmReserved = 0 ;
+       m_info.m_task.qType = 0 ;
+       m_info.m_table = wxMacGetNotifierTable() ;
+       m_info.m_timer = this ;
+}
+
+bool wxTimer::IsRunning() const 
+{
+       return ( m_info.m_task.qType & kTMTaskActive ) ;
 }
 
 wxTimer::~wxTimer()
 }
 
 wxTimer::~wxTimer()
@@ -31,20 +66,31 @@ wxTimer::~wxTimer()
 
 bool wxTimer::Start(int milliseconds,bool mode)
 {
 
 bool wxTimer::Start(int milliseconds,bool mode)
 {
-    m_oneShot = mode ;
-    if (milliseconds <= 0)
-        return FALSE;
+    (void)wxTimerBase::Start(milliseconds, mode);
 
 
-    m_milli = milliseconds;
+    wxCHECK_MSG( m_milli > 0, FALSE, wxT("invalid value for timer timeour") );
+    wxCHECK_MSG( m_info.m_task.tmAddr == NULL , FALSE, wxT("attempting to restart a timer") );
 
 
-    // TODO: set the timer going.
+    m_milli = milliseconds;
+       m_info.m_task.tmAddr = NewTimerProc( MacTimerProc ) ;
+       m_info.m_task.tmWakeUp = 0 ;
+       m_info.m_task.tmReserved = 0 ;
+    InsXTime((QElemPtr) &m_info.m_task ) ;
+    PrimeTime( (QElemPtr) &m_info.m_task , m_milli ) ;
     return FALSE;
 }
 
 void wxTimer::Stop()
 {
     return FALSE;
 }
 
 void wxTimer::Stop()
 {
-    m_id = 0 ;
     m_milli = 0 ;
     m_milli = 0 ;
+    if ( m_info.m_task.tmAddr )
+    {
+       RmvTime(  (QElemPtr) &m_info.m_task ) ;
+       DisposeTimerUPP(m_info.m_task.tmAddr) ;
+       m_info.m_task.tmAddr = NULL ;
+    }
+    wxMacRemoveAllNotifiersForData( wxMacGetNotifierTable() , this ) ;
 }
 
 
 }
 
 
+
index e4bd0aff79ff5484358c1a55fa5c1f4925745315..e118add0ed08f5fa423d714fa181fe2c5e119bec 100644 (file)
@@ -5,8 +5,7 @@
 // Modified by:
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Modified by:
 // Created:     04/01/98
 // RCS-ID:      $Id$
-// Copyright:   (c) AUTHOR
-// Licence:    wxWindows licence
+// Copyright:   (c) AUTHORy
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 #if wxUSE_TOOLBAR
 
 #include "wx/toolbar.h"
 #if wxUSE_TOOLBAR
 
 #include "wx/toolbar.h"
+#include "wx/notebook.h"
+#include "wx/tabctrl.h"
 
 
-IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxToolBarBase)
+#if !USE_SHARED_LIBRARY
+IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
 
 BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
 
 BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
+       EVT_MOUSE_EVENTS( wxToolBar::OnMouse ) 
+       EVT_PAINT( wxToolBar::OnPaint ) 
 END_EVENT_TABLE()
 END_EVENT_TABLE()
+#endif
 
 #include <wx/mac/uma.h>
 
 
 #include <wx/mac/uma.h>
 
@@ -45,14 +50,14 @@ public:
                             clientData, shortHelpString, longHelpString)
     {
         m_nSepCount = 0;
                             clientData, shortHelpString, longHelpString)
     {
         m_nSepCount = 0;
-        m_index = 0 ;
+        m_index = -1 ;
     }
 
     wxToolBarTool(wxToolBar *tbar, wxControl *control)
         : wxToolBarToolBase(tbar, control)
     {
         m_nSepCount = 1;
     }
 
     wxToolBarTool(wxToolBar *tbar, wxControl *control)
         : wxToolBarToolBase(tbar, control)
     {
         m_nSepCount = 1;
-        m_index = 0 ;
+        m_index = -1 ;
     }
 
     // set/get the number of separators which we use to cover the space used by
     }
 
     // set/get the number of separators which we use to cover the space used by
@@ -74,6 +79,9 @@ private:
 // wxToolBarTool
 // ----------------------------------------------------------------------------
 
 // wxToolBarTool
 // ----------------------------------------------------------------------------
 
+const short defwidth = 24 ;
+const short defheight = 22 ;
+
 wxToolBarToolBase *wxToolBar::CreateTool(int id,
                                          const wxBitmap& bitmap1,
                                          const wxBitmap& bitmap2,
 wxToolBarToolBase *wxToolBar::CreateTool(int id,
                                          const wxBitmap& bitmap1,
                                          const wxBitmap& bitmap2,
@@ -91,16 +99,12 @@ wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control)
     return new wxToolBarTool(this, control);
 }
 
     return new wxToolBarTool(this, control);
 }
 
-// ----------------------------------------------------------------------------
-// wxToolBar construction
-// ----------------------------------------------------------------------------
-
 void wxToolBar::Init()
 {
   m_maxWidth = -1;
   m_maxHeight = -1;
 void wxToolBar::Init()
 {
   m_maxWidth = -1;
   m_maxHeight = -1;
-  m_defaultWidth = 24;
-  m_defaultHeight = 22;
+  m_defaultWidth = defwidth;
+  m_defaultHeight = defheight;
   // TODO
 }
 
   // TODO
 }
 
@@ -109,8 +113,8 @@ bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
 {
   m_maxWidth = m_maxHeight = 0;
 
 {
   m_maxWidth = m_maxHeight = 0;
 
-  m_defaultWidth = 24;
-  m_defaultHeight = 22;
+  m_defaultWidth = defwidth;
+  m_defaultHeight = defheight;
   
   int x = pos.x;
   int y = pos.y;
   
   int x = pos.x;
   int y = pos.y;
@@ -125,16 +129,39 @@ bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
     x = 0;
   if (y < 0)
     y = 0;
     x = 0;
   if (y < 0)
     y = 0;
-
+#if 1
+       {
+         SetName(name);
+
+         m_windowStyle = style;
+         parent->AddChild(this);
+
+         m_backgroundColour = parent->GetBackgroundColour() ;
+         m_foregroundColour = parent->GetForegroundColour() ;
+
+         if (id == -1)
+             m_windowId = NewControlId();
+         else
+             m_windowId = id;
+
+               m_width = size.x ;
+               m_height = size.y ;
+               int x = pos.x ;
+               int y = pos.y ;
+               AdjustForParentClientOrigin(x, y, wxSIZE_USE_EXISTING);
+               m_x = x ;
+               m_y = y ;
+       }
+#else
        Rect bounds ;
        Str255 title ;
        
        Rect bounds ;
        Str255 title ;
        
-       MacPreControlCreate( parent , id ,  "" , wxPoint( x , y ) , wxSize( width , height ) ,style, *((wxValidator*)NULL) , name , &bounds , title ) ;
+       MacPreControlCreate( parent , id ,  "" , wxPoint( x , y ) , wxSize( width , height ) ,style, wxDefaultValidator , name , &bounds , title ) ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1, 
                kControlPlacardProc , (long) this ) ;
        MacPostControlCreate() ;
 
        m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1, 
                kControlPlacardProc , (long) this ) ;
        MacPostControlCreate() ;
-
+#endif
   return TRUE;
 }
 
   return TRUE;
 }
 
@@ -143,7 +170,8 @@ wxToolBar::~wxToolBar()
     // TODO
 }
 
     // TODO
 }
 
-PicHandle MakePict(GWorldPtr wp)
+PicHandle MakePict(GWorldPtr wp, GWorldPtr mask ) ;
+PicHandle MakePict(GWorldPtr wp, GWorldPtr mask ) 
 {
        CGrafPtr                origPort ;
        GDHandle                origDev ;
 {
        CGrafPtr                origPort ;
        GDHandle                origDev ;
@@ -151,52 +179,77 @@ PicHandle MakePict(GWorldPtr wp)
        PicHandle               pict;                           // this is the Picture we give back
 
        RGBColor                gray = { 0xCCCC ,0xCCCC , 0xCCCC } ;
        PicHandle               pict;                           // this is the Picture we give back
 
        RGBColor                gray = { 0xCCCC ,0xCCCC , 0xCCCC } ;
+       RGBColor                white = { 0xffff ,0xffff , 0xffff } ;
+       RGBColor                black = { 0x0000 ,0x0000 , 0x0000 } ;
        
        
-       GetGWorld( &origPort , &origDev ) ;
-       SetGWorld( wp , NULL ) ;
-       
-       pict = OpenPicture(&wp->portRect);      // open a picture, this disables drawing
-       if(!pict)       
-               return NULL;
-       
-       RGBBackColor( &gray ) ;
-       EraseRect(&wp->portRect) ;
-       CopyBits((BitMap*)*wp->portPixMap,                      // src PixMap   - we copy image over itself -
-                               (BitMap*)*wp->portPixMap,               // dst PixMap   - no drawing occurs -
-                               &wp->portRect,                  // srcRect              - it will be recorded and compressed -
-                               &wp->portRect,                  // dstRect              - into the picture that is open -
-                               srcCopy,NULL);                  // copyMode and no clip region
-
-       ClosePicture();                                         // We are done recording the picture
-       SetGWorld( origPort , origDev ) ;
-       return pict;                                            // return our groovy pict handle
-}
-
-PicHandle MakePictWhite(GWorldPtr wp)
-{
-       CGrafPtr                origPort ;
-       GDHandle                origDev ;
+       unsigned char *maskimage = NULL ;
+       Rect portRect ;
+       GetPortBounds( wp , &portRect ) ;
+       int width = portRect.right - portRect.left ;
+       int height = portRect.bottom - portRect.top ;
        
        
-       PicHandle               pict;                           // this is the Picture we give back
+       LockPixels( GetGWorldPixMap( wp ) ) ;
+       GetGWorld( &origPort , &origDev ) ;
 
 
-       RGBColor                white = { 0xFFFF ,0xFFFF  , 0xFFFF  } ;
+       if ( mask )
+       {
+               
+               maskimage = (unsigned char*) malloc( width * height ) ;
+               SetGWorld( mask , NULL ) ;
+               LockPixels( GetGWorldPixMap( mask ) ) ;
+               for ( int y = 0 ; y < height ; ++y )
+               {
+                       for( int x = 0 ; x < width ; ++x )
+                       {
+                               RGBColor col ;
+                               
+                               GetCPixel( x + portRect.left , y + portRect.top , &col ) ;
+                               maskimage[y*width + x] = ( col.red == 0 ) ; // for monochrome masks
+                       }
+               }
+               UnlockPixels( GetGWorldPixMap( mask ) ) ;
+       }
        
        
-       GetGWorld( &origPort , &origDev ) ;
        SetGWorld( wp , NULL ) ;
        
        SetGWorld( wp , NULL ) ;
        
-       pict = OpenPicture(&wp->portRect);      // open a picture, this disables drawing
+       pict = OpenPicture(&portRect);  // open a picture, this disables drawing
        if(!pict)       
                return NULL;
        if(!pict)       
                return NULL;
-       
+
+       RGBBackColor( &gray ) ;
+       RGBForeColor( &black ) ;
+       EraseRect(&portRect) ;
        RGBBackColor( &white ) ;
        RGBBackColor( &white ) ;
-       EraseRect(&wp->portRect) ;
-       CopyBits((BitMap*)*wp->portPixMap,                      // src PixMap   - we copy image over itself -
-                               (BitMap*)*wp->portPixMap,               // dst PixMap   - no drawing occurs -
-                               &wp->portRect,                  // srcRect              - it will be recorded and compressed -
-                               &wp->portRect,                  // dstRect              - into the picture that is open -
+
+       if ( maskimage )
+       {
+               for ( int y = 0 ; y < height ; ++y )
+               {
+                       for( int x = 0 ; x < width ; ++x )
+                       {
+                               if ( maskimage[y*width + x] )
+                               {
+                                       RGBColor col ;
+                               
+                                       GetCPixel( x + portRect.left , y + portRect.top , &col ) ;
+                                       SetCPixel( x + portRect.left , y + portRect.top , &col ) ;
+                               }
+                       }
+               }
+               free( maskimage ) ;
+               maskimage = NULL ;
+       }
+       else
+       {
+               CopyBits(GetPortBitMapForCopyBits(wp),                  // src PixMap   - we copy image over itself -
+                               GetPortBitMapForCopyBits(wp),           // dst PixMap   - no drawing occurs -
+                               &portRect,                      // srcRect              - it will be recorded and compressed -
+                               &portRect,                      // dstRect              - into the picture that is open -
                                srcCopy,NULL);                  // copyMode and no clip region
 
                                srcCopy,NULL);                  // copyMode and no clip region
 
+       }
        ClosePicture();                                         // We are done recording the picture
        ClosePicture();                                         // We are done recording the picture
+       UnlockPixels( GetGWorldPixMap( wp ) ) ;
        SetGWorld( origPort , origDev ) ;
        return pict;                                            // return our groovy pict handle
 }
        SetGWorld( origPort , origDev ) ;
        return pict;                                            // return our groovy pict handle
 }
@@ -226,7 +279,7 @@ bool wxToolBar::Realize()
                wxToolBarTool *tool = (wxToolBarTool *)node->Data();
                wxBitmapRefData * bmap = (wxBitmapRefData*) ( tool->GetBitmap1().GetRefData()) ;
                
                wxToolBarTool *tool = (wxToolBarTool *)node->Data();
                wxBitmapRefData * bmap = (wxBitmapRefData*) ( tool->GetBitmap1().GetRefData()) ;
                
-               if( !tool->IsSeparator() )
+               if(  !tool->IsSeparator()  )
                {
                        Rect toolrect = { toolbarrect.top + kwxMacToolBarTopMargin , toolbarrect.left + x + kwxMacToolBarLeftMargin , 0 , 0 } ;
                        toolrect.right = toolrect.left + toolSize.x ;
                {
                        Rect toolrect = { toolbarrect.top + kwxMacToolBarTopMargin , toolbarrect.left + x + kwxMacToolBarLeftMargin , 0 , 0 } ;
                        toolrect.right = toolrect.left + toolSize.x ;
@@ -239,12 +292,19 @@ bool wxToolBar::Realize()
                                        icon = bmap->m_hPict ;
                                else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
                                {
                                        icon = bmap->m_hPict ;
                                else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
                                {
-                                       icon = MakePict( bmap->m_hBitmap ) ;
+                                       if ( tool->GetBitmap1().GetMask() )
+                                       {
+                                               icon = MakePict( bmap->m_hBitmap , tool->GetBitmap1().GetMask()->GetMaskBitmap() ) ;
+                                       }
+                                       else
+                                       {
+                                               icon = MakePict( bmap->m_hBitmap , NULL ) ;
+                                       }
                                }
                        }
                        
                        ControlHandle m_macToolHandle ;
                                }
                        }
                        
                        ControlHandle m_macToolHandle ;
-                               
+                       
                        SInt16 behaviour = kControlBehaviorOffsetContents ;
                        if ( tool->CanBeToggled() )
                                behaviour += kControlBehaviorToggles ;
                        SInt16 behaviour = kControlBehaviorOffsetContents ;
                        if ( tool->CanBeToggled() )
                                behaviour += kControlBehaviorToggles ;
@@ -266,8 +326,19 @@ bool wxToolBar::Realize()
                                                behaviour  , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
                        }
                        m_macToolHandles.Add( m_macToolHandle ) ;
                                                behaviour  , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
                        }
                        m_macToolHandles.Add( m_macToolHandle ) ;
+                       tool->m_index = m_macToolHandles.Count() -1 ;
+                       if ( !tool->IsEnabled() )
+                       {
+                               UMADeactivateControl( m_macToolHandle ) ;
+                       }
+                       if ( tool->CanBeToggled() && tool->IsToggled() )
+                       {
+                               ::SetControlValue( m_macToolHandle , 1 ) ;
+                       }
                        UMASetControlFontStyle( m_macToolHandle , &controlstyle ) ;
                        UMASetControlFontStyle( m_macToolHandle , &controlstyle ) ;
-                       UMAEmbedControl( m_macToolHandle , m_macControl ) ;
+                       ControlHandle container = GetParent()->MacGetContainerForEmbedding() ;
+                       wxASSERT_MSG( container != NULL , "No valid mac container control" ) ;
+                       UMAEmbedControl( m_macToolHandle , container ) ;
                        
                        x += (int)toolSize.x;
                        noButtons ++;
                        
                        x += (int)toolSize.x;
                        noButtons ++;
@@ -311,7 +382,7 @@ void wxToolBar::SetToolBitmapSize(const wxSize& size)
 // The button size is bigger than the bitmap size
 wxSize wxToolBar::GetToolSize() const
 {
 // The button size is bigger than the bitmap size
 wxSize wxToolBar::GetToolSize() const
 {
-    return wxSize(m_defaultWidth + 8, m_defaultHeight + 7);
+    return wxSize(m_defaultWidth + 4, m_defaultHeight + 4);
 }
 
 void wxToolBar::MacHandleControlClick( ControlHandle control , SInt16 controlpart ) 
 }
 
 void wxToolBar::MacHandleControlClick( ControlHandle control , SInt16 controlpart ) 
@@ -321,7 +392,13 @@ void wxToolBar::MacHandleControlClick( ControlHandle control , SInt16 controlpar
        {
                if ( m_macToolHandles[index] == (void*) control )
                {
        {
                if ( m_macToolHandles[index] == (void*) control )
                {
-                       OnLeftClick( ( (wxToolBarTool*) (m_tools.Nth( index )->Data() ) ) ->m_index , ( (wxToolBarTool*) (m_tools.Nth( index )->Data() ) ) ->IsToggled() ) ;
+                       wxToolBarTool *tool = (wxToolBarTool *)m_tools.Nth( index )->Data();
+                       if ( tool->CanBeToggled() )
+               {
+                       tool->Toggle( GetControlValue( control ) ) ;
+               }
+                       OnLeftClick( tool->GetId() , tool -> IsToggled() ) ;
+                       break ;
                }
        }
 }
                }
        }
 }
@@ -340,43 +417,54 @@ void wxToolBar::SetRows(int nRows)
 wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
 {
     MacClientToRootWindow( &x , &y ) ;
 wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
 {
     MacClientToRootWindow( &x , &y ) ;
-    Point pt = { x ,y } ;
+    Point pt = { y ,x } ;
 
        int index = 0 ;
        for ( index = 0 ; index < m_macToolHandles.Count() ; ++index )
        {
 
        int index = 0 ;
        for ( index = 0 ; index < m_macToolHandles.Count() ; ++index )
        {
-               if ( PtInRect( pt , &(**(ControlHandle)(m_macToolHandles[index])).contrlRect) )
+               if ( m_macToolHandles[index] )
                {
                {
-                       return  (wxToolBarTool*) (m_tools.Nth( index )->Data() ) ;
+                       Rect bounds ;
+                       GetControlBounds((ControlHandle) m_macToolHandles[index], &bounds ) ;
+                       if ( PtInRect( pt , &bounds ) )
+                       {
+                               return  (wxToolBarTool*) (m_tools.Nth( index )->Data() ) ;
+                       }
                }
        }
 
     return (wxToolBarToolBase *)NULL;
 }
 
                }
        }
 
     return (wxToolBarToolBase *)NULL;
 }
 
+wxString wxToolBar::MacGetToolTipString( wxPoint &pt )
+{
+       wxToolBarToolBase* tool = FindToolForPosition( pt.x , pt.y ) ;
+       if ( tool )
+       {
+               return tool->GetShortHelp() ;
+       }
+       return "" ;
+}
+
 void wxToolBar::DoEnableTool(wxToolBarToolBase *t, bool enable)
 {
         wxToolBarTool *tool = (wxToolBarTool *)t;
 void wxToolBar::DoEnableTool(wxToolBarToolBase *t, bool enable)
 {
         wxToolBarTool *tool = (wxToolBarTool *)t;
+        if ( tool->m_index < 0 )
+               return ;
+               
         ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
         ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
-               if ( UMAHasAppearance() )
-               {
-                       if ( enable )
-                               ::ActivateControl( control ) ;
-                       else
-                               ::DeactivateControl( control ) ;
-               }
+
+               if ( enable )
+                       UMAActivateControl( control ) ;
                else
                else
-               {
-                       if ( enable )
-                               ::HiliteControl( control , 0 ) ;
-                       else
-                               ::HiliteControl( control , 255 ) ;
-               }
+                       UMADeactivateControl( control ) ;
 }
 
 void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle)
 {
        wxToolBarTool *tool = (wxToolBarTool *)t;
 }
 
 void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle)
 {
        wxToolBarTool *tool = (wxToolBarTool *)t;
+        if ( tool->m_index < 0 )
+               return ;
         
        ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
                ::SetControlValue( control , toggle ) ;
         
        ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
                ::SetControlValue( control , toggle ) ;
@@ -402,5 +490,116 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
 {
                return TRUE ;
 }
 {
                return TRUE ;
 }
+
+void wxToolBar::OnPaint(wxPaintEvent& event)
+{
+       WindowRef window = GetMacRootWindow() ;
+       if ( window )
+       {
+               wxWindow* win = wxFindWinFromMacWindow( window ) ;
+               if ( win )
+               {
+                       wxMacDrawingHelper help( win ) ;
+                       // the mac control manager always assumes to have the origin at 0,0
+                       SetOrigin( 0 , 0 ) ;
+                       
+                       bool                    hasTabBehind = false ;
+                       wxWindow* parent = GetParent() ;
+                       while ( parent )
+                       {
+                               if( parent->MacGetWindowData() )
+                               {
+                                       UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
+                                       break ;
+                               }
+                               
+                               if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) ||  parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
+                               {
+                                       if ( ((wxControl*)parent)->GetMacControl() )
+                                               SetUpControlBackground( ((wxControl*)parent)->GetMacControl() , -1 , true ) ;
+                                       break ;
+                               }
+                               
+                               parent = parent->GetParent() ;
+                       } 
+                       Rect toolbarrect = { m_y , m_x , m_y + m_height , m_x + m_width } ;
+
+                       UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
+                       {
+                               int index = 0 ;
+                               for ( index = 0 ; index < m_macToolHandles.Count() ; ++index )
+                               {
+                                       if ( m_macToolHandles[index] )
+                                       {
+                                               UMADrawControl( (ControlHandle) m_macToolHandles[index] ) ;
+                                       }
+                               }
+                       }
+                       UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
+               }
+       }
+}
+void  wxToolBar::OnMouse( wxMouseEvent &event ) 
+{
+               
+       if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
+       {
+                       
+               int x = event.m_x ;
+               int y = event.m_y ;
+               
+               MacClientToRootWindow( &x , &y ) ;
+                       
+               ControlHandle   control ;
+               Point           localwhere ;
+               GrafPtr         port ;
+               SInt16          controlpart ;
+               WindowRef       window = GetMacRootWindow() ;
+               
+               localwhere.h = x ;
+               localwhere.v = y ;
+       
+               short modifiers = 0;
+               
+               if ( !event.m_leftDown && !event.m_rightDown )
+                       modifiers  |= btnState ;
+       
+               if ( event.m_shiftDown )
+                       modifiers |= shiftKey ;
+                       
+               if ( event.m_controlDown )
+                       modifiers |= controlKey ;
+       
+               if ( event.m_altDown )
+                       modifiers |= optionKey ;
+       
+               if ( event.m_metaDown )
+                       modifiers |= cmdKey ;
+       
+               controlpart = FindControl( localwhere , window , &control ) ;
+               {
+                       if ( AcceptsFocus() && FindFocus() != this )
+                       {
+                               SetFocus() ;
+                       }
+                       if ( control && UMAIsControlActive( control ) )
+                       {
+                               {
+                                       if ( controlpart == kControlIndicatorPart && !UMAHasAppearance() )
+                                               controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) NULL ) ;
+                                       else
+                                               controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) -1 ) ;
+                                       wxTheApp->s_lastMouseDown = 0 ;
+                                       if ( controlpart && ! ( ( UMAHasAppearance() || (controlpart != kControlIndicatorPart) ) 
+                                               && (IsKindOf( CLASSINFO( wxScrollBar ) ) ) ) ) // otherwise we will get the event twice
+                                       {
+                                               MacHandleControlClick( control , controlpart ) ;
+                                       }
+                               }
+                       }
+               }
+       }
+}
+
 #endif // wxUSE_TOOLBAR
 
 #endif // wxUSE_TOOLBAR
 
index 3aea32e970e95e791b783448a9c81f198ab64193..137a885dbfa7e32c9096f78376146fda7cffaf68 100644 (file)
 #include "wx/stubs/textctrl.h"
 #include "wx/stubs/treectrl.h"
 
 #include "wx/stubs/textctrl.h"
 #include "wx/stubs/treectrl.h"
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxTreeItem, wxObject)
 
 IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxTreeItem, wxObject)
 
+#endif
 
 wxTreeCtrl::wxTreeCtrl()
 {
 
 wxTreeCtrl::wxTreeCtrl()
 {
index ba96908df9b93f0f8acd205fee847c816880646a..4dce1ce377002275bd563efca535af9618c102e7 100644 (file)
@@ -33,7 +33,7 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
        long total,contig;
        PurgeSpace(&total, &contig);
 #else
        long total,contig;
        PurgeSpace(&total, &contig);
 #else
-       InitMenus() ;
+       InitCursor();
 #endif
 
 #if UMA_USE_APPEARANCE
 #endif
 
 #if UMA_USE_APPEARANCE
@@ -87,7 +87,7 @@ bool UMAGetProcessModeDoesActivateOnFGSwitch()
 
 // menu manager
 
 
 // menu manager
 
-void UMASetMenuTitle( MenuRef menu , ConstStr255Param title )
+void UMASetMenuTitle( MenuRef menu , StringPtr title )
 {
 #if !TARGET_CARBON
        long                    size = GetHandleSize( (Handle) menu ) ;
 {
 #if !TARGET_CARBON
        long                    size = GetHandleSize( (Handle) menu ) ;
@@ -117,11 +117,13 @@ void UMASetMenuTitle( MenuRef menu , ConstStr255Param title )
 
 UInt32 UMAMenuEvent( EventRecord *inEvent )
 {
 
 UInt32 UMAMenuEvent( EventRecord *inEvent )
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
                return MenuEvent( inEvent ) ;
        }
        else
        if ( UMAHasAppearance() )
        {
                return MenuEvent( inEvent ) ;
        }
        else
+#endif
        {
                        if ( inEvent->what == keyDown && inEvent->modifiers & cmdKey)
                        {
        {
                        if ( inEvent->what == keyDown && inEvent->modifiers & cmdKey)
                        {
@@ -133,7 +135,7 @@ UInt32 UMAMenuEvent( EventRecord *inEvent )
 
 void                   UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex inItem ) 
 {
 
 void                   UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex inItem ) 
 {
-#if UMA_USE_8_6
+#if UMA_USE_8_6 || TARGET_CARBON
        EnableMenuItem( inMenu , inItem ) ;
 #else
        EnableItem( inMenu , inItem ) ;
        EnableMenuItem( inMenu , inItem ) ;
 #else
        EnableItem( inMenu , inItem ) ;
@@ -142,14 +144,145 @@ void                     UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex inItem )
 
 void                   UMADisableMenuItem( MenuRef inMenu , MenuItemIndex inItem ) 
 {
 
 void                   UMADisableMenuItem( MenuRef inMenu , MenuItemIndex inItem ) 
 {
-#if UMA_USE_8_6
+#if UMA_USE_8_6 || TARGET_CARBON
        DisableMenuItem( inMenu , inItem ) ;
 #else
        DisableItem( inMenu , inItem ) ;
 #endif
 }
        DisableMenuItem( inMenu , inItem ) ;
 #else
        DisableItem( inMenu , inItem ) ;
 #endif
 }
+
+void UMAAppendSubMenuItem( MenuRef menu , StringPtr l , SInt16 id ) 
+{
+       Str255 label ;
+       memcpy( label , l , l[0]+1 ) ;
+       // hardcoded adding of the submenu combination for mac
+
+       int theEnd = label[0] + 1; 
+       if (theEnd > 251) 
+               theEnd = 251; // mac allows only 255 characters
+       label[theEnd++] = '/';
+       label[theEnd++] = hMenuCmd; 
+       label[theEnd++] = '!';
+       label[theEnd++] = id ; 
+       label[theEnd] = 0x00;
+       label[0] = theEnd;
+       MacAppendMenu(menu, label);
+}
+
+void UMAInsertSubMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 id  ) 
+{
+       Str255 label ;
+       memcpy( label , l , l[0]+1 ) ;
+       // hardcoded adding of the submenu combination for mac
+
+       int theEnd = label[0] + 1; 
+       if (theEnd > 251) 
+               theEnd = 251; // mac allows only 255 characters
+       label[theEnd++] = '/';
+       label[theEnd++] = hMenuCmd; 
+       label[theEnd++] = '!';
+       label[theEnd++] = id; 
+       label[theEnd] = 0x00;
+       label[0] = theEnd;
+       MacInsertMenuItem(menu, label , item);
+}
+
+void UMAAppendMenuItem( MenuRef menu , StringPtr l , SInt16 key, UInt8 modifiers ) 
+{
+       Str255 label ;
+       memcpy( label , l , l[0]+1 ) ;
+       if ( key )
+       {
+                       int pos = label[0] ;
+                       label[++pos] = '/';
+                       label[++pos] = toupper( key );
+                       label[0] = pos ;
+       }
+       MacAppendMenu( menu , label ) ;
+}
+
+void UMAInsertMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 key, UInt8 modifiers ) 
+{
+       Str255 label ;
+       memcpy( label , l , l[0]+1 ) ;
+       if ( key )
+       {
+                       int pos = label[0] ;
+                       label[++pos] = '/';
+                       label[++pos] = toupper( key );
+                       label[0] = pos ;
+       }
+       MacInsertMenuItem( menu , label , item) ;
+}
+
+void UMADrawMenuBar() 
+{
+       DrawMenuBar() ;
+}
+
+
+void UMASetMenuItemText( MenuRef menu , MenuItemIndex item , StringPtr label ) 
+{
+       ::SetMenuItemText( menu , item , label ) ;
+}
+
+MenuRef        UMANewMenu( SInt16 menuid , StringPtr label ) 
+{
+       return ::NewMenu(menuid, label);
+}
+
+void UMADisposeMenu( MenuRef menu )
+{
+       DisposeMenu( menu ) ;
+}
+void UMADeleteMenu( SInt16 menuId ) 
+{
+       ::DeleteMenu( menuId ) ;
+}
+
+void UMAInsertMenu( MenuRef insertMenu , SInt16 afterId ) 
+{
+       ::InsertMenu( insertMenu , afterId ) ;
+}
+
+
 // quickdraw
 
 // quickdraw
 
+int gPrOpenCounter = 0 ;
+
+void UMAPrOpen() 
+{
+#if !TARGET_CARBON
+       OSErr err = noErr ;
+       ++gPrOpenCounter ;
+       if ( gPrOpenCounter == 1 )
+       {
+               PrOpen() ;
+               err = PrError() ;
+               wxASSERT( err == noErr ) ;
+       }
+#else
+       #pragma warning "TODO Printing for Carbon"
+#endif
+}
+
+void UMAPrClose() 
+{
+#if !TARGET_CARBON
+       OSErr err = noErr ;
+       wxASSERT( gPrOpenCounter >= 1 ) ;
+       if ( gPrOpenCounter == 1 )
+       {
+               PrClose() ;
+               err = PrError() ;
+               wxASSERT( err == noErr ) ;
+       }
+       --gPrOpenCounter ;
+#else
+       #pragma warning "TODO Printing for Carbon"
+#endif
+}
+
 #if !TARGET_CARBON
 
 pascal QDGlobalsPtr GetQDGlobalsPtr (void)
 #if !TARGET_CARBON
 
 pascal QDGlobalsPtr GetQDGlobalsPtr (void)
@@ -260,77 +393,145 @@ void                     UMACloseWindow(WindowRef inWindowRef)
 
 void UMAActivateControl( ControlHandle inControl ) 
 {
 
 void UMAActivateControl( ControlHandle inControl ) 
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        ::ActivateControl( inControl ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
        ::ActivateControl( inControl ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
    {
        AGAActivateControl( inControl ) ;
    }
    {
        AGAActivateControl( inControl ) ;
    }
+#else
+       {
+       }
+#endif
 }
 
 void UMADrawControl( ControlHandle inControl ) 
 {
 }
 
 void UMADrawControl( ControlHandle inControl ) 
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        ::DrawControlInCurrentPort( inControl ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
        ::DrawControlInCurrentPort( inControl ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
    {
        AGADrawControl( inControl ) ;
    }
    {
        AGADrawControl( inControl ) ;
    }
+#else
+       {
+       }
+#endif
 }
 
 void UMAMoveControl( ControlHandle inControl , short x , short y ) 
 {
 }
 
 void UMAMoveControl( ControlHandle inControl , short x , short y ) 
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
                ::MoveControl( inControl , x , y ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
                ::MoveControl( inControl , x , y ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
    {
        AGAMoveControl( inControl , x ,y  ) ;
    }
    {
        AGAMoveControl( inControl , x ,y  ) ;
    }
+#else
+       {
+       }
+#endif
 }
 
 void UMASizeControl( ControlHandle inControl , short x , short y ) 
 {
 }
 
 void UMASizeControl( ControlHandle inControl , short x , short y ) 
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
                ::SizeControl( inControl , x , y ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
                ::SizeControl( inControl , x , y ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
    {
        AGASizeControl( inControl , x ,y  ) ;
    }
    {
        AGASizeControl( inControl , x ,y  ) ;
    }
+#else
+       {
+       }
+#endif
 }
 
 void UMADeactivateControl( ControlHandle inControl ) 
 {
 }
 
 void UMADeactivateControl( ControlHandle inControl ) 
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        ::DeactivateControl( inControl ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
        ::DeactivateControl( inControl ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
    {
         AGADeactivateControl( inControl ) ;
    }
    {
         AGADeactivateControl( inControl ) ;
    }
+#else
+       {
+       }
+#endif
 }
 
 void                   UMASetThemeWindowBackground             (WindowRef                              inWindow,
                                                                 ThemeBrush                     inBrush,
 }
 
 void                   UMASetThemeWindowBackground             (WindowRef                              inWindow,
                                                                 ThemeBrush                     inBrush,
-                                                                Boolean                                inUpdate){
+                                                                Boolean                                inUpdate)
+{
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        ::SetThemeWindowBackground( inWindow ,inBrush , inUpdate ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
        ::SetThemeWindowBackground( inWindow ,inBrush , inUpdate ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
    {
        AGASetThemeWindowBackground( inWindow , inBrush , inUpdate ) ;
    }
    {
        AGASetThemeWindowBackground( inWindow , inBrush , inUpdate ) ;
    }
+#else
+       {
+       }
+#endif
 }
 
 }
 
+void                   UMAApplyThemeBackground                 (ThemeBackgroundKind    inKind,
+                                                                const Rect *                   bounds,
+                                                                ThemeDrawState                 inState,
+                                                                SInt16                                 inDepth,
+                                                                Boolean                                inColorDev)
+{
+#if UMA_USE_APPEARANCE
+       if ( UMAHasAppearance() )
+       {
+       /*
+               if ( sUMAAppearanceVersion >= 0x0110 )
+                       ::ApplyThemeBackground( inKind ,bounds , inState , inDepth , inColorDev ) ;
+   */
+   }
+   else
+#endif
+#if !TARGET_CARBON
+   {
+       AGAApplyThemeBackground( inKind ,bounds , inState , inDepth , inColorDev ) ;
+   }
+#else
+       {
+       }
+#endif
+}
 
 ControlHandle UMANewControl(WindowPtr                          owningWindow,
                                                                 const Rect *                   boundsRect,
 
 ControlHandle UMANewControl(WindowPtr                          owningWindow,
                                                                 const Rect *                   boundsRect,
@@ -343,16 +544,23 @@ ControlHandle UMANewControl(WindowPtr                             owningWindow,
                                                                 SInt32                                 controlReference)
 {
        ControlHandle theControl = NULL ;
                                                                 SInt32                                 controlReference)
 {
        ControlHandle theControl = NULL ;
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
    theControl =  NewControl( owningWindow , boundsRect , controlTitle , initiallyVisible ,
                initialValue , minimumValue , maximumValue , procID , controlReference ) ;
        }
        else
        if ( UMAHasAppearance() )
        {
    theControl =  NewControl( owningWindow , boundsRect , controlTitle , initiallyVisible ,
                initialValue , minimumValue , maximumValue , procID , controlReference ) ;
        }
        else
+#endif
+#if !TARGET_CARBON
        {
                theControl = AGANewControl( owningWindow , boundsRect , controlTitle , initiallyVisible ,
                initialValue , minimumValue , maximumValue , procID , controlReference ) ;
        }
        {
                theControl = AGANewControl( owningWindow , boundsRect , controlTitle , initiallyVisible ,
                initialValue , minimumValue , maximumValue , procID , controlReference ) ;
        }
+#else
+       {
+       }
+#endif
        return theControl ;
 }
 
        return theControl ;
 }
 
@@ -415,7 +623,9 @@ void UMASetControlVisibility                        (ControlHandle                  inControl,
                                                                 {
        if ( UMAHasAppearance() )
        {
                                                                 {
        if ( UMAHasAppearance() )
        {
+#if UMA_USE_APPEARANCE
        ::SetControlVisibility( inControl , inIsVisible, inDoDraw ) ;
        ::SetControlVisibility( inControl , inIsVisible, inDoDraw ) ;
+#endif
    }
 }
 
    }
 }
 
@@ -423,21 +633,29 @@ void UMASetControlVisibility                      (ControlHandle                  inControl,
 
 bool UMAIsControlActive                                        (ControlHandle                  inControl)
 {
 
 bool UMAIsControlActive                                        (ControlHandle                  inControl)
 {
+#if TARGET_CARBON
+       return IsControlActive( inControl ) ;
+#else
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        return IsControlActive( inControl ) ;
    }
   else
        if ( UMAHasAppearance() )
        {
        return IsControlActive( inControl ) ;
    }
   else
+#endif
        return (**inControl).contrlHilite == 0 ;
        return (**inControl).contrlHilite == 0 ;
+#endif
 }
 
 
 bool UMAIsControlVisible                               (ControlHandle                  inControl)
 {
 }
 
 
 bool UMAIsControlVisible                               (ControlHandle                  inControl)
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        return IsControlVisible( inControl ) ;
    }
        if ( UMAHasAppearance() )
        {
        return IsControlVisible( inControl ) ;
    }
+#endif
        return true ;
 }
 
        return true ;
 }
 
@@ -445,26 +663,42 @@ OSErr UMAGetBestControlRect                               (ControlHandle                  inControl,
                                                                 Rect *                                 outRect,
                                                                 SInt16 *                               outBaseLineOffset)
 {
                                                                 Rect *                                 outRect,
                                                                 SInt16 *                               outBaseLineOffset)
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        return GetBestControlRect( inControl , outRect , outBaseLineOffset ) ;
    }
   else
        if ( UMAHasAppearance() )
        {
        return GetBestControlRect( inControl , outRect , outBaseLineOffset ) ;
    }
   else
+#endif
+#if !TARGET_CARBON
   {
        return AGAGetBestControlRect( inControl , outRect , outBaseLineOffset ) ;
   }
   {
        return AGAGetBestControlRect( inControl , outRect , outBaseLineOffset ) ;
   }
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
 OSErr UMASetControlFontStyle                           (ControlHandle                  inControl,
                                                                 const ControlFontStyleRec * inStyle)   
 {
 }
 
 
 OSErr UMASetControlFontStyle                           (ControlHandle                  inControl,
                                                                 const ControlFontStyleRec * inStyle)   
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
                return ::SetControlFontStyle( inControl , inStyle ) ;
        }
        else
        if ( UMAHasAppearance() )
        {
                return ::SetControlFontStyle( inControl , inStyle ) ;
        }
        else
+#endif
+#if !TARGET_CARBON
                return AGASetControlFontStyle( inControl , inStyle ) ;
                return AGASetControlFontStyle( inControl , inStyle ) ;
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
 }
 
 
@@ -474,12 +708,20 @@ OSErr UMASetControlFontStyle                              (ControlHandle                  inControl,
 OSErr UMACreateRootControl                             (WindowPtr                              inWindow,
                                                                 ControlHandle *                outControl)
 {
 OSErr UMACreateRootControl                             (WindowPtr                              inWindow,
                                                                 ControlHandle *                outControl)
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        return CreateRootControl( inWindow , outControl  ) ;
    }
   else
        if ( UMAHasAppearance() )
        {
        return CreateRootControl( inWindow , outControl  ) ;
    }
   else
+#endif
+#if !TARGET_CARBON
        return AGACreateRootControl( inWindow , outControl ) ;
        return AGACreateRootControl( inWindow , outControl ) ;
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
 }
 
 
@@ -487,12 +729,20 @@ OSErr UMACreateRootControl                                (WindowPtr                              inWindow,
 OSErr UMAEmbedControl                                  (ControlHandle                  inControl,
                                                                 ControlHandle                  inContainer)
 {
 OSErr UMAEmbedControl                                  (ControlHandle                  inControl,
                                                                 ControlHandle                  inContainer)
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        return EmbedControl( inControl , inContainer ) ;
    }
   else
        if ( UMAHasAppearance() )
        {
        return EmbedControl( inControl , inContainer ) ;
    }
   else
+#endif
+#if !TARGET_CARBON
        return AGAEmbedControl( inControl , inContainer ) ; ;
        return AGAEmbedControl( inControl , inContainer ) ; ;
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
 }
 
 
@@ -502,12 +752,30 @@ OSErr UMASetKeyboardFocus                         (WindowPtr                              inWindow,
                                                                 ControlHandle                  inControl,
                                                                 ControlFocusPart               inPart)
 {
                                                                 ControlHandle                  inControl,
                                                                 ControlFocusPart               inPart)
 {
+       OSErr err = noErr;
+       GrafPtr port ;
+       GetPort( &port ) ;
+#if TARGET_CARBON
+       SetPort( GetWindowPort( inWindow ) ) ;
+#else
+       SetPort( inWindow ) ;
+#endif
+       SetOrigin( 0 , 0 ) ;
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        if ( UMAHasAppearance() )
        {
-       return SetKeyboardFocus( inWindow , inControl , inPart ) ;
+       err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
    }
   else
    }
   else
-       return AGASetKeyboardFocus( inWindow , inControl , inPart ) ;
+#endif
+#if !TARGET_CARBON
+       err = AGASetKeyboardFocus( inWindow , inControl , inPart ) ;
+#else
+       {
+       }
+#endif
+       SetPort( port ) ;
+       return err ;
 }
 
 
 }
 
 
@@ -520,14 +788,22 @@ ControlPartCode UMAHandleControlClick                             (ControlHandle                  inControl,
                                                                 SInt16                                 inModifiers,
                                                                 ControlActionUPP               inAction)                
 {
                                                                 SInt16                                 inModifiers,
                                                                 ControlActionUPP               inAction)                
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        return HandleControlClick( inControl , inWhere , inModifiers , inAction ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
        return HandleControlClick( inControl , inWhere , inModifiers , inAction ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
    {
        return AGAHandleControlClick( inControl , inWhere , inModifiers , inAction ) ;
    }
    {
        return AGAHandleControlClick( inControl , inWhere , inModifiers , inAction ) ;
    }
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
 }
 
 
@@ -536,52 +812,82 @@ SInt16 UMAHandleControlKey                                (ControlHandle                  inControl,
                                                                 SInt16                                 inCharCode,
                                                                 SInt16                                 inModifiers)
 {
                                                                 SInt16                                 inCharCode,
                                                                 SInt16                                 inModifiers)
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
        return HandleControlKey( inControl , inKeyCode , inCharCode , inModifiers ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
        return HandleControlKey( inControl , inKeyCode , inCharCode , inModifiers ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
    {
        return AGAHandleControlKey(inControl , inKeyCode , inCharCode , inModifiers ) ;
    }
    {
        return AGAHandleControlKey(inControl , inKeyCode , inCharCode , inModifiers ) ;
    }
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
                                                                 
 void UMAIdleControls                                   (WindowPtr                              inWindow)
 {
 }
 
 
                                                                 
 void UMAIdleControls                                   (WindowPtr                              inWindow)
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
                IdleControls( inWindow ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
                IdleControls( inWindow ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
    {
                AGAIdleControls( inWindow ) ;
    }
    {
                AGAIdleControls( inWindow ) ;
    }
+#else
+       {
+       }
+#endif
 }
 
 void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) 
 {
 }
 
 void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) 
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
                UpdateControls( inWindow , inRgn ) ;
        }
        else
        if ( UMAHasAppearance() )
        {
                UpdateControls( inWindow , inRgn ) ;
        }
        else
+#endif
+#if !TARGET_CARBON
        {
                AGAUpdateControls( inWindow , inRgn ) ;
        }
        {
                AGAUpdateControls( inWindow , inRgn ) ;
        }
+#else
+       {
+       }
+#endif
 }
 
 OSErr UMAGetRootControl( WindowPtr inWindow , ControlHandle *outControl ) 
 {
 }
 
 OSErr UMAGetRootControl( WindowPtr inWindow , ControlHandle *outControl ) 
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
                return GetRootControl( inWindow , outControl ) ;
        }
        else
        if ( UMAHasAppearance() )
        {
                return GetRootControl( inWindow , outControl ) ;
        }
        else
+#endif
+#if !TARGET_CARBON
        {
                return AGAGetRootControl( inWindow , outControl ) ;
        }
        {
                return AGAGetRootControl( inWindow , outControl ) ;
        }
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
 }
 
 
@@ -593,12 +899,20 @@ OSErr UMASetControlData                                   (ControlHandle                  inControl,
                                                                 Size                                   inSize,
                                                                 Ptr                                    inData)
 {
                                                                 Size                                   inSize,
                                                                 Ptr                                    inData)
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
         return SetControlData( inControl , inPart , inTagName , inSize , inData ) ;
    }
    else
        if ( UMAHasAppearance() )
        {
         return SetControlData( inControl , inPart , inTagName , inSize , inData ) ;
    }
    else
+#endif
+#if !TARGET_CARBON
                return AGASetControlData( inControl , inPart , inTagName , inSize , inData ) ;
                return AGASetControlData( inControl , inPart , inTagName , inSize , inData ) ;
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
 }
 
 
@@ -610,15 +924,22 @@ OSErr UMAGetControlData                                   (ControlHandle                  inControl,
                                                                 Ptr                                    outBuffer,
                                                                 Size *                                 outActualSize)
 {
                                                                 Ptr                                    outBuffer,
                                                                 Size *                                 outActualSize)
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
                return ::GetControlData( inControl , inPart , inTagName , inBufferSize , outBuffer , outActualSize ) ;
        }
        else
        if ( UMAHasAppearance() )
        {
                return ::GetControlData( inControl , inPart , inTagName , inBufferSize , outBuffer , outActualSize ) ;
        }
        else
+#endif
+#if !TARGET_CARBON
        {
                return AGAGetControlData( inControl , inPart , inTagName , inBufferSize , outBuffer , outActualSize ) ;
        }
        {
                return AGAGetControlData( inControl , inPart , inTagName , inBufferSize , outBuffer , outActualSize ) ;
        }
-       
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
 }
 
 
@@ -627,14 +948,22 @@ OSErr UMAGetControlDataSize                               (ControlHandle                  inControl,
                                                                 ResType                                inTagName,
                                                                 Size *                                 outMaxSize)
 {
                                                                 ResType                                inTagName,
                                                                 Size *                                 outMaxSize)
 {
+#if UMA_USE_APPEARANCE
        if ( UMAHasAppearance() )
        {
                return GetControlDataSize( inControl , inPart , inTagName , outMaxSize ) ;
        }
        else
        if ( UMAHasAppearance() )
        {
                return GetControlDataSize( inControl , inPart , inTagName , outMaxSize ) ;
        }
        else
+#endif
+#if !TARGET_CARBON
        {
                return AGAGetControlDataSize( inControl , inPart , inTagName , outMaxSize ) ;
        }
        {
                return AGAGetControlDataSize( inControl , inPart , inTagName , outMaxSize ) ;
        }
+#else
+       {
+               return noErr ;
+       }
+#endif
 }
 
 
 }
 
 
@@ -711,11 +1040,70 @@ OSStatus         UMACreateNewWindow( WindowClass windowClass , WindowAttributes attribu
                                case kMovableModalWindowClass :
                                        procID = kWindowMovableModalDialogProc;
                                        break ;
                                case kMovableModalWindowClass :
                                        procID = kWindowMovableModalDialogProc;
                                        break ;
-                               case kDocumentWindowClass :
-                                       procID = kWindowFullZoomGrowDocumentProc;
+                               case kModalWindowClass :
+                                       procID = kWindowShadowDialogProc;
+                                       break ;
+                               case kFloatingWindowClass :
+                                       if ( attributes & kWindowSideTitlebarAttribute )
+                                       {
+                                               if( ( attributes & kWindowResizableAttribute ) &&  
+                                                       ( attributes & kWindowFullZoomAttribute ) )
+                                               {
+                                                       procID = kWindowFloatSideFullZoomGrowProc ;
+                                               }
+                                               else if( attributes & kWindowFullZoomAttribute )
+                                               {
+                                                       procID = kWindowFloatSideFullZoomProc;
+                                               }
+                                               else if ( attributes & kWindowResizableAttribute )
+                                               {
+                                                       procID = kWindowFloatSideGrowProc;
+                                               }
+                                               else
+                                               {
+                                                       procID = kWindowFloatSideProc;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               if( ( attributes & kWindowResizableAttribute ) &&  
+                                                       ( attributes & kWindowFullZoomAttribute ) )
+                                               {
+                                                       procID = kWindowFloatFullZoomGrowProc ;
+                                               }
+                                               else if( attributes & kWindowFullZoomAttribute )
+                                               {
+                                                       procID = kWindowFloatFullZoomProc;
+                                               }
+                                               else if ( attributes & kWindowResizableAttribute )
+                                               {
+                                                       procID = kWindowFloatGrowProc;
+                                               }
+                                               else
+                                               {
+                                                       procID = kWindowFloatProc;
+                                               }
+                                       }
                                        break ;
                                        break ;
+                               case kDocumentWindowClass :
                                default :
                                default :
-                                       procID = kWindowMovableModalDialogProc;
+                                       if( ( attributes & kWindowResizableAttribute ) &&  
+                                               ( attributes & kWindowFullZoomAttribute ) )
+                                       {
+                                               procID = kWindowFullZoomGrowDocumentProc;
+                                       }
+                                       else if( attributes & kWindowFullZoomAttribute )
+                                       {
+                                               procID = kWindowFullZoomDocumentProc;
+                                       }
+                                       else if ( attributes & kWindowResizableAttribute )
+                                       {
+                                               procID = kWindowGrowDocumentProc;
+                                       }
+                                       else
+                                       {
+                                               procID = kWindowDocumentProc;
+                                       }
                                        break ;
                        }
                }
                                        break ;
                        }
                }
@@ -725,13 +1113,72 @@ OSStatus         UMACreateNewWindow( WindowClass windowClass , WindowAttributes attribu
                        {
                                case kMovableModalWindowClass :
                                        procID = movableDBoxProc;
                        {
                                case kMovableModalWindowClass :
                                        procID = movableDBoxProc;
-//                                     procID += kMovableModalDialogVariantCode;
                                        break ;
                                        break ;
-                               case kDocumentWindowClass :
-                                       procID = zoomDocProc;
+                               case kModalWindowClass :
+                                       procID = altDBoxProc;
+                                       break ;
+                               case kFloatingWindowClass :
+                                       if ( attributes & kWindowSideTitlebarAttribute )
+                                       {
+                                               if( ( attributes & kWindowResizableAttribute ) &&  
+                                                       ( attributes & kWindowFullZoomAttribute ) )
+                                               {
+                                                       procID = floatSideZoomGrowProc ;
+                                               }
+                                               else if( attributes & kWindowFullZoomAttribute )
+                                               {
+                                                       procID = floatSideZoomProc;
+                                               }
+                                               else if ( attributes & kWindowResizableAttribute )
+                                               {
+                                                       procID = floatSideGrowProc;
+                                               }
+                                               else
+                                               {
+                                                       procID = floatSideProc;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               if( ( attributes & kWindowResizableAttribute ) &&  
+                                                       ( attributes & kWindowFullZoomAttribute ) )
+                                               {
+                                                       procID = floatZoomGrowProc ;
+                                               }
+                                               else if( attributes & kWindowFullZoomAttribute )
+                                               {
+                                                       procID = floatZoomProc;
+                                               }
+                                               else if ( attributes & kWindowResizableAttribute )
+                                               {
+                                                       procID = floatGrowProc;
+                                               }
+                                               else
+                                               {
+                                                       procID = floatProc;
+                                               }
+                                       }
                                        break ;
                                        break ;
+                               case kDocumentWindowClass :
                                default :
                                default :
-                                       procID = documentProc;
+                                       if( ( attributes & kWindowResizableAttribute ) &&  
+                                               ( attributes & kWindowFullZoomAttribute ) )
+                                       {
+                                               procID = zoomDocProc;
+                                       }
+                                       else if( attributes & kWindowFullZoomAttribute )
+                                       {
+                                               procID = zoomNoGrow;
+                                       }
+                                       else if ( attributes & kWindowResizableAttribute )
+                                       {
+                                               procID = documentProc;
+                                       }
+                                       else
+                                       {
+                                               procID = noGrowDocProc;
+                                       }
+                                       break ;
                                        break ;
                        }
                }
                                        break ;
                        }
                }
@@ -853,6 +1300,32 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
 //             bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
 //             if ( inActivate != isHightlited )
                                HiliteWindow( inWindowRef , inActivate ) ;
 //             bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
 //             if ( inActivate != isHightlited )
                                HiliteWindow( inWindowRef , inActivate ) ;
+                               ControlHandle control = NULL ;
+                               UMAGetRootControl( inWindowRef , & control ) ;
+                               if ( control )
+                               {
+                                       if ( inActivate )
+                                               UMAActivateControl( control ) ;
+                                       else
+                                               UMADeactivateControl( control ) ;
+                               }       
        }
 }
        }
 }
+OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState ) 
+{
+#if UMA_USE_APPEARANCE
+       if ( UMAHasAppearance() )
+       {
+               ::DrawThemePlacard( inRect , inState ) ;
+   }
+   else
+#endif
+#if !TARGET_CARBON
+   {
+   }
+#else
+       {
+       }
+#endif
+}
 
 
index 817138cb63f2d440462b7e347bb721103d613970..0031f1efade1df19e67b0e7d6246b9774b3b4aac 100644 (file)
@@ -18,6 +18,7 @@
 #include "wx/setup.h"
 #include "wx/utils.h"
 #include "wx/app.h"
 #include "wx/setup.h"
 #include "wx/utils.h"
 #include "wx/app.h"
+#include "wx/mac/uma.h"
 
 #include <ctype.h>
 
 
 #include <ctype.h>
 
 #include <string.h>
 #include <stdarg.h>
 
 #include <string.h>
 #include <stdarg.h>
 
-// Get full hostname (eg. DoDo.BSn-Germany.crg.de)
+// get full hostname (with domain name if possible)
+bool wxGetFullHostName(wxChar *buf, int maxSize)
+{
+    return wxGetHostName(buf, maxSize);
+}
+
+// Get hostname only (without domain name)
 bool wxGetHostName(char *buf, int maxSize)
 {
     // TODO
 bool wxGetHostName(char *buf, int maxSize)
 {
     // TODO
@@ -227,7 +234,10 @@ void wxEndBusyCursor()
     if ( gMacStoredActiveCursor )
        ::SetCursor( *gMacStoredActiveCursor ) ;
     else
     if ( gMacStoredActiveCursor )
        ::SetCursor( *gMacStoredActiveCursor ) ;
     else
-       ::SetCursor( &qd.arrow ) ;
+    {
+               Cursor          MacArrow ;
+       ::SetCursor( GetQDGlobalsArrow( &MacArrow ) ) ;
+    }
        gMacStoredActiveCursor = NULL ;
   }
 }
        gMacStoredActiveCursor = NULL ;
   }
 }
@@ -238,6 +248,25 @@ bool wxIsBusy()
   return (wxBusyCursorCount > 0);
 }    
 
   return (wxBusyCursorCount > 0);
 }    
 
+wxString wxMacFindFolder( short                                        vol,
+                                                                OSType                                 folderType,
+                                                                Boolean                                createFolder)
+{
+       short           vRefNum  ;
+       long            dirID ;
+       wxString strDir ;
+               
+       if ( FindFolder( vol, folderType, createFolder, &vRefNum, &dirID) == noErr)
+       {
+               FSSpec file ;
+               if ( FSMakeFSSpec( vRefNum , dirID , "\p" , &file ) == noErr )
+               {
+                       strDir = wxMacFSSpec2UnixFilename( &file ) + "/" ;
+               }
+       }
+       return strDir ;
+}
+
 char *wxGetUserHome (const wxString& user)
 {
     // TODO
 char *wxGetUserHome (const wxString& user)
 {
     // TODO
@@ -271,23 +300,32 @@ bool wxColourDisplay()
 // Returns depth of screen
 int wxDisplayDepth()
 {
 // Returns depth of screen
 int wxDisplayDepth()
 {
-               // get max pixel depth
-               CGrafPtr port ;
-               GetCWMgrPort( &port ) ; 
-               GDHandle maxDevice ;
+       Rect globRect ; 
+       SetRect(&globRect, -32760, -32760, 32760, 32760);
+       GDHandle        theMaxDevice;
+
+       int theDepth = 8;
+       theMaxDevice = GetMaxDevice(&globRect);
+       if (theMaxDevice != nil)
+               theDepth = (**(**theMaxDevice).gdPMap).pixelSize;
                
                
-               maxDevice = GetMaxDevice( &port->portRect ) ;
-               if ( maxDevice )
-                       return (**((**maxDevice).gdPMap)).pixelSize ;
-               else
-                       return 8 ; 
+       return theDepth ;
 }
 
 // Get size of display
 void wxDisplaySize(int *width, int *height)
 {
 }
 
 // Get size of display
 void wxDisplaySize(int *width, int *height)
 {
-    *width = qd.screenBits.bounds.right - qd.screenBits.bounds.left  ;
-    *height = qd.screenBits.bounds.bottom - qd.screenBits.bounds.top ; 
-    *height -= LMGetMBarHeight() ;
+       BitMap screenBits;
+       GetQDGlobalsScreenBits( &screenBits );
+
+    *width = screenBits.bounds.right - screenBits.bounds.left  ;
+    *height = screenBits.bounds.bottom - screenBits.bounds.top ; 
+ #if TARGET_CARBON
+       SInt16 mheight ;
+       GetThemeMenuBarHeight( &mheight ) ;
+     *height -= mheight ;
+#else
+     *height -= LMGetMBarHeight() ;
+ #endif
 }
 
 }
 
index f8099265a2094b1dc026ee55dc26349fdf83653d..3dd198b36997c90f3570183a59f78acebbab0f21 100644 (file)
@@ -29,6 +29,7 @@
 #include "wx/frame.h"
 #include "wx/notebook.h"
 #include "wx/tabctrl.h"
 #include "wx/frame.h"
 #include "wx/notebook.h"
 #include "wx/tabctrl.h"
+#include "wx/tooltip.h"
 // TODO remove the line below, just for lookup-up convenience CS
 #include "wx/mac/window.h"
 
 // TODO remove the line below, just for lookup-up convenience CS
 #include "wx/mac/window.h"
 
@@ -54,8 +55,8 @@
 extern wxList wxPendingDelete;
 wxWindow* gFocusWindow = NULL ;
 
 extern wxList wxPendingDelete;
 wxWindow* gFocusWindow = NULL ;
 
+#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxEvtHandler)
 IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxEvtHandler)
-
 BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler)
   EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground)
   EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged)
 BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler)
   EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground)
   EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged)
@@ -64,6 +65,7 @@ BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler)
 //  EVT_SCROLL(wxWindow::OnScroll)
 END_EVENT_TABLE()
 
 //  EVT_SCROLL(wxWindow::OnScroll)
 END_EVENT_TABLE()
 
+#endif
 
 
 
 
 
 
@@ -163,6 +165,7 @@ wxWindow::~wxWindow()
 
        if ( m_macWindowData )
        {
 
        if ( m_macWindowData )
        {
+               wxToolTip::NotifyWindowDelete(m_macWindowData->m_macWindow) ;
        UMADisposeWindow( m_macWindowData->m_macWindow ) ;
        delete m_macWindowData ;
        wxRemoveMacWindowAssociation( this ) ;
        UMADisposeWindow( m_macWindowData->m_macWindow ) ;
        delete m_macWindowData ;
        wxRemoveMacWindowAssociation( this ) ;
@@ -189,7 +192,10 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
        m_width = WidthDefault( size.x );
        m_height = HeightDefault( size.y ) ;
 
        m_width = WidthDefault( size.x );
        m_height = HeightDefault( size.y ) ;
 
-    MacCreateScrollBars( style ) ;
+       if ( ! IsKindOf( CLASSINFO ( wxControl ) ) )
+       {
+       MacCreateScrollBars( style ) ;
+       }
 
     return TRUE;
 }
 
     return TRUE;
 }
@@ -211,6 +217,7 @@ void wxWindow::SetFocus()
                        if ( control && control->GetMacControl() )
                        {
                                UMASetKeyboardFocus( gFocusWindow->GetMacRootWindow() , control->GetMacControl()  , kControlFocusNoPart ) ;
                        if ( control && control->GetMacControl() )
                        {
                                UMASetKeyboardFocus( gFocusWindow->GetMacRootWindow() , control->GetMacControl()  , kControlFocusNoPart ) ;
+                               control->MacRedrawControl() ;
                        }
                wxFocusEvent event(wxEVT_KILL_FOCUS, gFocusWindow->m_windowId);
                event.SetEventObject(gFocusWindow);
                        }
                wxFocusEvent event(wxEVT_KILL_FOCUS, gFocusWindow->m_windowId);
                event.SetEventObject(gFocusWindow);
@@ -248,11 +255,6 @@ bool wxWindow::Enable(bool enable)
 {
     if ( !wxWindowBase::Enable(enable) )
         return FALSE;
 {
     if ( !wxWindowBase::Enable(enable) )
         return FALSE;
-/*
-    HWND hWnd = GetHwnd();
-    if ( hWnd )
-        ::EnableWindow(hWnd, (BOOL)enable);
-*/
 
     wxWindowList::Node *node = GetChildren().GetFirst();
     while ( node )
 
     wxWindowList::Node *node = GetChildren().GetFirst();
     while ( node )
@@ -319,9 +321,6 @@ void wxWindow::DoGetPosition(int *x, int *y) const
 }
 
 
 }
 
 
-
-
-
 bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
 {
        menu->SetInvokingWindow(this);
 bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
 {
        menu->SetInvokingWindow(this);
@@ -370,6 +369,7 @@ void wxWindow::DoClientToScreen(int *x, int *y) const
        GrafPtr         port ;  
        ::GetPort( &port ) ;
        ::SetPort( UMAGetWindowPort( window ) ) ;
        GrafPtr         port ;  
        ::GetPort( &port ) ;
        ::SetPort( UMAGetWindowPort( window ) ) ;
+       ::SetOrigin( 0 , 0 ) ;
        ::LocalToGlobal( &localwhere ) ;
        ::SetPort( port ) ;
        *x = localwhere.h ;
        ::LocalToGlobal( &localwhere ) ;
        ::SetPort( port ) ;
        *x = localwhere.h ;
@@ -437,10 +437,52 @@ void wxWindow::DoGetClientSize(int *x, int *y) const
     *x = m_width ;
     *y = m_height ;
 
     *x = m_width ;
     *y = m_height ;
 
-  if (m_vScrollBar && m_vScrollBar->IsShown() )
-       (*x) -= MAC_SCROLLBAR_SIZE;
-  if (m_hScrollBar  && m_hScrollBar->IsShown() )
-       (*y) -= MAC_SCROLLBAR_SIZE;
+       *x -= 2 * MacGetBorderSize(  ) ;
+       *y -= 2 * MacGetBorderSize(  ) ;
+       
+  if ( (m_vScrollBar && m_vScrollBar->IsShown()) || (m_hScrollBar  && m_hScrollBar->IsShown()) )
+  {
+       int x1 = 0 ; 
+       int y1 = 0 ;
+       int w = m_width ;
+       int h = m_height ;
+       
+       MacClientToRootWindow( &x1 , &y1 ) ;
+       MacClientToRootWindow( &w , &h ) ;
+       
+       WindowRef window = NULL ;
+       wxWindow *iter = (wxWindow*)this ;
+       
+       int totW = 10000 , totH = 10000;
+       while( iter )
+       {
+               if ( iter->m_macWindowData )
+               {
+                       totW = iter->m_width ;
+                       totH = iter->m_height ;
+                       break ;
+               }
+
+               iter = iter->GetParent() ;
+       } 
+       
+       if (m_hScrollBar  && m_hScrollBar->IsShown() )
+       {
+               (*y) -= MAC_SCROLLBAR_SIZE;
+               if ( h-y1 >= totH )
+               {
+                       (*y)+= 1 ;
+               }
+    }
+       if (m_vScrollBar  && m_vScrollBar->IsShown() )
+       {
+       (*x) -= MAC_SCROLLBAR_SIZE;
+               if ( w-x1 >= totW )
+               {
+               (*x) += 1 ;
+       }
+       }
+  }
 }
 
 
 }
 
 
@@ -454,8 +496,8 @@ void wxWindow::DoSetToolTip(wxToolTip *tooltip)
 {
     wxWindowBase::DoSetToolTip(tooltip);
 
 {
     wxWindowBase::DoSetToolTip(tooltip);
 
-//    if ( m_tooltip )
-//        m_tooltip->SetWindow(this);
+       if ( m_tooltip )
+               m_tooltip->SetWindow(this);
 }
 
 #endif // wxUSE_TOOLTIPS
 }
 
 #endif // wxUSE_TOOLTIPS
@@ -467,6 +509,7 @@ void wxWindow::DoMoveWindow(int x, int y, int width, int height)
 
 void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
 {
 
 void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
 {
+
        int former_x = m_x ;
        int former_y = m_y ;
        int former_w = m_width ;
        int former_x = m_x ;
        int former_y = m_y ;
        int former_w = m_width ;
@@ -481,9 +524,9 @@ void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
   int actualHeight = height;
   int actualX = x;
   int actualY = y;
   int actualHeight = height;
   int actualX = x;
   int actualY = y;
-  if (x == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+  if (x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
       actualX = currentX;
       actualX = currentX;
-  if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+  if (y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
       actualY = currentY;
   if (width == -1)
       actualWidth = currentW ;
       actualY = currentY;
   if (width == -1)
       actualWidth = currentW ;
@@ -524,7 +567,7 @@ void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
                                if ( focus.Ok() )
                                {
                                Rect clientrect = { 0 , 0 , m_height , m_width } ;
                                if ( focus.Ok() )
                                {
                                Rect clientrect = { 0 , 0 , m_height , m_width } ;
-                           InvalRect( &clientrect ) ;
+                           InvalWindowRect( GetMacRootWindow() , &clientrect ) ;
                                }
                        }
                }
                                }
                        }
                }
@@ -535,18 +578,18 @@ void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
                if ( m_macWindowData )
                {
                        if ( doMove )
                if ( m_macWindowData )
                {
                        if ( doMove )
-                               ::MoveWindow(m_macWindowData->m_macWindow, m_x, m_y, false); // don't make frontmost
+                               ::MoveWindow(m_macWindowData->m_macWindow, m_x, m_y  , false); // don't make frontmost
                        
                        if ( doResize )
                        
                        if ( doResize )
-                               ::SizeWindow(m_macWindowData->m_macWindow, m_width, m_height, true); 
+                               ::SizeWindow(m_macWindowData->m_macWindow, m_width, m_height  , true); 
                        
                        // the OS takes care of invalidating and erasing        
                        
                        if ( IsKindOf( CLASSINFO( wxFrame ) ) )
                        {
                                wxFrame* frame = (wxFrame*) this ;
                        
                        // the OS takes care of invalidating and erasing        
                        
                        if ( IsKindOf( CLASSINFO( wxFrame ) ) )
                        {
                                wxFrame* frame = (wxFrame*) this ;
-                         frame->PositionStatusBar();
-                       frame->PositionToolBar();
+                               frame->PositionStatusBar();
+                               frame->PositionToolBar();
                        }
                }
                else
                        }
                }
                else
@@ -556,8 +599,8 @@ void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
                                wxMacDrawingClientHelper focus( this ) ;
                                if ( focus.Ok() )
                                {
                                wxMacDrawingClientHelper focus( this ) ;
                                if ( focus.Ok() )
                                {
-                               Rect clientrect = { 0 , 0 , m_height , m_width } ;
-                           InvalRect( &clientrect ) ;
+                                       Rect clientrect = { 0 , 0 , m_height , m_width } ;
+                               InvalWindowRect( GetMacRootWindow() , &clientrect ) ;
                                }
                        }
                        if ( doMove )
                                }
                        }
                        if ( doMove )
@@ -566,17 +609,17 @@ void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
                MacRepositionScrollBars() ;
                if ( doMove )
                {
                MacRepositionScrollBars() ;
                if ( doMove )
                {
-       wxMoveEvent event(wxPoint(m_x, m_y), m_windowId);
-       event.SetEventObject(this);
-       GetEventHandler()->ProcessEvent(event) ;
-    }
-    if ( doResize )
-    {
+               wxMoveEvent event(wxPoint(m_x, m_y), m_windowId);
+               event.SetEventObject(this);
+               GetEventHandler()->ProcessEvent(event) ;
+       }
+       if ( doResize )
+       {
                        MacRepositionScrollBars() ;
                        MacRepositionScrollBars() ;
-           wxSizeEvent event(wxSize(m_width, m_height), m_windowId);
-           event.SetEventObject(this);
-           GetEventHandler()->ProcessEvent(event);
-    }
+               wxSizeEvent event(wxSize(m_width, m_height), m_windowId);
+               event.SetEventObject(this);
+               GetEventHandler()->ProcessEvent(event);
+       }
        }
 }
 // For implementation purposes - sometimes decorations make the client area
        }
 }
 // For implementation purposes - sometimes decorations make the client area
@@ -584,7 +627,7 @@ void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
 
 wxPoint wxWindow::GetClientAreaOrigin() const
 {
 
 wxPoint wxWindow::GetClientAreaOrigin() const
 {
-    return wxPoint(0, 0);
+    return wxPoint(MacGetBorderSize(  ) , MacGetBorderSize(  ) );
 }
 
 // Makes an adjustment to the window position (for example, a frame that has
 }
 
 // Makes an adjustment to the window position (for example, a frame that has
@@ -632,7 +675,8 @@ bool wxWindow::Show(bool show)
          {
                UMAShowWindow( m_macWindowData->m_macWindow ) ;
                UMASelectWindow( m_macWindowData->m_macWindow ) ;
          {
                UMAShowWindow( m_macWindowData->m_macWindow ) ;
                UMASelectWindow( m_macWindowData->m_macWindow ) ;
-                       // no need to generate events here, they will get them triggered by macos
+               // no need to generate events here, they will get them triggered by macos
+               // actually they should be , but apparently they are not
            wxSizeEvent event(wxSize(m_width, m_height), m_windowId);
            event.SetEventObject(this);
            GetEventHandler()->ProcessEvent(event);
            wxSizeEvent event(wxSize(m_width, m_height), m_windowId);
            event.SetEventObject(this);
            GetEventHandler()->ProcessEvent(event);
@@ -644,6 +688,8 @@ bool wxWindow::Show(bool show)
        }
        MacSuperShown( show ) ;
        Refresh() ;
        }
        MacSuperShown( show ) ;
        Refresh() ;
+       if(m_macWindowData)
+               MacUpdateImmediately() ;
 
     return TRUE;
 }
 
     return TRUE;
 }
@@ -682,10 +728,14 @@ void wxWindow::GetTextExtent(const wxString& string, int *x, int *y,
     wxClientDC dc( this ) ;
     long lx,ly,ld,le ;
     dc.GetTextExtent( string , &lx , &ly , &ld, &le, fontToUse ) ;
     wxClientDC dc( this ) ;
     long lx,ly,ld,le ;
     dc.GetTextExtent( string , &lx , &ly , &ld, &le, fontToUse ) ;
-    *externalLeading = le ;
-    *descent = ld ;
-    *x = lx ;
-    *y = ly ;
+    if ( externalLeading )
+       *externalLeading = le ;
+    if ( descent )
+       *descent = ld ;
+    if ( x )
+       *x = lx ;
+    if ( y )
+       *y = ly ;
 }
 
 void wxWindow::MacEraseBackground( Rect *rect )
 }
 
 void wxWindow::MacEraseBackground( Rect *rect )
@@ -715,7 +765,7 @@ void wxWindow::MacEraseBackground( Rect *rect )
                                        // if we have the normal colours in the hierarchy but another control etc. -> use it's background
                                        if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
                                        {
                                        // if we have the normal colours in the hierarchy but another control etc. -> use it's background
                                        if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
                                        {
-                                               ApplyThemeBackground                    (kThemeBackgroundTabPane, rect, kThemeStateActive,8,true);
+                                               UMAApplyThemeBackground(kThemeBackgroundTabPane, rect, kThemeStateActive,8,true);
                                                break ;
                                        }
                                }
                                                break ;
                                        }
                                }
@@ -743,10 +793,6 @@ void wxWindow::MacEraseBackground( Rect *rect )
        for (wxNode *node = GetChildren().First(); node; node = node->Next())
        {
                wxWindow *child = (wxWindow*)node->Data();
        for (wxNode *node = GetChildren().First(); node; node = node->Next())
        {
                wxWindow *child = (wxWindow*)node->Data();
-//                     int width ;
-//                     int height ;
-               
-//                     child->GetClientSize( &width , &height ) ;
                
                Rect clientrect = { child->m_x , child->m_y , child->m_x +child->m_width , child->m_y + child->m_height } ;
                SectRect( &clientrect , rect , &clientrect ) ;          
                
                Rect clientrect = { child->m_x , child->m_y , child->m_x +child->m_width , child->m_y + child->m_height } ;
                SectRect( &clientrect , rect , &clientrect ) ;          
@@ -765,26 +811,18 @@ void wxWindow::MacEraseBackground( Rect *rect )
 
 void wxWindow::Refresh(bool eraseBack, const wxRect *rect)
 {
 
 void wxWindow::Refresh(bool eraseBack, const wxRect *rect)
 {
-       wxMacDrawingClientHelper focus( this ) ;
+       wxMacDrawingHelper focus( this ) ;
        if ( focus.Ok() )
        {
        if ( focus.Ok() )
        {
-       int width , height ;
-       GetClientSize( &width , &height ) ;
-       Rect clientrect = { 0 , 0 , height , width } ;
-       ClipRect( &clientrect ) ;
+               Rect clientrect = { 0 , 0 , m_height , m_width } ;
+               ClipRect( &clientrect ) ;
 
 
-    if ( rect )
-    {
-       Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ;
+       if ( rect )
+       {
+               Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ;
                        SectRect( &clientrect , &r , &clientrect ) ;            
                        SectRect( &clientrect , &r , &clientrect ) ;            
-    }
-    InvalRect( &clientrect ) ;
-    /*
-    if ( eraseBack )
-    {
-       MacEraseBackground( &clientrect ) ;
-       }
-       */
+       }
+       InvalWindowRect( GetMacRootWindow() , &clientrect ) ;
        }
 }
 
        }
 }
 
@@ -927,41 +965,222 @@ void wxWindow::SetScrollPos(int orient, int pos, bool refresh)
                }
 }
 
                }
 }
 
-void wxWindow::MacPaint( wxPaintEvent &event ) 
+void  wxWindow::MacCreateRealWindow( const wxString& title,
+           const wxPoint& pos,
+           const wxSize& size,
+           long style,
+           const wxString& name ) 
 {
 {
-    wxPaintDC dc(this);
-    PrepareDC(dc);
+  SetName(name);
+  m_windowStyle = style;
+  m_isShown = FALSE;
 
 
-    if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) )
-    {
-       bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
+  // create frame.
 
 
-               wxPen m_penButton3DShadow( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DSHADOW ), 1, wxSOLID ) ;
-               wxPen m_penButton3DFace( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE ), 1, wxSOLID ) ;
-       
-               wxPen wxPen1 = sunken ? *wxWHITE_PEN : *wxBLACK_PEN;
-               wxPen wxPen2 = sunken ? m_penButton3DShadow : m_penButton3DShadow;
-               wxPen wxPen3 = sunken ? m_penButton3DFace : m_penButton3DShadow;
-               wxPen wxPen4 = sunken ? *wxBLACK_PEN : *wxWHITE_PEN;
+       Rect theBoundsRect;
+
+  m_x = (int)pos.x;
+  m_y = (int)pos.y;
+  if ( m_y < 50 )
+       m_y = 50 ;
+  if ( m_x < 20 )
+       m_x = 20 ;
+       
+  m_width = size.x;
+       if (m_width == -1) 
+               m_width = 20;
+  m_height = size.y;
+       if (m_height == -1) 
+               m_height = 20;
+
+       m_macWindowData = new MacWindowData() ;
+
+       ::SetRect(&theBoundsRect, m_x, m_y , m_x + m_width, m_y + m_height);
+
+       // translate the window attributes in the appropriate window class and attributes
+
+       WindowClass wclass  ;
+       WindowAttributes attr  ;
        
        
-               dc.SetPen(wxPen1);
-               dc.DrawRectangle(0, 0, m_width, m_height);          // outer - right and button
+       if ( HasFlag(wxTINY_CAPTION_HORIZ) ||  HasFlag(wxTINY_CAPTION_VERT) )
+       {
+               wclass = kFloatingWindowClass ;
+               if ( HasFlag(wxTINY_CAPTION_VERT) )
+               {
+                       attr |= kWindowSideTitlebarAttribute ;
+               }
+       }
+       else if ( HasFlag( wxTHICK_FRAME ) )
+       {
+               if ( HasFlag( wxDIALOG_MODAL ) )
+               {
+                       wclass = kMovableModalWindowClass ;
+               }
+               else if ( HasFlag( wxDIALOG_MODELESS ) )
+               {
+                       wclass = kDocumentWindowClass ;
+               }
+               else
+               {
+                       if ( HasFlag( wxCAPTION ) )
+                       {
+                               wclass = kDocumentWindowClass ;
+                       }
+                       else
+                       {
+                               wclass = kModalWindowClass ;
+                       }
+               }
+       }
+       else
+       {
+               wclass = kModalWindowClass ;
+       }
        
        
-           dc.SetPen(wxPen2);
-               dc.DrawRectangle(1, 1, m_width-1, m_height-1);      // outer - left and top
+       attr = kWindowNoAttributes ;
        
        
-           dc.SetPen(wxPen3);
-               dc.DrawRectangle(0, 0, m_width-2, m_height-2);          // inner - right and button
+       if ( HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) )
+       {
+               attr |= kWindowFullZoomAttribute ;
+               attr |= kWindowCollapseBoxAttribute ;
+       }
+       if ( HasFlag( wxRESIZE_BORDER ) )
+       {
+               attr |= kWindowResizableAttribute ;
+       }
+       if ( HasFlag( wxSYSTEM_MENU ) )
+       {
+               attr |= kWindowCloseBoxAttribute ;
+       }
        
        
-           dc.SetPen(wxPen4);
-               dc.DrawLine(0, 0, m_width-3, 0);                 // inner - left and top
-               dc.DrawLine(0, 0, 0, m_height-3);
+       UMACreateNewWindow( wclass , attr , &theBoundsRect , &m_macWindowData->m_macWindow ) ;
+       wxAssociateWinWithMacWindow( m_macWindowData->m_macWindow , this ) ;
+       wxString label ;
+       if( wxApp::s_macDefaultEncodingIsPC )
+               label = wxMacMakeMacStringFromPC( title ) ;
+       else
+               label = title ;
+       UMASetWTitleC( m_macWindowData->m_macWindow , label ) ;
+       UMACreateRootControl( m_macWindowData->m_macWindow , &m_macWindowData->m_macRootControl ) ;
+
+       m_macWindowData->m_macFocus = NULL ;
+}
+
+void wxWindow::MacPaint( wxPaintEvent &event ) 
+{
+}
+
+void wxWindow::MacPaintBorders( ) 
+{
+       if( m_macWindowData )
+               return ;
+               
+       RGBColor white = { 0xFFFF, 0xFFFF , 0xFFFF } ;
+       RGBColor black = { 0x0000, 0x0000 , 0x0000 } ;
+       RGBColor face = { 0xDDDD, 0xDDDD , 0xDDDD } ;
+       RGBColor shadow = { 0x4444, 0x4444 , 0x4444 } ;
+       PenNormal() ;
+
+    if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
+    {
+       bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
+       RGBColor pen1 = sunken ? white : black ;
+       RGBColor pen2 = sunken ? shadow : face ;
+       RGBColor pen3 = sunken ? face : shadow ;
+       RGBColor pen4 = sunken ? black : white ;
+       
+       RGBForeColor( &pen1 ) ;
+       {
+                       Rect rect = { 0 , 0 , m_height , m_width } ;
+               FrameRect( &rect ) ;
+       }
+       RGBForeColor( &pen2 ) ;
+       {
+                       Rect rect = { 1 , 1 , m_height -1 , m_width -1} ;
+               FrameRect( &rect ) ;
+       }
+       RGBForeColor( &pen3 ) ;
+       {
+                       Rect rect = { 0 , 0 , m_height -2 , m_width -2} ;
+               FrameRect( &rect ) ;
+       }
+       RGBForeColor( &pen4 ) ;
+       {
+               MoveTo( 0 , 0 ) ;
+               LineTo( m_width - 3 , 0 ) ;
+               MoveTo( 0 , 0 ) ;
+               LineTo( 0 , m_height - 3 ) ;
+       }
     }
     else if (HasFlag(wxSIMPLE_BORDER))
     {
     }
     else if (HasFlag(wxSIMPLE_BORDER))
     {
-               dc.SetPen(*wxBLACK_PEN);
-               dc.DrawRectangle(0, 0, m_width, m_height);         
+               Rect rect = { 0 , 0 , m_height , m_width } ;
+               RGBForeColor( &black ) ;
+       FrameRect( &rect ) ;
+    }
+/*
+       if ( this->GetParent() )
+       {
+           wxPaintDC dc(GetParent());
+           GetParent()->PrepareDC(dc);
+       
+           if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) )
+           {
+               bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
+       
+                       wxPen m_penButton3DShadow( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DSHADOW ), 1, wxSOLID ) ;
+                       wxPen m_penButton3DFace( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE ), 1, wxSOLID ) ;
+               
+                       wxPen wxPen1 = sunken ? *wxWHITE_PEN : *wxBLACK_PEN;
+                       wxPen wxPen2 = sunken ? m_penButton3DShadow : m_penButton3DShadow;
+                       wxPen wxPen3 = sunken ? m_penButton3DFace : m_penButton3DShadow;
+                       wxPen wxPen4 = sunken ? *wxBLACK_PEN : *wxWHITE_PEN;
+               
+                       dc.SetPen(wxPen1);
+                       dc.DrawRectangle(m_x, m_y, m_width, m_height);          // outer - right and button
+               
+                   dc.SetPen(wxPen2);
+                       dc.DrawRectangle(m_x+1, m_y+1, m_width-1, m_height-1);      // outer - left and top
+               
+                   dc.SetPen(wxPen3);
+                       dc.DrawRectangle(m_x, m_y, m_width-2, m_height-2);          // inner - right and button
+               
+                   dc.SetPen(wxPen4);
+                       dc.DrawLine(m_x, m_y, m_x + m_width-3, m_y);                 // inner - left and top
+                       dc.DrawLine(m_x, m_y, m_x, m_y + m_height-3);
+           }
+           else if (HasFlag(wxDOUBLE_BORDER))
+           {
+               bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
+       
+                       wxPen m_penButton3DShadow( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DSHADOW ), 1, wxSOLID ) ;
+                       wxPen m_penButton3DFace( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE ), 1, wxSOLID ) ;
+               
+                       wxPen wxPen1 = sunken ? *wxWHITE_PEN : *wxBLACK_PEN;
+                       wxPen wxPen2 = sunken ? m_penButton3DShadow : m_penButton3DShadow;
+                       wxPen wxPen3 = sunken ? m_penButton3DFace : m_penButton3DShadow;
+                       wxPen wxPen4 = sunken ? *wxBLACK_PEN : *wxWHITE_PEN;
+               
+                       dc.SetPen(wxPen1);
+                       dc.DrawRectangle(m_x, m_y, m_width, m_height);          // outer - right and button
+               
+                   dc.SetPen(wxPen2);
+                       dc.DrawRectangle(m_x+1, m_y+1, m_width-1, m_height-1);      // outer - left and top
+               
+                   dc.SetPen(wxPen3);
+                       dc.DrawRectangle(m_x, m_y, m_width-2, m_height-2);          // inner - right and button
+               
+                   dc.SetPen(wxPen4);
+                       dc.DrawLine(m_x, m_y, m_x + m_width-3, m_y);                 // inner - left and top
+                       dc.DrawLine(m_x, m_y, m_x, m_y + m_height-3);
+           }
+           else if (HasFlag(wxSIMPLE_BORDER))
+           {
+                       dc.SetPen(*wxBLACK_PEN);
+                       dc.DrawRectangle(m_x, m_y, m_width, m_height);         
+           }
     }
     }
+ */
 }
 
 // New function that will replace some of the above.
 }
 
 // New function that will replace some of the above.
@@ -1011,20 +1230,21 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
        wxMacDrawingClientHelper focus( this ) ;
        if ( focus.Ok() )
        {
        wxMacDrawingClientHelper focus( this ) ;
        if ( focus.Ok() )
        {
-       int width , height ;
-       GetClientSize( &width , &height ) ;
-       Rect scrollrect = { 0 , 0 , height , width } ;
+               int width , height ;
+               GetClientSize( &width , &height ) ;
+
+               Rect scrollrect = { 0 , 0 , height , width } ;
        
        
-       RgnHandle updateRgn = NewRgn() ;
-       ClipRect( &scrollrect ) ;
-    if ( rect )
-    {
-       Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ;
+               RgnHandle updateRgn = NewRgn() ;
+               ClipRect( &scrollrect ) ;
+       if ( rect )
+       {
+               Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ;
                        SectRect( &scrollrect , &r , &scrollrect ) ;            
                        SectRect( &scrollrect , &r , &scrollrect ) ;            
-    }
-       ScrollRect( &scrollrect , dx , dy , updateRgn ) ;
-    InvalRgn( updateRgn ) ;
-    DisposeRgn( updateRgn ) ;
+       }
+               ScrollRect( &scrollrect , dx , dy , updateRgn ) ;
+       InvalWindowRgn( GetMacRootWindow() ,  updateRgn ) ;
+       DisposeRgn( updateRgn ) ;
        }
 }
 
        }
 }
 
@@ -1136,9 +1356,9 @@ void wxWindow::Clear()
        else
        {
                wxClientDC dc(this);
        else
        {
                wxClientDC dc(this);
-    wxBrush brush(GetBackgroundColour(), wxSOLID);
-    dc.SetBackground(brush);
-    dc.Clear();
+       wxBrush brush(GetBackgroundColour(), wxSOLID);
+       dc.SetBackground(brush);
+       dc.Clear();
        }
 }
 
        }
 }
 
@@ -1193,6 +1413,9 @@ void wxWindow::DoSetClientSize(int width, int height)
                if ( height != -1 && m_vScrollBar )
                        height += MAC_SCROLLBAR_SIZE ;
 
                if ( height != -1 && m_vScrollBar )
                        height += MAC_SCROLLBAR_SIZE ;
 
+               width += 2 * MacGetBorderSize(  ) ;
+               height += 2 * MacGetBorderSize(  ) ;
+
                DoSetSize( -1 , -1 , width , height ) ;
        }
 }
                DoSetSize( -1 , -1 , width , height ) ;
        }
 }
@@ -1249,6 +1472,7 @@ bool wxWindow::MacDispatchMouseEvent(wxMouseEvent& event)
                (event.m_x > (m_x + m_width)) || (event.m_y > (m_y + m_height)))
                return FALSE;
        
                (event.m_x > (m_x + m_width)) || (event.m_y > (m_y + m_height)))
                return FALSE;
        
+
        if ( IsKindOf( CLASSINFO ( wxStaticBox ) ) )
                return FALSE ; 
        
        if ( IsKindOf( CLASSINFO ( wxStaticBox ) ) )
                return FALSE ; 
        
@@ -1277,10 +1501,28 @@ bool wxWindow::MacDispatchMouseEvent(wxMouseEvent& event)
        {
                m_cursor.MacInstall() ;
        }
        {
                m_cursor.MacInstall() ;
        }
+
+#if wxUSE_TOOLTIPS
+    if ( event.GetEventType() == wxEVT_MOTION 
+               || event.GetEventType() == wxEVT_ENTER_WINDOW
+               || event.GetEventType() == wxEVT_LEAVE_WINDOW )
+        wxToolTip::RelayEvent( this , event);
+#endif // wxUSE_TOOLTIPS
        GetEventHandler()->ProcessEvent( event ) ;
        return TRUE;
 }
 
        GetEventHandler()->ProcessEvent( event ) ;
        return TRUE;
 }
 
+Point lastWhere ;
+long lastWhen = 0 ;
+
+wxString wxWindow::MacGetToolTipString( wxPoint &pt )
+{
+       if ( m_tooltip )
+       {
+               return m_tooltip->GetTip() ;
+       }
+       return "" ;
+}
 void wxWindow::MacFireMouseEvent( EventRecord *ev )
 {
        wxMouseEvent event(wxEVT_LEFT_DOWN);
 void wxWindow::MacFireMouseEvent( EventRecord *ev )
 {
        wxMouseEvent event(wxEVT_LEFT_DOWN);
@@ -1323,6 +1565,22 @@ void wxWindow::MacFireMouseEvent( EventRecord *ev )
        ::GlobalToLocal( &localwhere ) ;
        ::SetPort( port ) ;
 
        ::GlobalToLocal( &localwhere ) ;
        ::SetPort( port ) ;
 
+       if ( ev->what == mouseDown )
+       {
+               if ( ev->when - lastWhen <= GetDblTime() )
+               {
+                       if ( abs( localwhere.h - lastWhere.h ) < 3 || abs( localwhere.v - lastWhere.v ) < 3 )
+                       {
+                               if ( controlDown )
+                                       event.SetEventType(wxEVT_RIGHT_DCLICK ) ;
+                               else
+                                       event.SetEventType(wxEVT_LEFT_DCLICK ) ;
+                       }
+               }
+               lastWhen = ev->when ;
+               lastWhere = localwhere ;
+       }
+
        event.m_x = localwhere.h;
        event.m_y = localwhere.v;
        event.m_x += m_x;
        event.m_x = localwhere.h;
        event.m_y = localwhere.v;
        event.m_x += m_x;
@@ -1407,7 +1665,7 @@ void wxWindow::MacRedraw( RgnHandle updatergn , long time)
        WindowRef window = GetMacRootWindow() ;
        wxWindow* win = wxFindWinFromMacWindow( window ) ;
        {
        WindowRef window = GetMacRootWindow() ;
        wxWindow* win = wxFindWinFromMacWindow( window ) ;
        {
-               wxMacDrawingClientHelper focus( this ) ;
+               wxMacDrawingHelper focus( this ) ; // was client
                if ( focus.Ok() )
                {
                        WindowRef window = GetMacRootWindow() ;
                if ( focus.Ok() )
                {
                        WindowRef window = GetMacRootWindow() ;
@@ -1446,7 +1704,9 @@ void wxWindow::MacRedraw( RgnHandle updatergn , long time)
                                                        // if we have the normal colours in the hierarchy but another control etc. -> use it's background
                                                        if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
                                                        {
                                                        // if we have the normal colours in the hierarchy but another control etc. -> use it's background
                                                        if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
                                                        {
-                                                               ApplyThemeBackground(kThemeBackgroundTabPane, &(**updatergn).rgnBBox , kThemeStateActive,8,true);
+                                                               Rect box ;
+                                                               GetRegionBounds( updatergn , &box) ;
+                                                               UMAApplyThemeBackground(kThemeBackgroundTabPane, &box , kThemeStateActive,8,true);
                                                                break ;
                                                        }
                                                }
                                                                break ;
                                                        }
                                                }
@@ -1475,32 +1735,39 @@ void wxWindow::MacRedraw( RgnHandle updatergn , long time)
                                EraseRgn( updatergn ) ; 
                        }
                }
                                EraseRgn( updatergn ) ; 
                        }
                }
+
+               m_macUpdateRgn = updatergn ;
+               {
+                       RgnHandle newupdate = NewRgn() ;
+                       wxSize point = GetClientSize() ;
+                       wxPoint origin = GetClientAreaOrigin() ;
+                       SetRectRgn( newupdate , origin.x , origin.y , origin.x + point.x , origin.y+point.y ) ;
+                       SectRgn( newupdate , m_macUpdateRgn , newupdate ) ;
+                       OffsetRgn( newupdate , -origin.x , -origin.y ) ;
+                       m_updateRegion = newupdate ;
+                       DisposeRgn( newupdate ) ;
+               }
+
+               MacPaintBorders() ;
+               wxPaintEvent event;
+               event.m_timeStamp = time ;
+               event.SetEventObject(this);
+               GetEventHandler()->ProcessEvent(event);
+       }
+       {
        }
 
        
        }
 
        
-       m_updateRegion = updatergn ;
-       wxPaintEvent event;
-       event.m_timeStamp = time ;
-       event.SetEventObject(this);
-       
-       wxPaintEvent event2( event ) ;
-       GetEventHandler()->ProcessEvent(event);
-       MacPaint( event2 ) ;
        
        RgnHandle childupdate = NewRgn() ;
 
        for (wxNode *node = GetChildren().First(); node; node = node->Next())
        {
                wxWindow *child = (wxWindow*)node->Data();
        
        RgnHandle childupdate = NewRgn() ;
 
        for (wxNode *node = GetChildren().First(); node; node = node->Next())
        {
                wxWindow *child = (wxWindow*)node->Data();
-               int width ;
-               int height ;
-               
-               child->GetClientSize( &width , &height ) ;
-               
-               SetRectRgn( childupdate , child->m_x , child->m_y , child->m_x +width ,  child->m_y + height ) ;
-               SectRgn( childupdate , m_updateRegion.GetWXHRGN() , childupdate ) ;
+               SetRectRgn( childupdate , child->m_x , child->m_y , child->m_x + child->m_width ,  child->m_y + child->m_height ) ;
+               SectRgn( childupdate , m_macUpdateRgn , childupdate ) ;
                OffsetRgn( childupdate , -child->m_x , -child->m_y ) ;
                OffsetRgn( childupdate , -child->m_x , -child->m_y ) ;
-               if ( child->GetMacRootWindow() == window && child->IsShown() )
+               if ( child->GetMacRootWindow() == window && child->IsShown() && !EmptyRgn( childupdate ) )
                {
                        // because dialogs may also be children
                        child->MacRedraw( childupdate , time ) ;
                {
                        // because dialogs may also be children
                        child->MacRedraw( childupdate , time ) ;
@@ -1516,24 +1783,28 @@ void wxWindow::MacUpdateImmediately()
        if ( window )
        {
                wxWindow* win = wxFindWinFromMacWindow( window ) ;
        if ( window )
        {
                wxWindow* win = wxFindWinFromMacWindow( window ) ;
+               #if TARGET_CARBON
+               AGAPortHelper help( GetWindowPort(window) ) ;
+               #else
+               AGAPortHelper help( (window) ) ;
+               #endif
+               SetOrigin( 0 , 0 ) ;
                BeginUpdate( window ) ;
                if ( win )
                {
                BeginUpdate( window ) ;
                if ( win )
                {
-               #if ! TARGET_CARBON
-                       if ( !EmptyRgn( window->visRgn ) )
-               #endif
+                       RgnHandle               region = NewRgn();
+                       
+                       if ( region )
                        {
                        {
-                               win->MacRedraw( window->visRgn , wxTheApp->sm_lastMessageTime ) ;
-/*
-                               {
-                                       wxMacDrawingHelper help( win ) ;
-                                       SetOrigin( 0 , 0 ) ;
-                                       UMASetThemeWindowBackground( win->m_macWindowData->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
-                                       UMAUpdateControls( window , window->visRgn ) ;
-                                       UMASetThemeWindowBackground( win->m_macWindowData->m_macWindow , win->m_macWindowData->m_macWindowBackgroundTheme , false ) ;
-                               }
-*/
-                       }
+                   GetPortVisibleRegion( GetWindowPort( window ), region );
+
+                               // if windowshade gives incompatibility , take the follwing out
+                   if ( !EmptyRgn( region ) )
+                   {
+                                       win->MacRedraw( region , wxTheApp->sm_lastMessageTime ) ;
+                   }
+                   DisposeRgn( region );
+               }
                }
                EndUpdate( window ) ;
        }
                }
                EndUpdate( window ) ;
        }
@@ -1543,26 +1814,28 @@ void wxWindow::MacUpdate( EventRecord *ev )
 {
        WindowRef window = (WindowRef) ev->message ;
        wxWindow * win = wxFindWinFromMacWindow( window ) ;
 {
        WindowRef window = (WindowRef) ev->message ;
        wxWindow * win = wxFindWinFromMacWindow( window ) ;
-       
+       #if TARGET_CARBON
+       AGAPortHelper help( GetWindowPort(window) ) ;
+       #else
+       AGAPortHelper help( (window) ) ;
+       #endif
+       SetOrigin( 0 , 0 ) ;
        BeginUpdate( window ) ;
        if ( win )
        {
        BeginUpdate( window ) ;
        if ( win )
        {
-               // if windowshade gives incompatibility , take the follwing out
-               #if ! TARGET_CARBON
-               if ( !EmptyRgn( window->visRgn ) )
-               #endif
+               RgnHandle               region = NewRgn();
+               
+               if ( region )
                {
                {
-                       MacRedraw( window->visRgn , ev->when ) ;
-                       /*
-                       {
-                               wxMacDrawingHelper help( this ) ;
-                               SetOrigin( 0 , 0 ) ;
-                               UMASetThemeWindowBackground( m_macWindowData->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
-                               UMAUpdateControls( window , window->visRgn ) ;
-                               UMASetThemeWindowBackground( m_macWindowData->m_macWindow , m_macWindowData->m_macWindowBackgroundTheme , false ) ;
-                       }
-                       */
-               }
+            GetPortVisibleRegion( GetWindowPort( window ), region );
+
+                       // if windowshade gives incompatibility , take the follwing out
+            if ( !EmptyRgn( region ) )
+            {
+                               MacRedraw( region , ev->when ) ;
+            }
+            DisposeRgn( region );
+        }
        }
        EndUpdate( window ) ;
 }
        }
        EndUpdate( window ) ;
 }
@@ -1586,20 +1859,36 @@ WindowRef wxWindow::GetMacRootWindow() const
 void wxWindow::MacCreateScrollBars( long style ) 
 {
        wxASSERT_MSG( m_vScrollBar == NULL && m_hScrollBar == NULL , "attempt to create window twice" ) ;
 void wxWindow::MacCreateScrollBars( long style ) 
 {
        wxASSERT_MSG( m_vScrollBar == NULL && m_hScrollBar == NULL , "attempt to create window twice" ) ;
+       
        bool hasBoth = ( style & wxVSCROLL ) && ( style & wxHSCROLL ) ;
        int adjust = hasBoth ? MAC_SCROLLBAR_SIZE - 1: 0 ;
        bool hasBoth = ( style & wxVSCROLL ) && ( style & wxHSCROLL ) ;
        int adjust = hasBoth ? MAC_SCROLLBAR_SIZE - 1: 0 ;
+       int width, height ;
+       GetClientSize( &width , &height ) ;
        
        
+       wxPoint vPoint(width-MAC_SCROLLBAR_SIZE, 0) ;
+       wxSize vSize(MAC_SCROLLBAR_SIZE, height - adjust) ;
+       wxPoint hPoint(0 , height-MAC_SCROLLBAR_SIZE ) ;
+       wxSize hSize( width - adjust, MAC_SCROLLBAR_SIZE) ;
+       
+       m_vScrollBar = new wxScrollBar(this, wxWINDOW_VSCROLL, vPoint, 
+               vSize , wxVERTICAL);
+
        if ( style & wxVSCROLL )
        {
        if ( style & wxVSCROLL )
        {
-               m_vScrollBar = new wxScrollBar(this, wxWINDOW_VSCROLL, wxPoint(m_width-MAC_SCROLLBAR_SIZE, 0), 
-                       wxSize(MAC_SCROLLBAR_SIZE, m_height - adjust), wxVERTICAL);
-//             m_vScrollBar->PushEventHandler( this ) ;
+               
+       }
+       else
+       {
+               m_vScrollBar->Show(false) ;
        }
        }
+       m_hScrollBar = new wxScrollBar(this, wxWINDOW_HSCROLL, hPoint, 
+               hSize , wxHORIZONTAL);
        if ( style  & wxHSCROLL )
        {
        if ( style  & wxHSCROLL )
        {
-               m_hScrollBar = new wxScrollBar(this, wxWINDOW_HSCROLL, wxPoint(0 , m_height-MAC_SCROLLBAR_SIZE ), 
-                       wxSize( m_width - adjust, MAC_SCROLLBAR_SIZE), wxHORIZONTAL);
-//             m_hScrollBar->PushEventHandler( this ) ;
+       }
+       else
+       {
+               m_hScrollBar->Show(false) ;
        }
        
        // because the create does not take into account the client area origin
        }
        
        // because the create does not take into account the client area origin
@@ -1611,18 +1900,79 @@ void wxWindow::MacRepositionScrollBars()
        bool hasBoth = ( m_hScrollBar && m_hScrollBar->IsShown()) && ( m_vScrollBar && m_vScrollBar->IsShown()) ;
        int adjust = hasBoth ? MAC_SCROLLBAR_SIZE - 1 : 0 ;
        
        bool hasBoth = ( m_hScrollBar && m_hScrollBar->IsShown()) && ( m_vScrollBar && m_vScrollBar->IsShown()) ;
        int adjust = hasBoth ? MAC_SCROLLBAR_SIZE - 1 : 0 ;
        
+       // get real client area
+       
+       int width = m_width ; 
+       int height = m_height ;
+
+       width -= 2 * MacGetBorderSize() ;
+       height -= 2 * MacGetBorderSize() ;
+       
+       wxPoint vPoint(width-MAC_SCROLLBAR_SIZE, 0) ;
+       wxSize vSize(MAC_SCROLLBAR_SIZE, height - adjust) ;
+       wxPoint hPoint(0 , height-MAC_SCROLLBAR_SIZE ) ;
+       wxSize hSize( width - adjust, MAC_SCROLLBAR_SIZE) ;
+       
+       int x = 0 ; 
+       int y = 0 ;
+       int w = m_width ;
+       int h = m_height ;
+       
+       MacClientToRootWindow( &x , &y ) ;
+       MacClientToRootWindow( &w , &h ) ;
+       
+       WindowRef window = NULL ;
+       wxWindow *iter = (wxWindow*)this ;
+       
+       int totW = 10000 , totH = 10000;
+       while( iter )
+       {
+               if ( iter->m_macWindowData )
+               {
+                       totW = iter->m_width ;
+                       totH = iter->m_height ;
+                       break ;
+               }
+
+               iter = iter->GetParent() ;
+       } 
+       
+       if ( x == 0 )
+       {
+               hPoint.x = -1 ;
+               hSize.x += 1 ;
+       }
+       if ( y == 0 )
+       {
+               vPoint.y = -1 ;
+               vSize.y += 1 ;
+       }
+       
+       if ( w-x >= totW )
+       {
+               hSize.x += 1 ;
+               vPoint.x += 1 ;
+       }
+       
+       if ( h-y >= totH )
+       {
+               vSize.y += 1 ;
+               hPoint.y += 1 ;
+       }
+
        if ( m_vScrollBar )
        {
        if ( m_vScrollBar )
        {
-               m_vScrollBar->SetSize( m_width-MAC_SCROLLBAR_SIZE, 0, MAC_SCROLLBAR_SIZE, m_height - adjust , wxSIZE_USE_EXISTING);
+               m_vScrollBar->SetSize( vPoint.x , vPoint.y, vSize.x, vSize.y , wxSIZE_ALLOW_MINUS_ONE);
        }
        if ( m_hScrollBar )
        {
        }
        if ( m_hScrollBar )
        {
-               m_hScrollBar->SetSize( 0 , m_height-MAC_SCROLLBAR_SIZE ,m_width - adjust, MAC_SCROLLBAR_SIZE, wxSIZE_USE_EXISTING);
+               m_hScrollBar->SetSize( hPoint.x , hPoint.y, hSize.x, hSize.y, wxSIZE_ALLOW_MINUS_ONE);
        }
 }
 
 void wxWindow::MacKeyDown( EventRecord *ev ) 
 {
        }
 }
 
 void wxWindow::MacKeyDown( EventRecord *ev ) 
 {
+
 }
 
 
 }
 
 
@@ -1651,7 +2001,8 @@ void wxWindow::MacSuperChangedPosition()
                node = node->Next();
        }
 }
                node = node->Next();
        }
 }
-       
+/*
+
 bool wxWindow::MacSetupFocusPort(  ) 
 {
        Point localOrigin ;
 bool wxWindow::MacSetupFocusPort(  ) 
 {
        Point localOrigin ;
@@ -1699,7 +2050,7 @@ bool wxWindow::MacSetupDrawingClientPort(  )
        MacGetPortClientParams( &localOrigin , &clipRect , &window , &rootwin) ;
        return  MacSetPortDrawingParams( localOrigin, clipRect, window , rootwin ) ; 
 }
        MacGetPortClientParams( &localOrigin , &clipRect , &window , &rootwin) ;
        return  MacSetPortDrawingParams( localOrigin, clipRect, window , rootwin ) ; 
 }
-
+*/
 
 bool wxWindow::MacSetPortFocusParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindow* win ) 
 {
 
 bool wxWindow::MacSetPortFocusParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindow* win ) 
 {
@@ -1714,6 +2065,7 @@ bool wxWindow::MacSetPortFocusParams( const Point & localOrigin, const Rect & cl
        if (currPort != port )
                        ::SetPort(port);
                                
        if (currPort != port )
                        ::SetPort(port);
                                
+//     wxASSERT( port->portRect.left == 0 && port->portRect.top == 0 ) ; 
        ::SetOrigin(-localOrigin.h, -localOrigin.v);
        return true;                    
 }
        ::SetOrigin(-localOrigin.h, -localOrigin.v);
        return true;                    
 }
@@ -1729,14 +2081,16 @@ bool wxWindow::MacSetPortDrawingParams( const Point & localOrigin, const Rect &
        port = UMAGetWindowPort( window) ;
        if (currPort != port )
                        ::SetPort(port);
        port = UMAGetWindowPort( window) ;
        if (currPort != port )
                        ::SetPort(port);
-                               
+//     wxASSERT( port->portRect.left == 0 && port->portRect.top == 0 ) ; 
        ::SetOrigin(-localOrigin.h, -localOrigin.v);
        ::ClipRect(&clipRect);
 
        ::PenNormal() ;
        ::RGBBackColor(& win->GetBackgroundColour().GetPixel() ) ;
        ::RGBForeColor(& win->GetForegroundColour().GetPixel() ) ;
        ::SetOrigin(-localOrigin.h, -localOrigin.v);
        ::ClipRect(&clipRect);
 
        ::PenNormal() ;
        ::RGBBackColor(& win->GetBackgroundColour().GetPixel() ) ;
        ::RGBForeColor(& win->GetForegroundColour().GetPixel() ) ;
-       ::BackPat( &qd.white ) ;
+       Pattern whiteColor ;
+       
+       ::BackPat( GetQDGlobalsWhite( &whiteColor) ) ;
        ::UMASetThemeWindowBackground(  win->m_macWindowData->m_macWindow , win->m_macWindowData->m_macWindowBackgroundTheme ,  false ) ;
        return true;                    
 }
        ::UMASetThemeWindowBackground(  win->m_macWindowData->m_macWindow , win->m_macWindowData->m_macWindowBackgroundTheme ,  false ) ;
        return true;                    
 }
@@ -1771,10 +2125,10 @@ void wxWindow::MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *w
        }
 }
 
        }
 }
 
-void wxWindow::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindow** rootwin ) 
+void wxWindow::MacDoGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindow** rootwin ) 
 {
 {
-       int width , height ;
-       GetClientSize( &width , &height ) ;
+//     int width , height ;
+//     GetClientSize( &width , &height ) ;
        
        if ( m_macWindowData )
        {
        
        if ( m_macWindowData )
        {
@@ -1791,7 +2145,7 @@ void wxWindow::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, Window
        {
                wxASSERT( GetParent() != NULL ) ;
                
        {
                wxASSERT( GetParent() != NULL ) ;
                
-               GetParent()->MacGetPortClientParams( localOrigin , clipRect , window, rootwin) ;
+               GetParent()->MacDoGetPortClientParams( localOrigin , clipRect , window, rootwin) ;
 
                localOrigin->h += m_x;
                localOrigin->v += m_y;
 
                localOrigin->h += m_x;
                localOrigin->v += m_y;
@@ -1800,12 +2154,58 @@ void wxWindow::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, Window
                Rect myClip;
                myClip.left = 0;
                myClip.top = 0;
                Rect myClip;
                myClip.left = 0;
                myClip.top = 0;
-               myClip.right = width;
-               myClip.bottom = height;
+               myClip.right = m_width ;//width;
+               myClip.bottom = m_height ;// height;
                SectRect(clipRect, &myClip, clipRect);
        }
 }
 
                SectRect(clipRect, &myClip, clipRect);
        }
 }
 
+void wxWindow::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindow** rootwin ) 
+{
+       MacDoGetPortClientParams( localOrigin , clipRect , window , rootwin ) ;
+
+       int width , height ;
+       GetClientSize( &width , &height ) ;
+       wxPoint client ;
+       client = GetClientAreaOrigin( ) ;
+       
+       localOrigin->h += client.x;
+       localOrigin->v += client.y;
+       OffsetRect(clipRect, -client.x, -client.y);
+
+       Rect myClip;
+       myClip.left = 0;
+       myClip.top = 0;
+       myClip.right = width;
+       myClip.bottom = height;
+       SectRect(clipRect, &myClip, clipRect);
+}
+
+long wxWindow::MacGetBorderSize( ) const
+{
+       if( m_macWindowData )
+               return 0 ;
+
+    if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER )
+    {
+               return 2 ;
+    }
+    else if (  m_windowStyle &wxDOUBLE_BORDER)
+    {
+               return 2 ;
+    }
+    else if (m_windowStyle &wxSIMPLE_BORDER)
+    {
+       return 1 ;
+    }
+       return 0 ;
+}
+
+long wxWindow::MacRemoveBordersFromStyle( long style ) 
+{
+       return style & ~( wxDOUBLE_BORDER | wxSUNKEN_BORDER | wxRAISED_BORDER | wxBORDER | wxSTATIC_BORDER ) ;
+}
+/*
 wxMacFocusHelper::wxMacFocusHelper( wxWindow * theWindow ) 
 {
        m_ok = false ;
 wxMacFocusHelper::wxMacFocusHelper( wxWindow * theWindow ) 
 {
        m_ok = false ;
@@ -1829,12 +2229,13 @@ wxMacFocusHelper::~wxMacFocusHelper()
 {
        if ( m_ok )
        {
 {
        if ( m_ok )
        {
+               SetPort( m_currentPort ) ;
                SetOrigin( 0 , 0 ) ;
        }
        if ( m_formerPort != m_currentPort )
                SetPort( m_formerPort ) ;
 }
                SetOrigin( 0 , 0 ) ;
        }
        if ( m_formerPort != m_currentPort )
                SetPort( m_formerPort ) ;
 }
-
+*/
 wxMacDrawingHelper::wxMacDrawingHelper( wxWindow * theWindow ) 
 {
        m_ok = false ;
 wxMacDrawingHelper::wxMacDrawingHelper( wxWindow * theWindow ) 
 {
        m_ok = false ;
@@ -1861,15 +2262,18 @@ wxMacDrawingHelper::~wxMacDrawingHelper()
 {
        if ( m_ok )
        {
 {
        if ( m_ok )
        {
+               SetPort( m_currentPort ) ;
                SetPenState( &m_savedPenState ) ;
                SetOrigin( 0 , 0 ) ;
                SetPenState( &m_savedPenState ) ;
                SetOrigin( 0 , 0 ) ;
-               ClipRect( &m_currentPort->portRect ) ;
+               Rect portRect ;
+               GetPortBounds( m_currentPort , &portRect ) ;
+               ClipRect( &portRect ) ;
        }
                
        if ( m_formerPort != m_currentPort )
                SetPort( m_formerPort ) ;
 }
        }
                
        if ( m_formerPort != m_currentPort )
                SetPort( m_formerPort ) ;
 }
-
+/*
 wxMacFocusClientHelper::wxMacFocusClientHelper( wxWindow * theWindow ) 
 {
        m_ok = false ;
 wxMacFocusClientHelper::wxMacFocusClientHelper( wxWindow * theWindow ) 
 {
        m_ok = false ;
@@ -1894,11 +2298,13 @@ wxMacFocusClientHelper::~wxMacFocusClientHelper()
 {
        if ( m_ok )
        {
 {
        if ( m_ok )
        {
+               SetPort( m_currentPort ) ;
                SetOrigin( 0 , 0 ) ;
        }
        if ( m_formerPort != m_currentPort )
                SetPort( m_formerPort ) ;
 }
                SetOrigin( 0 , 0 ) ;
        }
        if ( m_formerPort != m_currentPort )
                SetPort( m_formerPort ) ;
 }
+*/
 
 wxMacDrawingClientHelper::wxMacDrawingClientHelper( wxWindow * theWindow ) 
 {
 
 wxMacDrawingClientHelper::wxMacDrawingClientHelper( wxWindow * theWindow ) 
 {
@@ -1927,9 +2333,12 @@ wxMacDrawingClientHelper::~wxMacDrawingClientHelper()
 {
        if ( m_ok )
        {
 {
        if ( m_ok )
        {
+               SetPort( m_currentPort ) ;
                SetPenState( &m_savedPenState ) ;
                SetOrigin( 0 , 0 ) ;
                SetPenState( &m_savedPenState ) ;
                SetOrigin( 0 , 0 ) ;
-               ClipRect( &m_currentPort->portRect ) ;
+               Rect portRect ;
+               GetPortBounds( m_currentPort , &portRect ) ;
+               ClipRect( &portRect ) ;
        }
                
        if ( m_formerPort != m_currentPort )
        }
                
        if ( m_formerPort != m_currentPort )
index 23731901362e0c615659658c4b9cc34cb61e20fd..04b843b995b896faa80f9337bc1b70a8d8241d7a 100644 (file)
@@ -32,7 +32,7 @@
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
-#include "xpmi.h"
+#include "XpmI.h"
 
 /* 3.2 backward compatibility code */
 LFUNC(CreateOldColorTable, int, (XpmColor *ct, int ncolors,
 
 /* 3.2 backward compatibility code */
 LFUNC(CreateOldColorTable, int, (XpmColor *ct, int ncolors,
index 59b89c1a992e592234e6cdab747e1475ecb8865a..2bac74c316eea767b57cae1598d150e6662490df 100644 (file)
@@ -32,7 +32,7 @@
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
-#include "xpmi.h"
+#include "XpmI.h"
 
 LFUNC(WriteColors, int, (char **dataptr, unsigned int *data_size,
                         unsigned int *used_size, XpmColor *colors,
 
 LFUNC(WriteColors, int, (char **dataptr, unsigned int *data_size,
                         unsigned int *used_size, XpmColor *colors,
index 3a21e3d0646edca38cbac7b6fc9ec6c55c273996..bb0d2d293aba571b7224642013b51f0cfde345f9 100644 (file)
@@ -32,7 +32,7 @@
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
-#include "xpmi.h"
+#include "XpmI.h"
 
 LFUNC(CreateColors, int, (char **dataptr, unsigned int *data_size,
                          XpmColor *colors, unsigned int ncolors,
 
 LFUNC(CreateColors, int, (char **dataptr, unsigned int *data_size,
                          XpmColor *colors, unsigned int ncolors,
index 4b5ad728221e80cd2e5f22398892a51dedf9b380..ba863ac3e02f04458f3a9ce1f08831636ffc33bc 100644 (file)
@@ -32,7 +32,7 @@
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
-#include "xpmi.h"
+#include "XpmI.h"
 
 LFUNC(OpenBuffer, void, (char *buffer, xpmData *mdata));
 
 
 LFUNC(OpenBuffer, void, (char *buffer, xpmData *mdata));
 
index bb342d274389ee0e3ebde42c34c1c4b30bb536bb..f3c19c7cd618e597c11b14eb1361a76749ab5639 100644 (file)
@@ -32,7 +32,7 @@
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
-#include "xpmi.h"
+#include "XpmI.h"
 
 LFUNC(OpenArray, void, (char **data, xpmData *mdata));
 
 
 LFUNC(OpenArray, void, (char **data, xpmData *mdata));
 
index 9d4057ad3a301f728fe60c2a22a299a1e73ce894..0753622186d0f25afe10ffcb4e8677a2e7e5a284 100644 (file)
@@ -32,7 +32,7 @@
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
-#include "xpmi.h"
+#include "XpmI.h"
 
 /*
  * Init returned data to free safely later on
 
 /*
  * Init returned data to free safely later on
index f15c6c9b5714aaffbd7fcc77738450af6d4c7ab6..9bc41c89ebc6d4d8af28d1f2da73c2e3d56b8c14 100644 (file)
@@ -32,7 +32,7 @@
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
-#include "xpmi.h"
+#include "XpmI.h"
 
 /*
  * Init returned data to free safely later on
 
 /*
  * Init returned data to free safely later on
index 2745583cf04141134987b87dd2e72e99285aa1fb..abab09c787fc39a12f8ad795eaa5d144fede9ca0 100644 (file)
  * HeDu (hedu@cul-ipn.uni-kiel.de) 4/94
  */
 
  * HeDu (hedu@cul-ipn.uni-kiel.de) 4/94
  */
 
+#include "wx/setup.h"
+
 #ifdef macintosh
        #ifdef __std
                #undef __std
                #define __std()
        #endif
 #ifdef macintosh
        #ifdef __std
                #undef __std
                #define __std()
        #endif
-       #include <unistd.h>
        #include <stat.h>
        #include <stat.h>
-       #include <fcntl.h>
        #include <unix.h>
        #include <unix.h>
+    #include <unistd.h>
+       #include <fcntl.h>
 #endif
 
 #endif
 
-#include "xpmi.h"
+#include "XpmI.h"
 #ifndef macintosh
        #include <sys/stat.h>
 
 #ifndef macintosh
        #include <sys/stat.h>
 
index 58a97c45428620f1929767e27c31efec9a518789..4bb28fce2d8e6c2111da27997e8f7c3e4b62a328 100644 (file)
@@ -32,7 +32,7 @@
 *  Developed by Dan Greening dgreen@cs.ucla.edu / dgreen@sti.com              *
 \*****************************************************************************/
 
 *  Developed by Dan Greening dgreen@cs.ucla.edu / dgreen@sti.com              *
 \*****************************************************************************/
 
-#include "xpmi.h"
+#include "XpmI.h"
 
 int
 XpmReadFileToData(filename, data_return)
 
 int
 XpmReadFileToData(filename, data_return)
index 83bf9224892e7a96ff399fb5b91d84d0d93ed393..3339bbdde0c00fae81898379cefc4152cd889260 100644 (file)
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
+#include "wx/setup.h"
+
 #ifdef macintosh
        #ifdef __std
                #undef __std
                #define __std()
        #endif
 #ifdef macintosh
        #ifdef __std
                #undef __std
                #define __std()
        #endif
-       #include <unistd.h>
        #include <stat.h>
        #include <stat.h>
-       #include <fcntl.h>
        #include <unix.h>
        #include <unix.h>
+       #include <unistd.h>
+       #include <fcntl.h>
        #undef NO_ZPIPE
        #define NO_ZPIPE
 #endif
 
        #undef NO_ZPIPE
        #define NO_ZPIPE
 #endif
 
-#include "xpmi.h"
+#include "XpmI.h"
 #ifndef macintosh
 #include <sys/stat.h>
 #if !defined(NO_ZPIPE) && defined(WIN32)
 #ifndef macintosh
 #include <sys/stat.h>
 #if !defined(NO_ZPIPE) && defined(WIN32)
index 907100aee00e22c4032912b2d17a932691fdba41..3ed6685ada8a9eff39f320db48b6d302f92763a4 100644 (file)
@@ -32,7 +32,7 @@
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
-#include "xpmi.h"
+#include "XpmI.h"
 
 int
 XpmWriteFileFromBuffer(filename, buffer)
 
 int
 XpmWriteFileFromBuffer(filename, buffer)
index eaf5eec4a9685147eead9a5e021a36edb1bd1586..bfaa9097daaa1b38881649e7b82fde2b35d3bb23 100644 (file)
@@ -32,7 +32,7 @@
 *  Developed by Dan Greening dgreen@cs.ucla.edu / dgreen@sti.com              *
 \*****************************************************************************/
 
 *  Developed by Dan Greening dgreen@cs.ucla.edu / dgreen@sti.com              *
 \*****************************************************************************/
 
-#include "xpmi.h"
+#include "XpmI.h"
 
 int
 XpmWriteFileFromData(filename, data)
 
 int
 XpmWriteFileFromData(filename, data)
index be8812001b51aa762b60dacb0f8a2fcd8b76757d..4f5c1bfdaa95423893e499aa13f110f3bcd6c5a4 100644 (file)
@@ -37,7 +37,7 @@
  * Lorens Younes (d93-hyo@nada.kth.se) 4/96
  */
 
  * Lorens Younes (d93-hyo@nada.kth.se) 4/96
  */
 
-#include "xpmi.h"
+#include "XpmI.h"
 #ifdef macintosh
        #undef NO_ZPIPE
        #define NO_ZPIPE
 #ifdef macintosh
        #undef NO_ZPIPE
        #define NO_ZPIPE
index b529e65c5443e607c93d738926055e5ac292f93d..fe27a219cb012fafa4c1f36fb6b3461232576208 100644 (file)
@@ -43,7 +43,7 @@
  * Lorens Younes (d93-hyo@nada.kth.se) 4/96
  */
 
  * Lorens Younes (d93-hyo@nada.kth.se) 4/96
  */
 
-#include "xpmi.h"
+#include "XpmI.h"
 #include <ctype.h>
 
 LFUNC(xpmVisualType, int, (Visual *visual));
 #include <ctype.h>
 
 LFUNC(xpmVisualType, int, (Visual *visual));
index b26f3eb112f04f34e0ff878889e7de4991dee5d5..2a9d2ece2ec2cba8a7938b0ec76d9baab7003cb2 100644 (file)
@@ -39,7 +39,7 @@ static char *RCS_Version = "$XpmVersion: 3.4k $";
 /* Internal version number */
 static char *RCS_Id = "$Id$";
 
 /* Internal version number */
 static char *RCS_Id = "$Id$";
 
-#include "xpmi.h"
+#include "XpmI.h"
 #endif
 #include <ctype.h>
 
 #endif
 #include <ctype.h>
 
index bea343d58d77e1c8e486949f89d4adbaa4dc9acb..7d596ec429b34015245b5507b194cddeba173b47 100644 (file)
@@ -33,7 +33,7 @@
 *                                                                             *
 \*****************************************************************************/
 
 *                                                                             *
 \*****************************************************************************/
 
-#include "xpmi.h"
+#include "XpmI.h"
 
 LFUNC(AtomMake, xpmHashAtom, (char *name, void *data));
 LFUNC(HashTableGrows, int, (xpmHashTable * table));
 
 LFUNC(AtomMake, xpmHashAtom, (char *name, void *data));
 LFUNC(HashTableGrows, int, (xpmHashTable * table));
index 3f83af3ac88224e631d552871d27d6eb90751d75..22368ffac0f306c47a230c75693aeaec45f56006 100644 (file)
@@ -33,7 +33,7 @@
 *  Revised 4/96                                                               *
 \*****************************************************************************/
 
 *  Revised 4/96                                                               *
 \*****************************************************************************/
 
-#include "xpmi.h"
+#include "XpmI.h"
 //#include "macx.h"
 #include "simx.h"
 
 //#include "macx.h"
 #include "simx.h"
 
@@ -58,6 +58,7 @@ AllocXImage (
                        
                
                        NewGWorld( &img->gworldptr , depth , &rect , NULL , NULL , 0 ) ;
                        
                
                        NewGWorld( &img->gworldptr , depth , &rect , NULL , NULL , 0 ) ;
+                       LockPixels( GetGWorldPixMap( img->gworldptr ) ) ;
                        if (img->gworldptr == NULL)
                        {
                        XDestroyImage (img);
                        if (img->gworldptr == NULL)
                        {
                        XDestroyImage (img);
@@ -67,346 +68,3 @@ AllocXImage (
     
     return img;
 }
     
     return img;
 }
-
-/*
-
-static struct RastPort *
-AllocRastPort (unsigned int, unsigned int, unsigned int);
-static void
-FreeRastPort (struct RastPort *, unsigned int,unsigned int);
-
-
-static struct RastPort *
-AllocRastPort (
-    unsigned int   width,
-    unsigned int   height,
-    unsigned int   depth)
-{
-    struct RastPort  *rp;
-    
-    rp = XpmMalloc (sizeof (*rp));
-    if (rp != NULL)
-    {
-       InitRastPort (rp);
-       if (GfxBase->LibNode.lib_Version >= 39)
-       {
-           rp->BitMap = AllocBitMap (width, height, depth, BMF_CLEAR, NULL);
-           if (rp->BitMap == NULL)
-           {
-               FreeRastPort (rp, width, height);
-               return NULL;
-           }
-       }
-       else
-       {
-           unsigned int   i;
-           
-           rp->BitMap = XpmMalloc (sizeof (*rp->BitMap));
-           if (rp->BitMap == NULL)
-           {
-               FreeRastPort (rp, width, height);
-               return NULL;
-           }
-           
-           InitBitMap (rp->BitMap, depth, width, height);
-           for (i = 0; i < depth; ++i)
-               rp->BitMap->Planes[i] = NULL;
-           for (i = 0; i < depth; ++i)
-           {
-               rp->BitMap->Planes[i] = (PLANEPTR)AllocRaster (width, height);
-               if (rp->BitMap->Planes[i] == NULL)
-               {
-                   FreeRastPort (rp, width, height);
-                   return NULL;
-               }
-           }
-       }
-    }
-    
-    return rp;
-}
-
-
-static void
-FreeRastPort (
-    struct RastPort  *rp,
-    unsigned int      width,
-    unsigned int      height)
-{
-    if (rp != NULL)
-    {
-       if (rp->BitMap != NULL)
-       {
-           WaitBlit ();
-           if (GfxBase->LibNode.lib_Version >= 39)
-               FreeBitMap (rp->BitMap);
-           else
-           {
-               unsigned int   i;
-               
-               for (i = 0; i < rp->BitMap->Depth; ++i)
-               {
-                   if (rp->BitMap->Planes[i] != NULL)
-                       FreeRaster (rp->BitMap->Planes[i], width, height);
-               }
-               XpmFree (rp->BitMap);
-           }
-       }
-       XpmFree (rp);
-    }
-}
-
-
-XImage *
-AllocXImage (
-    unsigned int   width,
-    unsigned int   height,
-    unsigned int   depth)
-{
-    XImage  *img;
-    
-    img = XpmMalloc (sizeof (*img));
-    if (img != NULL)
-    {
-       img->width = width;
-       img->height = height;
-       img->rp = AllocRastPort (img->width, img->height, depth);
-       if (img->rp == NULL)
-       {
-           FreeXImage (img);
-           return NULL;
-       }
-    }
-    
-    return img;
-}
-
-
-int
-FreeXImage (
-    XImage  *ximage)
-{
-    if (ximage != NULL)
-    {
-       FreeRastPort (ximage->rp, ximage->width, ximage->height);
-       XpmFree (ximage);
-    }
-    
-    return Success;
-}
-
-
-int
-XPutPixel (
-    XImage         *ximage,
-    int             x,
-    int             y,
-    unsigned long   pixel)
-{
-    SetAPen (ximage->rp, pixel);
-    WritePixel (ximage->rp, x, y);
-    
-    return Success;
-}
-
-
-Status
-AllocBestPen (
-    Colormap        colormap,
-    XColor         *screen_in_out,
-    unsigned long   precision,
-    Bool            fail_if_bad)
-{
-    if (GfxBase->LibNode.lib_Version >= 39)
-    {
-       unsigned long   r, g, b;
-       
-       r = screen_in_out->red * 0x00010001;
-       g = screen_in_out->green * 0x00010001;
-       b = screen_in_out->blue * 0x00010001;
-       screen_in_out->pixel = ObtainBestPen (colormap, r, g, b,
-                                             OBP_Precision, precision,
-                                             OBP_FailIfBad, fail_if_bad,
-                                             TAG_DONE);
-       if (screen_in_out->pixel == -1)
-           return False;
-       
-       QueryColor (colormap, screen_in_out);
-    }
-    else
-    {
-       XColor   nearest, trial;
-       long     nearest_delta, trial_delta;
-       int      num_cells, i;
-       
-       num_cells = colormap->Count;
-       nearest.pixel = 0;
-       QueryColor (colormap, &nearest);
-       nearest_delta = ((((screen_in_out->red >> 8) - (nearest.red >> 8))
-                         * ((screen_in_out->red >> 8) - (nearest.red >> 8)))
-                        +
-                        (((screen_in_out->green >> 8) - (nearest.green >> 8))
-                         * ((screen_in_out->green >> 8) - (nearest.green >> 8)))
-                        +
-                        (((screen_in_out->blue >> 8) - (nearest.blue >> 8))
-                         * ((screen_in_out->blue >> 8) - (nearest.blue >> 8))));
-       for (i = 1; i < num_cells; i++)
-       {
-       // precision and fail_if_bad is ignored under pre V39 
-           trial.pixel = i;
-           QueryColor (colormap, &trial);
-           trial_delta = ((((screen_in_out->red >> 8) - (trial.red >> 8))
-                           * ((screen_in_out->red >> 8) - (trial.red >> 8)))
-                          +
-                          (((screen_in_out->green >> 8) - (trial.green >> 8))
-                           * ((screen_in_out->green >> 8) - (trial.green >> 8)))
-                          +
-                          (((screen_in_out->blue >> 8) - (trial.blue >> 8))
-                           * ((screen_in_out->blue >> 8) - (trial.blue >> 8))));
-           if (trial_delta < nearest_delta)
-           {
-               nearest = trial;
-               nearest_delta = trial_delta;
-           }
-       }
-       screen_in_out->pixel = nearest.pixel;
-       screen_in_out->red = nearest.red;
-       screen_in_out->green = nearest.green;
-       screen_in_out->blue = nearest.blue;
-    }
-    
-    return True;
-}
-
-
-int
-FreePens (
-    Colormap        colormap,
-    unsigned long  *pixels,
-    int             npixels)
-{
-    if (GfxBase->LibNode.lib_Version >= 39)
-    {
-       int   i;
-       
-       for (i = 0; i < npixels; i++)
-           ReleasePen (colormap, pixels[i]);
-    }
-    
-    return Success;
-}
-
-
-Status
-ParseColor (
-    char    *spec,
-    XColor  *exact_def_return)
-{
-    int spec_length;
-    
-    if (spec == 0)
-       return False;
-    
-    spec_length = strlen(spec);
-    if (spec[0] == '#')
-    {
-       int hexlen;
-       char hexstr[10];
-       
-       hexlen = (spec_length - 1) / 3;
-       if (hexlen < 1 || hexlen > 4 || hexlen * 3 != spec_length - 1)
-           return False;
-       
-       hexstr[hexlen] = '\0';
-       strncpy (hexstr, spec + 1, hexlen);
-       exact_def_return->red = strtoul (hexstr, NULL, 16) << (16 - 4*hexlen);
-       strncpy (hexstr, spec + 1 + hexlen, hexlen);
-       exact_def_return->green = strtoul (hexstr, NULL, 16) << (16 - 4*hexlen);
-       strncpy (hexstr, spec + 1 + 2 * hexlen, hexlen);
-       exact_def_return->blue = strtoul (hexstr, NULL, 16) << (16 - 4*hexlen);
-       
-       return True;
-    }
-    else
-    {
-       FILE  *rgbf;
-       int    items, red, green, blue;
-       char   line[512], name[512];
-       Bool   success = False;
-       
-       rgbf = fopen ("LIBS:rgb.txt", "r");
-       if (rgbf == NULL)
-           return False;
-       
-       while (fgets(line, sizeof (line), rgbf) && !success)
-       {
-           items = sscanf (line, "%d %d %d %[^\n]\n",
-                           &red, &green, &blue, name);
-           if (items != 4)
-               continue;
-           
-           if (red < 0 || red > 0xFF
-               || green < 0 || green > 0xFF
-               || blue < 0 || blue > 0xFF)
-           {
-               continue;
-           }
-           
-           if (0 == xpmstrcasecmp (spec, name))
-           {
-               exact_def_return->red = red * 0x0101;
-               exact_def_return->green = green * 0x0101;
-               exact_def_return->blue = blue * 0x0101;
-               success = True;
-           }
-       }
-       fclose (rgbf);
-       
-       return success;
-    }
-}
-
-
-int
-QueryColor (
-    Colormap   colormap,
-    XColor    *def_in_out)
-{
-    if (GfxBase->LibNode.lib_Version >= 39)
-    {
-       unsigned long   rgb[3];
-       
-       GetRGB32 (colormap, def_in_out->pixel, 1, rgb);
-       def_in_out->red = rgb[0] >> 16;
-       def_in_out->green = rgb[1] >> 16;
-       def_in_out->blue = rgb[2] >> 16;
-    }
-    else
-    {
-       unsigned short   rgb;
-       
-       rgb = GetRGB4 (colormap, def_in_out->pixel);
-       def_in_out->red = ((rgb >> 8) & 0xF) * 0x1111;
-       def_in_out->green = ((rgb >> 4) & 0xF) * 0x1111;
-       def_in_out->blue = (rgb & 0xF) * 0x1111;
-    }
-    
-    return Success;
-}
-
-
-int
-QueryColors (
-    Colormap   colormap,
-    XColor    *defs_in_out,
-    int        ncolors)
-{
-    int   i;
-    
-    for (i = 0; i < ncolors; i++)
-       QueryColor (colormap, &defs_in_out[i]);
-    
-    return Success;
-}
-
-*/
index 868c447910228a5c13493e64d49ff3f2cf3f457d..7a9ecb58ae9c359833ef68d28e568c525014953d 100644 (file)
@@ -32,7 +32,7 @@
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
 *  Developed by Arnaud Le Hors                                                *
 \*****************************************************************************/
 
-#include "xpmi.h"
+#include "XpmI.h"
 
 #ifdef NEED_STRDUP
 /*
 
 #ifdef NEED_STRDUP
 /*
index c7716897b84fd1aa1039c6e508d86f7222e94861..905666777ff928eb41cefd3e37b66a8d0aa2b21a 100644 (file)
@@ -38,7 +38,7 @@
  * HeDu (hedu@cul-ipn.uni-kiel.de) 4/94
  */
 
  * HeDu (hedu@cul-ipn.uni-kiel.de) 4/94
  */
 
-#include "xpmi.h"
+#include "XpmI.h"
 #include <ctype.h>
 
 LFUNC(ParsePixels, int, (xpmData *data, unsigned int width,
 #include <ctype.h>
 
 LFUNC(ParsePixels, int, (xpmData *data, unsigned int width,
index 0a0ae388c87e2c858e80b2072ad3f951fdbbee25..a5c4c355925f6cf1aa730499385b4901de88213a 100644 (file)
@@ -42,7 +42,7 @@
  * W. Snitily but has been modified for my special need
  */
 
  * W. Snitily but has been modified for my special need
  */
 
-#include "xpmi.h"
+#include "XpmI.h"
 #include <ctype.h>
 
 #include "rgbtab.h"                    /* hard coded rgb.txt table */
 #include <ctype.h>
 
 #include "rgbtab.h"                    /* hard coded rgb.txt table */
@@ -75,7 +75,7 @@ xpmGetRgbName(rgbn, rgbn_max, red, green, blue)
 
 {
     int i;
 
 {
     int i;
-    unsigned long rgbVal;
+    RGBColor rgbVal;
 
     i = 0;
     while (i < numTheRGBRecords) {
 
     i = 0;
     while (i < numTheRGBRecords) {
@@ -97,7 +97,7 @@ xpmGetRGBfromName(inname, r, g, b)
 {
     int left, right, middle;
     int cmp;
 {
     int left, right, middle;
     int cmp;
-    unsigned long rgbVal;
+    RGBColor rgbVal;
     char *name;
     char *grey, *p;
 
     char *name;
     char *grey, *p;
 
index 717dfe4947abc1de87abdb17c9ee7b6341049a2e..71ea23e2dea9be55dee9047a630a9f60b2f7c942 100644 (file)
@@ -40,7 +40,7 @@
 
 typedef struct {
     char *name;
 
 typedef struct {
     char *name;
-    unsigned long rgb;                 /* it's unsigned long */
+    RGBColor rgb;                      /* it's unsigned long */
 }      rgbRecord;
 
 /*
 }      rgbRecord;
 
 /*
@@ -50,10 +50,10 @@ typedef struct {
 #ifdef FOR_MSW
 #define myRGB(r,g,b)   RGB(r,g,b)      /* MSW has this macro */
 #else
 #ifdef FOR_MSW
 #define myRGB(r,g,b)   RGB(r,g,b)      /* MSW has this macro */
 #else
-#define myRGB(r,g,b)((r<<16)+(g<<8)+(b))
-#define GetRValue(c) ((((c&0x00FF0000)>>16)<<8)+((c&0x00FF0000)>>16))
-#define GetGValue(c) ((((c&0x0000FF00)>>8)<<8)+((c&0x0000FF00)>>8))
-#define GetBValue(c) (((c&0x000000FF)<<8)+(c&0x000000FF))
+#define myRGB(r,g,b) { ((r) << 8) + (r) , ((g) << 8) + (g), ((b) << 8) + (b) }
+#define GetRValue(c) ((c).red)
+#define GetGValue(c) ((c).green)
+#define GetBValue(c) ((c).blue)
 #endif
 
 static rgbRecord theRGBRecords[] =
 #endif
 
 static rgbRecord theRGBRecords[] =
index ebab00d3654715285ca3c2204f7e0a0e8ddd823c..1b56e3c9b348de62ff2ab5ceb1b12d94500aee6f 100644 (file)
@@ -42,7 +42,7 @@
  * Lorens Younes (d93-hyo@nada.kth.se) 4/96
  */
 
  * Lorens Younes (d93-hyo@nada.kth.se) 4/96
  */
 
-#include "xpmi.h"
+#include "XpmI.h"
 
 #define MAXPRINTABLE 92                        /* number of printable ascii chars
                                         * minus \ and " for string compat
 
 #define MAXPRINTABLE 92                        /* number of printable ascii chars
                                         * minus \ and " for string compat
index eac5bd39bd5538c9274b2da96ab5af1922db5b3c..48dc21b0374c13986ae6b1af3b0e698ca1c320e4 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "xpm.h"
 #include "xpmi.h"                      /* for XpmMalloc */
 
 #include "xpm.h"
 #include "xpmi.h"                      /* for XpmMalloc */
-
+#include "rgbtab.h"
 #ifdef FOR_MSW
 
 /*
 #ifdef FOR_MSW
 
 /*
@@ -310,6 +310,7 @@ XCreateImage(Display *d, Visual *v,
                rect.bottom = height ;
                
                NewGWorld( &img->gworldptr , depth , &rect , NULL , NULL , 0 ) ;
                rect.bottom = height ;
                
                NewGWorld( &img->gworldptr , depth , &rect , NULL , NULL , 0 ) ;
+               LockPixels( GetGWorldPixMap( img->gworldptr ) ) ;
                if (img->gworldptr == NULL)
                {
                XDestroyImage (img);
                if (img->gworldptr == NULL)
                {
                XDestroyImage (img);
@@ -347,7 +348,10 @@ XDestroyImage(XImage *img)
        DeleteObject(img->bitmap);      /* check return ??? */
        #elif macintosh
        if ( img->gworldptr )
        DeleteObject(img->bitmap);      /* check return ??? */
        #elif macintosh
        if ( img->gworldptr )
+       {
+               UnlockPixels( GetGWorldPixMap( img->gworldptr ) ) ;
                DisposeGWorld( img->gworldptr ) ;
                DisposeGWorld( img->gworldptr ) ;
+       }
        #endif
        XImageFree(img);
     }
        #endif
        XImageFree(img);
     }
index a70ad187a6c9dd961067c3b4315f556cc9c2de7f..4922f1f58ac978046cd7b37fb318729d06706d28 100644 (file)
@@ -90,7 +90,9 @@ typedef struct {
 }      XImage;
 
 #elif macintosh
 }      XImage;
 
 #elif macintosh
-
+#ifndef __MWERKS__
+#include <wx/wxprec.h>
+#endif
 /* define Mac types for X window types */
 
 typedef GDevice* Display;                      /* this should be similar */
 /* define Mac types for X window types */
 
 typedef GDevice* Display;                      /* this should be similar */