~ubuntu-branches/ubuntu/raring/wxwidgets2.8/raring

« back to all changes in this revision

Viewing changes to src/mac/carbon/toolbar.cpp

  • Committer: Package Import Robot
  • Author(s): Stéphane Graber
  • Date: 2012-01-07 13:59:25 UTC
  • mfrom: (1.1.9) (5.1.10 sid)
  • Revision ID: package-import@ubuntu.com-20120107135925-2601miy9ullcon9j
Tags: 2.8.12.1-6ubuntu1
* Resync from Debian, changes that were kept:
  - debian/rules: re-enable mediactrl. This allows libwx_gtk2u_media-2.8 to be
    built, as this is required by some applications (LP: #632984)
  - debian/control: Build-dep on libxt-dev for mediactrl.
  - Patches
    + fix-bashism-in-example
* Add conflict on python-wxgtk2.8 (<< 2.8.12.1-6ubuntu1~) to python-wxversion
  to guarantee upgrade ordering when moving from pycentral to dh_python2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
// Author:      Stefan Csomor
5
5
// Modified by:
6
6
// Created:     04/01/98
7
 
// RCS-ID:      $Id: toolbar.cpp 57849 2009-01-06 09:36:54Z SC $
 
7
// RCS-ID:      $Id: toolbar.cpp 67130 2011-03-05 18:36:04Z SC $
8
8
// Copyright:   (c) Stefan Csomor
9
9
// Licence:     wxWindows licence
10
10
/////////////////////////////////////////////////////////////////////////////
133
133
        if ( m_toolbarItemRef )
134
134
        {
135
135
            CFIndex count = CFGetRetainCount( m_toolbarItemRef ) ;
136
 
                        // different behaviour under Leopard
137
 
                        if ( UMAGetSystemVersion() < 0x1050 )
138
 
                        {
139
 
                                wxASSERT_MSG( count == 1 , wxT("Reference Count of native tool was not 1 in wxToolBarTool destructor") );
140
 
                        }
 
136
            // different behaviour under Leopard
 
137
            if ( UMAGetSystemVersion() < 0x1050 )
 
138
            {
 
139
                wxASSERT_MSG( count == 1 , wxT("Reference Count of native tool was not 1 in wxToolBarTool destructor") );
 
140
            }
141
141
            wxTheApp->MacAddToAutorelease(m_toolbarItemRef);
142
142
            CFRelease(m_toolbarItemRef);
143
143
            m_toolbarItemRef = NULL;
472
472
#ifdef __WXMAC_OSX__
473
473
    if ( toggle )
474
474
    {
475
 
        int w = m_bmpNormal.GetWidth();
476
 
        int h = m_bmpNormal.GetHeight();
 
475
        int w = m_bmpNormal.GetWidth() + 6;
 
476
        int h = m_bmpNormal.GetHeight() + 6;
477
477
        wxBitmap bmp( w, h );
478
478
        wxMemoryDC dc;
479
479
 
480
480
        dc.SelectObject( bmp );
481
 
        dc.SetPen( wxPen(*wxBLACK) );
482
 
        dc.SetBrush( wxBrush( *wxLIGHT_GREY ));
483
 
        dc.DrawRectangle( 0, 0, w, h );
484
 
        dc.DrawBitmap( m_bmpNormal, 0, 0, true );
 
481
        wxColour mid_grey_75   = wxColour(128, 128, 128, 196);
 
482
        wxColour light_grey_75 = wxColour(196, 196, 196, 196);
 
483
        dc.GradientFillLinear( wxRect(1, 1, w - 1, h-1),
 
484
                                light_grey_75, mid_grey_75, wxNORTH);
 
485
        wxColour black_50 = wxColour(0, 0, 0, 127);
 
486
        dc.SetPen( wxPen(black_50) );
 
487
        dc.DrawRoundedRectangle( 0, 0, w, h, 1.5 );
 
488
        dc.DrawBitmap( m_bmpNormal, 3, 3, true );
 
489
        
485
490
        dc.SelectObject( wxNullBitmap );
486
491
        ControlButtonContentInfo info;
487
492
        wxMacCreateBitmapButton( &info, bmp, kControlContentIconRef);
666
671
                            if ( count >= 1 )
667
672
                                CFRelease( viewRef ) ;
668
673
                        }
669
 
                            free( object ) ;
670
 
                        result = noErr;
 
674
                        free( object ) ;
 
675
                        result = noErr;
671
676
                    }
672
677
                    break;
673
678
            }
679
684
                case kEventToolbarItemCreateCustomView:
680
685
                {
681
686
                    HIViewRef viewRef = object->viewRef ;
682
 
                        HIViewRemoveFromSuperview( viewRef ) ;
 
687
                       HIViewRemoveFromSuperview( viewRef ) ;
683
688
                    HIViewSetVisible(viewRef, true) ;
684
689
                    CFRetain( viewRef ) ;
685
690
                    result = SetEventParameter( inEvent, kEventParamControlRef, typeControlRef, sizeof( HIViewRef ), &viewRef );
900
905
            MacInstallNativeToolbar( false );
901
906
 
902
907
        CFIndex count = CFGetRetainCount( m_macHIToolbarRef ) ;
903
 
                // Leopard seems to have one refcount more, so we cannot check reliably at the moment
904
 
                if ( UMAGetSystemVersion() < 0x1050 )
905
 
                {
906
 
                        wxASSERT_MSG( count == 1 , wxT("Reference Count of native control was not 1 in wxToolBar destructor") );
907
 
                }
 
908
        // Leopard seems to have one refcount more, so we cannot check reliably at the moment
 
909
        if ( UMAGetSystemVersion() < 0x1050 )
 
910
        {
 
911
            wxASSERT_MSG( count == 1 , wxT("Reference Count of native control was not 1 in wxToolBar destructor") );
 
912
        }
908
913
        CFRelease( (HIToolbarRef)m_macHIToolbarRef );
909
914
        m_macHIToolbarRef = NULL;
910
915
    }