*** empty log message ***

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3278 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster
1999-08-05 04:05:25 +00:00
parent 18ac8d6919
commit c3d434725b
8 changed files with 96 additions and 251 deletions

View File

@@ -21,7 +21,7 @@
#include "wx/validate.h" #include "wx/validate.h"
// General item class // General item class
class WXDLLEXPORT wxControl: public wxWindow class WXDLLEXPORT wxControl: public wxControlBase
{ {
DECLARE_ABSTRACT_CLASS(wxControl) DECLARE_ABSTRACT_CLASS(wxControl)
public: public:

View File

@@ -16,6 +16,7 @@
#pragma interface "dc.h" #pragma interface "dc.h"
#endif #endif
#include "wx/window.h"
#include "wx/pen.h" #include "wx/pen.h"
#include "wx/brush.h" #include "wx/brush.h"
#include "wx/icon.h" #include "wx/icon.h"
@@ -156,16 +157,6 @@ class WXDLLEXPORT wxDC: public wxDCBase
private: private:
void ComputeScaleAndOrigin(void);
long XDEV2LOG(long x) const;
long XDEV2LOGREL(long x) const;
long YDEV2LOG(long y) const;
long YDEV2LOGREL(long y) const;
long XLOG2DEV(long x) const;
long XLOG2DEVREL(long x) const;
long YLOG2DEV(long y) const;
long YLOG2DEVREL(long y) const;
#if WXWIN_COMPATIBILITY #if WXWIN_COMPATIBILITY
// function hiding warning supression // function hiding warning supression
virtual void GetTextExtent( const wxString& string virtual void GetTextExtent( const wxString& string

View File

@@ -146,6 +146,7 @@ public:
// same as DoSetSize() for the client size // same as DoSetSize() for the client size
virtual void DoSetClientSize(int width, int height); virtual void DoSetClientSize(int width, int height);
virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
virtual WXWidget GetHandle() const;
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// wxWindowBase virtual implementations that need to be overriden // wxWindowBase virtual implementations that need to be overriden

View File

@@ -36,42 +36,70 @@ IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
long wxDCBase::DeviceToLogicalX(long x) const long wxDCBase::DeviceToLogicalX(long x) const
{ {
return XDEV2LOG(x); long new_x = x - m_deviceOriginX;
if (new_x > 0)
return (long)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
else
return (long)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
}; };
long wxDCBase::DeviceToLogicalY(long y) const long wxDCBase::DeviceToLogicalY(long y) const
{ {
return YDEV2LOG(y); long new_y = y - m_deviceOriginY;
if (new_y > 0)
return (long)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
else
return (long)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
}; };
long wxDCBase::DeviceToLogicalXRel(long x) const long wxDCBase::DeviceToLogicalXRel(long x) const
{ {
return XDEV2LOGREL(x); if (x > 0)
return (long)((double)(x) / m_scaleX + 0.5);
else
return (long)((double)(x) / m_scaleX - 0.5);
}; };
long wxDCBase::DeviceToLogicalYRel(long y) const long wxDCBase::DeviceToLogicalYRel(long y) const
{ {
return YDEV2LOGREL(y); if (y > 0)
return (long)((double)(y) / m_scaleY + 0.5);
else
return (long)((double)(y) / m_scaleY - 0.5);
}; };
long wxDCBase::LogicalToDeviceX(long x) const long wxDCBase::LogicalToDeviceX(long x) const
{ {
return XLOG2DEV(x); long new_x = x - m_logicalOriginX;
if (new_x > 0)
return (long)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
else
return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
}; };
long wxDCBase::LogicalToDeviceY(long y) const long wxDCBase::LogicalToDeviceY(long y) const
{ {
return YLOG2DEV(y); long new_y = y - m_logicalOriginY;
if (new_y > 0)
return (long)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
else
return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
}; };
long wxDCBase::LogicalToDeviceXRel(long x) const long wxDCBase::LogicalToDeviceXRel(long x) const
{ {
return XLOG2DEVREL(x); if (x > 0)
return (long)((double)(x) * m_scaleX + 0.5);
else
return (long)((double)(x) * m_scaleX - 0.5);
}; };
long wxDCBase::LogicalToDeviceYRel(long y) const long wxDCBase::LogicalToDeviceYRel(long y) const
{ {
return YLOG2DEVREL(y); if (y > 0)
return (long)((double)(y) * m_scaleY + 0.5);
else
return (long)((double)(y) * m_scaleY - 0.5);
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -80,161 +108,79 @@ long wxDCBase::LogicalToDeviceYRel(long y) const
wxDC::wxDC(void) wxDC::wxDC(void)
{ {
m_ok = FALSE; m_owner = NULL;
m_optimize = FALSE; m_bitmap = NULL;
m_autoSetting = FALSE;
m_colour = TRUE;
m_clipping = FALSE;
m_mm_to_pix_x = 1.0; m_oldBitmap = 0;
m_mm_to_pix_y = 1.0; m_oldPen = 0;
m_oldBrush = 0;
m_logicalOriginX = 0; m_oldFont = 0;
m_logicalOriginY = 0; m_oldPalette = 0;
m_deviceOriginX = 0; m_hDC = 0;
m_deviceOriginY = 0; m_hDCCount = 0;
m_internalDeviceOriginX = 0;
m_internalDeviceOriginY = 0;
m_externalDeviceOriginX = 0;
m_externalDeviceOriginY = 0;
m_logicalScaleX = 1.0;
m_logicalScaleY = 1.0;
m_userScaleX = 1.0;
m_userScaleY = 1.0;
m_scaleX = 1.0;
m_scaleY = 1.0;
m_mappingMode = wxMM_TEXT;
m_needComputeScaleX = FALSE;
m_needComputeScaleY = FALSE;
m_signX = 1; // default x-axis left to right
m_signY = 1; // default y-axis top down
m_maxX = m_maxY = -100000;
m_minY = m_minY = 100000;
m_logicalFunction = wxCOPY;
// m_textAlignment = wxALIGN_TOP_LEFT;
m_backgroundMode = wxTRANSPARENT;
m_textForegroundColour = *wxBLACK;
m_textBackgroundColour = *wxWHITE;
m_pen = *wxBLACK_PEN;
m_font = *wxNORMAL_FONT;
m_brush = *wxTRANSPARENT_BRUSH;
m_backgroundBrush = *wxWHITE_BRUSH;
// m_palette = wxAPP_COLOURMAP;
}; };
wxDC::~wxDC(void) wxDC::~wxDC(void)
{ {
// TODO:
}; };
void wxDC::DestroyClippingRegion(void) void wxDC::DestroyClippingRegion(void)
{ {
m_clipping = FALSE; // TODO:
}; };
void wxDC::GetSize( int* width, int* height ) const void wxDC::DoGetSize( int* width, int* height ) const
{ {
*width = m_maxX-m_minX; // TODO:
*height = m_maxY-m_minY;
}; };
void wxDC::GetSizeMM( long* width, long* height ) const void wxDC::DoGetSizeMM( int* width, int* height ) const
{ {
int w = 0; // TODO:
int h = 0;
GetSize( &w, &h );
*width = long( double(w) / (m_scaleX*m_mm_to_pix_x) );
*height = long( double(h) / (m_scaleY*m_mm_to_pix_y) );
}; };
void wxDC::SetMapMode( int mode ) void wxDC::SetMapMode( int mode )
{ {
switch (mode) // TODO:
{
case wxMM_TWIPS:
SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
break;
case wxMM_POINTS:
SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
break;
case wxMM_METRIC:
SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
break;
case wxMM_LOMETRIC:
SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
break;
default:
case wxMM_TEXT:
SetLogicalScale( 1.0, 1.0 );
break;
};
if (mode != wxMM_TEXT)
{
m_needComputeScaleX = TRUE;
m_needComputeScaleY = TRUE;
};
}; };
void wxDC::SetUserScale( double x, double y ) void wxDC::SetUserScale( double x, double y )
{ {
// allow negative ? -> no
m_userScaleX = x; m_userScaleX = x;
m_userScaleY = y; m_userScaleY = y;
ComputeScaleAndOrigin();
};
void wxDC::GetUserScale( double *x, double *y ) SetMapMode(m_mappingMode);
{
if (x) *x = m_userScaleX;
if (y) *y = m_userScaleY;
}; };
void wxDC::SetLogicalScale( double x, double y ) void wxDC::SetLogicalScale( double x, double y )
{ {
// allow negative ? // TODO:
m_logicalScaleX = x;
m_logicalScaleY = y;
ComputeScaleAndOrigin();
}; };
void wxDC::SetLogicalOrigin( long x, long y ) void wxDC::SetLogicalOrigin( long x, long y )
{ {
m_logicalOriginX = x * m_signX; // is this still correct ? // TODO:
m_logicalOriginY = y * m_signY;
ComputeScaleAndOrigin();
}; };
void wxDC::SetDeviceOrigin( long x, long y ) void wxDC::SetDeviceOrigin( long x, long y )
{ {
m_externalDeviceOriginX = x; // TODO:
m_externalDeviceOriginY = y;
ComputeScaleAndOrigin();
}; };
void wxDC::SetInternalDeviceOrigin( long x, long y ) void wxDC::SetInternalDeviceOrigin( long x, long y )
{ {
m_internalDeviceOriginX = x; // TODO:
m_internalDeviceOriginY = y;
ComputeScaleAndOrigin();
}; };
void wxDC::GetInternalDeviceOrigin( long *x, long *y ) void wxDC::GetInternalDeviceOrigin( long *x, long *y )
{ {
if (x) *x = m_internalDeviceOriginX; // TODO:
if (y) *y = m_internalDeviceOriginY;
}; };
void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp ) void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
{ {
m_signX = (xLeftRight ? 1 : -1); // TODO:
m_signY = (yBottomUp ? -1 : 1);
ComputeScaleAndOrigin();
}; };
@@ -246,8 +192,10 @@ int wxDC::GetDepth() const
wxSize wxDC::GetPPI() const wxSize wxDC::GetPPI() const
{ {
int x = 1;
int y = 1;
// TODO: // TODO:
return (1); return (wxSize(x,y));
} }
void wxDC::GetTextExtent( const wxString& string void wxDC::GetTextExtent( const wxString& string
,long* x ,long* x
@@ -260,13 +208,13 @@ void wxDC::GetTextExtent( const wxString& string
// TODO: // TODO:
} }
void wxDC::GetCharWidth() const long wxDC::GetCharWidth() const
{ {
// TODO // TODO
return(1); return(1);
} }
void wxDC::GetCharHeight() const long wxDC::GetCharHeight() const
{ {
// TODO // TODO
return(1); return(1);
@@ -314,7 +262,7 @@ void wxDC::SetPalette(const wxPalette& palette)
void wxDC::DoFloodFill( long x void wxDC::DoFloodFill( long x
,long y ,long y
,const wxColour& col ,const wxColour& col
,int style = wxFLOOD_SURFACE ,int style
) )
{ {
// TODO // TODO
@@ -385,7 +333,7 @@ void wxDC::DoDrawIcon(const wxIcon& icon, long x, long y)
void wxDC::DoDrawBitmap( const wxBitmap &bmp void wxDC::DoDrawBitmap( const wxBitmap &bmp
,long x, long y ,long x, long y
,bool useMask = FALSE ,bool useMask
) )
{ {
// TODO // TODO
@@ -403,24 +351,14 @@ bool wxDC::DoBlit( long xdest
,wxDC *source ,wxDC *source
,long xsrc ,long xsrc
,long ysrc ,long ysrc
,int rop = wxCOPY ,int rop
,bool useMask = FALSE ,bool useMask
) )
{ {
// TODO // TODO
return(TRUE); return(TRUE);
} }
void wxDC::DoGetSize(int *width, int *height) const
{
// TODO
}
void wxDC::DoGetSizeMM(int* width, int* height) const
{
// TODO
}
void wxDC::DoDrawLines( int n, wxPoint points[] void wxDC::DoDrawLines( int n, wxPoint points[]
,long xoffset, long yoffset ,long xoffset, long yoffset
) )
@@ -430,7 +368,7 @@ void wxDC::DoDrawLines( int n, wxPoint points[]
void wxDC::DoDrawPolygon(int n, wxPoint points[] void wxDC::DoDrawPolygon(int n, wxPoint points[]
,long xoffset, long yoffset ,long xoffset, long yoffset
,int fillStyle = wxODDEVEN_RULE ,int fillStyle
) )
{ {
// TODO // TODO
@@ -458,95 +396,5 @@ void wxDC::DoDrawSpline(wxList *points)
// //
// Private functions // Private functions
// //
long wxDC::XDEV2LOG(long x) const
{
long new_x = x - m_deviceOriginX;
if (new_x > 0)
return (long)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
else
return (long)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
}
long wxDC::XDEV2LOGREL(long x) const
{
if (x > 0)
return (long)((double)(x) / m_scaleX + 0.5);
else
return (long)((double)(x) / m_scaleX - 0.5);
}
long wxDC::YDEV2LOG(long y) const
{
long new_y = y - m_deviceOriginY;
if (new_y > 0)
return (long)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
else
return (long)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
}
long wxDC::YDEV2LOGREL(long y) const
{
if (y > 0)
return (long)((double)(y) / m_scaleY + 0.5);
else
return (long)((double)(y) / m_scaleY - 0.5);
}
long wxDC::XLOG2DEV(long x) const
{
long new_x = x - m_logicalOriginX;
if (new_x > 0)
return (long)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
else
return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
}
long wxDC::XLOG2DEVREL(long x) const
{
if (x > 0)
return (long)((double)(x) * m_scaleX + 0.5);
else
return (long)((double)(x) * m_scaleX - 0.5);
}
long wxDC::YLOG2DEV(long y) const
{
long new_y = y - m_logicalOriginY;
if (new_y > 0)
return (long)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
else
return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
}
long wxDC::YLOG2DEVREL(long y) const
{
if (y > 0)
return (long)((double)(y) * m_scaleY + 0.5);
else
return (long)((double)(y) * m_scaleY - 0.5);
}
void wxDC::ComputeScaleAndOrigin(void)
{
// CMB: copy scale to see if it changes
double origScaleX = m_scaleX;
double origScaleY = m_scaleY;
m_scaleX = m_logicalScaleX * m_userScaleX;
m_scaleY = m_logicalScaleY * m_userScaleY;
m_deviceOriginX = m_internalDeviceOriginX + m_externalDeviceOriginX;
m_deviceOriginY = m_internalDeviceOriginY + m_externalDeviceOriginY;
// CMB: if scale has changed call SetPen to recalulate the line width
if (m_scaleX != origScaleX || m_scaleY != origScaleY)
{
// this is a bit artificial, but we need to force wxDC to think
// the pen has changed
wxPen* pen = & GetPen();
wxPen tempPen;
m_pen = tempPen;
SetPen(* pen);
}
};

View File

@@ -132,11 +132,6 @@ bool wxDialog::IsIconized() const
return FALSE; return FALSE;
} }
void wxDialog::SetClientSize(int width, int height)
{
// TODO
}
void wxDialog::GetPosition(int *x, int *y) const void wxDialog::GetPosition(int *x, int *y) const
{ {
// TODO // TODO

View File

@@ -14,6 +14,7 @@
#endif #endif
#include "wx/frame.h" #include "wx/frame.h"
#include "wx/event.h"
#include "wx/statusbr.h" #include "wx/statusbr.h"
#include "wx/toolbar.h" #include "wx/toolbar.h"
#include "wx/menuitem.h" #include "wx/menuitem.h"
@@ -47,12 +48,12 @@ bool wxFrame::m_useNativeStatusBar = FALSE;
wxFrame::wxFrame() wxFrame::wxFrame()
{ {
m_frameToolBar = NULL ;
m_frameMenuBar = NULL; m_frameMenuBar = NULL;
m_frameStatusBar = NULL; m_frameStatusBar = NULL;
m_windowParent = NULL;
m_iconized = FALSE; m_iconized = FALSE;
m_frameToolBar = NULL ;
} }
bool wxFrame::Create(wxWindow *parent, bool wxFrame::Create(wxWindow *parent,
@@ -200,7 +201,7 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
dc.SetFont(statusBar->GetFont()); dc.SetFont(statusBar->GetFont());
long x, y; long x, y;
dc.GetTextExtent("X", &x, &y); dc.GetTextExtent("X", &x, &y, NULL, NULL, NULL, FALSE);
int height = (int)( (y * 1.1) + 2* statusBar->GetBorderY()); int height = (int)( (y * 1.1) + 2* statusBar->GetBorderY());
@@ -435,7 +436,7 @@ void wxFrame::Command(int id)
void wxFrame::ProcessCommand(int id) void wxFrame::ProcessCommand(int id)
{ {
wxCommandEvent commandEvent(wxEVENT_TYPE_MENU_COMMAND, id); wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, id);
commandEvent.SetInt( id ); commandEvent.SetInt( id );
commandEvent.SetEventObject( this ); commandEvent.SetEventObject( this );

View File

@@ -183,6 +183,9 @@ COMMONOBJS = \
OS2OBJS = \ OS2OBJS = \
..\os2\$D\dc.obj \
..\os2\$D\dialog.obj \
..\os2\$D\frame.obj \
..\os2\$D\window.obj \ ..\os2\$D\window.obj \
HTMLOBJS = \ HTMLOBJS = \

View File

@@ -495,6 +495,12 @@ wxObject* wxWindow::GetChild(int number) const
return((wxObject*)this); return((wxObject*)this);
} }
WXWidget wxWindow::GetHandle() const
{
// TODO:
return((WXWidget)m_hWnd);
}
void wxWindow::PMDetachWindowMenu() void wxWindow::PMDetachWindowMenu()
{ {
if ( m_hMenu ) if ( m_hMenu )