From: Stefan Csomor Date: Thu, 13 Jan 2000 07:57:22 +0000 (+0000) Subject: adaptions for CW Pro 5.3 on mac X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4765d335f603c29f1fd300288ff1d40a118fcf0e adaptions for CW Pro 5.3 on mac git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5365 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/mac/button.h b/include/wx/mac/button.h index d581f9a97b..b016c98338 100644 --- a/include/wx/mac/button.h +++ b/include/wx/mac/button.h @@ -48,7 +48,7 @@ class WXDLLEXPORT wxButton: public wxControl virtual void SetDefault(); virtual void Command(wxCommandEvent& event); protected: - virtual wxSize DoGetBestSize(); + virtual wxSize DoGetBestSize() const ; }; #endif diff --git a/include/wx/mac/control.h b/include/wx/mac/control.h index 3770d647f2..713f91fd09 100644 --- a/include/wx/mac/control.h +++ b/include/wx/mac/control.h @@ -16,6 +16,8 @@ #pragma interface "control.h" #endif +WXDLLEXPORT_DATA(extern const wxChar*) wxControlNameStr; + // General item class class WXDLLEXPORT wxControl : public wxControlBase { @@ -25,6 +27,12 @@ public: wxControl(); virtual ~wxControl(); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxControlNameStr); + // Simulates an event virtual void Command(wxCommandEvent& event) { ProcessCommand(event); } @@ -88,7 +96,7 @@ protected: int m_macVerticalBorder ; wxList m_subControls; - virtual wxSize DoGetBestSize(); + virtual wxSize DoGetBestSize() const ; private: DECLARE_EVENT_TABLE() diff --git a/include/wx/mac/dc.h b/include/wx/mac/dc.h index 3075bbf734..82c959b4c7 100644 --- a/include/wx/mac/dc.h +++ b/include/wx/mac/dc.h @@ -168,6 +168,17 @@ class WXDLLEXPORT wxDC: public wxObject virtual void GetTextExtent( const wxString &string, long *width, long *height, long *descent = NULL, long *externalLeading = NULL, wxFont *theFont = NULL, bool use16 = FALSE ) const ; + virtual void GetTextExtent( const wxString &string, int *width, int *height, + int *descent = NULL, int *externalLeading = NULL, + wxFont *theFont = NULL, bool use16 = FALSE ) const + { + long lwidth,lheight,ldescent,lexternal ; + GetTextExtent( string, &lwidth,&lheight,&ldescent,&lexternal,theFont,use16 ) ; + *width = lwidth ; + *height = lheight ; + if (descent) *descent = ldescent ; + if (externalLeading) *externalLeading = lexternal ; + } virtual wxCoord GetCharWidth(void) const; virtual wxCoord GetCharHeight(void) const; diff --git a/include/wx/mac/listbox.h b/include/wx/mac/listbox.h index 96be3d0f0e..a312aec593 100644 --- a/include/wx/mac/listbox.h +++ b/include/wx/mac/listbox.h @@ -138,7 +138,7 @@ protected: int m_noItems; int m_selected; - virtual wxSize DoGetBestSize(); + virtual wxSize DoGetBestSize() const ; #if wxUSE_OWNER_DRAWN // control items diff --git a/include/wx/mac/notebook.h b/include/wx/mac/notebook.h index 0e43da55d8..aac5e6042e 100644 --- a/include/wx/mac/notebook.h +++ b/include/wx/mac/notebook.h @@ -34,27 +34,6 @@ class WXDLLEXPORT wxWindow; typedef wxWindow wxNotebookPage; // so far, any window can be a page WX_DEFINE_ARRAY(wxNotebookPage *, wxArrayPages); -// ---------------------------------------------------------------------------- -// notebook events -// ---------------------------------------------------------------------------- -class WXDLLEXPORT wxNotebookEvent : public wxCommandEvent -{ -public: - wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, - int nSel = -1, int nOldSel = -1) - : wxCommandEvent(commandType, id) { m_nSel = nSel; m_nOldSel = nOldSel; } - - // accessors - int GetSelection() const { return m_nSel; } - int GetOldSelection() const { return m_nOldSel; } - -private: - int m_nSel, // currently selected page - m_nOldSel; // previously selected page - - DECLARE_DYNAMIC_CLASS(wxNotebookEvent) -}; - // ---------------------------------------------------------------------------- // wxNotebook // ---------------------------------------------------------------------------- @@ -181,27 +160,5 @@ protected: DECLARE_EVENT_TABLE() }; -// ---------------------------------------------------------------------------- -// event macros -// ---------------------------------------------------------------------------- -typedef void (wxEvtHandler::*wxNotebookEventFunction)(wxNotebookEvent&); - -#define EVT_NOTEBOOK_PAGE_CHANGED(id, fn) \ - { \ - wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, \ - id, \ - -1, \ - (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \ - NULL \ - }, - -#define EVT_NOTEBOOK_PAGE_CHANGING(id, fn) \ - { \ - wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, \ \ - id, \ - -1, \ - (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \ - NULL \ - }, #endif // _WX_NOTEBOOK_H_ diff --git a/include/wx/mac/setup.h b/include/wx/mac/setup.h index 0a1df37e9a..bfb74aab4d 100644 --- a/include/wx/mac/setup.h +++ b/include/wx/mac/setup.h @@ -12,21 +12,128 @@ #ifndef _WX_SETUP_H_ #define _WX_SETUP_H_ -/* - * General features - * - */ +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library +#define wxUSE_GUI 1 +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 1.68 API: +// Level 0: no backward compatibility, all new features +// Level 1: some extra methods are defined for compatibility. +// +// Default is 0. +// +// Recommended setting: 0 (in fact the compatibility code is now very minimal +// so there is little advantage to setting it to 1. +#define WXWIN_COMPATIBILITY 0 + #define WORDS_BIGENDIAN 1 +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + + +// Set wxUSE_TIMEDATE to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. wxDateTime replaces the +// old wxTime and wxDate classes which are still provided for backwards +// compatibility (and implemented in terms of wxDateTime). +// +// Note that this class is relatively new and is still officially in alpha +// stage because some features are not yet (fully) implemented. It is already +// quite useful though and should only be disabled if you are aiming at +// absolutely minimal version of the library. +// +// Requires: wxUSE_LONGLONG +// +// Recommended setting: 1 +#define wxUSE_TIMEDATE 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 #define wxUSE_CONFIG 1 - // Use wxConfig, with CreateConfig in wxApp -#define WXWIN_COMPATIBILITY 0 - // Compatibility with 1.66 API. - // Level 0: no backward compatibility, all new features - // Level 1: wxDC, OnSize (etc.) compatibility, but - // some new features such as event tables +// ---------------------------------------------------------------------------- +// Optional controls +// ---------------------------------------------------------------------------- + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. Additionally, the generic toolbar class which +// supports some features which might not be supported by the native wxToolBar +// class may be compiled in if wxUSE_TOOLBAR_SIMPLE is 1. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE and 0 for +// wxUSE_TOOLBAR_SIMPLE (the default is 1 mainly for backwards compatibility). +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 +#define wxUSE_TOOLBAR_SIMPLE 0 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used ot logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + + +// The corresponding controls will be compiled in if wxUSE_ is set to +// 1 and not compiled into the library otherwise. +// +// Default is 1 for everything. +// +// Recommended setting: 1 (library might fail to compile for some combinations +// of disabled controls) +#define wxUSE_COMBOBOX 1 +#define wxUSE_CHOICE 1 +#define wxUSE_RADIOBTN 1 +#define wxUSE_RADIOBOX 1 +#define wxUSE_SCROLLBAR 1 +#define wxUSE_CHECKBOX 1 +#define wxUSE_LISTBOX 1 +#define wxUSE_SPINBTN 1 +#define wxUSE_SPINCTRL 1 +#define wxUSE_STATLINE 1 +#define wxUSE_CHECKLISTBOX 1 +#define wxUSE_CHOICE 1 +#define wxUSE_CARET 1 +#define wxUSE_SLIDER 1 + +// ---------------------------------------------------------------------------- +// Postscript support settings +// ---------------------------------------------------------------------------- + + #define wxUSE_POSTSCRIPT 0 // 0 for no PostScript device context #define wxUSE_AFM_FOR_POSTSCRIPT 0 diff --git a/include/wx/mac/spinbutt.h b/include/wx/mac/spinbutt.h index 3903eecb29..9909adfea9 100644 --- a/include/wx/mac/spinbutt.h +++ b/include/wx/mac/spinbutt.h @@ -65,7 +65,7 @@ public: virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ; protected: - virtual wxSize DoGetBestSize(); + virtual wxSize DoGetBestSize() const; int m_value ; private: diff --git a/include/wx/mac/statbmp.h b/include/wx/mac/statbmp.h index f2162aeb10..48cad8933a 100644 --- a/include/wx/mac/statbmp.h +++ b/include/wx/mac/statbmp.h @@ -54,6 +54,7 @@ class WXDLLEXPORT wxStaticBitmap: public wxControl // overriden base class virtuals virtual bool AcceptsFocus() const { return FALSE; } + wxSize DoGetBestSize() const ; protected: wxBitmap m_messageBitmap; diff --git a/include/wx/mac/toolbar.h b/include/wx/mac/toolbar.h index 6fe126b788..63c3d7f937 100644 --- a/include/wx/mac/toolbar.h +++ b/include/wx/mac/toolbar.h @@ -31,12 +31,14 @@ class WXDLLEXPORT wxToolBar: public wxToolBarBase * Public interface */ - wxToolBar(); + wxToolBar() { Init(); } + inline wxToolBar(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxNO_BORDER|wxTB_HORIZONTAL, const wxString& name = wxToolBarNameStr) { + Init(); Create(parent, id, pos, size, style, name); } ~wxToolBar(); @@ -45,36 +47,43 @@ class WXDLLEXPORT wxToolBar: public wxToolBarBase long style = wxNO_BORDER|wxTB_HORIZONTAL, const wxString& name = wxToolBarNameStr); - // If pushedBitmap is NULL, a reversed version of bitmap is - // created and used as the pushed/toggled image. - // If toggle is TRUE, the button toggles between the two states. - wxToolBarTool *AddTool(int toolIndex, const wxBitmap& bitmap, const wxBitmap& pushedBitmap = wxNullBitmap, - bool toggle = FALSE, long xPos = -1, long yPos = -1, wxObject *clientData = NULL, - const wxString& helpString1 = "", const wxString& helpString2 = ""); + // override/implement base class virtuals + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; - // Set default bitmap size - void SetToolBitmapSize(const wxSize& size); - void EnableTool(int toolIndex, bool enable); // additional drawing on enabling - void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on - void ClearTools(); + virtual bool Realize(); - // The button size is bigger than the bitmap size - wxSize GetToolSize() const; + virtual void SetToolBitmapSize(const wxSize& size); + virtual wxSize GetToolSize() const; - wxSize GetMaxSize() const; + virtual void SetRows(int nRows); // Add all the buttons - virtual bool CreateTools(); - virtual void LayoutButtons() {} - // The post-tool-addition call. TODO: do here whatever's - // necessary for completing the toolbar construction. - bool Realize() { return CreateTools(); }; virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ; protected: + // common part of all ctors + void Init(); + + // implement base class pure virtuals + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); + + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); + + virtual wxToolBarToolBase *CreateTool(int id, + const wxBitmap& bitmap1, + const wxBitmap& bitmap2, + bool toggle, + wxObject *clientData, + const wxString& shortHelpString, + const wxString& longHelpString); + virtual wxToolBarToolBase *CreateTool(wxControl *control); + wxArrayPtrVoid m_macToolHandles ; -DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() }; #endif // wxUSE_TOOLBAR diff --git a/include/wx/mac/window.h b/include/wx/mac/window.h index 3eac7270ce..c7c6bd43b0 100644 --- a/include/wx/mac/window.h +++ b/include/wx/mac/window.h @@ -86,7 +86,6 @@ public: virtual void SetFocus(); - virtual bool Reparent( wxWindow *newParent ); virtual void WarpPointer(int x, int y); virtual void CaptureMouse(); @@ -181,6 +180,8 @@ public: void OnEraseBackground(wxEraseEvent& event); void OnIdle(wxIdleEvent& event); void MacOnScroll(wxScrollEvent&event ) ; + + bool AcceptsFocus() const ; public: // For implementation purposes - sometimes decorations make the client area @@ -297,10 +298,6 @@ protected: int sizeFlags = wxSIZE_AUTO); virtual void DoSetClientSize(int width, int height); - // get the size which best suits the window: e.g., for a static text it - // will be the width and height of the text - virtual wxSize DoGetBestSize(); - // move the window to the specified location and resize it: this is called // from both DoSetSize() and DoSetClientSize() and would usually just call // ::MoveWindow() except for composite controls which will want to arrange diff --git a/include/wx/notebook.h b/include/wx/notebook.h index 4dea9653ef..63bbee89ea 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/generic/notebook.h" + #include "wx/mac/notebook.h" #elif defined(__WXPM__) #include "wx/os2/notebook.h" #elif defined(__WXSTUBS__) diff --git a/include/wx/resource.h b/include/wx/resource.h index bbd5aa1f75..937bc47b7f 100644 --- a/include/wx/resource.h +++ b/include/wx/resource.h @@ -147,6 +147,7 @@ class WXDLLEXPORT wxResourceTable: public wxHashTable virtual bool DeleteResource(const wxString& name); virtual bool ParseResourceFile(const wxString& filename); + virtual bool ParseResourceFile( wxInputStream *is ) ; virtual bool ParseResourceData(const wxString& data); virtual bool SaveResource(const wxString& filename); diff --git a/src/make_cw.mcp b/src/make_cw.mcp index 4dedadf9b2..79abe23b37 100644 Binary files a/src/make_cw.mcp and b/src/make_cw.mcp differ