From 6418cb93022a02da40be0e50aea3d5615074fb71 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Fri, 3 Dec 1999 14:30:39 +0000 Subject: [PATCH] wxMSW update for CW, wxMac updated git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4801 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/mac/printmac.h | 22 ++++++++++------- include/wx/notebook.h | 2 +- src/mac/app.cpp | 2 +- src/mac/carbon/app.cpp | 2 +- src/mac/carbon/frame.cpp | 50 +++++++++++++++++++++++++++++++++++++++ src/mac/carbon/mdi.cpp | 1 - src/mac/carbon/window.cpp | 1 - src/mac/frame.cpp | 50 +++++++++++++++++++++++++++++++++++++++ src/mac/mdi.cpp | 1 - src/mac/window.cpp | 1 - src/msw/app.cpp | 12 +++++++++- 11 files changed, 128 insertions(+), 16 deletions(-) diff --git a/include/wx/mac/printmac.h b/include/wx/mac/printmac.h index df7ccd0b82..243ed2fefe 100644 --- a/include/wx/mac/printmac.h +++ b/include/wx/mac/printmac.h @@ -27,14 +27,15 @@ class WXDLLEXPORT wxMacPrinter: public wxPrinterBase DECLARE_DYNAMIC_CLASS(wxMacPrinter) public: - wxMacPrinter(wxPrintData *data = NULL); - ~wxMacPrinter(void); + wxMacPrinter(wxPrintDialogData *data = NULL); + virtual ~wxMacPrinter(); - virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = TRUE); - virtual bool PrintDialog(wxWindow *parent); + virtual bool Print(wxWindow *parent, + wxPrintout *printout, + bool prompt = TRUE); + virtual wxDC* PrintDialog(wxWindow *parent); virtual bool Setup(wxWindow *parent); - private: }; /* @@ -47,11 +48,16 @@ class WXDLLEXPORT wxMacPrintPreview: public wxPrintPreviewBase DECLARE_CLASS(wxMacPrintPreview) public: - wxMacPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting = NULL, wxPrintData *data = NULL); - ~wxMacPrintPreview(void); + wxMacPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting = NULL, + wxPrintDialogData *data = NULL); + wxMacPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting, + wxPrintData *data); + virtual ~wxMacPrintPreview(); virtual bool Print(bool interactive); - virtual void DetermineScaling(void); + virtual void DetermineScaling(); }; #endif diff --git a/include/wx/notebook.h b/include/wx/notebook.h index 63bbee89ea..4dea9653ef 100644 --- a/include/wx/notebook.h +++ b/include/wx/notebook.h @@ -102,7 +102,7 @@ typedef void (wxEvtHandler::*wxNotebookEventFunction)(wxNotebookEvent&); #elif defined(__WXQT__) #include "wx/qt/notebook.h" #elif defined(__WXMAC__) - #include "wx/mac/notebook.h" + #include "wx/generic/notebook.h" #elif defined(__WXPM__) #include "wx/os2/notebook.h" #elif defined(__WXSTUBS__) diff --git a/src/mac/app.cpp b/src/mac/app.cpp index ed4cdaf1f3..1bd9461b3d 100644 --- a/src/mac/app.cpp +++ b/src/mac/app.cpp @@ -50,7 +50,7 @@ extern wxList wxPendingDelete; extern wxList *wxWinMacWindowList; extern wxList *wxWinMacControlList; -extern wxApp *wxTheApp ; +wxApp *wxTheApp = NULL; #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler) diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index ed4cdaf1f3..1bd9461b3d 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -50,7 +50,7 @@ extern wxList wxPendingDelete; extern wxList *wxWinMacWindowList; extern wxList *wxWinMacControlList; -extern wxApp *wxTheApp ; +wxApp *wxTheApp = NULL; #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler) diff --git a/src/mac/carbon/frame.cpp b/src/mac/carbon/frame.cpp index 6e98062322..ba1377151f 100644 --- a/src/mac/carbon/frame.cpp +++ b/src/mac/carbon/frame.cpp @@ -341,6 +341,56 @@ void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) // Default resizing behaviour - if only ONE subwindow, // resize to client rectangle size +void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) ) +{ + DoMenuUpdates(); +} + + +// update all menus +void wxFrame::DoMenuUpdates() +{ + wxMenuBar* bar = GetMenuBar(); + + if ( bar != NULL ) + { + int nCount = bar->GetMenuCount(); + for (int n = 0; n < nCount; n++) + DoMenuUpdates(bar->GetMenu(n), (wxWindow*) NULL); + } +} + +// update a menu and all submenus recursively +void wxFrame::DoMenuUpdates(wxMenu* menu, wxWindow* WXUNUSED(focusWin)) +{ + wxEvtHandler* evtHandler = GetEventHandler(); + wxMenuItemList::Node* node = menu->GetMenuItems().GetFirst(); + while (node) + { + wxMenuItem* item = node->GetData(); + if ( !item->IsSeparator() ) + { + wxWindowID id = item->GetId(); + wxUpdateUIEvent event(id); + event.SetEventObject( this ); + + if (evtHandler->ProcessEvent(event)) + { + if (event.GetSetText()) + menu->SetLabel(id, event.GetText()); + if (event.GetSetChecked()) + menu->Check(id, event.GetChecked()); + if (event.GetSetEnabled()) + menu->Enable(id, event.GetEnabled()); + } + + if (item->GetSubMenu()) + DoMenuUpdates(item->GetSubMenu(), (wxWindow*) NULL); + } + node = node->GetNext(); + } +} + void wxFrame::OnSize(wxSizeEvent& event) { // if we're using constraints - do use them diff --git a/src/mac/carbon/mdi.cpp b/src/mac/carbon/mdi.cpp index 57862a20ff..598f62c3f5 100644 --- a/src/mac/carbon/mdi.cpp +++ b/src/mac/carbon/mdi.cpp @@ -241,6 +241,5 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style) // Explicitly call default scroll behaviour void wxMDIClientWindow::OnScroll(wxScrollEvent& event) { - Default(); // Default processing } diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index a9aec9174f..43e490d70b 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -838,7 +838,6 @@ void wxWindow::WarpPointer (int x_pos, int y_pos) void wxWindow::OnEraseBackground(wxEraseEvent& event) { // TODO : probably we would adopt the EraseEvent structure - Default(); } int wxWindow::GetScrollPos(int orient) const diff --git a/src/mac/frame.cpp b/src/mac/frame.cpp index 6e98062322..ba1377151f 100644 --- a/src/mac/frame.cpp +++ b/src/mac/frame.cpp @@ -341,6 +341,56 @@ void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) // Default resizing behaviour - if only ONE subwindow, // resize to client rectangle size +void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) ) +{ + DoMenuUpdates(); +} + + +// update all menus +void wxFrame::DoMenuUpdates() +{ + wxMenuBar* bar = GetMenuBar(); + + if ( bar != NULL ) + { + int nCount = bar->GetMenuCount(); + for (int n = 0; n < nCount; n++) + DoMenuUpdates(bar->GetMenu(n), (wxWindow*) NULL); + } +} + +// update a menu and all submenus recursively +void wxFrame::DoMenuUpdates(wxMenu* menu, wxWindow* WXUNUSED(focusWin)) +{ + wxEvtHandler* evtHandler = GetEventHandler(); + wxMenuItemList::Node* node = menu->GetMenuItems().GetFirst(); + while (node) + { + wxMenuItem* item = node->GetData(); + if ( !item->IsSeparator() ) + { + wxWindowID id = item->GetId(); + wxUpdateUIEvent event(id); + event.SetEventObject( this ); + + if (evtHandler->ProcessEvent(event)) + { + if (event.GetSetText()) + menu->SetLabel(id, event.GetText()); + if (event.GetSetChecked()) + menu->Check(id, event.GetChecked()); + if (event.GetSetEnabled()) + menu->Enable(id, event.GetEnabled()); + } + + if (item->GetSubMenu()) + DoMenuUpdates(item->GetSubMenu(), (wxWindow*) NULL); + } + node = node->GetNext(); + } +} + void wxFrame::OnSize(wxSizeEvent& event) { // if we're using constraints - do use them diff --git a/src/mac/mdi.cpp b/src/mac/mdi.cpp index 57862a20ff..598f62c3f5 100644 --- a/src/mac/mdi.cpp +++ b/src/mac/mdi.cpp @@ -241,6 +241,5 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style) // Explicitly call default scroll behaviour void wxMDIClientWindow::OnScroll(wxScrollEvent& event) { - Default(); // Default processing } diff --git a/src/mac/window.cpp b/src/mac/window.cpp index a9aec9174f..43e490d70b 100644 --- a/src/mac/window.cpp +++ b/src/mac/window.cpp @@ -838,7 +838,6 @@ void wxWindow::WarpPointer (int x_pos, int y_pos) void wxWindow::OnEraseBackground(wxEraseEvent& event) { // TODO : probably we would adopt the EraseEvent structure - Default(); } int wxWindow::GetScrollPos(int orient) const diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 0b947a5409..b3da445a29 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -593,7 +593,17 @@ int wxEntry(WXHINSTANCE hInstance, // (another useful flag is _CRTDBG_DELAY_FREE_MEM_DF which doesn't free // deallocated memory which may be used to simulate low-memory condition) wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF); - +#ifdef __MWERKS__ +#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT + // This seems to be necessary since there are 'rogue' + // objects present at this point (perhaps global objects?) + // Setting a checkpoint will ignore them as far as the + // memory checking facility is concerned. + // Of course you may argue that memory allocated in globals should be + // checked, but this is a reasonable compromise. + wxDebugContext::SetCheckpoint(); +#endif +#endif // take everything into a try-except block in release build // FIXME other compilers must support Win32 SEH (structured exception // handling) too, just find the appropriate keyword in their docs! -- 2.47.2