From 90b959aee428b26304ee0056864af48775051496 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Fri, 29 Jun 2001 16:19:53 +0000 Subject: [PATCH] post wxUniv merge fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10719 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/filefn.h | 2 - include/wx/generic/spinctlg.h | 2 +- include/wx/mac/menu.h | 5 -- include/wx/mac/notebook.h | 66 +++++++++++-------------- include/wx/mac/radiobox.h | 28 ++++++----- include/wx/mac/setup.h | 26 +--------- src/mac/app.cpp | 4 +- src/mac/bitmap.cpp | 8 +++ src/mac/carbon/app.cpp | 4 +- src/mac/carbon/bitmap.cpp | 8 +++ src/mac/carbon/icon.cpp | 2 +- src/mac/carbon/menu.cpp | 27 +++------- src/mac/carbon/notebmac.cpp | 93 ++++++++++------------------------- src/mac/carbon/radiobox.cpp | 79 +++-------------------------- src/mac/carbon/spinbutt.cpp | 5 -- src/mac/carbon/spinctrl.cpp | 2 +- src/mac/carbon/statbmp.cpp | 2 +- src/mac/carbon/stattext.cpp | 2 +- src/mac/carbon/textctrl.cpp | 13 ++++- src/mac/carbon/window.cpp | 5 ++ src/mac/icon.cpp | 2 +- src/mac/menu.cpp | 27 +++------- src/mac/notebmac.cpp | 93 ++++++++++------------------------- src/mac/radiobox.cpp | 79 +++-------------------------- src/mac/spinbutt.cpp | 5 -- src/mac/spinctrl.cpp | 2 +- src/mac/statbmp.cpp | 2 +- src/mac/stattext.cpp | 2 +- src/mac/textctrl.cpp | 13 ++++- src/mac/window.cpp | 5 ++ 30 files changed, 185 insertions(+), 428 deletions(-) diff --git a/include/wx/filefn.h b/include/wx/filefn.h index 85931defeb..1ffa54f836 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -170,12 +170,10 @@ WXDLLEXPORT void wxUnix2DosFilename(wxChar *s); #if defined(__WXMAC__) && !defined(__UNIX__) WXDLLEXPORT wxString wxMacFSSpec2MacFilename( const FSSpec *spec ) ; WXDLLEXPORT void wxMacFilename2FSSpec( const char *path , FSSpec *spec ) ; - /* WXDLLEXPORT wxString wxMacFSSpec2UnixFilename( const FSSpec *spec ) ; WXDLLEXPORT void wxUnixFilename2FSSpec( const char *path , FSSpec *spec ) ; WXDLLEXPORT wxString wxMac2UnixFilename( const char *s) ; WXDLLEXPORT wxString wxUnix2MacFilename( const char *s); -*/ #endif // Strip the extension, in situ diff --git a/include/wx/generic/spinctlg.h b/include/wx/generic/spinctlg.h index d1b84a7328..3c24bf3384 100644 --- a/include/wx/generic/spinctlg.h +++ b/include/wx/generic/spinctlg.h @@ -20,7 +20,7 @@ // without tons of #ifdefs. // ---------------------------------------------------------------------------- -#if wxUSE_SPINBTN +#if wxUSE_SPINBTN && !defined(__WXMAC__) #ifdef __GNUG__ #pragma interface "spinctlg.h" diff --git a/include/wx/mac/menu.h b/include/wx/mac/menu.h index 98b840a56f..39b0f0a918 100644 --- a/include/wx/mac/menu.h +++ b/include/wx/mac/menu.h @@ -74,9 +74,6 @@ public: // get the menu handle WXHMENU GetHMenu() const { return m_hMenu; } - // attach/detach menu to/from wxMenuBar - void Attach(wxMenuBar *menubar); - void Detach(); short MacGetMenuId() { return m_macMenuId ; } #if wxUSE_ACCEL // called by wxMenuBar to build its accel table from the accels of all menus @@ -192,8 +189,6 @@ protected: wxArrayString m_titles; - wxFrame *m_menuBarFrame; - #if wxUSE_ACCEL // the accelerator table for all accelerators in all our menus wxAcceleratorTable m_accelTable; diff --git a/include/wx/mac/notebook.h b/include/wx/mac/notebook.h index 713b3f6058..283a0166b8 100644 --- a/include/wx/mac/notebook.h +++ b/include/wx/mac/notebook.h @@ -37,7 +37,7 @@ class WXDLLEXPORT wxWindow; // @@@ this class should really derive from wxTabCtrl, but the interface is not // exactly the same, so I can't do it right now and instead we reimplement // part of wxTabCtrl here -class wxNotebook : public wxControl +class wxNotebook : public wxNotebookBase { public: // ctors @@ -63,15 +63,10 @@ public: // accessors // --------- - // get number of pages in the dialog - int GetPageCount() const; - // set the currently selected page, return the index of the previously // selected one (or -1 on error) // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events int SetSelection(int nPage); - // cycle thru the tabs - void AdvanceSelection(bool bForward = TRUE); // get the currently selected page int GetSelection() const { return m_nSelection; } @@ -79,53 +74,44 @@ public: bool SetPageText(int nPage, const wxString& strText); wxString GetPageText(int nPage) const; - // image list stuff: each page may have an image associated with it. All - // the images belong to an image list, so you have to - // 1) create an image list - // 2) associate it with the notebook - // 3) set for each page it's image - // associate image list with a control - void SetImageList(wxImageList* imageList); - // get pointer (may be NULL) to the associated image list - wxImageList* GetImageList() const { return m_pImageList; } - // sets/returns item's image index in the current image list int GetPageImage(int nPage) const; bool SetPageImage(int nPage, int nImage); - // currently it's always 1 because wxGTK doesn't support multi-row - // tab controls - int GetRowCount() const; - // control the appearance of the notebook pages // set the size (the same for all pages) void SetPageSize(const wxSize& size); // set the padding between tabs (in pixels) void SetPadding(const wxSize& padding); + // sets the size of the tabs (assumes all tabs are the same size) + void SetTabSize(const wxSize& sz); + +/* + // get number of pages in the dialog + int GetPageCount() const; + + // cycle thru the tabs + void AdvanceSelection(bool bForward = TRUE); + + // currently it's always 1 because wxGTK doesn't support multi-row + // tab controls + int GetRowCount() const; +*/ // operations // ---------- - // remove one page from the notebook - bool DeletePage(int nPage); - // remove one page from the notebook, without deleting - bool RemovePage(int nPage); // remove all pages bool DeleteAllPages(); - // adds a new page to the notebook (it will be deleted ny the notebook, - // don't delete it yourself). If bSelect, this page becomes active. - bool AddPage(wxNotebookPage *pPage, - const wxString& strText, - bool bSelect = FALSE, - int imageId = -1); // the same as AddPage(), but adds it at the specified position bool InsertPage(int nPage, wxNotebookPage *pPage, const wxString& strText, bool bSelect = FALSE, int imageId = -1); +/* // get the panel which represents the given page wxNotebookPage *GetPage(int nPage) { return m_aPages[nPage]; } - +*/ // callbacks // --------- void OnSize(wxSizeEvent& event); @@ -133,13 +119,21 @@ public: void OnSetFocus(wxFocusEvent& event); void OnNavigationKey(wxNavigationKeyEvent& event); - // base class virtuals - // ------------------- - virtual void Command(wxCommandEvent& event); + + // implementation + // -------------- + +#if wxUSE_CONSTRAINTS virtual void SetConstraintSizes(bool recurse = TRUE); virtual bool DoPhase(int nPhase); +#endif + + // base class virtuals + // ------------------- + virtual void Command(wxCommandEvent& event); protected: + virtual wxNotebookPage *DoRemovePage(int page) ; virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ; // common part of all ctors void Init(); @@ -148,8 +142,8 @@ protected: void ChangePage(int nOldSel, int nSel); // change pages void MacSetupTabs(); - wxImageList *m_pImageList; // we can have an associated image list - wxArrayPages m_aPages; // array of pages +// wxImageList *m_pImageList; // we can have an associated image list +// wxArrayPages m_aPages; // array of pages int m_nSelection; // the current selection (-1 if none) diff --git a/include/wx/mac/radiobox.h b/include/wx/mac/radiobox.h index 514ef7f849..665635334b 100644 --- a/include/wx/mac/radiobox.h +++ b/include/wx/mac/radiobox.h @@ -43,21 +43,25 @@ public: const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); // Specific functions (in wxWindows2 reference) + virtual void SetSelection(int item); + virtual int GetSelection() const; + + inline virtual int GetCount() const { return m_noItems; } ; + + virtual wxString GetString(int item) const; + virtual void SetString(int item, const wxString& label) ; + + virtual void Enable(int item, bool enable); + virtual void Show(int item, bool show) ; + + virtual int GetColumnCount() const ; + virtual int GetRowCount() const ; + + bool Enable(bool enable); - void Enable(int item, bool enable); - int FindString(const wxString& s) const; wxString GetLabel() const; - wxString GetLabel(int item) const; - int GetSelection() const; - wxString GetString(int item) const; - virtual wxString GetStringSelection() const; - inline virtual int GetCount() const { return m_noItems; } ; void SetLabel(const wxString& label) ; - void SetLabel(int item, const wxString& label) ; - void SetSelection(int item); - virtual bool SetStringSelection(const wxString& s); bool Show(bool show); - void Show(int item, bool show) ; // Other external functions void Command(wxCommandEvent& event); @@ -79,8 +83,6 @@ protected: virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - int GetNumHor() const; - int GetNumVer() const; DECLARE_EVENT_TABLE() }; diff --git a/include/wx/mac/setup.h b/include/wx/mac/setup.h index a618ed3f89..a3bca25ad4 100644 --- a/include/wx/mac/setup.h +++ b/include/wx/mac/setup.h @@ -414,7 +414,7 @@ #define wxUSE_STATTEXT 1 // wxStaticText #define wxUSE_STATBMP 1 // wxStaticBitmap #define wxUSE_TEXTCTRL 1 // wxTextCtrl -#define wxUSE_TOGGLEBTN 1 // requires wxButton +#define wxUSE_TOGGLEBTN 0 // requires wxButton #define wxUSE_TREECTRL 1 // wxTreeCtrl // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR @@ -546,15 +546,6 @@ // common dialogs // ---------------------------------------------------------------------------- -// Define 1 to use generic dialogs in Windows, even though they duplicate -// native common dialog (e.g. wxColourDialog). This is mainly useful for -// testing. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_GENERIC_DIALOGS_IN_MSW 0 - // On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. // file selector, printer dialog). Switching this off also switches off the // printing architecture and interactive wxPrinterDC. @@ -717,17 +708,6 @@ #define wxUSE_SPLINES 1 // 0 for no splines -#define wxUSE_XPM_IN_MSW 1 - // 0 for no XPM support in wxBitmap. - // Default is 1, as XPM is now fully - // supported this makes easier the issue - // of portable icons and bitmaps. - -#define wxUSE_IMAGE_LOADING_IN_MSW 1 - // Use dynamic DIB loading/saving code in utils/dib under MSW. -#define wxUSE_RESOURCE_LOADING_IN_MSW 1 - // Use dynamic icon/cursor loading/saving code - // under MSW. #define wxUSE_WX_RESOURCES 1 // Use .wxr resource mechanism (requires PrologIO library) @@ -744,10 +724,6 @@ // Set to 1 to use font metric files in GetTextExtent #define wxUSE_AFM_FOR_POSTSCRIPT 0 -// Set to 0 to disable PostScript print/preview architecture code under Windows -// (just use Windows printing). -#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 - // ---------------------------------------------------------------------------- // database classes // ---------------------------------------------------------------------------- diff --git a/src/mac/app.cpp b/src/mac/app.cpp index 55df1bd41e..d03b4244fd 100644 --- a/src/mac/app.cpp +++ b/src/mac/app.cpp @@ -900,11 +900,13 @@ bool wxYield() #endif EventRecord event ; - long sleepTime = 0 ; //::GetCaretTime(); + long sleepTime = 1 ; //::GetCaretTime(); while ( !wxTheApp->IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, wxApp::s_macCursorRgn)) { wxTheApp->MacHandleOneEvent( &event ); + if ( event.what != kHighLevelEvent ) + SetRectRgn( wxApp::s_macCursorRgn , event.where.h , event.where.v , event.where.h + 1 , event.where.v + 1 ) ; } wxMacProcessNotifierAndPendingEvents() ; diff --git a/src/mac/bitmap.cpp b/src/mac/bitmap.cpp index 1a59104b9e..fd0f461f17 100644 --- a/src/mac/bitmap.cpp +++ b/src/mac/bitmap.cpp @@ -26,6 +26,8 @@ #if !USE_SHARED_LIBRARIES IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject) +IMPLEMENT_ABSTRACT_CLASS(wxBitmapBase , wxGDIObject ) +IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandlerBase, wxObject ) #endif #ifdef __UNIX__ @@ -241,6 +243,12 @@ wxBitmapRefData::~wxBitmapRefData() wxList wxBitmap::sm_handlers; + +bool wxBitmap::CopyFromIcon(const wxIcon& icon) +{ + Ref(icon) ; +} + wxBitmap::wxBitmap() { m_refData = NULL; diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index 55df1bd41e..d03b4244fd 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -900,11 +900,13 @@ bool wxYield() #endif EventRecord event ; - long sleepTime = 0 ; //::GetCaretTime(); + long sleepTime = 1 ; //::GetCaretTime(); while ( !wxTheApp->IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, wxApp::s_macCursorRgn)) { wxTheApp->MacHandleOneEvent( &event ); + if ( event.what != kHighLevelEvent ) + SetRectRgn( wxApp::s_macCursorRgn , event.where.h , event.where.v , event.where.h + 1 , event.where.v + 1 ) ; } wxMacProcessNotifierAndPendingEvents() ; diff --git a/src/mac/carbon/bitmap.cpp b/src/mac/carbon/bitmap.cpp index 1a59104b9e..fd0f461f17 100644 --- a/src/mac/carbon/bitmap.cpp +++ b/src/mac/carbon/bitmap.cpp @@ -26,6 +26,8 @@ #if !USE_SHARED_LIBRARIES IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject) +IMPLEMENT_ABSTRACT_CLASS(wxBitmapBase , wxGDIObject ) +IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandlerBase, wxObject ) #endif #ifdef __UNIX__ @@ -241,6 +243,12 @@ wxBitmapRefData::~wxBitmapRefData() wxList wxBitmap::sm_handlers; + +bool wxBitmap::CopyFromIcon(const wxIcon& icon) +{ + Ref(icon) ; +} + wxBitmap::wxBitmap() { m_refData = NULL; diff --git a/src/mac/carbon/icon.cpp b/src/mac/carbon/icon.cpp index 7bfb1d8309..26cb83e93c 100644 --- a/src/mac/carbon/icon.cpp +++ b/src/mac/carbon/icon.cpp @@ -61,7 +61,7 @@ bool wxIcon::LoadFile(const wxString& filename, long type, m_refData = new wxBitmapRefData; - wxBitmapHandler *handler = FindHandler(type); + wxBitmapHandler *handler = FindHandler((wxBitmapType)type); if ( handler ) return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight); diff --git a/src/mac/carbon/menu.cpp b/src/mac/carbon/menu.cpp index fe599686ad..3e6277ac5b 100644 --- a/src/mac/carbon/menu.cpp +++ b/src/mac/carbon/menu.cpp @@ -347,22 +347,6 @@ bool wxMenu::ProcessCommand(wxCommandEvent & event) // other // --------------------------------------------------------------------------- -void wxMenu::Attach(wxMenuBar *menubar) -{ - // menu can be in at most one menubar because otherwise they would both - // delete the menu pointer - wxASSERT_MSG( !m_menuBar, wxT("menu belongs to 2 menubars, expect a crash") ); - - m_menuBar = menubar; -} - -void wxMenu::Detach() -{ - wxASSERT_MSG( m_menuBar, wxT("can't detach menu if it's not attached") ); - - m_menuBar = NULL; -} - wxWindow *wxMenu::GetWindow() const { if ( m_invokingWindow != NULL ) @@ -979,8 +963,6 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title) if ( !wxMenuBarBase::Append(menu, title) ) return FALSE; - menu->Attach(this); - m_titles.Add(title); if ( IsAttached() ) @@ -1004,11 +986,14 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title) return TRUE; } -void wxMenuBar::Attach(wxFrame *frame) +void wxMenuBar::Detach() { -// wxASSERT_MSG( !IsAttached(), wxT("menubar already attached!") ); + wxMenuBarBase::Detach() ; +} - m_menuBarFrame = frame; +void wxMenuBar::Attach(wxFrame *frame) +{ + wxMenuBarBase::Attach( frame ) ; #if wxUSE_ACCEL RebuildAccelTable(); diff --git a/src/mac/carbon/notebmac.cpp b/src/mac/carbon/notebmac.cpp index 686a969462..6e94d28049 100644 --- a/src/mac/carbon/notebmac.cpp +++ b/src/mac/carbon/notebmac.cpp @@ -80,7 +80,6 @@ void wxNotebook::Init() m_macHorizontalBorder = 7; m_macVerticalBorder = 8; #endif - m_pImageList = NULL; m_nSelection = -1; } @@ -132,14 +131,17 @@ wxNotebook::~wxNotebook() // ---------------------------------------------------------------------------- // wxNotebook accessors // ---------------------------------------------------------------------------- -int wxNotebook::GetPageCount() const + +void wxNotebook::SetPadding(const wxSize& padding) +{ +} + +void wxNotebook::SetTabSize(const wxSize& sz) { - return m_aPages.Count(); } -int wxNotebook::GetRowCount() const +void wxNotebook::SetPageSize(const wxSize& size) { - return 1; } int wxNotebook::SetSelection(int nPage) @@ -152,24 +154,11 @@ int wxNotebook::SetSelection(int nPage) return m_nSelection; } -void wxNotebook::AdvanceSelection(bool bForward) -{ - if (GetPageCount() == 0) { - return; - } - int nSel = GetSelection(); - int nMax = GetPageCount() - 1; - if ( bForward ) - SetSelection(nSel == nMax ? 0 : nSel + 1); - else - SetSelection(nSel == 0 ? nMax : nSel - 1); -} - bool wxNotebook::SetPageText(int nPage, const wxString& strText) { wxASSERT( IS_VALID_PAGE(nPage) ); - wxNotebookPage *page = m_aPages[nPage]; + wxNotebookPage *page = m_pages[nPage]; page->SetLabel(strText); MacSetupTabs(); @@ -180,7 +169,7 @@ wxString wxNotebook::GetPageText(int nPage) const { wxASSERT( IS_VALID_PAGE(nPage) ); - wxNotebookPage *page = m_aPages[nPage]; + wxNotebookPage *page = m_pages[nPage]; return page->GetLabel(); } @@ -200,23 +189,16 @@ bool wxNotebook::SetPageImage(int nPage, int nImage) return FALSE; } -void wxNotebook::SetImageList(wxImageList* imageList) -{ - m_pImageList = imageList; - // TODO -} - // ---------------------------------------------------------------------------- // wxNotebook operations // ---------------------------------------------------------------------------- -// remove one page from the notebook -bool wxNotebook::DeletePage(int nPage) +// remove one page from the notebook, without deleting the window +wxNotebookPage* wxNotebook::DoRemovePage(int nPage) { - wxCHECK( IS_VALID_PAGE(nPage), FALSE ); - - delete m_aPages[nPage]; - m_aPages.Remove(nPage); + wxCHECK( IS_VALID_PAGE(nPage), NULL ); + wxNotebookPage* page = m_pages[nPage] ; + m_pages.Remove(nPage); MacSetupTabs(); @@ -224,20 +206,9 @@ bool wxNotebook::DeletePage(int nPage) m_nSelection = GetPageCount() - 1; } if(m_nSelection >= 0) { - m_aPages[m_nSelection]->Show(true); + m_pages[m_nSelection]->Show(true); } - - return true; -} - -// remove one page from the notebook, without deleting the window -bool wxNotebook::RemovePage(int nPage) -{ - wxCHECK( IS_VALID_PAGE(nPage), FALSE ); - - m_aPages.Remove(nPage); - - return TRUE; + return page; } // remove all pages @@ -245,26 +216,12 @@ bool wxNotebook::DeleteAllPages() { // TODO: delete native widget pages - int nPageCount = GetPageCount(); - int nPage; - for ( nPage = 0; nPage < nPageCount; nPage++ ) - delete m_aPages[nPage]; - - m_aPages.Clear(); - + WX_CLEAR_ARRAY(m_pages) ; MacSetupTabs(); return TRUE; } -// add a page to the notebook -bool wxNotebook::AddPage(wxNotebookPage *pPage, - const wxString& strText, - bool bSelect, - int imageId) -{ - return InsertPage(GetPageCount(), pPage, strText, bSelect, imageId); -} // same as AddPage() but does it at given position bool wxNotebook::InsertPage(int nPage, @@ -279,7 +236,7 @@ bool wxNotebook::InsertPage(int nPage, pPage->SetLabel(strText); // save the pointer to the page - m_aPages.Insert(pPage, nPage); + m_pages.Insert(pPage, nPage); MacSetupTabs(); @@ -321,7 +278,7 @@ void wxNotebook::MacSetupTabs() Boolean enabled = true; for(int ii = 0; ii < GetPageCount(); ii++) { - page = m_aPages[ii]; + page = m_pages[ii]; info.version = 0; info.iconSuiteID = 0; #if TARGET_CARBON @@ -366,9 +323,9 @@ void wxNotebook::OnSize(wxSizeEvent& event) int w, h; GetSize(&w, &h); - unsigned int nCount = m_aPages.Count(); + unsigned int nCount = m_pages.Count(); for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) { - wxNotebookPage *pPage = m_aPages[nPage]; + wxNotebookPage *pPage = m_pages[nPage]; pPage->SetSize(kwxMacTabLeftMargin, kwxMacTabTopMargin, w - kwxMacTabLeftMargin - kwxMacTabRightMargin, h - kwxMacTabTopMargin - kwxMacTabBottomMargin ); @@ -395,7 +352,7 @@ void wxNotebook::OnSetFocus(wxFocusEvent& event) { // set focus to the currently selected page if any if ( m_nSelection != -1 ) - m_aPages[m_nSelection]->SetFocus(); + m_pages[m_nSelection]->SetFocus(); event.Skip(); } @@ -448,7 +405,7 @@ void wxNotebook::ChangePage(int nOldSel, int nSel) // and it may happen - just do nothing if ( nSel == nOldSel ) { - wxNotebookPage *pPage = m_aPages[nSel]; + wxNotebookPage *pPage = m_pages[nSel]; pPage->Show(FALSE); pPage->Show(TRUE); pPage->SetFocus(); @@ -457,10 +414,10 @@ void wxNotebook::ChangePage(int nOldSel, int nSel) // Hide previous page if ( nOldSel != -1 ) { - m_aPages[nOldSel]->Show(FALSE); + m_pages[nOldSel]->Show(FALSE); } - wxNotebookPage *pPage = m_aPages[nSel]; + wxNotebookPage *pPage = m_pages[nSel]; pPage->Show(TRUE); pPage->SetFocus(); diff --git a/src/mac/carbon/radiobox.cpp b/src/mac/carbon/radiobox.cpp index c7bf4dce28..cafbf2ed98 100644 --- a/src/mac/carbon/radiobox.cpp +++ b/src/mac/carbon/radiobox.cpp @@ -181,28 +181,6 @@ void wxRadioBox::Enable(int item, bool enable) } } - -//------------------------------------------------------------------------------------- -// ¥ FindString -//------------------------------------------------------------------------------------- -// Finds a button matching the given string, returning the position if found -// or -1 if not found - -int wxRadioBox::FindString(const wxString& s) const -{ - int i; - wxRadioButton *current; - - current=m_radioButtonCycle; - for (i = 0; i < m_noItems; i++) - { - if (s == current->GetLabel()) - return i; - current=current->NextInCycle(); - } - return -1; -} - //------------------------------------------------------------------------------------- // ¥ GetLabel() //------------------------------------------------------------------------------------- @@ -218,7 +196,7 @@ wxString wxRadioBox::GetLabel() const //------------------------------------------------------------------------------------- // Returns the label for the given button -wxString wxRadioBox::GetLabel(int item) const +wxString wxRadioBox::GetString(int item) const { int i; wxRadioButton *current; @@ -254,31 +232,6 @@ int wxRadioBox::GetSelection() const return i; } -//------------------------------------------------------------------------------------- -// ¥ GetString -//------------------------------------------------------------------------------------- -// Find string for position - -wxString wxRadioBox::GetString(int item) const -{ - - return GetLabel(item); -} - -//------------------------------------------------------------------------------------- -// ¥ GetStringSelection -//------------------------------------------------------------------------------------- -// Returns the selected string - -wxString wxRadioBox::GetStringSelection () const -{ - int sel = GetSelection (); - if (sel > -1) - return this->GetString (sel); - else - return wxString(""); -} - //------------------------------------------------------------------------------------- // ¥ Number //------------------------------------------------------------------------------------- @@ -302,7 +255,7 @@ void wxRadioBox::SetLabel(const wxString& label) //------------------------------------------------------------------------------------- // Sets the label of a given button -void wxRadioBox::SetLabel(int item,const wxString& label) +void wxRadioBox::SetString(int item,const wxString& label) { int i; wxRadioButton *current; @@ -341,24 +294,6 @@ void wxRadioBox::SetSelection(int item) } -//------------------------------------------------------------------------------------- -// ¥ SetStringSelection -//------------------------------------------------------------------------------------- -// Sets a button by passing the desired string. This does not cause -// wxEVT_COMMAND_RADIOBOX_SELECTED event to get emitted - -bool wxRadioBox::SetStringSelection (const wxString& s) -{ - int sel = FindString (s); - if (sel > -1) - { - SetSelection (sel); - return TRUE; - } - else - return FALSE; -} - //------------------------------------------------------------------------------------- // ¥ Show(bool) //------------------------------------------------------------------------------------- @@ -479,15 +414,15 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) maxHeight=-1; for (i = 0 ; i < m_noItems; i++) { - GetTextExtent(GetLabel(i), &eachWidth[i], &eachHeight[i]); + GetTextExtent(GetString(i), &eachWidth[i], &eachHeight[i]); eachWidth[i] = (int)(eachWidth[i] + RADIO_SIZE); eachHeight[i] = (int)((3*eachHeight[i])/2); if (maxWidthProcessEvent(event); } void wxSpinButton::SetRange(int minVal, int maxVal) diff --git a/src/mac/carbon/spinctrl.cpp b/src/mac/carbon/spinctrl.cpp index 54384ccb1c..31aca32843 100644 --- a/src/mac/carbon/spinctrl.cpp +++ b/src/mac/carbon/spinctrl.cpp @@ -23,7 +23,7 @@ // wxSpinCtrl //----------------------------------------------------------------------------- -#if wxUSE_SPINBTN +#if wxUSE_SPINBTN && !defined(__WXMAC__) #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl,wxControl) diff --git a/src/mac/carbon/statbmp.cpp b/src/mac/carbon/statbmp.cpp index 03f68a2ea7..1605258450 100644 --- a/src/mac/carbon/statbmp.cpp +++ b/src/mac/carbon/statbmp.cpp @@ -19,7 +19,7 @@ #include "wx/dcclient.h" #if !USE_SHARED_LIBRARY -IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxStaticBitmapBase) +IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl) #endif /* diff --git a/src/mac/carbon/stattext.cpp b/src/mac/carbon/stattext.cpp index 68e1453ba8..6439400bf3 100644 --- a/src/mac/carbon/stattext.cpp +++ b/src/mac/carbon/stattext.cpp @@ -23,7 +23,7 @@ #include #if !USE_SHARED_LIBRARY -IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxStaticTextBase) +IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl) #endif #include diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index 9a2c72ef33..0724fe9da9 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -107,7 +107,16 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, MacPreControlCreate( parent , id , "" , pos , mySize ,style, validator , name , &bounds , title ) ; - m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , false , 0 , 0 , 1, + if ( m_windowStyle & wxTE_MULTILINE ) + { + wxASSERT_MSG( !(m_windowStyle & wxTE_PROCESS_ENTER), + wxT("wxTE_PROCESS_ENTER style is ignored for multiline text controls (they always process it)") ); + + m_windowStyle |= wxTE_PROCESS_ENTER; + } + + + m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1, ( style & wxTE_PASSWORD ) ? kControlEditTextPasswordProc : kControlEditTextProc , (long) this ) ; MacPostControlCreate() ; @@ -653,7 +662,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) keychar = short(ev->message & charCodeMask); keycode = short(ev->message & keyCodeMask) >> 8 ; UMAHandleControlKey( m_macControl , keycode , keychar , ev->modifiers ) ; - if ( keychar >= 0x20 || event.KeyCode() == WXK_RETURN) + if ( keychar >= 0x20 || event.KeyCode() == WXK_RETURN || event.KeyCode() == WXK_DELETE || event.KeyCode() == WXK_BACK) { wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId); event.SetString( GetValue() ) ; diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 1dc5b4e6ae..62f65318ea 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -296,6 +296,11 @@ void wxWindow::CaptureMouse() wxTheApp->s_captureWindow = this ; } +wxWindow* wxWindowBase::GetCapture() +{ + return wxTheApp->s_captureWindow ; +} + void wxWindow::ReleaseMouse() { wxTheApp->s_captureWindow = NULL ; diff --git a/src/mac/icon.cpp b/src/mac/icon.cpp index 7bfb1d8309..26cb83e93c 100644 --- a/src/mac/icon.cpp +++ b/src/mac/icon.cpp @@ -61,7 +61,7 @@ bool wxIcon::LoadFile(const wxString& filename, long type, m_refData = new wxBitmapRefData; - wxBitmapHandler *handler = FindHandler(type); + wxBitmapHandler *handler = FindHandler((wxBitmapType)type); if ( handler ) return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight); diff --git a/src/mac/menu.cpp b/src/mac/menu.cpp index fe599686ad..3e6277ac5b 100644 --- a/src/mac/menu.cpp +++ b/src/mac/menu.cpp @@ -347,22 +347,6 @@ bool wxMenu::ProcessCommand(wxCommandEvent & event) // other // --------------------------------------------------------------------------- -void wxMenu::Attach(wxMenuBar *menubar) -{ - // menu can be in at most one menubar because otherwise they would both - // delete the menu pointer - wxASSERT_MSG( !m_menuBar, wxT("menu belongs to 2 menubars, expect a crash") ); - - m_menuBar = menubar; -} - -void wxMenu::Detach() -{ - wxASSERT_MSG( m_menuBar, wxT("can't detach menu if it's not attached") ); - - m_menuBar = NULL; -} - wxWindow *wxMenu::GetWindow() const { if ( m_invokingWindow != NULL ) @@ -979,8 +963,6 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title) if ( !wxMenuBarBase::Append(menu, title) ) return FALSE; - menu->Attach(this); - m_titles.Add(title); if ( IsAttached() ) @@ -1004,11 +986,14 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title) return TRUE; } -void wxMenuBar::Attach(wxFrame *frame) +void wxMenuBar::Detach() { -// wxASSERT_MSG( !IsAttached(), wxT("menubar already attached!") ); + wxMenuBarBase::Detach() ; +} - m_menuBarFrame = frame; +void wxMenuBar::Attach(wxFrame *frame) +{ + wxMenuBarBase::Attach( frame ) ; #if wxUSE_ACCEL RebuildAccelTable(); diff --git a/src/mac/notebmac.cpp b/src/mac/notebmac.cpp index 686a969462..6e94d28049 100644 --- a/src/mac/notebmac.cpp +++ b/src/mac/notebmac.cpp @@ -80,7 +80,6 @@ void wxNotebook::Init() m_macHorizontalBorder = 7; m_macVerticalBorder = 8; #endif - m_pImageList = NULL; m_nSelection = -1; } @@ -132,14 +131,17 @@ wxNotebook::~wxNotebook() // ---------------------------------------------------------------------------- // wxNotebook accessors // ---------------------------------------------------------------------------- -int wxNotebook::GetPageCount() const + +void wxNotebook::SetPadding(const wxSize& padding) +{ +} + +void wxNotebook::SetTabSize(const wxSize& sz) { - return m_aPages.Count(); } -int wxNotebook::GetRowCount() const +void wxNotebook::SetPageSize(const wxSize& size) { - return 1; } int wxNotebook::SetSelection(int nPage) @@ -152,24 +154,11 @@ int wxNotebook::SetSelection(int nPage) return m_nSelection; } -void wxNotebook::AdvanceSelection(bool bForward) -{ - if (GetPageCount() == 0) { - return; - } - int nSel = GetSelection(); - int nMax = GetPageCount() - 1; - if ( bForward ) - SetSelection(nSel == nMax ? 0 : nSel + 1); - else - SetSelection(nSel == 0 ? nMax : nSel - 1); -} - bool wxNotebook::SetPageText(int nPage, const wxString& strText) { wxASSERT( IS_VALID_PAGE(nPage) ); - wxNotebookPage *page = m_aPages[nPage]; + wxNotebookPage *page = m_pages[nPage]; page->SetLabel(strText); MacSetupTabs(); @@ -180,7 +169,7 @@ wxString wxNotebook::GetPageText(int nPage) const { wxASSERT( IS_VALID_PAGE(nPage) ); - wxNotebookPage *page = m_aPages[nPage]; + wxNotebookPage *page = m_pages[nPage]; return page->GetLabel(); } @@ -200,23 +189,16 @@ bool wxNotebook::SetPageImage(int nPage, int nImage) return FALSE; } -void wxNotebook::SetImageList(wxImageList* imageList) -{ - m_pImageList = imageList; - // TODO -} - // ---------------------------------------------------------------------------- // wxNotebook operations // ---------------------------------------------------------------------------- -// remove one page from the notebook -bool wxNotebook::DeletePage(int nPage) +// remove one page from the notebook, without deleting the window +wxNotebookPage* wxNotebook::DoRemovePage(int nPage) { - wxCHECK( IS_VALID_PAGE(nPage), FALSE ); - - delete m_aPages[nPage]; - m_aPages.Remove(nPage); + wxCHECK( IS_VALID_PAGE(nPage), NULL ); + wxNotebookPage* page = m_pages[nPage] ; + m_pages.Remove(nPage); MacSetupTabs(); @@ -224,20 +206,9 @@ bool wxNotebook::DeletePage(int nPage) m_nSelection = GetPageCount() - 1; } if(m_nSelection >= 0) { - m_aPages[m_nSelection]->Show(true); + m_pages[m_nSelection]->Show(true); } - - return true; -} - -// remove one page from the notebook, without deleting the window -bool wxNotebook::RemovePage(int nPage) -{ - wxCHECK( IS_VALID_PAGE(nPage), FALSE ); - - m_aPages.Remove(nPage); - - return TRUE; + return page; } // remove all pages @@ -245,26 +216,12 @@ bool wxNotebook::DeleteAllPages() { // TODO: delete native widget pages - int nPageCount = GetPageCount(); - int nPage; - for ( nPage = 0; nPage < nPageCount; nPage++ ) - delete m_aPages[nPage]; - - m_aPages.Clear(); - + WX_CLEAR_ARRAY(m_pages) ; MacSetupTabs(); return TRUE; } -// add a page to the notebook -bool wxNotebook::AddPage(wxNotebookPage *pPage, - const wxString& strText, - bool bSelect, - int imageId) -{ - return InsertPage(GetPageCount(), pPage, strText, bSelect, imageId); -} // same as AddPage() but does it at given position bool wxNotebook::InsertPage(int nPage, @@ -279,7 +236,7 @@ bool wxNotebook::InsertPage(int nPage, pPage->SetLabel(strText); // save the pointer to the page - m_aPages.Insert(pPage, nPage); + m_pages.Insert(pPage, nPage); MacSetupTabs(); @@ -321,7 +278,7 @@ void wxNotebook::MacSetupTabs() Boolean enabled = true; for(int ii = 0; ii < GetPageCount(); ii++) { - page = m_aPages[ii]; + page = m_pages[ii]; info.version = 0; info.iconSuiteID = 0; #if TARGET_CARBON @@ -366,9 +323,9 @@ void wxNotebook::OnSize(wxSizeEvent& event) int w, h; GetSize(&w, &h); - unsigned int nCount = m_aPages.Count(); + unsigned int nCount = m_pages.Count(); for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) { - wxNotebookPage *pPage = m_aPages[nPage]; + wxNotebookPage *pPage = m_pages[nPage]; pPage->SetSize(kwxMacTabLeftMargin, kwxMacTabTopMargin, w - kwxMacTabLeftMargin - kwxMacTabRightMargin, h - kwxMacTabTopMargin - kwxMacTabBottomMargin ); @@ -395,7 +352,7 @@ void wxNotebook::OnSetFocus(wxFocusEvent& event) { // set focus to the currently selected page if any if ( m_nSelection != -1 ) - m_aPages[m_nSelection]->SetFocus(); + m_pages[m_nSelection]->SetFocus(); event.Skip(); } @@ -448,7 +405,7 @@ void wxNotebook::ChangePage(int nOldSel, int nSel) // and it may happen - just do nothing if ( nSel == nOldSel ) { - wxNotebookPage *pPage = m_aPages[nSel]; + wxNotebookPage *pPage = m_pages[nSel]; pPage->Show(FALSE); pPage->Show(TRUE); pPage->SetFocus(); @@ -457,10 +414,10 @@ void wxNotebook::ChangePage(int nOldSel, int nSel) // Hide previous page if ( nOldSel != -1 ) { - m_aPages[nOldSel]->Show(FALSE); + m_pages[nOldSel]->Show(FALSE); } - wxNotebookPage *pPage = m_aPages[nSel]; + wxNotebookPage *pPage = m_pages[nSel]; pPage->Show(TRUE); pPage->SetFocus(); diff --git a/src/mac/radiobox.cpp b/src/mac/radiobox.cpp index c7bf4dce28..cafbf2ed98 100644 --- a/src/mac/radiobox.cpp +++ b/src/mac/radiobox.cpp @@ -181,28 +181,6 @@ void wxRadioBox::Enable(int item, bool enable) } } - -//------------------------------------------------------------------------------------- -// ¥ FindString -//------------------------------------------------------------------------------------- -// Finds a button matching the given string, returning the position if found -// or -1 if not found - -int wxRadioBox::FindString(const wxString& s) const -{ - int i; - wxRadioButton *current; - - current=m_radioButtonCycle; - for (i = 0; i < m_noItems; i++) - { - if (s == current->GetLabel()) - return i; - current=current->NextInCycle(); - } - return -1; -} - //------------------------------------------------------------------------------------- // ¥ GetLabel() //------------------------------------------------------------------------------------- @@ -218,7 +196,7 @@ wxString wxRadioBox::GetLabel() const //------------------------------------------------------------------------------------- // Returns the label for the given button -wxString wxRadioBox::GetLabel(int item) const +wxString wxRadioBox::GetString(int item) const { int i; wxRadioButton *current; @@ -254,31 +232,6 @@ int wxRadioBox::GetSelection() const return i; } -//------------------------------------------------------------------------------------- -// ¥ GetString -//------------------------------------------------------------------------------------- -// Find string for position - -wxString wxRadioBox::GetString(int item) const -{ - - return GetLabel(item); -} - -//------------------------------------------------------------------------------------- -// ¥ GetStringSelection -//------------------------------------------------------------------------------------- -// Returns the selected string - -wxString wxRadioBox::GetStringSelection () const -{ - int sel = GetSelection (); - if (sel > -1) - return this->GetString (sel); - else - return wxString(""); -} - //------------------------------------------------------------------------------------- // ¥ Number //------------------------------------------------------------------------------------- @@ -302,7 +255,7 @@ void wxRadioBox::SetLabel(const wxString& label) //------------------------------------------------------------------------------------- // Sets the label of a given button -void wxRadioBox::SetLabel(int item,const wxString& label) +void wxRadioBox::SetString(int item,const wxString& label) { int i; wxRadioButton *current; @@ -341,24 +294,6 @@ void wxRadioBox::SetSelection(int item) } -//------------------------------------------------------------------------------------- -// ¥ SetStringSelection -//------------------------------------------------------------------------------------- -// Sets a button by passing the desired string. This does not cause -// wxEVT_COMMAND_RADIOBOX_SELECTED event to get emitted - -bool wxRadioBox::SetStringSelection (const wxString& s) -{ - int sel = FindString (s); - if (sel > -1) - { - SetSelection (sel); - return TRUE; - } - else - return FALSE; -} - //------------------------------------------------------------------------------------- // ¥ Show(bool) //------------------------------------------------------------------------------------- @@ -479,15 +414,15 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) maxHeight=-1; for (i = 0 ; i < m_noItems; i++) { - GetTextExtent(GetLabel(i), &eachWidth[i], &eachHeight[i]); + GetTextExtent(GetString(i), &eachWidth[i], &eachHeight[i]); eachWidth[i] = (int)(eachWidth[i] + RADIO_SIZE); eachHeight[i] = (int)((3*eachHeight[i])/2); if (maxWidthProcessEvent(event); } void wxSpinButton::SetRange(int minVal, int maxVal) diff --git a/src/mac/spinctrl.cpp b/src/mac/spinctrl.cpp index 54384ccb1c..31aca32843 100644 --- a/src/mac/spinctrl.cpp +++ b/src/mac/spinctrl.cpp @@ -23,7 +23,7 @@ // wxSpinCtrl //----------------------------------------------------------------------------- -#if wxUSE_SPINBTN +#if wxUSE_SPINBTN && !defined(__WXMAC__) #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl,wxControl) diff --git a/src/mac/statbmp.cpp b/src/mac/statbmp.cpp index 03f68a2ea7..1605258450 100644 --- a/src/mac/statbmp.cpp +++ b/src/mac/statbmp.cpp @@ -19,7 +19,7 @@ #include "wx/dcclient.h" #if !USE_SHARED_LIBRARY -IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxStaticBitmapBase) +IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl) #endif /* diff --git a/src/mac/stattext.cpp b/src/mac/stattext.cpp index 68e1453ba8..6439400bf3 100644 --- a/src/mac/stattext.cpp +++ b/src/mac/stattext.cpp @@ -23,7 +23,7 @@ #include #if !USE_SHARED_LIBRARY -IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxStaticTextBase) +IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl) #endif #include diff --git a/src/mac/textctrl.cpp b/src/mac/textctrl.cpp index 9a2c72ef33..0724fe9da9 100644 --- a/src/mac/textctrl.cpp +++ b/src/mac/textctrl.cpp @@ -107,7 +107,16 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, MacPreControlCreate( parent , id , "" , pos , mySize ,style, validator , name , &bounds , title ) ; - m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , false , 0 , 0 , 1, + if ( m_windowStyle & wxTE_MULTILINE ) + { + wxASSERT_MSG( !(m_windowStyle & wxTE_PROCESS_ENTER), + wxT("wxTE_PROCESS_ENTER style is ignored for multiline text controls (they always process it)") ); + + m_windowStyle |= wxTE_PROCESS_ENTER; + } + + + m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1, ( style & wxTE_PASSWORD ) ? kControlEditTextPasswordProc : kControlEditTextProc , (long) this ) ; MacPostControlCreate() ; @@ -653,7 +662,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) keychar = short(ev->message & charCodeMask); keycode = short(ev->message & keyCodeMask) >> 8 ; UMAHandleControlKey( m_macControl , keycode , keychar , ev->modifiers ) ; - if ( keychar >= 0x20 || event.KeyCode() == WXK_RETURN) + if ( keychar >= 0x20 || event.KeyCode() == WXK_RETURN || event.KeyCode() == WXK_DELETE || event.KeyCode() == WXK_BACK) { wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId); event.SetString( GetValue() ) ; diff --git a/src/mac/window.cpp b/src/mac/window.cpp index 1dc5b4e6ae..62f65318ea 100644 --- a/src/mac/window.cpp +++ b/src/mac/window.cpp @@ -296,6 +296,11 @@ void wxWindow::CaptureMouse() wxTheApp->s_captureWindow = this ; } +wxWindow* wxWindowBase::GetCapture() +{ + return wxTheApp->s_captureWindow ; +} + void wxWindow::ReleaseMouse() { wxTheApp->s_captureWindow = NULL ; -- 2.45.2