Example #1
0
bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
{
    wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), FALSE,
                 _T("Shaped windows must be created with the wxFRAME_SHAPED style."));

#if TARGET_CARBON
    // The empty region signifies that the shape should be removed from the
    // window.
    if ( region.IsEmpty() )
    {
        wxSize sz = GetClientSize();
        wxRegion rgn(0, 0, sz.x, sz.y);
        return SetShape(rgn);
    }

    // Make a copy of the region
    RgnHandle  shapeRegion = NewRgn();
    CopyRgn( (RgnHandle)region.GetWXHRGN(), shapeRegion );

    // Dispose of any shape region we may already have
    RgnHandle oldRgn = (RgnHandle)GetWRefCon( (WindowRef)MacGetWindowRef() );
    if ( oldRgn )
        DisposeRgn(oldRgn);

    // Save the region so we can use it later
    SetWRefCon((WindowRef)MacGetWindowRef(), (SInt32)shapeRegion);

    // Tell the window manager that the window has changed shape
    ReshapeCustomWindow((WindowRef)MacGetWindowRef());
    return TRUE;
#else
    return FALSE;
#endif
}
Example #2
0
void wxDialog::DoShowModal()
{
    wxCHECK_RET( !IsModalShowing(), _T("DoShowModal() called twice") );

    wxModalDialogs.Append(this);

    SetFocus() ;
    
#if TARGET_CARBON
    BeginAppModalStateForWindow(  (WindowRef) MacGetWindowRef()) ;
#else
    // TODO : test whether parent gets disabled
    bool formerModal = s_macIsInModalLoop ;
    s_macIsInModalLoop = true ;
#endif
    while ( IsModalShowing() )
    {
        wxTheApp->MacDoOneEvent() ;
        // calls process idle itself
    }

#if TARGET_CARBON
    EndAppModalStateForWindow( (WindowRef) MacGetWindowRef() ) ;
#else
    // TODO probably reenable the parent window if any
    s_macIsInModalLoop = formerModal ;
#endif
}
Example #3
0
void wxDialog::SetModal(bool flag)
{
    if ( flag )
    {
        m_isModalStyle = true;

        wxModelessWindows.DeleteObject(this);
#if TARGET_CARBON
        SetWindowModality( (WindowRef) MacGetWindowRef() , kWindowModalityAppModal , NULL ) ;
#endif
    }
    else
    {
        m_isModalStyle = false;

        wxModelessWindows.Append(this);
    }
}
Example #4
0
LyricsWindow::LyricsWindow(AudacityProject *parent):
   wxFrame(parent, -1, 
            wxString::Format(_("Audacity Lyrics%s"), 
                              ((parent->GetName() == wxEmptyString) ? 
                                 wxT("") :
                                 wxString::Format(
                                   wxT(" - %s"),
                                   parent->GetName().c_str()).c_str())),
            wxPoint(100, 300), gSize, 
            wxDEFAULT_FRAME_STYLE
#ifndef __WXMAC__
           | ((parent == NULL) ? 0x0 : wxFRAME_FLOAT_ON_PARENT) //vvvvv
#endif
             )
{
#ifdef __WXMAC__
   // WXMAC doesn't support wxFRAME_FLOAT_ON_PARENT, so we do
   SetWindowClass((WindowRef) MacGetWindowRef(), kFloatingWindowClass);
#endif
   mProject = parent;

   // loads either the XPM or the windows resource, depending on the platform
#if !defined(__WXMAC__) && !defined(__WXX11__)
   #ifdef __WXMSW__
      wxIcon ic(wxICON(AudacityLogo));
   #else
      wxIcon ic(wxICON(AudacityLogo48x48));
   #endif
   SetIcon(ic);
#endif

   wxToolBar* pToolBar = this->CreateToolBar();
   const int kHorizMargin = 8;
   wxRadioButton* pRadioButton_BouncingBall = 
      new wxRadioButton(pToolBar, kID_RadioButton_BouncingBall, _("Bouncing Ball"), wxPoint(kHorizMargin, 4),
          wxDefaultSize, wxRB_GROUP);
   // Reposition to center vertically. 
   wxSize tbSize = pToolBar->GetSize();
   wxSize btnSize = pRadioButton_BouncingBall->GetSize();
   int top = (tbSize.GetHeight() - btnSize.GetHeight()) / 2;
   pRadioButton_BouncingBall->Move(kHorizMargin, top);
   pToolBar->AddControl(pRadioButton_BouncingBall);

   int left = kHorizMargin + btnSize.GetWidth() + kHorizMargin; //vvv Doesn't actually work. Probably need sizers.
   wxRadioButton* pRadioButton_Highlight = 
      new wxRadioButton(pToolBar, kID_RadioButton_Highlight, _("Highlight"), wxPoint(left, top));
   pToolBar->AddControl(pRadioButton_Highlight);
   pRadioButton_Highlight->Enable(false); //vvvvv not working right in ported version, so disabled.

#if defined(__WXMAC__)
   wxColour face = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
   pRadioButton_BouncingBall->SetBackgroundColour(face);
   pRadioButton_Highlight->SetBackgroundColour(face);
#endif

   pToolBar->Realize();

   mLyricsPanel = 
      new Lyrics(this, -1, 
                  wxPoint(0, tbSize.GetHeight()), 
                  wxSize(gSize.GetWidth(), gSize.GetHeight() - tbSize.GetHeight()));
   switch (mLyricsPanel->GetLyricsStyle()) 
   {
      case Lyrics::kBouncingBallLyrics:
         pRadioButton_BouncingBall->SetValue(true); break;
      case Lyrics::kHighlightLyrics:
      default:
         pRadioButton_Highlight->SetValue(true); break;
   }
}