From 05adb9d2fdc40d8620730be490bf406b8e367cf8 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Wed, 9 Aug 2000 11:02:59 +0000 Subject: [PATCH] merge of wxMac into main repository git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7994 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/mac/aga.h | 29 ++++++ include/wx/mac/app.h | 72 +++------------ include/wx/mac/choice.h | 6 +- include/wx/mac/clipbrd.h | 4 +- include/wx/mac/control.h | 23 +++-- include/wx/mac/dataform.h | 41 ++++----- include/wx/mac/dc.h | 158 ++++++++++++++++++++++++++------- include/wx/mac/dialog.h | 58 +++++------- include/wx/mac/frame.h | 179 ++++++++++++++++--------------------- include/wx/mac/listbox.h | 2 +- include/wx/mac/menuitem.h | 2 + include/wx/mac/pen.h | 10 +-- include/wx/mac/settings.h | 91 +++++++++++++++++++ include/wx/mac/setup.h | 181 ++++++++------------------------------ include/wx/mac/stattext.h | 5 +- include/wx/mac/statusbr.h | 39 ++++---- include/wx/mac/textctrl.h | 141 +++++++++++++++-------------- include/wx/mac/timer.h | 26 +++--- include/wx/mac/toolbar.h | 3 + include/wx/mac/tooltip.h | 22 ++--- include/wx/mac/uma.h | 59 +++++++++++-- include/wx/mac/window.h | 30 +++++-- 22 files changed, 643 insertions(+), 538 deletions(-) diff --git a/include/wx/mac/aga.h b/include/wx/mac/aga.h index 8d976e17e1..8c6f598f7a 100644 --- a/include/wx/mac/aga.h +++ b/include/wx/mac/aga.h @@ -77,8 +77,37 @@ OSErr AGAGetRootControl( WindowPtr inWindow , ControlHandle *outControl ) ; void AGASetThemeWindowBackground (WindowRef inWindow, ThemeBrush inBrush, Boolean inUpdate) ; +void AGAApplyThemeBackground (ThemeBackgroundKind inKind, + const Rect * bounds, + ThemeDrawState inState, + SInt16 inDepth, + Boolean inColorDev) ; void AGAMoveControl( ControlHandle inControl , short x , short y ) ; void AGASizeControl( ControlHandle inControl , short x , short y ) ; +class AGAPortHelper +{ +public : + AGAPortHelper( GrafPtr newport) ; + AGAPortHelper() ; + void Setup( GrafPtr newport ) ; + void Clear() ; + bool IsCleared() { return clip == NULL ; } + GrafPtr GetCurrentPort() { return nport ; } + ~AGAPortHelper() ; + +private : + GrafPtr nport ; + GrafPtr port ; + PenState oldPenState ; + RGBColor oldForeColor ; + RGBColor oldBackColor ; + RgnHandle clip ; + short font ; + short size ; + short style ; + short mode ; +} ; + #endif \ No newline at end of file diff --git a/include/wx/mac/app.h b/include/wx/mac/app.h index 4d50c75d06..145c023274 100644 --- a/include/wx/mac/app.h +++ b/include/wx/mac/app.h @@ -40,57 +40,26 @@ bool WXDLLEXPORT wxYield(); // Represents the application. Derive OnInit and declare // a new App object to start application -class WXDLLEXPORT wxApp: public wxEvtHandler +class WXDLLEXPORT wxApp: public wxAppBase { DECLARE_DYNAMIC_CLASS(wxApp) wxApp(); - inline ~wxApp() {} - - static void SetInitializerFunction(wxAppInitializerFunction fn) { m_appInitFn = fn; } - static wxAppInitializerFunction GetInitializerFunction() { return m_appInitFn; } + virtual ~wxApp() {} virtual int MainLoop(); - void ExitMainLoop(); - bool Initialized(); + virtual void ExitMainLoop(); + virtual bool Initialized(); virtual bool Pending() ; virtual void Dispatch() ; - void OnIdle(wxIdleEvent& event); - -// Generic - virtual bool OnInit() { return FALSE; }; - - // No specific tasks to do here. - virtual bool OnInitGui() { return TRUE; } - - // Called to set off the main loop - virtual int OnRun() { return MainLoop(); }; - virtual int OnExit() { return 0; } - - inline void SetPrintMode(int mode) { m_printMode = mode; } - inline int GetPrintMode() const { return m_printMode; } - - inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; } - inline bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete; } - - inline wxString GetAppName() const { - if (m_appName != "") - return m_appName; - else return m_className; - } + virtual wxIcon GetStdIcon(int which) const; + virtual void SetPrintMode(int mode) { m_printMode = mode; } + virtual int GetPrintMode() const { return m_printMode; } - inline void SetAppName(const wxString& name) { m_appName = name; }; - inline wxString GetClassName() const { return m_className; } - inline void SetClassName(const wxString& name) { m_className = name; } - - void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; } - const wxString& GetVendorName() const { return m_vendorName; } - - wxWindow *GetTopWindow() const ; - inline void SetTopWindow(wxWindow *win) { m_topWindow = win; } - - inline void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; } - inline bool GetWantDebugOutput() { return m_wantDebugOutput; } + // implementation only + void OnIdle(wxIdleEvent& event); + void OnEndSession(wxCloseEvent& event); + void OnQueryEndSession(wxCloseEvent& event); // Send idle event to all top-level windows. // Returns TRUE if more idle time is requested. @@ -104,27 +73,11 @@ class WXDLLEXPORT wxApp: public wxEvtHandler inline void SetAuto3D(bool flag) { m_auto3D = flag; } inline bool GetAuto3D() const { return m_auto3D; } - // Creates a log object - virtual wxLog* CreateLogTarget(); - -public: - // Will always be set to the appropriate, main-style values. - int argc; - char ** argv; - protected: - bool m_wantDebugOutput ; - wxString m_className; - wxString m_appName, - m_vendorName; - wxWindow * m_topWindow; - bool m_exitOnFrameDelete; bool m_showOnInit; int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT bool m_auto3D ; // Always use 3D controls, except // where overriden - static wxAppInitializerFunction m_appInitFn; - public: // Implementation @@ -133,6 +86,7 @@ public: void DeletePendingObjects(); bool ProcessIdle(); + bool IsExiting() { return !m_keepGoing ; } public: static long sm_lastMessageTime; @@ -202,7 +156,7 @@ DECLARE_EVENT_TABLE() }; // TODO: add platform-specific arguments -int WXDLLEXPORT wxEntry( int argc, char *argv[] ); +int WXDLLEXPORT wxEntry( int argc, char *argv[] , bool enterLoop = TRUE); void wxMacConvertFromPCForControls( char * p ) ; diff --git a/include/wx/mac/choice.h b/include/wx/mac/choice.h index 4682944941..a6a84a65b6 100644 --- a/include/wx/mac/choice.h +++ b/include/wx/mac/choice.h @@ -26,7 +26,7 @@ class WXDLLEXPORT wxChoice: public wxControl DECLARE_DYNAMIC_CLASS(wxChoice) public: - inline wxChoice() { m_noStrings = 0; } + inline wxChoice() {} inline wxChoice(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, @@ -58,7 +58,7 @@ class WXDLLEXPORT wxChoice: public wxControl virtual wxString GetStringSelection() const ; virtual bool SetStringSelection(const wxString& sel); - virtual inline int Number() const { return m_noStrings; } + virtual inline int Number() const { return m_strings.GetCount(); } virtual void Command(wxCommandEvent& event); virtual inline void SetColumns(int WXUNUSED(n) = 1 ) { /* No effect */ } ; @@ -66,7 +66,7 @@ class WXDLLEXPORT wxChoice: public wxControl void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ; protected: - int m_noStrings; + wxArrayString m_strings; MenuHandle m_macPopUpMenuHandle ; }; diff --git a/include/wx/mac/clipbrd.h b/include/wx/mac/clipbrd.h index 0c9bee6acf..a197ffa71e 100644 --- a/include/wx/mac/clipbrd.h +++ b/include/wx/mac/clipbrd.h @@ -55,7 +55,7 @@ WXDLLEXPORT bool wxGetClipboardFormatName(wxDataFormat dataFormat, //----------------------------------------------------------------------------- class WXDLLEXPORT wxDataObject; -class WXDLLEXPORT wxClipboard : public wxObject +class WXDLLEXPORT wxClipboard : public wxClipboardBase { DECLARE_DYNAMIC_CLASS(wxClipboard) @@ -79,7 +79,7 @@ public: virtual bool AddData( wxDataObject *data ); // ask if data in correct format is available - virtual bool IsSupported( wxDataFormat format ); + virtual bool IsSupported( const wxDataFormat& format ); // fill data with data on the clipboard (if available) virtual bool GetData( wxDataObject& data ); diff --git a/include/wx/mac/control.h b/include/wx/mac/control.h index 713f91fd09..441d823d20 100644 --- a/include/wx/mac/control.h +++ b/include/wx/mac/control.h @@ -25,13 +25,21 @@ class WXDLLEXPORT wxControl : public wxControlBase public: wxControl(); - virtual ~wxControl(); + wxControl(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxControlNameStr) + { + Create(parent, id, pos, size, style, validator, name); + } 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); + virtual ~wxControl(); // Simulates an event virtual void Command(wxCommandEvent& event) { ProcessCommand(event); } @@ -49,7 +57,8 @@ public: virtual bool Enable(bool enabled) ; virtual bool Show(bool show) ; - + + virtual void MacRedrawControl () ; virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ; virtual void MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString label , const wxPoint& pos, @@ -91,12 +100,12 @@ protected: protected: // For controls like radiobuttons which are really composite - ControlHandle m_macControl ; - int m_macHorizontalBorder ; - int m_macVerticalBorder ; - wxList m_subControls; + ControlHandle m_macControl ; + wxList m_subControls; + int m_macHorizontalBorder ; + int m_macVerticalBorder ; - virtual wxSize DoGetBestSize() const ; + virtual wxSize DoGetBestSize() const; private: DECLARE_EVENT_TABLE() diff --git a/include/wx/mac/dataform.h b/include/wx/mac/dataform.h index d052bf4e0c..3492479d26 100644 --- a/include/wx/mac/dataform.h +++ b/include/wx/mac/dataform.h @@ -1,22 +1,21 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: os2/dataform.h +// Name: mac/dataform.h // Purpose: declaration of the wxDataFormat class -// Author: David Webster (lifted from dnd.h) +// Author: Stefan Csomor (lifted from dnd.h) // Modified by: // Created: 10/21/99 // RCS-ID: $Id$ -// Copyright: (c) 1999 David Webster +// Copyright: (c) 1999 Stefan Csomor // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// -#ifndef _WX_OS2_DATAFORM_H -#define _WX_OS2_DATAFORM_H +#ifndef _WX_MAC_DATAFORM_H +#define _WX_MAC_DATAFORM_H class wxDataFormat { public: - // the clipboard formats under GDK are GdkAtoms - typedef unsigned short NativeFormat; + typedef OSType NativeFormat; wxDataFormat(); wxDataFormat(wxDataFormatId vType); @@ -28,18 +27,22 @@ public: { SetId(vFormat); return *this; } // comparison (must have both versions) - bool operator==(NativeFormat vFormat) const - { return m_vFormat == (NativeFormat)vFormat; } - bool operator!=(NativeFormat vFormat) const - { return m_vFormat != (NativeFormat)vFormat; } + bool operator==(NativeFormat format) const + { return m_format == (NativeFormat)format; } + bool operator!=(NativeFormat format) const + { return m_format != (NativeFormat)format; } + bool operator==(wxDataFormatId format) const + { return m_type == (wxDataFormatId)format; } + bool operator!=(wxDataFormatId format) const + { return m_type != (wxDataFormatId)format; } // explicit and implicit conversions to NativeFormat which is one of // standard data types (implicit conversion is useful for preserving the // compatibility with old code) - NativeFormat GetFormatId() const { return m_vFormat; } - operator NativeFormat() const { return m_vFormat; } + NativeFormat GetFormatId() const { return m_format; } + operator NativeFormat() const { return m_format; } - void SetId(NativeFormat vFormat); + void SetId(NativeFormat format); // string ids are used for custom types - this SetId() must be used for // application-specific formats @@ -48,13 +51,11 @@ public: // implementation wxDataFormatId GetType() const; + void SetType( wxDataFormatId type ); private: - wxDataFormatId m_vType; - NativeFormat m_vFormat; - - void PrepareFormats(); - void SetType(wxDataFormatId vType); + wxDataFormatId m_type; + NativeFormat m_format; }; -#endif // _WX_GTK_DATAFORM_H +#endif // _WX_MAC_DATAFORM_H diff --git a/include/wx/mac/dc.h b/include/wx/mac/dc.h index 89d8cdd981..719fe2df2e 100644 --- a/include/wx/mac/dc.h +++ b/include/wx/mac/dc.h @@ -21,6 +21,7 @@ #include "wx/icon.h" #include "wx/font.h" #include "wx/gdicmn.h" +#include "wx/mac/aga.h" //----------------------------------------------------------------------------- // constants @@ -47,15 +48,65 @@ extern int wxPageNumber; // wxDC //----------------------------------------------------------------------------- -class WXDLLEXPORT wxDC: public wxObject +class WXDLLEXPORT wxDC: public wxDCBase { - DECLARE_ABSTRACT_CLASS(wxDC) + DECLARE_DYNAMIC_CLASS(wxDC) public: - wxDC(void); - ~wxDC(void); + wxDC(); + ~wxDC(); + + // implement base class pure virtuals + // ---------------------------------- + + virtual void Clear(); + + virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }; + virtual void EndDoc(void) {}; + + virtual void StartPage(void) {}; + virtual void EndPage(void) {}; + + virtual void SetFont(const wxFont& font); + virtual void SetPen(const wxPen& pen); + virtual void SetBrush(const wxBrush& brush); + virtual void SetBackground(const wxBrush& brush); + virtual void SetBackgroundMode(int mode); + virtual void SetPalette(const wxPalette& palette); + + virtual void DestroyClippingRegion(); + + virtual wxCoord GetCharHeight() const; + virtual wxCoord GetCharWidth() const; + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + wxFont *theFont = NULL) const; + + virtual bool CanDrawBitmap() const; + virtual bool CanGetTextExtent() const; + virtual int GetDepth() const; + virtual wxSize GetPPI() const; + + virtual void SetMapMode(int mode); + virtual void SetUserScale(double x, double y); + + virtual void SetLogicalScale(double x, double y); + virtual void SetLogicalOrigin(wxCoord x, wxCoord y); + virtual void SetDeviceOrigin(wxCoord x, wxCoord y); + virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); + virtual void SetLogicalFunction(int function); + + virtual void SetTextForeground(const wxColour& colour) ; + virtual void SetTextBackground(const wxColour& colour) ; + +// +// + +/* void BeginDrawing(void) {}; void EndDrawing(void) {}; @@ -165,20 +216,9 @@ class WXDLLEXPORT wxDC: public wxObject } virtual bool CanGetTextExtent(void) const ; - 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 ; - } + wxFont *theFont = NULL, bool use16 = FALSE ) const ; virtual wxCoord GetCharWidth(void) const; virtual wxCoord GetCharHeight(void) const; @@ -227,27 +267,16 @@ class WXDLLEXPORT wxDC: public wxObject inline wxSize GetSize(void) const { int w, h; GetSize(&w, &h); return wxSize(w, h); } virtual void GetSizeMM( long* width, long* height ) const; - virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }; - virtual void EndDoc(void) {}; - virtual void StartPage(void) {}; - virtual void EndPage(void) {}; - virtual void SetMapMode( int mode ); virtual int GetMapMode(void) const { return m_mappingMode; }; - virtual void SetUserScale( double x, double y ); virtual void GetUserScale( double *x, double *y ); - virtual void SetLogicalScale( double x, double y ); virtual void GetLogicalScale( double *x, double *y ); - virtual void SetLogicalOrigin( long x, long y ); virtual void GetLogicalOrigin( long *x, long *y ); - virtual void SetDeviceOrigin( long x, long y ); virtual void GetDeviceOrigin( long *x, long *y ); virtual void SetInternalDeviceOrigin( long x, long y ); virtual void GetInternalDeviceOrigin( long *x, long *y ); - - virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); virtual void SetOptimization( bool WXUNUSED(optimize) ) {}; virtual bool GetOptimization(void) { return m_optimize; }; @@ -261,10 +290,12 @@ class WXDLLEXPORT wxDC: public wxObject virtual long LogicalToDeviceXRel(long x) const; virtual long LogicalToDeviceYRel(long y) const; - public: - void CalcBoundingBox( long x, long y ); +*/ + void ComputeScaleAndOrigin(void); + public: + long XDEV2LOG(long x) const { @@ -327,6 +358,71 @@ class WXDLLEXPORT wxDC: public wxObject return (long)((double)(y) * m_scaleY - 0.5); } +// + +protected: + virtual void DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, + int style = wxFLOOD_SURFACE); + + virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; + + virtual void DoDrawPoint(wxCoord x, wxCoord y); + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); + + virtual void DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc); + + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea); + + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + double radius); + virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + + virtual void DoCrossHair(wxCoord x, wxCoord y); + + virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); + virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = FALSE); + + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); + virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, + double angle); + + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + int rop = wxCOPY, bool useMask = FALSE); + + // this is gnarly - we can't even call this function DoSetClippingRegion() + // because of virtual function hiding + virtual void DoSetClippingRegionAsRegion(const wxRegion& region); + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord width, wxCoord height); + virtual void DoGetClippingRegion(wxCoord *x, wxCoord *y, + wxCoord *width, wxCoord *height) + { + GetClippingBox(x, y, width, height); + } + + virtual void DoGetSize(int *width, int *height) const; + virtual void DoGetSizeMM(int* width, int* height) const; + + virtual void DoDrawLines(int n, wxPoint points[], + wxCoord xoffset, wxCoord yoffset); + virtual void DoDrawPolygon(int n, wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + int fillStyle = wxODDEVEN_RULE); + +#if wxUSE_SPLINES + virtual void DoDrawSpline(wxList *points); +#endif // wxUSE_SPLINES + + +// + public: bool m_ok; @@ -375,6 +471,8 @@ class WXDLLEXPORT wxDC: public wxObject bool m_needComputeScaleX,m_needComputeScaleY; // not yet used + float m_scaleFactor; // wxPSDC wants to have this. Will disappear. + long m_clipX1,m_clipY1,m_clipX2,m_clipY2; long m_minX,m_maxX,m_minY,m_maxY; @@ -397,7 +495,7 @@ class WXDLLEXPORT wxDC: public wxObject GrafPtr m_macOrigPort ; Rect m_macClipRect ; Point m_macLocalOrigin ; - + AGAPortHelper m_macPortHelper ; void MacSetupPort() const ; void MacVerifySetup() const { if ( m_macPortId != m_macCurrentPortId ) MacSetupPort() ; } diff --git a/include/wx/mac/dialog.h b/include/wx/mac/dialog.h index d725df8d57..78d8942e7c 100644 --- a/include/wx/mac/dialog.h +++ b/include/wx/mac/dialog.h @@ -65,40 +65,36 @@ public: ~wxDialog(); virtual bool Destroy(); + bool Show(bool show); + void Iconize(bool iconize); + virtual bool IsIconized() const; - virtual void DoSetClientSize(int width, int height); + virtual bool IsTopLevel() const { return TRUE; } - virtual void GetPosition(int *x, int *y) const; + void SetModal(bool flag); + virtual bool IsModal() const; - bool Show(bool show); - bool IsShown() const; - void Iconize(bool iconize); + // For now, same as Show(TRUE) but returns return code + virtual int ShowModal(); + + // may be called to terminate the dialog with the given return code + virtual void EndModal(int retCode); + + // returns TRUE if we're in a modal loop + bool IsModalShowing() const; #if WXWIN_COMPATIBILITY bool Iconized() const { return IsIconized(); }; #endif - virtual bool IsIconized() const; - void Fit(); - - void SetTitle(const wxString& title); - wxString GetTitle() const ; + // implementation + // -------------- - void OnSize(wxSizeEvent& event); + // event handlers bool OnClose(); void OnCharHook(wxKeyEvent& event); - void OnPaint(wxPaintEvent& event); void OnCloseWindow(wxCloseEvent& event); - void SetModal(bool flag); - - virtual void Centre(int direction = wxBOTH); - virtual bool IsModal() const; - - // For now, same as Show(TRUE) but returns return code - virtual int ShowModal(); - virtual void EndModal(int retCode); - // Standard buttons void OnOK(wxCommandEvent& event); void OnApply(wxCommandEvent& event); @@ -107,22 +103,12 @@ public: // Responds to colour changes void OnSysColourChanged(wxSysColourChangedEvent& event); - // implementation - // -------------- - - bool IsModalShowing() const { return m_modalShowing; } - virtual bool IsTopLevel() const { return TRUE; } - - // tooltip management -#if wxUSE_TOOLTIPS - wxMacToolTip* GetToolTipCtrl() const { return m_hwndToolTip; } - void SetToolTipCtrl(wxMacToolTip *tt) { m_hwndToolTip = tt; } - wxMacToolTip* m_hwndToolTip ; -#endif // tooltips + // override more base class virtuals + virtual void DoGetPosition(int *x, int *y) const; + virtual void DoSetClientSize(int width, int height); -protected: - bool m_modalShowing; - WXHWND m_hwndOldFocus; // the window which had focus before we were shown + // show modal dialog and enter modal loop + void DoShowModal(); private: DECLARE_EVENT_TABLE() diff --git a/include/wx/mac/frame.h b/include/wx/mac/frame.h index c342d83c90..331568d974 100644 --- a/include/wx/mac/frame.h +++ b/include/wx/mac/frame.h @@ -28,114 +28,84 @@ class WXDLLEXPORT wxMenuBar; class WXDLLEXPORT wxStatusBar; class WXDLLEXPORT wxMacToolTip ; -class WXDLLEXPORT wxFrame: public wxWindow { +class WXDLLEXPORT wxFrame: public wxFrameBase { DECLARE_DYNAMIC_CLASS(wxFrame) public: - wxFrame(); - inline wxFrame(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - Create(parent, id, title, pos, size, style, name); - } - - ~wxFrame(); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - virtual bool Destroy(); - virtual bool IsTopLevel() const { return TRUE; } - - void OnSize(wxSizeEvent& event); - void OnMenuHighlight(wxMenuEvent& event); - void OnActivate(wxActivateEvent& event); - void OnIdle(wxIdleEvent& event); - void OnCloseWindow(wxCloseEvent& event); - - // Set menu bar - void SetMenuBar(wxMenuBar *menu_bar); - virtual wxMenuBar *GetMenuBar() const ; - - // Call this to simulate a menu command - virtual void Command(int id); - virtual void ProcessCommand(int id); - - // Set icon - virtual void SetIcon(const wxIcon& icon); - - // Create status line - virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0, - const wxString& name = "statusBar"); - inline wxStatusBar *GetStatusBar() const { return m_frameStatusBar; } - virtual void PositionStatusBar(); - virtual wxStatusBar *OnCreateStatusBar(int number, long style, wxWindowID id, - const wxString& name); - + // construction + wxFrame() { Init(); } + wxFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr) + { + Init(); + + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + virtual ~wxFrame(); + + // implement base class pure virtuals + virtual void Maximize(bool maximize = TRUE); + virtual bool IsMaximized() const; + virtual void Iconize(bool iconize = TRUE); + virtual bool IsIconized() const; + virtual void Restore(); + virtual void SetMenuBar(wxMenuBar *menubar); + virtual void SetIcon(const wxIcon& icon); + + // implementation only from now on + // ------------------------------- + + // override some more virtuals + virtual bool Enable(bool enable) ; + + // get the origin of the client area (which may be different from (0, 0) + // if the frame has a toolbar) in client coordinates + virtual wxPoint GetClientAreaOrigin() const; + + // event handlers + void OnActivate(wxActivateEvent& event); + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // Toolbar #if wxUSE_TOOLBAR + virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT, + wxWindowID id = -1, + const wxString& name = wxToolBarNameStr); - // Create toolbar - virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, const wxString& name = wxToolBarNameStr); - virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name); - // If made known to the frame, the frame will manage it automatically. - virtual inline void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; } - virtual inline wxToolBar *GetToolBar() const { return m_frameToolBar; } - virtual void PositionToolBar(); - -#endif + virtual void PositionToolBar(); +#endif // wxUSE_TOOLBAR - // Set status line text - virtual void SetStatusText(const wxString& text, int number = 0); + // Status bar +#if wxUSE_STATUSBAR + virtual wxStatusBar* OnCreateStatusBar(int number = 1, + long style = wxST_SIZEGRIP, + wxWindowID id = 0, + const wxString& name = wxStatusLineNameStr); - // Set status line widths - virtual void SetStatusWidths(int n, const int widths_field[]); + virtual void PositionStatusBar(); // Hint to tell framework which status bar to use // TODO: should this go into a wxFrameworkSettings class perhaps? static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; }; static bool UsesNativeStatusBar() { return m_useNativeStatusBar; }; +#endif // wxUSE_STATUSBAR - // Fit frame around subwindows - virtual void Fit(); - - // Iconize - virtual void Iconize(bool iconize); - - virtual bool IsIconized() const ; - - // Compatibility - inline bool Iconized() const { return IsIconized(); } - - // Is the frame maximized? - virtual bool IsMaximized(void) const ; - - virtual void Maximize(bool maximize); - - // Responds to colour changes - void OnSysColourChanged(wxSysColourChangedEvent& event); - - // Query app for menu item updates (called from OnIdle) - // Query app for menu item updates (called from OnIdle) - void DoMenuUpdates(); - void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin); - - // Checks if there is a toolbar, and returns the first free client position - virtual wxPoint GetClientAreaOrigin() const; - virtual void DoGetClientSize(int *x, int *y) const ; - virtual void DoSetClientSize(int clientwidth, int clientheight) ; - - // tooltip management + // tooltip management #if wxUSE_TOOLTIPS wxMacToolTip* GetToolTipCtrl() const { return m_hwndToolTip; } void SetToolTipCtrl(wxMacToolTip *tt) { m_hwndToolTip = tt; } @@ -143,16 +113,21 @@ public: #endif // tooltips protected: - wxMenuBar * m_frameMenuBar; - wxStatusBar * m_frameStatusBar; - wxIcon m_icon; + // common part of all ctors + void Init(); + + // override base class virtuals + virtual void DoGetClientSize(int *width, int *height) const; + virtual void DoSetClientSize(int width, int height); + +protected: bool m_iconized; - static bool m_useNativeStatusBar; -#if wxUSE_TOOLBAR - wxToolBar * m_frameToolBar ; -#endif +#if wxUSE_STATUSBAR + static bool m_useNativeStatusBar; +#endif // wxUSE_STATUSBAR - DECLARE_EVENT_TABLE() +private: + DECLARE_EVENT_TABLE() }; #endif diff --git a/include/wx/mac/listbox.h b/include/wx/mac/listbox.h index a312aec593..46346daa2c 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() const ; + virtual wxSize DoGetBestSize() const; #if wxUSE_OWNER_DRAWN // control items diff --git a/include/wx/mac/menuitem.h b/include/wx/mac/menuitem.h index 97359a102a..7e9fab32fb 100644 --- a/include/wx/mac/menuitem.h +++ b/include/wx/mac/menuitem.h @@ -69,6 +69,8 @@ public: // menu handle depending on what we're int GetRealId() const; + static MacBuildMenuString(StringPtr outMacItemText, SInt16 *outMacShortcutChar , UInt8 *outMacModifiers , const char *inItemName , bool useShortcuts ) ; + private: DECLARE_DYNAMIC_CLASS(wxMenuItem) }; diff --git a/include/wx/mac/pen.h b/include/wx/mac/pen.h index 4da77c1586..40c9b5c4ba 100644 --- a/include/wx/mac/pen.h +++ b/include/wx/mac/pen.h @@ -20,8 +20,6 @@ #include "wx/colour.h" #include "wx/bitmap.h" -typedef long wxMACDash; - class WXDLLEXPORT wxPen; class WXDLLEXPORT wxPenRefData: public wxGDIRefData @@ -39,7 +37,7 @@ protected: int m_cap ; wxBitmap m_stipple ; int m_nbDash ; - wxMACDash * m_dash ; + wxDash * m_dash ; wxColour m_colour; /* TODO: implementation WXHPEN m_hPen; @@ -81,10 +79,8 @@ public: inline int GetStyle() const { return (M_PENDATA ? M_PENDATA->m_style : 0); }; inline int GetJoin() const { return (M_PENDATA ? M_PENDATA->m_join : 0); }; inline int GetCap() const { return (M_PENDATA ? M_PENDATA->m_cap : 0); }; - inline int GetDashes(wxDash **ptr) const - { - *ptr = (M_PENDATA ? (wxDash*)M_PENDATA->m_dash : (wxDash*) NULL); - return (M_PENDATA ? M_PENDATA->m_nbDash : 0); + inline int GetDashes(wxDash **ptr) const { + *ptr = (M_PENDATA ? M_PENDATA->m_dash : (wxDash*) NULL); return (M_PENDATA ? M_PENDATA->m_nbDash : 0); } inline wxBitmap *GetStipple() const { return (M_PENDATA ? (& M_PENDATA->m_stipple) : (wxBitmap*) NULL); }; diff --git a/include/wx/mac/settings.h b/include/wx/mac/settings.h index b194f1c477..8ed994f1ba 100644 --- a/include/wx/mac/settings.h +++ b/include/wx/mac/settings.h @@ -22,6 +22,97 @@ #include "wx/colour.h" #include "wx/font.h" +#define wxSYS_WHITE_BRUSH 0 +#define wxSYS_LTGRAY_BRUSH 1 +#define wxSYS_GRAY_BRUSH 2 +#define wxSYS_DKGRAY_BRUSH 3 +#define wxSYS_BLACK_BRUSH 4 +#define wxSYS_NULL_BRUSH 5 +#define wxSYS_HOLLOW_BRUSH wxSYS_NULL_BRUSH +#define wxSYS_WHITE_PEN 6 +#define wxSYS_BLACK_PEN 7 +#define wxSYS_NULL_PEN 8 +#define wxSYS_OEM_FIXED_FONT 10 +#define wxSYS_ANSI_FIXED_FONT 11 +#define wxSYS_ANSI_VAR_FONT 12 +#define wxSYS_SYSTEM_FONT 13 +#define wxSYS_DEVICE_DEFAULT_FONT 14 +#define wxSYS_DEFAULT_PALETTE 15 +#define wxSYS_SYSTEM_FIXED_FONT 16 // Obsolete +#define wxSYS_DEFAULT_GUI_FONT 17 + +#define wxSYS_COLOUR_SCROLLBAR 0 +#define wxSYS_COLOUR_BACKGROUND 1 +#define wxSYS_COLOUR_ACTIVECAPTION 2 +#define wxSYS_COLOUR_INACTIVECAPTION 3 +#define wxSYS_COLOUR_MENU 4 +#define wxSYS_COLOUR_WINDOW 5 +#define wxSYS_COLOUR_WINDOWFRAME 6 +#define wxSYS_COLOUR_MENUTEXT 7 +#define wxSYS_COLOUR_WINDOWTEXT 8 +#define wxSYS_COLOUR_CAPTIONTEXT 9 +#define wxSYS_COLOUR_ACTIVEBORDER 10 +#define wxSYS_COLOUR_INACTIVEBORDER 11 +#define wxSYS_COLOUR_APPWORKSPACE 12 +#define wxSYS_COLOUR_HIGHLIGHT 13 +#define wxSYS_COLOUR_HIGHLIGHTTEXT 14 +#define wxSYS_COLOUR_BTNFACE 15 +#define wxSYS_COLOUR_BTNSHADOW 16 +#define wxSYS_COLOUR_GRAYTEXT 17 +#define wxSYS_COLOUR_BTNTEXT 18 +#define wxSYS_COLOUR_INACTIVECAPTIONTEXT 19 +#define wxSYS_COLOUR_BTNHIGHLIGHT 20 + +#define wxSYS_COLOUR_3DDKSHADOW 21 +#define wxSYS_COLOUR_3DLIGHT 22 +#define wxSYS_COLOUR_INFOTEXT 23 +#define wxSYS_COLOUR_INFOBK 24 + +#define wxSYS_COLOUR_DESKTOP wxSYS_COLOUR_BACKGROUND +#define wxSYS_COLOUR_3DFACE wxSYS_COLOUR_BTNFACE +#define wxSYS_COLOUR_3DSHADOW wxSYS_COLOUR_BTNSHADOW +#define wxSYS_COLOUR_3DHIGHLIGHT wxSYS_COLOUR_BTNHIGHLIGHT +#define wxSYS_COLOUR_3DHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT +#define wxSYS_COLOUR_BTNHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT + +// Metrics +#define wxSYS_MOUSE_BUTTONS 1 +#define wxSYS_BORDER_X 2 +#define wxSYS_BORDER_Y 3 +#define wxSYS_CURSOR_X 4 +#define wxSYS_CURSOR_Y 5 +#define wxSYS_DCLICK_X 6 +#define wxSYS_DCLICK_Y 7 +#define wxSYS_DRAG_X 8 +#define wxSYS_DRAG_Y 9 +#define wxSYS_EDGE_X 10 +#define wxSYS_EDGE_Y 11 +#define wxSYS_HSCROLL_ARROW_X 12 +#define wxSYS_HSCROLL_ARROW_Y 13 +#define wxSYS_HTHUMB_X 14 +#define wxSYS_ICON_X 15 +#define wxSYS_ICON_Y 16 +#define wxSYS_ICONSPACING_X 17 +#define wxSYS_ICONSPACING_Y 18 +#define wxSYS_WINDOWMIN_X 19 +#define wxSYS_WINDOWMIN_Y 20 +#define wxSYS_SCREEN_X 21 +#define wxSYS_SCREEN_Y 22 +#define wxSYS_FRAMESIZE_X 23 +#define wxSYS_FRAMESIZE_Y 24 +#define wxSYS_SMALLICON_X 25 +#define wxSYS_SMALLICON_Y 26 +#define wxSYS_HSCROLL_Y 27 +#define wxSYS_VSCROLL_X 28 +#define wxSYS_VSCROLL_ARROW_X 29 +#define wxSYS_VSCROLL_ARROW_Y 30 +#define wxSYS_VTHUMB_Y 31 +#define wxSYS_CAPTION_Y 32 +#define wxSYS_MENU_Y 33 +#define wxSYS_NETWORK_PRESENT 34 +#define wxSYS_PENWINDOWS_PRESENT 35 +#define wxSYS_SHOW_SOUNDS 36 +#define wxSYS_SWAP_BUTTONS 37 class WXDLLEXPORT wxSystemSettings: public wxObject { diff --git a/include/wx/mac/setup.h b/include/wx/mac/setup.h index 44e5cb73a8..bdbcba2aff 100644 --- a/include/wx/mac/setup.h +++ b/include/wx/mac/setup.h @@ -12,128 +12,22 @@ #ifndef _WX_SETUP_H_ #define _WX_SETUP_H_ -// ---------------------------------------------------------------------------- -// global settings -// ---------------------------------------------------------------------------- - -// define this to 0 when building wxBase library -#define wxUSE_GUI 1 +/* + * General features + * + */ -// ---------------------------------------------------------------------------- -// 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 wxUSE_GEOMETRY 1 #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 -// ---------------------------------------------------------------------------- -// 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 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 #define wxUSE_POSTSCRIPT 0 // 0 for no PostScript device context #define wxUSE_AFM_FOR_POSTSCRIPT 0 @@ -142,7 +36,7 @@ // 0 for no Metafile and metafile device context #define wxUSE_IPC 0 // 0 for no interprocess comms -#define wxUSE_HELP 0 +#define wxUSE_HELP 1 // 0 for no help facility #define wxUSE_RESOURCES 1 // 0 for no wxGetResource/wxWriteResource @@ -161,6 +55,7 @@ // 0 for no drag and drop #define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 // Define 1 to use toolbar classes #define wxUSE_BUTTONBAR 1 // Define 1 to use buttonbar classes (enhanced toolbar @@ -238,7 +133,11 @@ // wxObject::delete *IF* __WXDEBUG__ is also defined. // WARNING: this code may not work with all architectures, especially // if alignment is an issue. +#ifndef __MWERKS__ +#define wxUSE_DEBUG_CONTEXT 0 +#else #define wxUSE_DEBUG_CONTEXT 1 +#endif // If 1, enables wxDebugContext, for // writing error messages to file, etc. // If __WXDEBUG__ is not defined, will still use @@ -262,27 +161,17 @@ // Set this to 0 if your compiler can't cope // with omission of prototype parameters. -#define wxUSE_ODBC 1 - // Define 1 to use ODBC classes - +#define wxUSE_ODBC 1 + // Define 1 to use ODBC classes -#define wxODBC_FWD_ONLY_CURSORS 1 - // For backward compatibility reasons, this parameter now only - // controls the default scrolling method used by cursors. This - // default behavior can be overriden by setting the second param - // of wxDB::GetDbConnection() to indicate whether the connection - // (and any wxTable()s that use the connection) should support - // forward only scrolling of cursors, or both forward and backward - // Support for backward scrolling cursors is dependent on the - // data source as well as the ODBC driver being used. -#define wxODBC_BACKWARD_COMPATABILITY 0 - // Default is 0. Set to 1 to use the deprecated classes, enum - // types, function, member variables. With a setting of 1, full - // backward compatability with the 2.0.x release is possible. - // It is STRONGLY recommended that this be set to 0, as - // future development will be done only on the non-deprecated - // functions/classes/member variables/etc. +#define wxODBC_FWD_ONLY_CURSORS 1 + // Some databases/ODBC drivers only allow forward scrolling cursors. + // Unless you specifically want to use backward scrolling + // cursors, and you know that all of the databases/ODBC drivers + // that you will use these odbc classes with allow backward + // scrolling cursors, this setting should remain set to 1 + // for maximum database/driver compatibilty @@ -298,9 +187,13 @@ #define wxUSE_STREAMS 1 // If enabled (1), compiles wxWindows streams classes +#ifndef __MWERKS__ +#define wxUSE_STD_IOSTREAM 0 +#else #define wxUSE_STD_IOSTREAM 1 // Use standard C++ streams if 1. If 0, use wxWin // streams implementation. +#endif #define wxUSE_WXCONFIG 1 // if enabled, compiles built-in OS independent wxConfig @@ -314,8 +207,13 @@ // Use zlib for compression in streams and PNG code #define wxUSE_LIBPNG 1 // Use PNG bitmap code -#define wxUSE_LIBJPEG 0 +#define wxUSE_LIBJPEG 1 // Use JPEG bitmap code +#define wxUSE_LIBTIFF 1 + // Use TIFF bitmap code +#define wxUSE_GIF 1 + // Use GIF bitmap code + #define wxUSE_SERIAL 0 // Use serialization (requires utils/serialize) #define wxUSE_DYNLIB_CLASS 0 @@ -324,10 +222,12 @@ #define wxUSE_TOOLTIPS 1 // Define to use wxToolTip class and // wxWindow::SetToolTip() method -#define wxUSE_SOCKETS 0 // 0 +#define wxUSE_SOCKETS 1 // 0 // Set to 1 to use socket classes #define wxUSE_HTML 1 // 0 // Set to 1 to use wxHTML sub-library +#define wxUSE_FILESYSTEM 1 + #define wxUSE_FS_ZIP 1 // 0 #define wxUSE_FS_INET 1 // 0 // Set to 1 to enable virtual file systems @@ -372,9 +272,6 @@ // text entry dialog and wxGetTextFromUser function #define wxUSE_TEXTDLG 1 -// wxToolBar class -#define wxUSE_TOOLBAR 1 - // wxStatusBar class #define wxUSE_STATUSBAR 1 diff --git a/include/wx/mac/stattext.h b/include/wx/mac/stattext.h index 5cf88232a2..e41f06ba4f 100644 --- a/include/wx/mac/stattext.h +++ b/include/wx/mac/stattext.h @@ -44,14 +44,15 @@ class WXDLLEXPORT wxStaticText: public wxControl const wxString& name = wxStaticTextNameStr); // accessors - void SetLabel(const wxString& , bool resize ); - void SetLabel( const wxString &str ) { SetLabel( str , true ) ; } + void SetLabel( const wxString &str ) ; // operations virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {}; // events void OnPaint( wxPaintEvent &event ) ; + void OnDraw( wxDC &dc ) ; wxSize DoGetBestSize() const ; + virtual bool AcceptsFocus() const { return FALSE; } private : wxString m_label ; diff --git a/include/wx/mac/statusbr.h b/include/wx/mac/statusbr.h index a83d84ae33..c45b276306 100644 --- a/include/wx/mac/statusbr.h +++ b/include/wx/mac/statusbr.h @@ -19,35 +19,34 @@ #include "wx/generic/statusbr.h" -class WXDLLEXPORT wxStatusBarMac : public wxStatusBar +class WXDLLEXPORT wxStatusBarMac : public wxStatusBarGeneric { - DECLARE_DYNAMIC_CLASS(wxStatusBarXX); + DECLARE_DYNAMIC_CLASS(wxStatusBarMac); -public: - // ctors - wxStatusBarXX(); - wxStatusBarXX(wxWindow *parent, wxWindowID id = -1, long style = wxST_SIZEGRIP); + wxStatusBarMac(void); + inline wxStatusBarMac(wxWindow *parent, wxWindowID id, + long style = 0, + const wxString& name = wxPanelNameStr) + { + Create(parent, id, style, name); + } - // create status line - bool Create(wxWindow *parent, wxWindowID id = -1, long style = wxST_SIZEGRIP); + ~wxStatusBarMac(); - // a status line can have several (<256) fields numbered from 0 - virtual void SetFieldsCount(int number = 1, const int widths[] = NULL); + bool Create(wxWindow *parent, wxWindowID id, + long style, + const wxString& name = wxPanelNameStr) ; - // each field of status line has its own text - virtual void SetStatusText(const wxString& text, int number = 0); - virtual wxString GetStatusText(int number = 0) const; + virtual void DrawFieldText(wxDC& dc, int i); + virtual void DrawField(wxDC& dc, int i); - // set status line fields' widths - virtual void SetStatusWidths(int n, const int widths_field[]); + //////////////////////////////////////////////////////////////////////// + // Implementation - void OnSize(wxSizeEvent& event); + void OnPaint(wxPaintEvent& event); +protected: DECLARE_EVENT_TABLE() - -protected: - void CopyFieldsWidth(const int widths[]); - void SetFieldsWidth(); }; #endif diff --git a/include/wx/mac/textctrl.h b/include/wx/mac/textctrl.h index da11bfad29..d7f946d3d1 100644 --- a/include/wx/mac/textctrl.h +++ b/include/wx/mac/textctrl.h @@ -18,28 +18,11 @@ #include "wx/control.h" -#if wxUSE_IOSTREAMH -#include -#else -#include -#endif - WXDLLEXPORT_DATA(extern const char*) wxTextCtrlNameStr; WXDLLEXPORT_DATA(extern const char*) wxEmptyString; // Single-line text item -class WXDLLEXPORT wxTextCtrl: public wxControl - -// TODO Some platforms/compilers don't like inheritance from streambuf. - -#if (defined(__BORLANDC__) && !defined(__WIN32__)) || defined(__MWERKS__) -#define NO_TEXT_WINDOW_STREAM -#endif - -#ifndef NO_TEXT_WINDOW_STREAM -, public streambuf -#endif - +class WXDLLEXPORT wxTextCtrl: public wxTextCtrlBase { DECLARE_DYNAMIC_CLASS(wxTextCtrl) @@ -53,9 +36,6 @@ public: const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr) -#ifndef NO_TEXT_WINDOW_STREAM - :streambuf() -#endif { Create(parent, id, value, pos, size, style, validator, name); } @@ -76,63 +56,94 @@ public: virtual wxString GetLineText(long lineNo) const; virtual int GetNumberOfLines() const; + virtual bool IsModified() const; + virtual bool IsEditable() const; + + // If the return values from and to are the same, there is no selection. + virtual void GetSelection(long* from, long* to) const; + // operations // ---------- - virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - + + // editing + + virtual void Clear(); + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + + // load the controls contents from the file + virtual bool LoadFile(const wxString& file); + + // clears the dirty flag + virtual void DiscardEdits(); + + // writing text inserts it at the current position, appending always + // inserts it at the end + virtual void WriteText(const wxString& text); + virtual void AppendText(const wxString& text); + + // translate between the position (which is just an index in the text ctrl + // considering all its contents as a single strings) and (x, y) coordinates + // which represent column and line. + virtual long XYToPosition(long x, long y) const; + virtual bool PositionToXY(long pos, long *x, long *y) const; + + virtual void ShowPosition(long pos); + // Clipboard operations virtual void Copy(); virtual void Cut(); virtual void Paste(); + virtual bool CanCopy() const; + virtual bool CanCut() const; + virtual bool CanPaste() const; + + // Undo/redo + virtual void Undo(); + virtual void Redo(); + + virtual bool CanUndo() const; + virtual bool CanRedo() const; + + // Insertion point virtual void SetInsertionPoint(long pos); virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const ; - virtual long GetLastPosition() const ; - virtual void Replace(long from, long to, const wxString& value); - virtual void Remove(long from, long to); + virtual long GetInsertionPoint() const; + virtual long GetLastPosition() const; + virtual void SetSelection(long from, long to); virtual void SetEditable(bool editable); - - // streambuf implementation -#ifndef NO_TEXT_WINDOW_STREAM - int overflow(int i); - int sync(); - int underflow(); -#endif - - wxTextCtrl& operator<<(const wxString& s); - wxTextCtrl& operator<<(int i); - wxTextCtrl& operator<<(long i); - wxTextCtrl& operator<<(float f); - wxTextCtrl& operator<<(double d); - wxTextCtrl& operator<<(const char c); - - virtual bool LoadFile(const wxString& file); - virtual bool SaveFile(const wxString& file); - virtual void WriteText(const wxString& text); - virtual void AppendText(const wxString& text); - virtual void DiscardEdits(); - virtual bool IsModified() const; - - virtual long XYToPosition(long x, long y) const ; - virtual void PositionToXY(long pos, long *x, long *y) const ; - virtual void ShowPosition(long pos); - virtual void Clear(); - virtual bool MacCanFocus() const { return true ; } - - // callbacks - // --------- - void OnDropFiles(wxDropFilesEvent& event); - void OnChar(wxKeyEvent& event); // Process 'enter' if required -// void OnEraseBackground(wxEraseEvent& event); - - // Implementation - // -------------- - virtual void Command(wxCommandEvent& event); + // Implementation from now on + // -------------------------- + + // Implementation + // -------------- + virtual void Command(wxCommandEvent& event); + + virtual bool AcceptsFocus() const; + + // callbacks + void OnDropFiles(wxDropFilesEvent& event); + void OnChar(wxKeyEvent& event); // Process 'enter' if required + + void OnCut(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnPaste(wxCommandEvent& event); + void OnUndo(wxCommandEvent& event); + void OnRedo(wxCommandEvent& event); + + void OnUpdateCut(wxUpdateUIEvent& event); + void OnUpdateCopy(wxUpdateUIEvent& event); + void OnUpdatePaste(wxUpdateUIEvent& event); + void OnUpdateUndo(wxUpdateUIEvent& event); + void OnUpdateRedo(wxUpdateUIEvent& event); + + virtual bool MacCanFocus() const { return true ; } + protected: - wxString m_fileName; + virtual wxSize DoGetBestSize() const; DECLARE_EVENT_TABLE() }; diff --git a/include/wx/mac/timer.h b/include/wx/mac/timer.h index 0f656dae8f..1554893d8e 100644 --- a/include/wx/mac/timer.h +++ b/include/wx/mac/timer.h @@ -17,8 +17,18 @@ #endif #include "wx/object.h" +#include "wx/mac/macnotfy.h" -class WXDLLEXPORT wxTimer: public wxObject +class wxTimer ; + +typedef struct MacTimerInfo +{ + TMTask m_task; + wxMacNotifierTableRef m_table ; + wxTimer* m_timer ; +} ; + +class WXDLLEXPORT wxTimer: public wxTimerBase { public: wxTimer(); @@ -28,19 +38,9 @@ public: bool one_shot = FALSE); // Start timer virtual void Stop(); // Stop timer - virtual void Notify() = 0; // Override this member - - // Returns the current interval time (0 if stop) - int Interval() const { return m_milli; }; - bool OneShot() const { return m_oneShot; } - -protected: - bool m_oneShot ; - int m_milli ; - int m_lastMilli ; - - long m_id; + virtual bool IsRunning() const ; + MacTimerInfo m_info; private: DECLARE_ABSTRACT_CLASS(wxTimer) }; diff --git a/include/wx/mac/toolbar.h b/include/wx/mac/toolbar.h index 63c3d7f937..11a488ca90 100644 --- a/include/wx/mac/toolbar.h +++ b/include/wx/mac/toolbar.h @@ -60,6 +60,9 @@ class WXDLLEXPORT wxToolBar: public wxToolBarBase // Add all the buttons virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ; + virtual wxString MacGetToolTipString( wxPoint &where ) ; + void OnPaint(wxPaintEvent& event) ; + void OnMouse(wxMouseEvent& event) ; protected: // common part of all ctors void Init(); diff --git a/include/wx/mac/tooltip.h b/include/wx/mac/tooltip.h index 467b0570a7..240ad50356 100644 --- a/include/wx/mac/tooltip.h +++ b/include/wx/mac/tooltip.h @@ -1,17 +1,15 @@ /////////////////////////////////////////////////////////////////////////////// // Name: mac/tooltip.h // Purpose: wxToolTip class - tooltip control -// Author: Vadim Zeitlin +// Author: Stefan Csomor // Modified by: // Created: 31.01.99 // RCS-ID: $Id$ -// Copyright: (c) 1999 Robert Roebling, Vadim Zeitlin +// Copyright: (c) 1999 Robert Roebling, Vadim Zeitlin, Stefan Csomor // Licence: wxWindows license /////////////////////////////////////////////////////////////////////////////// -//TO ADAPT... - class wxToolTip : public wxObject { public: @@ -33,18 +31,16 @@ public: static void Enable(bool flag); // set the delay after which the tooltip appears static void SetDelay(long milliseconds); + static void NotifyWindowDelete( WindowRef win ) ; - // implementation - //void RelayEvent(WXMSG *msg); - -private: - // create the tooltip ctrl for our parent frame if it doesn't exist yet - // and return its window handle - WXHWND GetToolTipCtrl(); + // implementation only from now on + // ------------------------------- - // remove this tooltip from the tooltip control - void Remove(); + // should be called in response to mouse events + static void RelayEvent(wxWindow *win , wxMouseEvent &event); + static void RemoveToolTips(); +private: wxString m_text; // tooltip text wxWindow *m_window; // window we're associated with }; diff --git a/include/wx/mac/uma.h b/include/wx/mac/uma.h index fd9adb9bcb..ddaba6ed30 100644 --- a/include/wx/mac/uma.h +++ b/include/wx/mac/uma.h @@ -16,12 +16,13 @@ #define UMA_USE_8_6 0 -// define this to be 1 if you have the carbon libs (weak linked or PreCarbon.lib) - -#define UMA_USE_CARBON 0 - +#if __POWERPC__ #define UMA_USE_APPEARANCE 1 #define UMA_USE_WINDOWMGR 1 +#else +#define UMA_USE_APPEARANCE 0 +#define UMA_USE_WINDOWMGR 0 +#endif #if !UMA_USE_8_6 && UMA_USE_WINDOWMGR #undef UMA_USE_WINDOWMGR @@ -29,7 +30,8 @@ #endif #if !TARGET_CARBON - typedef short MenuItemIndex ; +// this is now defined in the latest headers +// typedef short MenuItemIndex ; #endif void UMAInitToolbox( UInt16 inMoreMastersCalls) ; @@ -43,15 +45,33 @@ bool UMAGetProcessModeDoesActivateOnFGSwitch() ; // menu manager -void UMASetMenuTitle( MenuRef menu , ConstStr255Param title ) ; -UInt32 UMAMenuEvent( EventRecord *inEvent ) ; +void UMASetMenuTitle( MenuRef menu , StringPtr title ) ; +UInt32 UMAMenuEvent( EventRecord *inEvent ) ; void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex item ) ; void UMADisableMenuItem( MenuRef inMenu , MenuItemIndex item ) ; +void UMAAppendSubMenuItem( MenuRef menu , StringPtr label , SInt16 submenuid ) ; +void UMAInsertSubMenuItem( MenuRef menu , StringPtr label , MenuItemIndex item , SInt16 submenuid ) ; +void UMAAppendMenuItem( MenuRef menu , StringPtr label , SInt16 key= 0, UInt8 modifiers = 0 ) ; +void UMAInsertMenuItem( MenuRef menu , StringPtr label , MenuItemIndex item , SInt16 key = 0 , UInt8 modifiers = 0 ) ; +void UMASetMenuItemText( MenuRef menu , MenuItemIndex item , StringPtr label ) ; + +MenuRef UMANewMenu( SInt16 menuid , StringPtr label ) ; +void UMADisposeMenu( MenuRef menu ) ; + +// handling the menubar + +void UMADeleteMenu( SInt16 menuId ) ; +void UMAInsertMenu( MenuRef insertMenu , SInt16 afterId ) ; +void UMADrawMenuBar() ; + // quickdraw void UMAShowWatchCursor() ; void UMAShowArrowCursor() ; +void UMAPrOpen() ; +void UMAPrClose() ; + // window manager GrafPtr UMAGetWindowPort( WindowRef inWindowRef ) ; @@ -74,6 +94,11 @@ void UMADrawControl( ControlHandle inControl ) ; void UMAActivateControl( ControlHandle inControl ) ; void UMADeactivateControl( ControlHandle inControl ) ; +void UMAApplyThemeBackground (ThemeBackgroundKind inKind, + const Rect * bounds, + ThemeDrawState inState, + SInt16 inDepth, + Boolean inColorDev); void UMASetThemeWindowBackground (WindowRef inWindow, ThemeBrush inBrush, Boolean inUpdate) ; @@ -190,5 +215,25 @@ WindowRef UMAGetActiveNonFloatingWindow() ; void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate ) ; +#if !TARGET_CARBON +#define GetPortTextFont( p) ((p)->txFont ) +#define GetPortTextSize( p) ((p)->txSize ) +#define GetPortTextFace( p) ((p)->txFace ) +#define GetPortTextMode( p) ((p)->txMode ) +#define GetRegionBounds( r , b) ((*b) = (**r).rgnBBox) +#define GetPortBounds( p , b) ((*b) = p->portRect ) +#define GetWindowPortBounds( p , b) ((*b) = p->portRect ) +#define GetPortVisibleRegion( p, r ) CopyRgn( p->visRgn , r ) +#define GetQDGlobalsWhite( a ) (&((*a) = qd.white)) +#define GetQDGlobalsBlack( a ) (&((*a) = qd.black)) +#define GetQDGlobalsScreenBits( a ) (*a) = qd.screenBits +#define GetQDGlobalsArrow( a ) (&((*a) = qd.arrow)) +#define GetControlBounds( c , b ) ((*b) = (**c).contrlRect ) +#define GetPortBitMapForCopyBits( p ) ((BitMap*) &(((CGrafPtr)p)->portPixMap )) +#endif + +// Appearance Drawing + +OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState ) ; #endif \ No newline at end of file diff --git a/include/wx/mac/window.h b/include/wx/mac/window.h index ba8b50315f..98bccb0324 100644 --- a/include/wx/mac/window.h +++ b/include/wx/mac/window.h @@ -86,7 +86,6 @@ public: virtual void SetFocus(); - virtual void WarpPointer(int x, int y); virtual void CaptureMouse(); virtual void ReleaseMouse(); @@ -162,7 +161,8 @@ public: void MacClientToRootWindow( int *x , int *y ) const ; void MacRootWindowToClient( int *x , int *y ) const ; - + + virtual wxString MacGetToolTipString( wxPoint &where ) ; // simple accessors // ---------------- @@ -220,8 +220,12 @@ public: // Responds to colour changes: passes event on to children. void OnSysColourChanged(wxSysColourChangedEvent& event); - public : + virtual void MacCreateRealWindow( const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name ) ; static bool MacGetWindowFromPoint( const wxPoint &point , wxWindow** outWin ) ; virtual void MacActivate( EventRecord *ev , bool inIsActivating ) ; virtual void MacUpdate( EventRecord *ev ) ; @@ -236,23 +240,28 @@ public : virtual void MacFireMouseEvent( EventRecord *ev ) ; virtual bool MacDispatchMouseEvent(wxMouseEvent& event ) ; virtual void MacEraseBackground( Rect *rect ) ; + virtual void MacPaintBorders() ; + // obsolete : only for link compatibility virtual void MacPaint( wxPaintEvent &event ) ; - WindowRef GetMacRootWindow() const ; + WindowRef GetMacRootWindow() const ; - virtual ControlHandle MacGetContainerForEmbedding() ; + virtual ControlHandle MacGetContainerForEmbedding() ; + virtual long MacGetBorderSize() const ; + static long MacRemoveBordersFromStyle( long style ) ; virtual void MacSuperChangedPosition() ; virtual void MacSuperShown( bool show ) ; - +/* bool MacSetupFocusPort() ; bool MacSetupDrawingPort() ; bool MacSetupFocusClientPort() ; bool MacSetupDrawingClientPort() ; - +*/ virtual bool MacSetPortFocusParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindow* rootwin ) ; virtual bool MacSetPortDrawingParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindow* rootwin ) ; virtual void MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindow** rootwin ) ; virtual void MacGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindow** rootwin) ; + virtual void MacDoGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindow** rootwin) ; MacWindowData* MacGetWindowData() { return m_macWindowData ; } static WindowRef MacGetWindowInUpdate() { return s_macWindowInUpdate ; } bool MacIsWindowScrollbar( const wxScrollBar* sb ) { return (m_hScrollBar == sb || m_vScrollBar == sb) ; } @@ -263,6 +272,7 @@ protected: MacWindowData* m_macWindowData ; static WindowRef s_macWindowInUpdate ; + RgnHandle m_macUpdateRgn ; int m_x ; int m_y ; @@ -324,6 +334,7 @@ wxWindow* wxFindWinFromMacWindow( WindowRef inWindow ) ; void wxAssociateWinWithMacWindow(WindowRef inWindow, wxWindow *win) ; void wxRemoveMacWindowAssociation(wxWindow *win) ; +/* class wxMacFocusHelper { public : @@ -336,6 +347,7 @@ private : GrafPtr m_currentPort ; bool m_ok ; } ; +*/ class wxMacDrawingHelper { @@ -350,7 +362,7 @@ private : PenState m_savedPenState ; bool m_ok ; } ; - +/* class wxMacFocusClientHelper { public : @@ -363,7 +375,7 @@ private : GrafPtr m_currentPort ; bool m_ok ; } ; - +*/ class wxMacDrawingClientHelper { public : -- 2.45.2