/////////////////////////////////////////////////////////////////////////////
// Name: frame.cpp
-// Purpose: wxFrameMac
+// Purpose: wxFrame
// Author: AUTHOR
// Modified by:
// Created: ??/??/98
#include "wx/settings.h"
#include "wx/app.h"
-#include <wx/mac/uma.h>
+#include "wx/mac/uma.h"
extern wxWindowList wxModelessWindows;
extern wxList wxPendingDelete;
#if !USE_SHARED_LIBRARY
-BEGIN_EVENT_TABLE(wxFrameMac, wxFrameBase)
- EVT_ACTIVATE(wxFrameMac::OnActivate)
- // EVT_MENU_HIGHLIGHT_ALL(wxFrameMac::OnMenuHighlight)
- EVT_SYS_COLOUR_CHANGED(wxFrameMac::OnSysColourChanged)
-// EVT_IDLE(wxFrameMac::OnIdle)
-// EVT_CLOSE(wxFrameMac::OnCloseWindow)
+BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
+ EVT_ACTIVATE(wxFrame::OnActivate)
+ // EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
+ EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
+// EVT_IDLE(wxFrame::OnIdle)
+// EVT_CLOSE(wxFrame::OnCloseWindow)
END_EVENT_TABLE()
-IMPLEMENT_DYNAMIC_CLASS(wxFrameMac, wxWindow)
-#endif
-#ifndef __WXUNIVERSAL__
-IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxFrameMac)
+IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow)
#endif
#if wxUSE_NATIVE_STATUSBAR
-bool wxFrameMac::m_useNativeStatusBar = TRUE;
+bool wxFrame::m_useNativeStatusBar = TRUE;
#else
-bool wxFrameMac::m_useNativeStatusBar = FALSE;
+bool wxFrame::m_useNativeStatusBar = FALSE;
#endif
#define WX_MAC_STATUSBAR_HEIGHT 15
// creation/destruction
// ----------------------------------------------------------------------------
-void wxFrameMac::Init()
+void wxFrame::Init()
{
m_frameMenuBar = NULL;
#endif
}
-wxPoint wxFrameMac::GetClientAreaOrigin() const
+wxPoint wxFrame::GetClientAreaOrigin() const
{
// on mac we are at position -1,-1 with the control
wxPoint pt(0, 0);
return pt;
}
-bool wxFrameMac::Create(wxWindow *parent,
+bool wxFrame::Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
long style,
const wxString& name)
{
- SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
+ SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
return FALSE;
MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
- m_macWindowData->m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
+ m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
+ SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
wxModelessWindows.Append(this);
return TRUE;
}
-wxFrameMac::~wxFrameMac()
+wxFrame::~wxFrame()
{
m_isBeingDeleted = TRUE;
}
-bool wxFrameMac::Enable(bool enable)
+bool wxFrame::Enable(bool enable)
{
if ( !wxWindow::Enable(enable) )
return FALSE;
if ( m_frameMenuBar && m_frameMenuBar == wxMenuBar::MacGetInstalledMenuBar() )
{
- for ( int i = 0 ; i < m_frameMenuBar->GetMenuCount() ; ++ i )
+ int iMaxMenu = m_frameMenuBar->GetMenuCount();
+ for ( int i = 0 ; i < iMaxMenu ; ++ i )
{
m_frameMenuBar->EnableTop( i , enable ) ;
}
return TRUE;
}
-wxStatusBar *wxFrameMac::OnCreateStatusBar(int number, long style, wxWindowID id,
+wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
const wxString& name)
{
wxStatusBar *statusBar = NULL;
return statusBar;
}
-void wxFrameMac::PositionStatusBar()
+void wxFrame::PositionStatusBar()
{
if (m_frameStatusBar )
{
}
// Responds to colour changes, and passes event on to children.
-void wxFrameMac::OnSysColourChanged(wxSysColourChangedEvent& event)
+void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
{
- SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
+ SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
Refresh();
if ( m_frameStatusBar )
// Default activation behaviour - set the focus for the first child
// subwindow found.
-void wxFrameMac::OnActivate(wxActivateEvent& event)
+void wxFrame::OnActivate(wxActivateEvent& event)
{
if ( !event.GetActive() )
{
{
m_frameMenuBar->MacInstallMenuBar() ;
}
+ else if (wxTheApp->GetTopWindow() && wxTheApp->GetTopWindow()->IsKindOf(CLASSINFO(wxFrame)))
+ {
+ // Trying toplevel frame menbar
+ if( ((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar() )
+ ((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar()->MacInstallMenuBar();
+ }
}
}
-void wxFrameMac::DoGetClientSize(int *x, int *y) const
+void wxFrame::DetachMenuBar()
+{
+ if ( m_frameMenuBar )
+ {
+ m_frameMenuBar->UnsetInvokingWindow();
+ }
+
+ wxFrameBase::DetachMenuBar();
+}
+
+void wxFrame::AttachMenuBar( wxMenuBar *menuBar )
+{
+ wxFrameBase::AttachMenuBar(menuBar);
+
+ if (m_frameMenuBar)
+ {
+ m_frameMenuBar->SetInvokingWindow( this );
+ }
+}
+
+void wxFrame::DoGetClientSize(int *x, int *y) const
{
wxWindow::DoGetClientSize( x , y ) ;
*x -= pt.x;
}
-void wxFrameMac::DoSetClientSize(int clientwidth, int clientheight)
+void wxFrame::DoSetClientSize(int clientwidth, int clientheight)
{
int currentclientwidth , currentclientheight ;
int currentwidth , currentheight ;
#if wxUSE_TOOLBAR
-wxToolBar* wxFrameMac::CreateToolBar(long style, wxWindowID id, const wxString& name)
+wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{
if ( wxFrameBase::CreateToolBar(style, id, name) )
{
return m_frameToolBar;
}
-void wxFrameMac::PositionToolBar()
+void wxFrame::PositionToolBar()
{
int cw, ch;