mac updates and msw bitmapdrawing on printer
authorStefan Csomor <csomor@advancedconcepts.ch>
Thu, 13 Jan 2000 11:07:58 +0000 (11:07 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Thu, 13 Jan 2000 11:07:58 +0000 (11:07 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5371 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

42 files changed:
include/wx/mac/dc.h
include/wx/mac/dialog.h
include/wx/mac/frame.h
include/wx/mac/stattext.h
include/wx/mac/window.h
include/wx/msw/bitmap.h
samples/minimal/minimal.cpp
src/common/datetime.cpp
src/common/image.cpp
src/mac/bitmap.cpp
src/mac/bmpbuttn.cpp
src/mac/carbon/bitmap.cpp
src/mac/carbon/bmpbuttn.cpp
src/mac/carbon/checkbox.cpp
src/mac/carbon/choice.cpp
src/mac/carbon/control.cpp
src/mac/carbon/data.cpp
src/mac/carbon/dc.cpp
src/mac/carbon/dcmemory.cpp
src/mac/carbon/listbox.cpp
src/mac/carbon/menu.cpp
src/mac/carbon/msgdlg.cpp
src/mac/carbon/radiobox.cpp
src/mac/carbon/radiobut.cpp
src/mac/carbon/stattext.cpp
src/mac/carbon/toolbar.cpp
src/mac/carbon/window.cpp
src/mac/checkbox.cpp
src/mac/choice.cpp
src/mac/control.cpp
src/mac/data.cpp
src/mac/dc.cpp
src/mac/dcmemory.cpp
src/mac/listbox.cpp
src/mac/menu.cpp
src/mac/msgdlg.cpp
src/mac/radiobox.cpp
src/mac/radiobut.cpp
src/mac/stattext.cpp
src/mac/toolbar.cpp
src/mac/window.cpp
src/msw/dc.cpp

index 82c959b4c7b3e81c07269098dffd2462f094007d..dd5525257346e6dfee8fc7b79eb7763c04c2f174 100644 (file)
@@ -382,6 +382,7 @@ class WXDLLEXPORT wxDC: public wxObject
 
 //begin wxmac
        GrafPtr                         m_macPort ;
+       GWorldPtr                       m_macMask ;
 
        // in order to preserve the const inheritance of the virtual functions, we have to 
        // use mutable variables starting from CWPro 5
index 1aa01b36f04892859cafc1a9bcd79c9e541f99c7..d725df8d5768e639733d7a8ac17f1de7aa277f8c 100644 (file)
@@ -111,6 +111,7 @@ public:
     // --------------
 
     bool IsModalShowing() const { return m_modalShowing; }
+    virtual bool IsTopLevel() const { return TRUE; }
 
   // tooltip management
 #if wxUSE_TOOLTIPS
index 3d6a52941d6c7ed0c212feb152df462f52762e3f..c342d83c90c928c5e2db4d30277e5728acb871b7 100644 (file)
@@ -56,6 +56,7 @@ public:
            const wxString& name = wxFrameNameStr);
 
   virtual bool Destroy();
+  virtual bool IsTopLevel() const { return TRUE; }
 
   void OnSize(wxSizeEvent& event);
   void OnMenuHighlight(wxMenuEvent& event);
index 1117b6fc9aef7db2d0129785ea5fc6c3fd9a2eb4..5cf88232a2bfa19ebe3dca1741798060f2138da3 100644 (file)
@@ -49,6 +49,13 @@ class WXDLLEXPORT wxStaticText: public wxControl
   // operations
   virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
   virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
+  // events
+  void OnPaint( wxPaintEvent &event ) ;
+  wxSize DoGetBestSize() const ;
+ private :
+       wxString        m_label ;
+
+   DECLARE_EVENT_TABLE()
 };
 
 #endif
index c7c6bd43b06f2c309fd6a006e3a52045fa5ea876..ba8b50315f183f1d4ba1b95b9a4821e1e8345d5f 100644 (file)
@@ -236,10 +236,12 @@ public :
        virtual void                                            MacFireMouseEvent( EventRecord *ev ) ;
        virtual bool                                            MacDispatchMouseEvent(wxMouseEvent& event ) ;
        virtual void                                            MacEraseBackground( Rect *rect ) ;
+       virtual void                                            MacPaint( wxPaintEvent &event ) ;
        WindowRef                                                               GetMacRootWindow() const  ;
 
        virtual ControlHandle   MacGetContainerForEmbedding() ;
        virtual void                                            MacSuperChangedPosition() ;
+       virtual void                                            MacSuperShown( bool show ) ;
 
        bool                                                                            MacSetupFocusPort() ;
        bool                                                                            MacSetupDrawingPort() ;
index 82b5d302512b6e16565e79fa19bcbc9ad6ab29dc..d71506f9447132aafe49f7e0b4ca98f458233fe5 100644 (file)
@@ -117,7 +117,7 @@ public:
     virtual ~wxBitmap();
 
     // GRG, Dic/99
-    wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect ) const;
+    wxBitmap GetSubBitmap( const wxRect& rect ) const;
  
     // copies the contents and mask of the given (colour) icon to the bitmap
     bool CopyFromIcon(const wxIcon& icon);
index a66bb77444afeea33784f2f8da393572ad181558..84a4ff0a090b918b98e71aa57deb491a238d08bc 100644 (file)
@@ -140,19 +140,33 @@ bool MyApp::OnInit()
 MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
        : wxFrame((wxFrame *)NULL, -1, title, pos, size)
 {
+#ifdef __WXMAC__
+       // we need this in order to allow the about menu relocation, since ABOUT is not the default id of the about menu 
+       wxApp::s_macAboutMenuItemId = Minimal_About ;
+#endif
+
     // set the frame icon
     SetIcon(wxICON(mondrian));
 
     // create a menu bar
     wxMenu *menuFile = new wxMenu("", wxMENU_TEAROFF);
 
+#ifdef __WXMAC__
+       // since the about should be in the help menu for auto-relocation we have to do a little more...
+    wxMenu *helpMenu = new wxMenu("", wxMENU_TEAROFF);
+    helpMenu->Append(Minimal_About, "&About...\tCntrl+A", "Show about dialog");
+#else
     menuFile->Append(Minimal_About, "&About...\tCtrl-A", "Show about dialog");
     menuFile->AppendSeparator();
-    menuFile->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program");
+#endif
 
+    menuFile->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program");
     // now append the freshly created menu to the menu bar...
     wxMenuBar *menuBar = new wxMenuBar();
     menuBar->Append(menuFile, "&File");
+#ifdef __WXMAC__
+    menuBar->Append(helpMenu, "&Help");
+#endif
 
     // ... and attach this menu bar to the frame
     SetMenuBar(menuBar);
index 4d224205816cb8bdcfab90853ed829de64617ad8..5326de0e313838d519910451145491ba0ef8bcef 100644 (file)
@@ -95,9 +95,9 @@
 #ifndef WX_TIMEZONE
     #if defined(__BORLANDC__) || defined(__MINGW32__) || defined(__VISAGECPP__)
         #define WX_TIMEZONE _timezone
-    #elif defined(__WXMAC__)
-       long wxmac_timezone = 28800;
-       #define WX_TIMEZONE wxmac_timezone ;
+    #elif defined(__MWERKS__)
+       long wxmw_timezone = 28800;
+       #define WX_TIMEZONE wxmw_timezone ;
     #else // unknown platform - try timezone
         #define WX_TIMEZONE timezone
     #endif
index bbd261d3cf1b03c5f4622d2691ff6eb8b6b7b0b0..627e7ab6ad221ee7e275187482310d66cd5b9ed0 100644 (file)
@@ -883,7 +883,12 @@ wxBitmap wxImage::ConvertToBitmap() const
             {
                 for(i=0; i<width; i++ )
                 {
-                    if( (*(ptdata++)!=r) | (*(ptdata++)!=g) | (*(ptdata++)!=b) )
+                    // was causing a code gen bug in cw : if( ( cr !=r) || (cg!=g) || (cb!=b) )
+                       unsigned char cr = (*(ptdata++)) ;
+                       unsigned char cg = (*(ptdata++)) ;
+                       unsigned char cb = (*(ptdata++)) ;
+                       
+                    if( ( cr !=r) || (cg!=g) || (cb!=b) )
                     {
                         *(ptbits++) = one;
                         *(ptbits++) = one;
@@ -1128,6 +1133,12 @@ wxBitmap wxImage::ConvertToBitmap() const
 
        SetGWorld( origPort , origDevice ) ;
 
+    if ( HasMask() )
+    {
+        wxColour colour( GetMaskRed(), GetMaskGreen(), GetMaskBlue());
+        wxMask *mask = new wxMask( bitmap, colour );
+        bitmap.SetMask( mask );
+    }
     return bitmap;
 
 }
index d14b15ba7f3c7d936210fe0ef8e8339b1284cce5..1ae5a445d4b8fc5c16285428023761b29a351955 100644 (file)
@@ -446,18 +446,14 @@ wxBitmapHandler *wxBitmap::FindHandler(long bitmapType)
 
 wxMask::wxMask()
 {
-/* TODO
     m_maskBitmap = 0;
-*/
 }
 
 // Construct a mask from a bitmap and a colour indicating
 // the transparent area
 wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
 {
-/* TODO
     m_maskBitmap = 0;
-*/
     Create(bitmap, colour);
 }
 
@@ -465,26 +461,24 @@ wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
 // the transparent area
 wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex)
 {
-/* TODO
     m_maskBitmap = 0;
-*/
-
     Create(bitmap, paletteIndex);
 }
 
 // Construct a mask from a mono bitmap (copies the bitmap).
 wxMask::wxMask(const wxBitmap& bitmap)
 {
-/* TODO
     m_maskBitmap = 0;
-*/
-
     Create(bitmap);
 }
 
 wxMask::~wxMask()
 {
-// TODO: delete mask bitmap
+       if ( m_maskBitmap )
+       {
+               wxMacDestroyGWorld( m_maskBitmap ) ;
+               m_maskBitmap = NULL ;
+       }
 }
 
 // Create a mask from a mono bitmap (copies the bitmap).
@@ -506,8 +500,54 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex)
 // the transparent area
 bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
 {
-// TODO
-    return FALSE;
+       if ( m_maskBitmap )
+       {
+               wxMacDestroyGWorld( m_maskBitmap ) ;
+               m_maskBitmap = NULL ;
+       }
+       wxASSERT( ((wxBitmapRefData*) bitmap.GetRefData())->m_bitmapType == kMacBitmapTypeGrafWorld ) ;
+       // other types would require a temporary bitmap. not yet implemented 
+       
+    if (!bitmap.Ok())
+    {
+        return FALSE;
+    }
+
+       m_maskBitmap = wxMacCreateGWorld( bitmap.GetWidth() , bitmap.GetHeight() , 1 ) ;        
+       RGBColor maskColor = colour.GetPixel() ;
+
+    // this is not very efficient, but I can't think
+    // of a better way of doing it
+       CGrafPtr        origPort ;
+       GDHandle        origDevice ;
+                       
+       GetGWorld( &origPort , &origDevice ) ;
+       for (int w = 0; w < bitmap.GetWidth(); w++)
+    {
+        for (int h = 0; h < bitmap.GetHeight(); h++)
+        {              
+                       RGBColor colors[2] = { 
+                               { 0xFFFF , 0xFFFF , 0xFFFF } ,
+                               { 0, 0 , 0 } 
+                               } ;
+                               
+                       SetGWorld( ((wxBitmapRefData*) bitmap.GetRefData())->m_hBitmap , NULL ) ;
+                       RGBColor col ;
+                       GetCPixel( w , h , &col ) ;
+                       SetGWorld( m_maskBitmap , NULL ) ;
+            if (col.red == maskColor.red && col.blue == maskColor.blue && col.green == maskColor.green)
+            {
+                               SetCPixel( w , h , &colors[0] ) ;
+            }
+            else
+            {
+                               SetCPixel( w , h , &colors[1] ) ;
+            }
+        }
+    }
+       SetGWorld( origPort , origDevice ) ;
+
+    return TRUE;
 }
 
 /*
index f435ab2b3215a836ed80d06caf1de4263f94da3e..569a2cd338b0c634434ede1f7d11c2666785462d 100644 (file)
@@ -48,8 +48,8 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
     if ( height == -1 && bitmap.Ok())
        height = bitmap.GetHeight() + 2*m_marginY;
 
-       m_macHorizontalBorder = 2 ; // additional pixels around the real control
-       m_macVerticalBorder = 2 ;
+       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 ) ;
index d14b15ba7f3c7d936210fe0ef8e8339b1284cce5..1ae5a445d4b8fc5c16285428023761b29a351955 100644 (file)
@@ -446,18 +446,14 @@ wxBitmapHandler *wxBitmap::FindHandler(long bitmapType)
 
 wxMask::wxMask()
 {
-/* TODO
     m_maskBitmap = 0;
-*/
 }
 
 // Construct a mask from a bitmap and a colour indicating
 // the transparent area
 wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
 {
-/* TODO
     m_maskBitmap = 0;
-*/
     Create(bitmap, colour);
 }
 
@@ -465,26 +461,24 @@ wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
 // the transparent area
 wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex)
 {
-/* TODO
     m_maskBitmap = 0;
-*/
-
     Create(bitmap, paletteIndex);
 }
 
 // Construct a mask from a mono bitmap (copies the bitmap).
 wxMask::wxMask(const wxBitmap& bitmap)
 {
-/* TODO
     m_maskBitmap = 0;
-*/
-
     Create(bitmap);
 }
 
 wxMask::~wxMask()
 {
-// TODO: delete mask bitmap
+       if ( m_maskBitmap )
+       {
+               wxMacDestroyGWorld( m_maskBitmap ) ;
+               m_maskBitmap = NULL ;
+       }
 }
 
 // Create a mask from a mono bitmap (copies the bitmap).
@@ -506,8 +500,54 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex)
 // the transparent area
 bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
 {
-// TODO
-    return FALSE;
+       if ( m_maskBitmap )
+       {
+               wxMacDestroyGWorld( m_maskBitmap ) ;
+               m_maskBitmap = NULL ;
+       }
+       wxASSERT( ((wxBitmapRefData*) bitmap.GetRefData())->m_bitmapType == kMacBitmapTypeGrafWorld ) ;
+       // other types would require a temporary bitmap. not yet implemented 
+       
+    if (!bitmap.Ok())
+    {
+        return FALSE;
+    }
+
+       m_maskBitmap = wxMacCreateGWorld( bitmap.GetWidth() , bitmap.GetHeight() , 1 ) ;        
+       RGBColor maskColor = colour.GetPixel() ;
+
+    // this is not very efficient, but I can't think
+    // of a better way of doing it
+       CGrafPtr        origPort ;
+       GDHandle        origDevice ;
+                       
+       GetGWorld( &origPort , &origDevice ) ;
+       for (int w = 0; w < bitmap.GetWidth(); w++)
+    {
+        for (int h = 0; h < bitmap.GetHeight(); h++)
+        {              
+                       RGBColor colors[2] = { 
+                               { 0xFFFF , 0xFFFF , 0xFFFF } ,
+                               { 0, 0 , 0 } 
+                               } ;
+                               
+                       SetGWorld( ((wxBitmapRefData*) bitmap.GetRefData())->m_hBitmap , NULL ) ;
+                       RGBColor col ;
+                       GetCPixel( w , h , &col ) ;
+                       SetGWorld( m_maskBitmap , NULL ) ;
+            if (col.red == maskColor.red && col.blue == maskColor.blue && col.green == maskColor.green)
+            {
+                               SetCPixel( w , h , &colors[0] ) ;
+            }
+            else
+            {
+                               SetCPixel( w , h , &colors[1] ) ;
+            }
+        }
+    }
+       SetGWorld( origPort , origDevice ) ;
+
+    return TRUE;
 }
 
 /*
index f435ab2b3215a836ed80d06caf1de4263f94da3e..569a2cd338b0c634434ede1f7d11c2666785462d 100644 (file)
@@ -48,8 +48,8 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
     if ( height == -1 && bitmap.Ok())
        height = bitmap.GetHeight() + 2*m_marginY;
 
-       m_macHorizontalBorder = 2 ; // additional pixels around the real control
-       m_macVerticalBorder = 2 ;
+       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 ) ;
index aa589bd32db9d517554e6c59f95c79e9f9bbe3e3..df3424b88fca86cc1a7756b8c463cb9926cce626 100644 (file)
@@ -59,6 +59,10 @@ void wxCheckBox::Command (wxCommandEvent & event)
 void wxCheckBox::MacHandleControlClick( ControlHandle control , SInt16 controlpart ) 
 {
        SetValue( !GetValue() ) ;
+    wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
+    event.SetInt(GetValue());
+    event.SetEventObject(this);
+    ProcessCommand(event);
 }
 
 // Bitmap checkbox
index 301b0731a84a8cbfc4e89cfa551c17678d70274c..343f3d239ebda7f1e14c6489559f5c0c09e34f8c 100644 (file)
@@ -34,8 +34,8 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
        
                MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
        
-               m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0, 
-               kControlPopupButtonProc , (long) this ) ; 
+               m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0 
+               kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ; 
        
                m_macPopUpMenuHandle =  NewMenu( 1 , "\pPopUp Menu" ) ;
                SetControlData( m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
index 122f58de8fa498838c6f41516602acf40d99785e..f6fa56cb91b0ef5859aa363bb0c6d858e35bdf95 100644 (file)
@@ -18,7 +18,7 @@
 #include "wx/tabctrl.h"
 #include "wx/spinbutt.h"
 
-IMPLEMENT_ABSTRACT_CLASS(wxControl, wxControlBase)
+IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
 
 BEGIN_EVENT_TABLE(wxControl, wxControlBase)
        EVT_MOUSE_EVENTS( wxControl::OnMouseEvent ) 
@@ -383,7 +383,6 @@ void wxControl::MacSuperEnabled( bool enabled )
 
 void  wxControl::MacSuperShown( bool show ) 
 {
-       /*
        if ( m_macControl )
        {
                if ( !show )
@@ -392,13 +391,12 @@ void  wxControl::MacSuperShown( bool show )
                }
                else
                {
-                       if ( m_macShown )
+                       if ( m_isShown )
                                ::UMAShowControl( m_macControl ) ;
                }
        }
                
        wxWindow::MacSuperShown( show ) ;
-       */
 }
 
 void  wxControl::DoSetSize(int x, int y,
index bdabb51e99ac4029c33bf9b1ffe1a70d2616984a..fab57c49fef17f87d70ee7667be89d140b02688a 100644 (file)
@@ -92,44 +92,47 @@ wxFont   wxNullFont;
 wxColour wxNullColour;
 
 // Default window names
-const char *wxButtonNameStr = "button";
-const char *wxCanvasNameStr = "canvas";
-const char *wxCheckBoxNameStr = "check";
-const char *wxChoiceNameStr = "choice";
-const char *wxComboBoxNameStr = "comboBox";
-const char *wxDialogNameStr = "dialog";
-const char *wxFrameNameStr = "frame";
-const char *wxGaugeNameStr = "gauge";
-const char *wxStaticBoxNameStr = "groupBox";
-const char *wxListBoxNameStr = "listBox";
-const char *wxStaticTextNameStr = "message";
-const char *wxStaticBitmapNameStr = "message";
-const char *wxMultiTextNameStr = "multitext";
-const char *wxPanelNameStr = "panel";
-const char *wxRadioBoxNameStr = "radioBox";
-const char *wxRadioButtonNameStr = "radioButton";
-const char *wxBitmapRadioButtonNameStr = "radioButton";
-const char *wxScrollBarNameStr = "scrollBar";
-const char *wxSliderNameStr = "slider";
-const char *wxStaticNameStr = "static";
-const char *wxTextCtrlWindowNameStr = "textWindow";
-const char *wxTextCtrlNameStr = "text";
-const char *wxVirtListBoxNameStr = "virtListBox";
-const char *wxButtonBarNameStr = "buttonbar";
-const char *wxEnhDialogNameStr = "Shell";
-const char *wxToolBarNameStr = "toolbar";
-const char *wxStatusLineNameStr = "status_line";
-
-const char *wxGetTextFromUserPromptStr = "Input Text";
-const char *wxMessageBoxCaptionStr = "Message";
-const char *wxFileSelectorPromptStr = "Select a file";
-const char *wxFileSelectorDefaultWildcardStr = "*.*";
-const char *wxInternalErrorStr = "wxWindows Internal Error";
-const char *wxFatalErrorStr = "wxWindows Fatal Error";
+const wxChar *wxButtonNameStr = wxT("button");
+const wxChar *wxCanvasNameStr = wxT("canvas");
+const wxChar *wxCheckBoxNameStr = wxT("check");
+const wxChar *wxChoiceNameStr = wxT("choice");
+const wxChar *wxComboBoxNameStr = wxT("comboBox");
+const wxChar *wxDialogNameStr = wxT("dialog");
+const wxChar *wxFrameNameStr = wxT("frame");
+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 *wxMultiTextNameStr = wxT("multitext");
+const wxChar *wxPanelNameStr = wxT("panel");
+const wxChar *wxRadioBoxNameStr = wxT("radioBox");
+const wxChar *wxRadioButtonNameStr = wxT("radioButton");
+const wxChar *wxBitmapRadioButtonNameStr = wxT("radioButton");
+const wxChar *wxScrollBarNameStr = wxT("scrollBar");
+const wxChar *wxSliderNameStr = wxT("slider");
+const wxChar *wxStaticNameStr = wxT("static");
+const wxChar *wxTextCtrlWindowNameStr = wxT("textWindow");
+const wxChar *wxTextCtrlNameStr = wxT("text");
+const wxChar *wxVirtListBoxNameStr = wxT("virtListBox");
+const wxChar *wxButtonBarNameStr = wxT("buttonbar");
+const wxChar *wxEnhDialogNameStr = wxT("Shell");
+const wxChar *wxToolBarNameStr = wxT("toolbar");
+const wxChar *wxStatusLineNameStr = wxT("status_line");
+
+const wxChar *wxGetTextFromUserPromptStr = wxT("Input Text");
+const wxChar *wxMessageBoxCaptionStr = wxT("Message");
+const wxChar *wxFileSelectorPromptStr = wxT("Select a file");
+const wxChar *wxFileSelectorDefaultWildcardStr = wxT("*.*");
+const wxChar *wxInternalErrorStr = wxT("wxWindows Internal Error");
+const wxChar *wxFatalErrorStr = wxT("wxWindows Fatal Error");
+const wxChar *wxTreeCtrlNameStr = wxT("treeCtrl");
+const wxChar *wxDirDialogNameStr = wxT("wxDirCtrl");
+const wxChar *wxDirDialogDefaultFolderStr = wxT("/");
 
 // See wx/utils.h
-const char *wxFloatToStringStr = "%.2f";
-const char *wxDoubleToStringStr = "%.2f";
+const wxChar *wxFloatToStringStr = wxT("%.2f");
+const wxChar *wxDoubleToStringStr = wxT("%.2f");
 
 const wxSize wxDefaultSize(-1, -1);
 const wxPoint wxDefaultPosition(-1, -1);
index 0043d823fb3b8a3669e995e309da2d8c7006225a..ecbb3ca70366564e1087d724907571bf8c4d56f0 100644 (file)
@@ -84,6 +84,7 @@ wxDC::wxDC(void)
   
 //  m_palette = wxAPP_COLOURMAP;
   m_macPort = NULL ;
+  m_macMask = NULL ;
   m_ok = FALSE ;
   
        m_macFontInstalled = false ;
@@ -153,8 +154,6 @@ void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
                                        RGBColor                black = { 0,0,0} ;
                                        RGBForeColor( &black ) ;
                                        RGBBackColor( &white ) ;
-                       //              RGBForeColor( &m_textForegroundColour.GetPixel() ) ;
-                       //              RGBBackColor( &m_textBackgroundColour.GetPixel() ) ;
                        
                                        bmappixels = GetGWorldPixMap( bmapworld ) ;
                                        if ( LockPixels(bmappixels) )
@@ -168,21 +167,20 @@ void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
                                                dest.left = XLOG2DEV(x) ;
                                                dest.bottom = YLOG2DEV(y + bmap->m_height )  ;
                                                dest.right = XLOG2DEV(x + bmap->m_width ) ;
-                                               // ::ClipRect(&m_macClipRect);
-                                               CopyBits( &GrafPtr( bmapworld )->portBits , &GrafPtr( m_macPort )->portBits ,
-                                                       &source, &dest, srcCopy, NULL ) ;
-                                               /*
-                                               if ( m_clipping )
-                                               {
-                                                       long x1 = XLOG2DEV(m_clipX1);
-                                                       long y1 = YLOG2DEV(m_clipY1);
-                                                       long x2 = XLOG2DEV(m_clipX2);
-                                                       long y2 = YLOG2DEV(m_clipY2);
        
-                                                       Rect clip = { y1 , x1 , y2 , x2 } ;
-                                                       ::ClipRect(&clip);
+                                               if ( useMask && bmp.GetMask() )
+                                               {
+                                                       if ( LockPixels( GetGWorldPixMap( bmp.GetMask()->GetMaskBitmap( ) ) ) )
+                                                       {
+                                                               CopyMask( &GrafPtr( bmapworld )->portBits , &GrafPtr( bmp.GetMask()->GetMaskBitmap( ) )->portBits , &GrafPtr( m_macPort )->portBits ,
+                                                                       &source, &source , &dest ) ;
+                                                               UnlockPixels( GetGWorldPixMap( bmp.GetMask()->GetMaskBitmap( ) )  ) ;
+                                                       }
                                                }
-                                               */
+                                               else
+                                                       CopyBits( &GrafPtr( bmapworld )->portBits , &GrafPtr( m_macPort )->portBits ,
+                                                               &source, &dest, srcCopy, NULL ) ;
+
                                                UnlockPixels( bmappixels ) ;
                                        } 
                                        m_macPenInstalled = false ;
@@ -1071,8 +1069,6 @@ 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} ;
-//             RGBForeColor( &black ) ;
-//             RGBBackColor( &white ) ;
                RGBForeColor( &m_textForegroundColour.GetPixel() ) ;
                RGBBackColor( &m_textBackgroundColour.GetPixel() ) ;
 
@@ -1087,21 +1083,36 @@ bool  wxDC::Blit( long xdest, long ydest, long width, long height,
                dstrect.left = XLOG2DEV(xdest) ;
                dstrect.bottom = YLOG2DEV(ydest + height )  ;
                dstrect.right = XLOG2DEV(xdest + width ) ;
-//             ::ClipRect(&m_macClipRect);
+
+       short  mode = (logical_func == wxCOPY ? srcCopy :
+ //    logical_func == wxCLEAR ? WHITENESS :
+ //    logical_func == wxSET ? BLACKNESS :
+               logical_func == wxINVERT ? hilite :
+  //   logical_func == wxAND ? MERGECOPY :
+       logical_func == wxOR ? srcOr :
+       logical_func == wxSRC_INVERT ? notSrcCopy :
+       logical_func == wxXOR ? srcXor :
+  //   logical_func == wxOR_REVERSE ? MERGEPAINT :
+  //   logical_func == wxAND_REVERSE ? SRCERASE :
+       logical_func == wxSRC_OR ? srcOr :
+  //   logical_func == wxSRC_AND ? SRCAND :
+               srcCopy );
+
+               if ( useMask && 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 ,
+                                       &srcrect, &srcrect , &dstrect ) ;
+                               UnlockPixels( GetGWorldPixMap( source->m_macMask )  ) ;
+                       }
+               }
+               else
+               {
                CopyBits( &GrafPtr( sourcePort )->portBits , &GrafPtr( m_macPort )->portBits ,
-                       &srcrect, &dstrect, srcCopy, NULL ) ;
-/*
-                                               if ( m_clipping )
-                                               {
-                                                       long x1 = XLOG2DEV(m_clipX1);
-                                                       long y1 = YLOG2DEV(m_clipY1);
-                                                       long x2 = XLOG2DEV(m_clipX2);
-                                                       long y2 = YLOG2DEV(m_clipY2);
-       
-                                                       Rect clip = { y1 , x1 , y2 , x2 } ;
-                                                       ::ClipRect(&clip);
-                                               }
-*/
+                               &srcrect, &dstrect, mode, NULL ) ;
+               }
                UnlockPixels( bmappixels ) ;
        } 
        
index 28a652368a97e41c1058b70f1469f67367563a3d..fe88bf806cfa070d3f05e15e107f8f80ede1df6d 100644 (file)
@@ -44,6 +44,11 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
                if ( bmap->m_hBitmap )
                {
                        m_macPort = (GrafPtr) bmap->m_hBitmap ;
+                       wxMask * mask = bitmap.GetMask() ;
+                       if ( mask )
+                       {
+                               m_macMask = mask->GetMaskBitmap() ;
+                       }
                        MacSetupPort() ;
                        m_ok = TRUE ;
                        // SetBackground(wxBrush(*wxWHITE, wxSOLID));
index 3b062f04e521ea681e4c33e18450133eba97855d..c518ad035ccb495731dd670ffaf0ce91a5874f3e 100644 (file)
@@ -68,8 +68,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
        UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxListHandleTag , sizeof( ListHandle ) , (char*) &m_macList  , &result ) ;
 
        NewExtLDEFInfo( m_macList , MacDrawStringCell , (long) this ) ;
-       (**m_macList).selFlags = lOnlyOne ;
-       if ( style  & wxLB_MULTIPLE )
+       (**m_macList).selFlags = 0 ;
+       if ( style & wxLB_MULTIPLE )
        {
                (**m_macList).selFlags += lNoExtend ;
        }
@@ -77,6 +77,10 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
        {
                (**m_macList).selFlags += lExtendDrag ;
        }
+       else
+       {
+               (**m_macList).selFlags = lOnlyOne ;
+       }
        Point pt = (**m_macList).cellSize ;
        pt.v = 14 ;
        LCellSize( pt , m_macList ) ;
@@ -151,6 +155,7 @@ void wxListBox::Delete(int N)
     }
 #endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
        m_stringArray.Remove( N ) ;
+       m_dataArray.Remove( N ) ;
        m_noItems --;
        
        MacDelete( N ) ;
@@ -185,7 +190,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
             wxASSERT_MSG(clientData[i] == NULL,
                          wxT("Can't use client data with owner-drawn listboxes"));
 #else // !wxUSE_OWNER_DRAWN
-               Append( choices[i] , clientData[0] ) ;
+               Append( choices[i] , clientData[i] ) ;
  #endif
        }
        else
@@ -298,7 +303,16 @@ void wxListBox::DoSetItemClientData(int N, void *Client_data)
         wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
     }
 #endif // wxUSE_OWNER_DRAWN
-    m_dataArray[N] = (char*) Client_data ;
+       wxASSERT_MSG( m_dataArray.GetCount() >= N , "invalid client_data array" ) ;
+       
+       if ( m_dataArray.GetCount() > N )
+       {
+       m_dataArray[N] = (char*) Client_data ;
+       }
+    else
+    {
+       m_dataArray.Add( (char*) Client_data ) ;
+    }
 }
 
 void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData)
index b52790b67d5df2d952388f1a470e8e8edc17a0af..427db90852fd76c82b19f57c160a7b38ebd20c00 100644 (file)
@@ -55,11 +55,23 @@ 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 *inItemName , bool useShortcuts )
+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 ;
@@ -120,6 +132,11 @@ void wxMacBuildMenuString(StringPtr outMacItemText, char *outMacShortcutChar , s
                                                        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;
@@ -876,7 +893,7 @@ void wxMenuBar::MacInstallMenuBar()
                        wxMenu* menu = m_menus[i] , *subMenu = NULL ;
                
                        
-                       if( m_titles[i] == "?" || m_titles[i] == wxApp::s_macHelpMenuTitleName )
+                       if( m_titles[i] == "?" || m_titles[i] == "&?"  || m_titles[i] == wxApp::s_macHelpMenuTitleName )
                        {
                                MenuHandle mh = NULL ;
                                if ( HMGetHelpMenuHandle( &mh ) != noErr )
@@ -899,24 +916,32 @@ void wxMenuBar::MacInstallMenuBar()
                                        }
                                        else            
                                        {
-                                               Str255 label ;
-                                               wxMacBuildMenuString( label , NULL , NULL , item->GetText(), item->GetId() != wxApp::s_macAboutMenuItemId); // no shortcut in about menu
-                                               if ( label[0] == 0 )
+                                               if ( item->IsSeparator() )
                                                {
-                                                       // we cannot add empty menus on mac
-                                                       label[0] = 1 ;
-                                                       label[1] = ' ' ;
+                                                       if ( mh )
+                                                               ::AppendMenu(mh, "\p-" );
                                                }
-                                               if ( item->GetId() == wxApp::s_macAboutMenuItemId )
-                                               { 
-                                                               ::SetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , label );
-               //                                      ::EnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
-                                                               ::EnableItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
-                                               }
                                                else
                                                {
-                                                       if ( mh )
-                                                               ::AppendMenu(mh, label );
+                                                       Str255 label ;
+                                                       wxMacBuildMenuString( label , NULL , NULL , item->GetText(), item->GetId() != wxApp::s_macAboutMenuItemId); // no shortcut in about menu
+                                                       if ( label[0] == 0 )
+                                                       {
+                                                               // we cannot add empty menus on mac
+                                                               label[0] = 1 ;
+                                                               label[1] = ' ' ;
+                                                       }
+                                                       if ( item->GetId() == wxApp::s_macAboutMenuItemId )
+                                                       { 
+                                                                       ::SetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , label );
+                       //                                      ::EnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
+                                                                       ::EnableItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
+                                                       }
+                                                       else
+                                                       {
+                                                               if ( mh )
+                                                                       ::AppendMenu(mh, label );
+                                                       }
                                                }
                                        }
                                }
@@ -1094,7 +1119,7 @@ void wxMenuBar::MacMenuSelect(wxEvtHandler* handler, long when , int macMenuId,
          for (int i = 0; i < m_menus.GetCount() ; i++)
          {
                if ( m_menus[i]->MacGetMenuId() == macMenuId || 
-                       ( macMenuId == kHMHelpMenuID && ( m_titles[i] == "?" || m_titles[i] == wxApp::s_macHelpMenuTitleName ) )
+                       ( macMenuId == kHMHelpMenuID && ( m_titles[i] == "?" || m_titles[i] == "&?"  || m_titles[i] == wxApp::s_macHelpMenuTitleName ) )
                        )
                {
                        if ( m_menus[i]->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) )
index f19da7bb4f12ee6fb0c10b4e5d168cc8bfdb593e..cf229e520008140529f009f37dd7cbfedda33d15 100644 (file)
@@ -70,12 +70,24 @@ int wxMessageDialog::ShowModal()
        Str255 pascalTitle ;
        Str255 pascalText ;
        
-       strcpy( (char*) pascalTitle , m_caption ) ;
+       
+       if (wxApp::s_macDefaultEncodingIsPC)
+       {
+               strcpy( (char*) pascalTitle , wxMacMakeMacStringFromPC( m_caption ) ) ;
+               strcpy( (char*) pascalText , wxMacMakeMacStringFromPC( m_message) ) ;
+       }
+       else
+       {
+               strcpy( (char*) pascalTitle , m_caption ) ;
+               strcpy( (char*) pascalText , m_message ) ;
+       }
+
        c2pstr( (char*) pascalTitle ) ;
-       strcpy( (char*) pascalText , m_message ) ;
        wxMacConvertNewlines( (char*)pascalText ,(char*) pascalText) ;
        c2pstr( (char*) pascalText ) ;
 
+       wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , "this style is not supported on mac" ) ;
+
        if ( !UMAHasAppearance() )
        {
                int resourceID ;
index 70da0df49cf3d86360985c4ff1275e96f3697a6b..416ba0b18f8e20ad9690ef5395b1ff4340b96ce7 100644 (file)
@@ -418,7 +418,7 @@ void wxRadioBox::SetFocus()
 //-------------------------------------------------------------------------------------
 // Simulates the effect of the user issuing a command to the item
 
-#define RADIO_SIZE 20
+#define RADIO_SIZE 40
 
 void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
 {
@@ -429,6 +429,8 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
 
        int x_current, y_current;
        int x_offset,y_offset;
+    int widthOld, heightOld;
+    GetSize(&widthOld, &heightOld);
 
        x_offset = x;
        y_offset = y;
@@ -463,7 +465,24 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
        totHeight = GetNumVer() * (maxHeight + charHeight/2) + charHeight*3/2;
        totWidth  = GetNumHor() * (maxWidth + charWidth) + charWidth;
 
-       wxControl::DoSetSize(x_offset,y_offset,totWidth,totHeight,wxSIZE_AUTO);
+    // only change our width/height if asked for
+    if ( width == -1 )
+    {
+        if ( sizeFlags & wxSIZE_AUTO_WIDTH )
+            width = totWidth ;
+        else
+            width = widthOld;
+    }
+
+    if ( height == -1 )
+    {
+        if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
+            height = totHeight ;
+        else
+            height = heightOld;
+    }
+
+       wxControl::DoSetSize(x_offset,y_offset,width,height,wxSIZE_AUTO);
 
 // arrange radiobuttons
 
index a2fc26d840dc5b1e6be46b6dff01b3215570870e..f5f95dfab2ed077ed0129df18750e82cc96a650e 100644 (file)
@@ -73,6 +73,9 @@ void wxRadioButton::Command (wxCommandEvent & event)
 void wxRadioButton::MacHandleControlClick( ControlHandle control , SInt16 controlpart ) 
 {
        SetValue(true) ;
+    wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, m_windowId );
+    event.SetEventObject(this);
+    ProcessCommand(event);
 }
 
 wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)
index ec4de7cc317e0181c8c54dcc303c3a4de8b246a9..b249fc0e11b8be216d0363d123a1e9c8a4701907 100644 (file)
@@ -22,6 +22,65 @@ IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
 
 #include <wx/mac/uma.h>
 
+BEGIN_EVENT_TABLE(wxStaticText, wxControl)
+    EVT_PAINT(wxStaticText::OnPaint)
+END_EVENT_TABLE()
+
+bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
+           const wxString& label,
+           const wxPoint& pos,
+           const wxSize& size,
+           long style,
+           const wxString& name)
+{
+    SetName(name);
+    m_backgroundColour = parent->GetBackgroundColour() ;
+    m_foregroundColour = parent->GetForegroundColour() ;
+
+    if ( id == -1 )
+           m_windowId = (int)NewControlId();
+    else
+           m_windowId = id;
+
+    m_windowStyle = style;
+    m_label = label ;
+
+       bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
+       SetSizeOrDefault( size ) ;
+    
+    return ret;
+}
+
+void wxStaticText::OnPaint( wxPaintEvent &event ) 
+{
+    wxPaintDC dc(this);
+    PrepareDC(dc);
+    dc.Clear() ;
+    dc.DrawText( m_label , 0 , 0 ) ;
+}
+
+wxSize wxStaticText::DoGetBestSize() const
+{
+       int x , y  ;
+       GetTextExtent( m_label , &x , &y ) ;
+       return wxSize( x , y ) ;
+}
+
+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)
+{
+    wxControl::SetSize( x , y , width , height , sizeFlags ) ;
+}
+
 bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
            const wxString& label,
            const wxPoint& pos,
@@ -56,4 +115,5 @@ void wxStaticText::SetLabel(const wxString& st , bool resize )
        ::UMASetControlData( m_macControl, kControlLabelPart, kControlStaticTextTextTag , (long) label.Length() , (char*)(const char*) label ) ;
        Refresh() ;
 }
+*/
 
index 26f3a748cb6d47e1063ddb7751e473587f06cce4..e4bd0aff79ff5484358c1a55fa5c1f4925745315 100644 (file)
@@ -245,10 +245,14 @@ bool wxToolBar::Realize()
                        
                        ControlHandle m_macToolHandle ;
                                
+                       SInt16 behaviour = kControlBehaviorOffsetContents ;
+                       if ( tool->CanBeToggled() )
+                               behaviour += kControlBehaviorToggles ;
+                               
                        if ( icon )
                        {
                                m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 , 
-                                       kControlBehaviorOffsetContents + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
+                                       behaviour + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
                                ControlButtonContentInfo info ;
                                
                                info.contentType = kControlContentPictHandle ;
@@ -259,7 +263,7 @@ bool wxToolBar::Realize()
                        else
                        {
                                                m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 , 
-                                               kControlBehaviorOffsetContents  , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
+                                               behaviour  , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
                        }
                        m_macToolHandles.Add( m_macToolHandle ) ;
                        UMASetControlFontStyle( m_macToolHandle , &controlstyle ) ;
@@ -353,12 +357,29 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
 void wxToolBar::DoEnableTool(wxToolBarToolBase *t, bool enable)
 {
         wxToolBarTool *tool = (wxToolBarTool *)t;
+        ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
+               if ( UMAHasAppearance() )
+               {
+                       if ( enable )
+                               ::ActivateControl( control ) ;
+                       else
+                               ::DeactivateControl( control ) ;
+               }
+               else
+               {
+                       if ( enable )
+                               ::HiliteControl( control , 0 ) ;
+                       else
+                               ::HiliteControl( control , 255 ) ;
+               }
 }
 
 void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle)
 {
        wxToolBarTool *tool = (wxToolBarTool *)t;
-       // TODO: set toggle state
+        
+       ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
+               ::SetControlValue( control , toggle ) ;
 }
 
 bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos),
index 516e3ba7b7791f7200ad624db93af8ee67cd5189..f8099265a2094b1dc026ee55dc26349fdf83653d 100644 (file)
@@ -642,11 +642,24 @@ bool wxWindow::Show(bool show)
                UMAHideWindow( m_macWindowData->m_macWindow ) ;
          }
        }
+       MacSuperShown( show ) ;
        Refresh() ;
 
     return TRUE;
 }
 
+void wxWindow::MacSuperShown( bool show ) 
+{
+       wxNode *node = GetChildren().First();
+       while ( node )
+       {
+               wxWindow *child = (wxWindow *)node->Data();
+               if ( child->m_isShown )
+                       child->MacSuperShown( show ) ;
+               node = node->Next();
+       }
+}
+
 int wxWindow::GetCharHeight() const
 {
        wxClientDC dc ( (wxWindow*)this ) ;
@@ -914,6 +927,43 @@ void wxWindow::SetScrollPos(int orient, int pos, bool refresh)
                }
 }
 
+void wxWindow::MacPaint( wxPaintEvent &event ) 
+{
+    wxPaintDC dc(this);
+    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(0, 0, m_width, m_height);          // outer - right and button
+       
+           dc.SetPen(wxPen2);
+               dc.DrawRectangle(1, 1, m_width-1, m_height-1);      // outer - left and top
+       
+           dc.SetPen(wxPen3);
+               dc.DrawRectangle(0, 0, m_width-2, m_height-2);          // inner - right and button
+       
+           dc.SetPen(wxPen4);
+               dc.DrawLine(0, 0, m_width-3, 0);                 // inner - left and top
+               dc.DrawLine(0, 0, 0, m_height-3);
+    }
+    else if (HasFlag(wxSIMPLE_BORDER))
+    {
+               dc.SetPen(*wxBLACK_PEN);
+               dc.DrawRectangle(0, 0, m_width, m_height);         
+    }
+}
+
 // New function that will replace some of the above.
 void wxWindow::SetScrollbar(int orient, int pos, int thumbVisible,
     int range, bool refresh)
@@ -1433,7 +1483,9 @@ void wxWindow::MacRedraw( RgnHandle updatergn , long time)
        event.m_timeStamp = time ;
        event.SetEventObject(this);
        
+       wxPaintEvent event2( event ) ;
        GetEventHandler()->ProcessEvent(event);
+       MacPaint( event2 ) ;
        
        RgnHandle childupdate = NewRgn() ;
 
index aa589bd32db9d517554e6c59f95c79e9f9bbe3e3..df3424b88fca86cc1a7756b8c463cb9926cce626 100644 (file)
@@ -59,6 +59,10 @@ void wxCheckBox::Command (wxCommandEvent & event)
 void wxCheckBox::MacHandleControlClick( ControlHandle control , SInt16 controlpart ) 
 {
        SetValue( !GetValue() ) ;
+    wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
+    event.SetInt(GetValue());
+    event.SetEventObject(this);
+    ProcessCommand(event);
 }
 
 // Bitmap checkbox
index 301b0731a84a8cbfc4e89cfa551c17678d70274c..343f3d239ebda7f1e14c6489559f5c0c09e34f8c 100644 (file)
@@ -34,8 +34,8 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
        
                MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
        
-               m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0, 
-               kControlPopupButtonProc , (long) this ) ; 
+               m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0 
+               kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ; 
        
                m_macPopUpMenuHandle =  NewMenu( 1 , "\pPopUp Menu" ) ;
                SetControlData( m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
index 122f58de8fa498838c6f41516602acf40d99785e..f6fa56cb91b0ef5859aa363bb0c6d858e35bdf95 100644 (file)
@@ -18,7 +18,7 @@
 #include "wx/tabctrl.h"
 #include "wx/spinbutt.h"
 
-IMPLEMENT_ABSTRACT_CLASS(wxControl, wxControlBase)
+IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
 
 BEGIN_EVENT_TABLE(wxControl, wxControlBase)
        EVT_MOUSE_EVENTS( wxControl::OnMouseEvent ) 
@@ -383,7 +383,6 @@ void wxControl::MacSuperEnabled( bool enabled )
 
 void  wxControl::MacSuperShown( bool show ) 
 {
-       /*
        if ( m_macControl )
        {
                if ( !show )
@@ -392,13 +391,12 @@ void  wxControl::MacSuperShown( bool show )
                }
                else
                {
-                       if ( m_macShown )
+                       if ( m_isShown )
                                ::UMAShowControl( m_macControl ) ;
                }
        }
                
        wxWindow::MacSuperShown( show ) ;
-       */
 }
 
 void  wxControl::DoSetSize(int x, int y,
index bdabb51e99ac4029c33bf9b1ffe1a70d2616984a..fab57c49fef17f87d70ee7667be89d140b02688a 100644 (file)
@@ -92,44 +92,47 @@ wxFont   wxNullFont;
 wxColour wxNullColour;
 
 // Default window names
-const char *wxButtonNameStr = "button";
-const char *wxCanvasNameStr = "canvas";
-const char *wxCheckBoxNameStr = "check";
-const char *wxChoiceNameStr = "choice";
-const char *wxComboBoxNameStr = "comboBox";
-const char *wxDialogNameStr = "dialog";
-const char *wxFrameNameStr = "frame";
-const char *wxGaugeNameStr = "gauge";
-const char *wxStaticBoxNameStr = "groupBox";
-const char *wxListBoxNameStr = "listBox";
-const char *wxStaticTextNameStr = "message";
-const char *wxStaticBitmapNameStr = "message";
-const char *wxMultiTextNameStr = "multitext";
-const char *wxPanelNameStr = "panel";
-const char *wxRadioBoxNameStr = "radioBox";
-const char *wxRadioButtonNameStr = "radioButton";
-const char *wxBitmapRadioButtonNameStr = "radioButton";
-const char *wxScrollBarNameStr = "scrollBar";
-const char *wxSliderNameStr = "slider";
-const char *wxStaticNameStr = "static";
-const char *wxTextCtrlWindowNameStr = "textWindow";
-const char *wxTextCtrlNameStr = "text";
-const char *wxVirtListBoxNameStr = "virtListBox";
-const char *wxButtonBarNameStr = "buttonbar";
-const char *wxEnhDialogNameStr = "Shell";
-const char *wxToolBarNameStr = "toolbar";
-const char *wxStatusLineNameStr = "status_line";
-
-const char *wxGetTextFromUserPromptStr = "Input Text";
-const char *wxMessageBoxCaptionStr = "Message";
-const char *wxFileSelectorPromptStr = "Select a file";
-const char *wxFileSelectorDefaultWildcardStr = "*.*";
-const char *wxInternalErrorStr = "wxWindows Internal Error";
-const char *wxFatalErrorStr = "wxWindows Fatal Error";
+const wxChar *wxButtonNameStr = wxT("button");
+const wxChar *wxCanvasNameStr = wxT("canvas");
+const wxChar *wxCheckBoxNameStr = wxT("check");
+const wxChar *wxChoiceNameStr = wxT("choice");
+const wxChar *wxComboBoxNameStr = wxT("comboBox");
+const wxChar *wxDialogNameStr = wxT("dialog");
+const wxChar *wxFrameNameStr = wxT("frame");
+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 *wxMultiTextNameStr = wxT("multitext");
+const wxChar *wxPanelNameStr = wxT("panel");
+const wxChar *wxRadioBoxNameStr = wxT("radioBox");
+const wxChar *wxRadioButtonNameStr = wxT("radioButton");
+const wxChar *wxBitmapRadioButtonNameStr = wxT("radioButton");
+const wxChar *wxScrollBarNameStr = wxT("scrollBar");
+const wxChar *wxSliderNameStr = wxT("slider");
+const wxChar *wxStaticNameStr = wxT("static");
+const wxChar *wxTextCtrlWindowNameStr = wxT("textWindow");
+const wxChar *wxTextCtrlNameStr = wxT("text");
+const wxChar *wxVirtListBoxNameStr = wxT("virtListBox");
+const wxChar *wxButtonBarNameStr = wxT("buttonbar");
+const wxChar *wxEnhDialogNameStr = wxT("Shell");
+const wxChar *wxToolBarNameStr = wxT("toolbar");
+const wxChar *wxStatusLineNameStr = wxT("status_line");
+
+const wxChar *wxGetTextFromUserPromptStr = wxT("Input Text");
+const wxChar *wxMessageBoxCaptionStr = wxT("Message");
+const wxChar *wxFileSelectorPromptStr = wxT("Select a file");
+const wxChar *wxFileSelectorDefaultWildcardStr = wxT("*.*");
+const wxChar *wxInternalErrorStr = wxT("wxWindows Internal Error");
+const wxChar *wxFatalErrorStr = wxT("wxWindows Fatal Error");
+const wxChar *wxTreeCtrlNameStr = wxT("treeCtrl");
+const wxChar *wxDirDialogNameStr = wxT("wxDirCtrl");
+const wxChar *wxDirDialogDefaultFolderStr = wxT("/");
 
 // See wx/utils.h
-const char *wxFloatToStringStr = "%.2f";
-const char *wxDoubleToStringStr = "%.2f";
+const wxChar *wxFloatToStringStr = wxT("%.2f");
+const wxChar *wxDoubleToStringStr = wxT("%.2f");
 
 const wxSize wxDefaultSize(-1, -1);
 const wxPoint wxDefaultPosition(-1, -1);
index 0043d823fb3b8a3669e995e309da2d8c7006225a..ecbb3ca70366564e1087d724907571bf8c4d56f0 100644 (file)
@@ -84,6 +84,7 @@ wxDC::wxDC(void)
   
 //  m_palette = wxAPP_COLOURMAP;
   m_macPort = NULL ;
+  m_macMask = NULL ;
   m_ok = FALSE ;
   
        m_macFontInstalled = false ;
@@ -153,8 +154,6 @@ void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
                                        RGBColor                black = { 0,0,0} ;
                                        RGBForeColor( &black ) ;
                                        RGBBackColor( &white ) ;
-                       //              RGBForeColor( &m_textForegroundColour.GetPixel() ) ;
-                       //              RGBBackColor( &m_textBackgroundColour.GetPixel() ) ;
                        
                                        bmappixels = GetGWorldPixMap( bmapworld ) ;
                                        if ( LockPixels(bmappixels) )
@@ -168,21 +167,20 @@ void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
                                                dest.left = XLOG2DEV(x) ;
                                                dest.bottom = YLOG2DEV(y + bmap->m_height )  ;
                                                dest.right = XLOG2DEV(x + bmap->m_width ) ;
-                                               // ::ClipRect(&m_macClipRect);
-                                               CopyBits( &GrafPtr( bmapworld )->portBits , &GrafPtr( m_macPort )->portBits ,
-                                                       &source, &dest, srcCopy, NULL ) ;
-                                               /*
-                                               if ( m_clipping )
-                                               {
-                                                       long x1 = XLOG2DEV(m_clipX1);
-                                                       long y1 = YLOG2DEV(m_clipY1);
-                                                       long x2 = XLOG2DEV(m_clipX2);
-                                                       long y2 = YLOG2DEV(m_clipY2);
        
-                                                       Rect clip = { y1 , x1 , y2 , x2 } ;
-                                                       ::ClipRect(&clip);
+                                               if ( useMask && bmp.GetMask() )
+                                               {
+                                                       if ( LockPixels( GetGWorldPixMap( bmp.GetMask()->GetMaskBitmap( ) ) ) )
+                                                       {
+                                                               CopyMask( &GrafPtr( bmapworld )->portBits , &GrafPtr( bmp.GetMask()->GetMaskBitmap( ) )->portBits , &GrafPtr( m_macPort )->portBits ,
+                                                                       &source, &source , &dest ) ;
+                                                               UnlockPixels( GetGWorldPixMap( bmp.GetMask()->GetMaskBitmap( ) )  ) ;
+                                                       }
                                                }
-                                               */
+                                               else
+                                                       CopyBits( &GrafPtr( bmapworld )->portBits , &GrafPtr( m_macPort )->portBits ,
+                                                               &source, &dest, srcCopy, NULL ) ;
+
                                                UnlockPixels( bmappixels ) ;
                                        } 
                                        m_macPenInstalled = false ;
@@ -1071,8 +1069,6 @@ 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} ;
-//             RGBForeColor( &black ) ;
-//             RGBBackColor( &white ) ;
                RGBForeColor( &m_textForegroundColour.GetPixel() ) ;
                RGBBackColor( &m_textBackgroundColour.GetPixel() ) ;
 
@@ -1087,21 +1083,36 @@ bool  wxDC::Blit( long xdest, long ydest, long width, long height,
                dstrect.left = XLOG2DEV(xdest) ;
                dstrect.bottom = YLOG2DEV(ydest + height )  ;
                dstrect.right = XLOG2DEV(xdest + width ) ;
-//             ::ClipRect(&m_macClipRect);
+
+       short  mode = (logical_func == wxCOPY ? srcCopy :
+ //    logical_func == wxCLEAR ? WHITENESS :
+ //    logical_func == wxSET ? BLACKNESS :
+               logical_func == wxINVERT ? hilite :
+  //   logical_func == wxAND ? MERGECOPY :
+       logical_func == wxOR ? srcOr :
+       logical_func == wxSRC_INVERT ? notSrcCopy :
+       logical_func == wxXOR ? srcXor :
+  //   logical_func == wxOR_REVERSE ? MERGEPAINT :
+  //   logical_func == wxAND_REVERSE ? SRCERASE :
+       logical_func == wxSRC_OR ? srcOr :
+  //   logical_func == wxSRC_AND ? SRCAND :
+               srcCopy );
+
+               if ( useMask && 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 ,
+                                       &srcrect, &srcrect , &dstrect ) ;
+                               UnlockPixels( GetGWorldPixMap( source->m_macMask )  ) ;
+                       }
+               }
+               else
+               {
                CopyBits( &GrafPtr( sourcePort )->portBits , &GrafPtr( m_macPort )->portBits ,
-                       &srcrect, &dstrect, srcCopy, NULL ) ;
-/*
-                                               if ( m_clipping )
-                                               {
-                                                       long x1 = XLOG2DEV(m_clipX1);
-                                                       long y1 = YLOG2DEV(m_clipY1);
-                                                       long x2 = XLOG2DEV(m_clipX2);
-                                                       long y2 = YLOG2DEV(m_clipY2);
-       
-                                                       Rect clip = { y1 , x1 , y2 , x2 } ;
-                                                       ::ClipRect(&clip);
-                                               }
-*/
+                               &srcrect, &dstrect, mode, NULL ) ;
+               }
                UnlockPixels( bmappixels ) ;
        } 
        
index 28a652368a97e41c1058b70f1469f67367563a3d..fe88bf806cfa070d3f05e15e107f8f80ede1df6d 100644 (file)
@@ -44,6 +44,11 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
                if ( bmap->m_hBitmap )
                {
                        m_macPort = (GrafPtr) bmap->m_hBitmap ;
+                       wxMask * mask = bitmap.GetMask() ;
+                       if ( mask )
+                       {
+                               m_macMask = mask->GetMaskBitmap() ;
+                       }
                        MacSetupPort() ;
                        m_ok = TRUE ;
                        // SetBackground(wxBrush(*wxWHITE, wxSOLID));
index 3b062f04e521ea681e4c33e18450133eba97855d..c518ad035ccb495731dd670ffaf0ce91a5874f3e 100644 (file)
@@ -68,8 +68,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
        UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxListHandleTag , sizeof( ListHandle ) , (char*) &m_macList  , &result ) ;
 
        NewExtLDEFInfo( m_macList , MacDrawStringCell , (long) this ) ;
-       (**m_macList).selFlags = lOnlyOne ;
-       if ( style  & wxLB_MULTIPLE )
+       (**m_macList).selFlags = 0 ;
+       if ( style & wxLB_MULTIPLE )
        {
                (**m_macList).selFlags += lNoExtend ;
        }
@@ -77,6 +77,10 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
        {
                (**m_macList).selFlags += lExtendDrag ;
        }
+       else
+       {
+               (**m_macList).selFlags = lOnlyOne ;
+       }
        Point pt = (**m_macList).cellSize ;
        pt.v = 14 ;
        LCellSize( pt , m_macList ) ;
@@ -151,6 +155,7 @@ void wxListBox::Delete(int N)
     }
 #endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
        m_stringArray.Remove( N ) ;
+       m_dataArray.Remove( N ) ;
        m_noItems --;
        
        MacDelete( N ) ;
@@ -185,7 +190,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
             wxASSERT_MSG(clientData[i] == NULL,
                          wxT("Can't use client data with owner-drawn listboxes"));
 #else // !wxUSE_OWNER_DRAWN
-               Append( choices[i] , clientData[0] ) ;
+               Append( choices[i] , clientData[i] ) ;
  #endif
        }
        else
@@ -298,7 +303,16 @@ void wxListBox::DoSetItemClientData(int N, void *Client_data)
         wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
     }
 #endif // wxUSE_OWNER_DRAWN
-    m_dataArray[N] = (char*) Client_data ;
+       wxASSERT_MSG( m_dataArray.GetCount() >= N , "invalid client_data array" ) ;
+       
+       if ( m_dataArray.GetCount() > N )
+       {
+       m_dataArray[N] = (char*) Client_data ;
+       }
+    else
+    {
+       m_dataArray.Add( (char*) Client_data ) ;
+    }
 }
 
 void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData)
index b52790b67d5df2d952388f1a470e8e8edc17a0af..427db90852fd76c82b19f57c160a7b38ebd20c00 100644 (file)
@@ -55,11 +55,23 @@ 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 *inItemName , bool useShortcuts )
+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 ;
@@ -120,6 +132,11 @@ void wxMacBuildMenuString(StringPtr outMacItemText, char *outMacShortcutChar , s
                                                        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;
@@ -876,7 +893,7 @@ void wxMenuBar::MacInstallMenuBar()
                        wxMenu* menu = m_menus[i] , *subMenu = NULL ;
                
                        
-                       if( m_titles[i] == "?" || m_titles[i] == wxApp::s_macHelpMenuTitleName )
+                       if( m_titles[i] == "?" || m_titles[i] == "&?"  || m_titles[i] == wxApp::s_macHelpMenuTitleName )
                        {
                                MenuHandle mh = NULL ;
                                if ( HMGetHelpMenuHandle( &mh ) != noErr )
@@ -899,24 +916,32 @@ void wxMenuBar::MacInstallMenuBar()
                                        }
                                        else            
                                        {
-                                               Str255 label ;
-                                               wxMacBuildMenuString( label , NULL , NULL , item->GetText(), item->GetId() != wxApp::s_macAboutMenuItemId); // no shortcut in about menu
-                                               if ( label[0] == 0 )
+                                               if ( item->IsSeparator() )
                                                {
-                                                       // we cannot add empty menus on mac
-                                                       label[0] = 1 ;
-                                                       label[1] = ' ' ;
+                                                       if ( mh )
+                                                               ::AppendMenu(mh, "\p-" );
                                                }
-                                               if ( item->GetId() == wxApp::s_macAboutMenuItemId )
-                                               { 
-                                                               ::SetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , label );
-               //                                      ::EnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
-                                                               ::EnableItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
-                                               }
                                                else
                                                {
-                                                       if ( mh )
-                                                               ::AppendMenu(mh, label );
+                                                       Str255 label ;
+                                                       wxMacBuildMenuString( label , NULL , NULL , item->GetText(), item->GetId() != wxApp::s_macAboutMenuItemId); // no shortcut in about menu
+                                                       if ( label[0] == 0 )
+                                                       {
+                                                               // we cannot add empty menus on mac
+                                                               label[0] = 1 ;
+                                                               label[1] = ' ' ;
+                                                       }
+                                                       if ( item->GetId() == wxApp::s_macAboutMenuItemId )
+                                                       { 
+                                                                       ::SetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , label );
+                       //                                      ::EnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
+                                                                       ::EnableItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
+                                                       }
+                                                       else
+                                                       {
+                                                               if ( mh )
+                                                                       ::AppendMenu(mh, label );
+                                                       }
                                                }
                                        }
                                }
@@ -1094,7 +1119,7 @@ void wxMenuBar::MacMenuSelect(wxEvtHandler* handler, long when , int macMenuId,
          for (int i = 0; i < m_menus.GetCount() ; i++)
          {
                if ( m_menus[i]->MacGetMenuId() == macMenuId || 
-                       ( macMenuId == kHMHelpMenuID && ( m_titles[i] == "?" || m_titles[i] == wxApp::s_macHelpMenuTitleName ) )
+                       ( macMenuId == kHMHelpMenuID && ( m_titles[i] == "?" || m_titles[i] == "&?"  || m_titles[i] == wxApp::s_macHelpMenuTitleName ) )
                        )
                {
                        if ( m_menus[i]->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) )
index f19da7bb4f12ee6fb0c10b4e5d168cc8bfdb593e..cf229e520008140529f009f37dd7cbfedda33d15 100644 (file)
@@ -70,12 +70,24 @@ int wxMessageDialog::ShowModal()
        Str255 pascalTitle ;
        Str255 pascalText ;
        
-       strcpy( (char*) pascalTitle , m_caption ) ;
+       
+       if (wxApp::s_macDefaultEncodingIsPC)
+       {
+               strcpy( (char*) pascalTitle , wxMacMakeMacStringFromPC( m_caption ) ) ;
+               strcpy( (char*) pascalText , wxMacMakeMacStringFromPC( m_message) ) ;
+       }
+       else
+       {
+               strcpy( (char*) pascalTitle , m_caption ) ;
+               strcpy( (char*) pascalText , m_message ) ;
+       }
+
        c2pstr( (char*) pascalTitle ) ;
-       strcpy( (char*) pascalText , m_message ) ;
        wxMacConvertNewlines( (char*)pascalText ,(char*) pascalText) ;
        c2pstr( (char*) pascalText ) ;
 
+       wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , "this style is not supported on mac" ) ;
+
        if ( !UMAHasAppearance() )
        {
                int resourceID ;
index 70da0df49cf3d86360985c4ff1275e96f3697a6b..416ba0b18f8e20ad9690ef5395b1ff4340b96ce7 100644 (file)
@@ -418,7 +418,7 @@ void wxRadioBox::SetFocus()
 //-------------------------------------------------------------------------------------
 // Simulates the effect of the user issuing a command to the item
 
-#define RADIO_SIZE 20
+#define RADIO_SIZE 40
 
 void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
 {
@@ -429,6 +429,8 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
 
        int x_current, y_current;
        int x_offset,y_offset;
+    int widthOld, heightOld;
+    GetSize(&widthOld, &heightOld);
 
        x_offset = x;
        y_offset = y;
@@ -463,7 +465,24 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
        totHeight = GetNumVer() * (maxHeight + charHeight/2) + charHeight*3/2;
        totWidth  = GetNumHor() * (maxWidth + charWidth) + charWidth;
 
-       wxControl::DoSetSize(x_offset,y_offset,totWidth,totHeight,wxSIZE_AUTO);
+    // only change our width/height if asked for
+    if ( width == -1 )
+    {
+        if ( sizeFlags & wxSIZE_AUTO_WIDTH )
+            width = totWidth ;
+        else
+            width = widthOld;
+    }
+
+    if ( height == -1 )
+    {
+        if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
+            height = totHeight ;
+        else
+            height = heightOld;
+    }
+
+       wxControl::DoSetSize(x_offset,y_offset,width,height,wxSIZE_AUTO);
 
 // arrange radiobuttons
 
index a2fc26d840dc5b1e6be46b6dff01b3215570870e..f5f95dfab2ed077ed0129df18750e82cc96a650e 100644 (file)
@@ -73,6 +73,9 @@ void wxRadioButton::Command (wxCommandEvent & event)
 void wxRadioButton::MacHandleControlClick( ControlHandle control , SInt16 controlpart ) 
 {
        SetValue(true) ;
+    wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, m_windowId );
+    event.SetEventObject(this);
+    ProcessCommand(event);
 }
 
 wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)
index ec4de7cc317e0181c8c54dcc303c3a4de8b246a9..b249fc0e11b8be216d0363d123a1e9c8a4701907 100644 (file)
@@ -22,6 +22,65 @@ IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
 
 #include <wx/mac/uma.h>
 
+BEGIN_EVENT_TABLE(wxStaticText, wxControl)
+    EVT_PAINT(wxStaticText::OnPaint)
+END_EVENT_TABLE()
+
+bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
+           const wxString& label,
+           const wxPoint& pos,
+           const wxSize& size,
+           long style,
+           const wxString& name)
+{
+    SetName(name);
+    m_backgroundColour = parent->GetBackgroundColour() ;
+    m_foregroundColour = parent->GetForegroundColour() ;
+
+    if ( id == -1 )
+           m_windowId = (int)NewControlId();
+    else
+           m_windowId = id;
+
+    m_windowStyle = style;
+    m_label = label ;
+
+       bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
+       SetSizeOrDefault( size ) ;
+    
+    return ret;
+}
+
+void wxStaticText::OnPaint( wxPaintEvent &event ) 
+{
+    wxPaintDC dc(this);
+    PrepareDC(dc);
+    dc.Clear() ;
+    dc.DrawText( m_label , 0 , 0 ) ;
+}
+
+wxSize wxStaticText::DoGetBestSize() const
+{
+       int x , y  ;
+       GetTextExtent( m_label , &x , &y ) ;
+       return wxSize( x , y ) ;
+}
+
+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)
+{
+    wxControl::SetSize( x , y , width , height , sizeFlags ) ;
+}
+
 bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
            const wxString& label,
            const wxPoint& pos,
@@ -56,4 +115,5 @@ void wxStaticText::SetLabel(const wxString& st , bool resize )
        ::UMASetControlData( m_macControl, kControlLabelPart, kControlStaticTextTextTag , (long) label.Length() , (char*)(const char*) label ) ;
        Refresh() ;
 }
+*/
 
index 26f3a748cb6d47e1063ddb7751e473587f06cce4..e4bd0aff79ff5484358c1a55fa5c1f4925745315 100644 (file)
@@ -245,10 +245,14 @@ bool wxToolBar::Realize()
                        
                        ControlHandle m_macToolHandle ;
                                
+                       SInt16 behaviour = kControlBehaviorOffsetContents ;
+                       if ( tool->CanBeToggled() )
+                               behaviour += kControlBehaviorToggles ;
+                               
                        if ( icon )
                        {
                                m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 , 
-                                       kControlBehaviorOffsetContents + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
+                                       behaviour + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
                                ControlButtonContentInfo info ;
                                
                                info.contentType = kControlContentPictHandle ;
@@ -259,7 +263,7 @@ bool wxToolBar::Realize()
                        else
                        {
                                                m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 , 
-                                               kControlBehaviorOffsetContents  , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
+                                               behaviour  , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
                        }
                        m_macToolHandles.Add( m_macToolHandle ) ;
                        UMASetControlFontStyle( m_macToolHandle , &controlstyle ) ;
@@ -353,12 +357,29 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
 void wxToolBar::DoEnableTool(wxToolBarToolBase *t, bool enable)
 {
         wxToolBarTool *tool = (wxToolBarTool *)t;
+        ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
+               if ( UMAHasAppearance() )
+               {
+                       if ( enable )
+                               ::ActivateControl( control ) ;
+                       else
+                               ::DeactivateControl( control ) ;
+               }
+               else
+               {
+                       if ( enable )
+                               ::HiliteControl( control , 0 ) ;
+                       else
+                               ::HiliteControl( control , 255 ) ;
+               }
 }
 
 void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle)
 {
        wxToolBarTool *tool = (wxToolBarTool *)t;
-       // TODO: set toggle state
+        
+       ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
+               ::SetControlValue( control , toggle ) ;
 }
 
 bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos),
index 516e3ba7b7791f7200ad624db93af8ee67cd5189..f8099265a2094b1dc026ee55dc26349fdf83653d 100644 (file)
@@ -642,11 +642,24 @@ bool wxWindow::Show(bool show)
                UMAHideWindow( m_macWindowData->m_macWindow ) ;
          }
        }
+       MacSuperShown( show ) ;
        Refresh() ;
 
     return TRUE;
 }
 
+void wxWindow::MacSuperShown( bool show ) 
+{
+       wxNode *node = GetChildren().First();
+       while ( node )
+       {
+               wxWindow *child = (wxWindow *)node->Data();
+               if ( child->m_isShown )
+                       child->MacSuperShown( show ) ;
+               node = node->Next();
+       }
+}
+
 int wxWindow::GetCharHeight() const
 {
        wxClientDC dc ( (wxWindow*)this ) ;
@@ -914,6 +927,43 @@ void wxWindow::SetScrollPos(int orient, int pos, bool refresh)
                }
 }
 
+void wxWindow::MacPaint( wxPaintEvent &event ) 
+{
+    wxPaintDC dc(this);
+    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(0, 0, m_width, m_height);          // outer - right and button
+       
+           dc.SetPen(wxPen2);
+               dc.DrawRectangle(1, 1, m_width-1, m_height-1);      // outer - left and top
+       
+           dc.SetPen(wxPen3);
+               dc.DrawRectangle(0, 0, m_width-2, m_height-2);          // inner - right and button
+       
+           dc.SetPen(wxPen4);
+               dc.DrawLine(0, 0, m_width-3, 0);                 // inner - left and top
+               dc.DrawLine(0, 0, 0, m_height-3);
+    }
+    else if (HasFlag(wxSIMPLE_BORDER))
+    {
+               dc.SetPen(*wxBLACK_PEN);
+               dc.DrawRectangle(0, 0, m_width, m_height);         
+    }
+}
+
 // New function that will replace some of the above.
 void wxWindow::SetScrollbar(int orient, int pos, int thumbVisible,
     int range, bool refresh)
@@ -1433,7 +1483,9 @@ void wxWindow::MacRedraw( RgnHandle updatergn , long time)
        event.m_timeStamp = time ;
        event.SetEventObject(this);
        
+       wxPaintEvent event2( event ) ;
        GetEventHandler()->ProcessEvent(event);
+       MacPaint( event2 ) ;
        
        RgnHandle childupdate = NewRgn() ;
 
index 45c51e9417f3e8d30a713bd31d265bd9e43ec971..3cffc336ee304d28f0f62fe309e970d53cc4d60f 100644 (file)
@@ -600,19 +600,63 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
     if (!bmp.Ok())
         return;
 
+       bool needsPixelCopy = false ;
+       bool isPrinter = false ;
+    if (IsKindOf(CLASSINFO(wxPrinterDC)) )
+    {
+       isPrinter = true ;
+       if ( ::GetDeviceCaps((HDC) m_hDC, RASTERCAPS) & RC_STRETCHDIB )
+               {
+       }
+               else
+               {
+                       needsPixelCopy = true ;
+               }
+       }
     // If we're not drawing transparently, and not drawing to a printer,
     // optimize this function to use Windows functions.
-    if (!useMask && !IsKindOf(CLASSINFO(wxPrinterDC)))
+    if (!useMask && !needsPixelCopy)
     {
-        HDC cdc = GetHdc();
-        HDC memdc = ::CreateCompatibleDC( cdc );
-        HBITMAP hbitmap = (HBITMAP) bmp.GetHBITMAP( );
-
-        wxASSERT_MSG( hbitmap, wxT("bitmap is ok but HBITMAP is NULL?") );
-
-        ::SelectObject( memdc, hbitmap );
-        ::BitBlt( cdc, x, y, bmp.GetWidth(), bmp.GetHeight(), memdc, 0, 0, SRCCOPY);
-        ::DeleteDC( memdc );
+       if ( isPrinter )
+       {
+               BITMAPINFO *info = (BITMAPINFO *) malloc( sizeof( BITMAPINFOHEADER ) + 256 * sizeof(RGBQUAD ) ) ;
+               int iBitsSize = ((bmp.GetWidth() + 3 ) & ~3 ) * bmp.GetHeight() ;
+               
+               void* bits = malloc( iBitsSize ) ;
+               
+               memset( info , 0 , sizeof( BITMAPINFOHEADER ) ) ;
+               
+               info->bmiHeader.biSize = sizeof( BITMAPINFOHEADER ) ;
+               info->bmiHeader.biWidth = bmp.GetWidth() ;
+               info->bmiHeader.biHeight = bmp.GetHeight() ;
+               info->bmiHeader.biPlanes = 1 ;
+               info->bmiHeader.biBitCount = 8 ;
+               info->bmiHeader.biCompression = BI_RGB ;
+               
+               HDC display = GetDC( NULL ) ;
+                       if ( GetDIBits( display , (HBITMAP) bmp.GetHBITMAP( ) , 0 , bmp.GetHeight() , bits , info , DIB_RGB_COLORS ) )
+                       {
+                               StretchDIBits( (HDC) m_hDC, 
+                                       x, y, bmp.GetWidth(), bmp.GetHeight() , 
+                                       0 , 0 ,bmp.GetWidth(), bmp.GetHeight() , 
+                                       bits , info , DIB_RGB_COLORS , SRCCOPY ) ;
+                       }
+                       ReleaseDC( NULL , display ) ;
+                       free ( bits ) ;
+                       free( info ) ;
+       }
+       else
+       {
+               HDC cdc = GetHdc();
+               HDC memdc = ::CreateCompatibleDC( cdc );
+               HBITMAP hbitmap = (HBITMAP) bmp.GetHBITMAP( );
+
+               wxASSERT_MSG( hbitmap, wxT("bitmap is ok but HBITMAP is NULL?") );
+
+               ::SelectObject( memdc, hbitmap );
+               ::BitBlt( cdc, x, y, bmp.GetWidth(), bmp.GetHeight(), memdc, 0, 0, SRCCOPY);
+               ::DeleteDC( memdc );
+        }
     }
     else
     {