mac fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10045 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2001-05-08 07:29:46 +00:00
parent 233d02951f
commit 0a67a93b17
47 changed files with 1324 additions and 606 deletions

View File

@@ -103,196 +103,6 @@ class WXDLLEXPORT wxDC: public wxDCBase
virtual void SetTextForeground(const wxColour& colour) ;
virtual void SetTextBackground(const wxColour& colour) ;
//
//
/*
void BeginDrawing(void) {};
void EndDrawing(void) {};
virtual bool Ok(void) const { return m_ok; };
virtual void FloodFill( long x1, long y1, const wxColour& col, int style=wxFLOOD_SURFACE );
inline void FloodFill(const wxPoint& pt, const wxColour& col, int style=wxFLOOD_SURFACE)
{
FloodFill(pt.x, pt.y, col, style);
}
virtual bool GetPixel( long x1, long y1, wxColour *col ) const ;
inline bool GetPixel(const wxPoint& pt, wxColour *col) const
{
return GetPixel(pt.x, pt.y, col);
}
virtual void DrawLine( long x1, long y1, long x2, long y2 );
inline void DrawLine(const wxPoint& pt1, const wxPoint& pt2)
{
DrawLine(pt1.x, pt1.y, pt2.x, pt2.y);
}
virtual void CrossHair( long x, long y );
inline void CrossHair(const wxPoint& pt)
{
CrossHair(pt.x, pt.y);
}
virtual void DrawArc( long x1, long y1, long x2, long y2, long xc, long yc );
inline void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre)
{
DrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y);
}
virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea );
virtual void DrawEllipticArc (const wxPoint& pt, const wxSize& sz, double sa, double ea)
{
DrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea);
}
virtual void DrawPoint( long x, long y );
virtual void DrawPoint( wxPoint& point );
virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 );
virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 );
virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE );
virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE );
virtual void DrawRectangle( long x, long y, long width, long height );
inline void DrawRectangle(const wxPoint& pt, const wxSize& sz)
{
DrawRectangle(pt.x, pt.y, sz.x, sz.y);
}
inline void DrawRectangle(const wxRect& rect)
{
DrawRectangle(rect.x, rect.y, rect.width, rect.height);
}
virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 );
inline void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius = 20.0)
{
DrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius);
}
inline void DrawRoundedRectangle(const wxRect& rect, double radius = 20.0)
{
DrawRoundedRectangle(rect.x, rect.y, rect.width, rect.height, radius);
}
virtual void DrawEllipse( long x, long y, long width, long height );
inline void DrawEllipse(const wxPoint& pt, const wxSize& sz)
{
DrawEllipse(pt.x, pt.y, sz.x, sz.y);
}
inline void DrawEllipse(const wxRect& rect)
{
DrawEllipse(rect.x, rect.y, rect.width, rect.height);
}
virtual void DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 );
virtual void DrawSpline( wxList *points );
virtual void DrawSpline( int n, wxPoint points[] );
virtual bool CanDrawBitmap(void) const ;
virtual void DrawIcon( const wxIcon &icon, long x, long y, bool useMask=FALSE );
inline void DrawIcon(const wxIcon& icon, const wxPoint& pt)
{
DrawIcon(icon, pt.x, pt.y);
}
void DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask=FALSE ) ;
virtual bool Blit( long xdest, long ydest, long width, long height,
wxDC *source, long xsrc, long ysrc, int logical_func = wxCOPY, bool useMask=FALSE );
inline bool Blit(const wxPoint& destPt, const wxSize& sz,
wxDC *source, const wxPoint& srcPt, int rop = wxCOPY, bool useMask = FALSE)
{
return Blit(destPt.x, destPt.y, sz.x, sz.y, source, srcPt.x, srcPt.y, rop, useMask);
}
virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE );
inline void DrawText(const wxString& text, const wxPoint& pt, bool use16bit = FALSE)
{
DrawText(text, pt.x, pt.y, use16bit);
}
virtual bool CanGetTextExtent(void) const ;
virtual void GetTextExtent( const wxString &string, int *width, int *height,
int *descent = NULL, int *externalLeading = NULL,
wxFont *theFont = NULL, bool use16 = FALSE ) const ;
virtual wxCoord GetCharWidth(void) const;
virtual wxCoord GetCharHeight(void) const;
virtual void Clear(void);
virtual void SetFont( const wxFont &font );
virtual wxFont& GetFont(void) const { return (wxFont&) m_font; };
virtual void SetPen( const wxPen &pen );
virtual wxPen& GetPen(void) const { return (wxPen&) m_pen; };
virtual void SetBrush( const wxBrush &brush );
virtual wxBrush& GetBrush(void) const { return (wxBrush&) m_brush; };
virtual void SetBackground( const wxBrush &brush );
virtual wxBrush& GetBackground(void) const { return (wxBrush&) m_backgroundBrush; };
virtual void SetLogicalFunction( int function );
virtual int GetLogicalFunction(void) const { return m_logicalFunction; };
virtual void SetTextForeground( const wxColour &col );
virtual void SetTextBackground( const wxColour &col );
virtual wxColour& GetTextBackground(void) const { return (wxColour&)m_textBackgroundColour; };
virtual wxColour& GetTextForeground(void) const { return (wxColour&)m_textForegroundColour; };
virtual void SetBackgroundMode( int mode );
virtual int GetBackgroundMode(void) const { return m_backgroundMode; };
virtual void SetPalette( const wxPalette& palette );
void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
// the first two must be overridden and called
virtual void SetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
virtual void SetClippingRegion( const wxRect& rect );
virtual void DestroyClippingRegion(void);
virtual void GetClippingBox( wxCoord *x, wxCoord *y, wxCoord *width, wxCoord *height ) const;
virtual void GetClippingBox( long *x, long *y, long *width, long *height ) const;
virtual void GetClippingBox(wxRect& rect) const;
virtual inline long MinX(void) const { return m_minX; }
virtual inline long MaxX(void) const { return m_maxX; }
virtual inline long MinY(void) const { return m_minY; }
virtual inline long MaxY(void) const { return m_maxY; }
virtual void GetSize( int* width, int* height ) const;
inline wxSize GetSize(void) const { int w, h; GetSize(&w, &h); return wxSize(w, h); }
virtual void GetSizeMM( long* width, long* height ) const;
virtual int GetMapMode(void) const { return m_mappingMode; };
virtual void GetUserScale( double *x, double *y );
virtual void GetLogicalScale( double *x, double *y );
virtual void GetLogicalOrigin( 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 SetOptimization( bool WXUNUSED(optimize) ) {};
virtual bool GetOptimization(void) { return m_optimize; };
virtual long DeviceToLogicalX(long x) const;
virtual long DeviceToLogicalY(long y) const;
virtual long DeviceToLogicalXRel(long x) const;
virtual long DeviceToLogicalYRel(long y) const;
virtual long LogicalToDeviceX(long x) const;
virtual long LogicalToDeviceY(long y) const;
virtual long LogicalToDeviceXRel(long x) const;
virtual long LogicalToDeviceYRel(long y) const;
void CalcBoundingBox( long x, long y );
*/
void ComputeScaleAndOrigin(void);
public:

View File

@@ -27,7 +27,7 @@ class WXDLLEXPORT wxMemoryDC: public wxPaintDC
wxMemoryDC( wxDC *dc ); // Create compatible DC
~wxMemoryDC(void);
virtual void SelectObject( const wxBitmap& bitmap );
void GetSize( int *width, int *height ) const;
virtual void DoGetSize( int *width, int *height ) const;
wxBitmap GetSelectedObject() { return m_selected ; }
private:
wxBitmap m_selected;

121
include/wx/mac/glcanvas.h Normal file
View File

@@ -0,0 +1,121 @@
/////////////////////////////////////////////////////////////////////////////
// Name: glcanvas.h
// Purpose: wxGLCanvas, for using OpenGL with wxWindows under Macintosh
// Author: AUTHOR
// Modified by:
// Created: ??/??/98
// RCS-ID: $Id$
// Copyright: (c) AUTHOR
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma interface "glcanvas.h"
#endif
#ifndef _WX_GLCANVAS_H_
#define _WX_GLCANVAS_H_
#include "wx/setup.h"
#if wxUSE_GLCANVAS
#include "wx/palette.h"
#include "wx/scrolwin.h"
#include <gl.h>
#include <agl.h>
//---------------------------------------------------------------------------
// Constants for attriblist
//---------------------------------------------------------------------------
enum
{
WX_GL_RGBA=1, /* use true color palette */
WX_GL_BUFFER_SIZE, /* bits for buffer if not WX_GL_RGBA */
WX_GL_LEVEL, /* 0 for main buffer, >0 for overlay, <0 for underlay */
WX_GL_DOUBLEBUFFER, /* use doublebuffer */
WX_GL_STEREO, /* use stereoscopic display */
WX_GL_AUX_BUFFERS, /* number of auxiliary buffers */
WX_GL_MIN_RED, /* use red buffer with most bits (> MIN_RED bits) */
WX_GL_MIN_GREEN, /* use green buffer with most bits (> MIN_GREEN bits) */
WX_GL_MIN_BLUE, /* use blue buffer with most bits (> MIN_BLUE bits) */
WX_GL_MIN_ALPHA, /* use blue buffer with most bits (> MIN_ALPHA bits) */
WX_GL_DEPTH_SIZE, /* bits for Z-buffer (0,16,32) */
WX_GL_STENCIL_SIZE, /* bits for stencil buffer */
WX_GL_MIN_ACCUM_RED, /* use red accum buffer with most bits (> MIN_ACCUM_RED bits) */
WX_GL_MIN_ACCUM_GREEN, /* use green buffer with most bits (> MIN_ACCUM_GREEN bits) */
WX_GL_MIN_ACCUM_BLUE, /* use blue buffer with most bits (> MIN_ACCUM_BLUE bits) */
WX_GL_MIN_ACCUM_ALPHA /* use blue buffer with most bits (> MIN_ACCUM_ALPHA bits) */
};
class WXDLLEXPORT wxGLCanvas; /* forward reference */
class WXDLLEXPORT wxGLContext: public wxObject
{
public:
wxGLContext(AGLPixelFormat fmt, wxGLCanvas *win,
const wxPalette& WXUNUSED(palette),
const wxGLContext *other /* for sharing display lists */
);
~wxGLContext();
void SetCurrent();
void Update(); // must be called after window drag/grows/zoom or clut change
void SetColour(const char *colour);
void SwapBuffers();
inline wxWindow* GetWindow() const { return m_window; }
inline AGLDrawable GetDrawable() const { return m_drawable; }
public:
AGLContext m_glContext;
AGLDrawable m_drawable;
wxWindow* m_window;
};
class WXDLLEXPORT wxGLCanvas: public wxScrolledWindow
{
DECLARE_CLASS(wxGLCanvas)
public:
wxGLCanvas(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette);
wxGLCanvas( wxWindow *parent, const wxGLContext *shared = (wxGLContext *)NULL,
wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "GLCanvas",
int *attribList = (int*) NULL, const wxPalette& palette = wxNullPalette );
wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared = (wxGLCanvas *)NULL, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0,
const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette );
~wxGLCanvas();
bool Create(wxWindow *parent, const wxGLContext *shared, wxWindowID id,
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
int *attribList, const wxPalette& palette);
void SetCurrent();
void SetColour(const char *colour);
void SwapBuffers();
void UpdateContext();
void SetViewport();
// Unlike some other platforms, this must get called if you override it.
// It sets the viewport correctly and update the context.
// You shouldn't call glViewport yourself either (use SetViewport if you must reset it.)
void OnSize(wxSizeEvent& event);
inline wxGLContext* GetContext() const { return m_glContext; }
protected:
wxGLContext* m_glContext;
DECLARE_EVENT_TABLE()
};
#endif // wxUSE_GLCANVAS
#endif // _WX_GLCANVAS_H_

View File

@@ -87,7 +87,14 @@ protected:
// TODO maybe have this member
wxMDIClientWindow *m_clientWindow;
wxMDIChildFrame * m_currentChild;
wxMenu* m_windowMenu;
// TRUE if MDI Frame is intercepting commands, not child
bool m_parentFrameActive;
private:
friend class WXDLLEXPORT wxMDIChildFrame;
DECLARE_EVENT_TABLE()
};
@@ -105,6 +112,7 @@ public:
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
{
Init() ;
Create(parent, id, title, pos, size, style, name);
}
@@ -120,14 +128,16 @@ public:
// Set menu bar
void SetMenuBar(wxMenuBar *menu_bar);
void SetClientSize(int width, int height);
void GetPosition(int *x, int *y) const ;
// MDI operations
virtual void Maximize();
virtual void Maximize( bool ){ Maximize() ; } // this one is inherited from wxFrame
virtual void Restore();
virtual void Activate();
protected:
// common part of all ctors
void Init();
};
/* The client window is a child of the parent MDI frame, and itself

View File

@@ -32,7 +32,7 @@ class WXDLLEXPORT wxWindow;
// array of notebook pages
typedef wxWindow wxNotebookPage; // so far, any window can be a page
WX_DEFINE_ARRAY(wxNotebookPage *, wxArrayPages);
WX_DEFINE_ARRAY(wxNotebookPage *, wxArrayPages) ;
// ----------------------------------------------------------------------------
// wxNotebook

View File

@@ -22,6 +22,8 @@ WXDLLEXPORT_DATA(extern const char*) wxRadioButtonNameStr;
class WXDLLEXPORT wxRadioButton: public wxControl
{
DECLARE_DYNAMIC_CLASS(wxRadioButton)
protected:
public:
inline wxRadioButton() {}
inline wxRadioButton(wxWindow *parent, wxWindowID id,
@@ -51,14 +53,9 @@ public:
wxRadioButton *AddInCycle(wxRadioButton *cycle);
inline wxRadioButton *NextInCycle() {return m_cycle;}
void OnIdle( wxIdleEvent &event );
protected:
protected:
wxRadioButton *m_cycle;
private:
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxRadioButton)
};
// Not implemented

View File

@@ -267,6 +267,8 @@
#define wxUSE_ZIPSTREAM 1 // 0
// input stream for reading from zip archives
// OpenGL canvas
#define wxUSE_GLCANVAS 1
/*
* Finer detail
*

View File

@@ -270,14 +270,16 @@ public :
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) ; }
static wxWindow* s_lastMouseWindow ;
private:
virtual bool MacGetWindowFromPointSub( const wxPoint &point , wxWindow** outWin ) ;
protected:
MacWindowData* m_macWindowData ;
static WindowRef s_macWindowInUpdate ;
RgnHandle m_macUpdateRgn ;
bool m_macEraseOnRedraw ;
int m_x ;
int m_y ;