#include "wx/log.h"
#include "wx/icon.h"
#include "wx/msgdlg.h"
- #include "wx/module.h"
+#if wxUSE_STATUSBAR
+ #include "wx/statusbr.h"
+#endif
#endif
+#include "wx/module.h"
#include "wx/dcprint.h"
#include <string.h>
void wxDC::ClearCache()
{
- m_svBitmapCache.DeleteContents(TRUE);
+ m_svBitmapCache.DeleteContents(true);
m_svBitmapCache.Clear();
- m_svBitmapCache.DeleteContents(FALSE);
- m_svDCCache.DeleteContents(TRUE);
+ m_svBitmapCache.DeleteContents(false);
+ m_svDCCache.DeleteContents(true);
m_svDCCache.Clear();
- m_svDCCache.DeleteContents(FALSE);
+ m_svDCCache.DeleteContents(false);
} // end of wxDC::ClearCache
// Clean up cache at app exit
class wxDCModule : public wxModule
{
public:
- virtual bool OnInit() { return TRUE; }
+ virtual bool OnInit() { return true; }
virtual void OnExit() { wxDC::ClearCache(); }
private:
wxDC::wxDC(void)
{
- wxColour vColor;
-
m_pCanvas = NULL;
m_hOldBitmap = 0;
m_hOldFont = 0;
m_hOldPalette = 0;
- m_bOwnsDC = FALSE;
+ m_bOwnsDC = false;
m_hDC = 0;
m_hOldPS = NULL;
m_hPS = NULL;
- m_bIsPaintTime = FALSE; // True at Paint Time
+ m_bIsPaintTime = false; // True at Paint Time
- vColor.InitFromName("BLACK");
+ wxColour vColor( wxT("BLACK") );
m_pen.SetColour(vColor);
- vColor.Set("WHITE");
+
+ vColor.Set( wxT("WHITE") );
m_brush.SetColour(vColor);
+
} // end of wxDC::wxDC
wxDC::~wxDC(void)
RECTL vRect;
vY = OS2Y(vY,vHeight);
- m_clipping = TRUE;
+ m_clipping = true;
vRect.xLeft = vX;
vRect.yTop = vY + vHeight;
vRect.xRight = vX + vWidth;
wxCHECK_RET(rRegion.GetHRGN(), wxT("invalid clipping region"));
HRGN hRgnOld;
- m_clipping = TRUE;
+ m_clipping = true;
::GpiSetClipRegion( m_hPS
,(HRGN)rRegion.GetHRGN()
,&hRgnOld
::GpiSetClipRegion(m_hPS, hRgn, &hRgnOld);
}
- m_clipping = FALSE;
+ m_clipping = false;
} // end of wxDC::DestroyClippingRegion
// ---------------------------------------------------------------------------
bool wxDC::CanDrawBitmap() const
{
- return TRUE;
+ return true;
}
bool wxDC::CanGetTextExtent() const
LONG lColor;
LONG lOptions;
LONG lHits;
- bool bSuccess = FALSE;
+ bool bSuccess = false;
vPtlPos.x = vX; // Loads x-coordinate
vPtlPos.y = OS2Y(vY,0); // Loads y-coordinate
lOptions = FF_SURFACE;
if ((lHits = ::GpiFloodFill(m_hPS, lOptions, lColor)) != GPI_ERROR)
- bSuccess = TRUE;
- return TRUE;
+ bSuccess = true;
+
+ return true;
} // end of wxDC::DoFloodFill
bool wxDC::DoGetPixel(
if(m_brush.GetStyle() == wxTRANSPARENT)
lControl = DRO_OUTLINE;
- ::GpiSetColor(m_hPS, lColor);
+ ::GpiSetColor(m_hPS, lBorderColor);
::GpiBox( m_hPS // handle to a presentation space
,lControl // draw the box outline ? or ?
,&vPoint[1] // address of the corner
::GpiBox( m_hPS
,lControl
,&vPoint[1]
- ,0L
- ,0L
+ ,(LONG)dRadius
+ ,(LONG)dRadius
);
lControl = DRO_FILL;
::GpiSetColor( m_hPS
::GpiBox( m_hPS
,lControl
,&vPoint[1]
- ,0L
- ,0L
+ ,(LONG)dRadius
+ ,(LONG)dRadius
);
}
//
if (rIcon.IsXpm())
{
- DoDrawBitmap(rIcon.GetXpmSrc(), vX, vY, TRUE);
+ DoDrawBitmap(rIcon.GetXpmSrc(), vX, vY, true);
}
else
{
wxBitmap vBitmap(rIcon);
- DoDrawBitmap(vBitmap, vX, vY, FALSE);
+ DoDrawBitmap(vBitmap, vX, vY, false);
}
CalcBoundingBox(vX, vY);
CalcBoundingBox(vX + rIcon.GetWidth(), vY + rIcon.GetHeight());
vY = OS2Y(vY,rBmp.GetHeight());
- //
- // Flip the picture as OS/2 is upside-down
- //
- if (rBmp.Flip())
- {
- vPoint[0].x = vX;
- vPoint[0].y = vY + rBmp.GetHeight();
- vPoint[1].x = vX + rBmp.GetWidth();
- vPoint[1].y = vY;
- vPoint[2].x = 0;
- vPoint[2].y = 0;
- vPoint[3].x = rBmp.GetWidth();
- vPoint[3].y = rBmp.GetHeight();
- }
- else
- {
- vPoint[0].x = vX;
- vPoint[0].y = vY;
- vPoint[1].x = vX + rBmp.GetWidth();
- vPoint[1].y = vY + rBmp.GetHeight();
- vPoint[2].x = 0;
- vPoint[2].y = 0;
- vPoint[3].x = rBmp.GetWidth();
- vPoint[3].y = rBmp.GetHeight();
- }
+ vPoint[0].x = vX;
+ vPoint[0].y = vY + rBmp.GetHeight();
+ vPoint[1].x = vX + rBmp.GetWidth();
+ vPoint[1].y = vY;
+ vPoint[2].x = 0;
+ vPoint[2].y = 0;
+ vPoint[3].x = rBmp.GetWidth();
+ vPoint[3].y = rBmp.GetHeight();
if (bUseMask)
{
wxMask* pMask = rBmp.GetMask();
//
// Need to get a background color for mask blitting
//
- if (IsKindOf(CLASSINFO(wxPaintDC)))
+ if (IsKindOf(CLASSINFO(wxWindowDC)))
{
- wxPaintDC* pPaintDC = wxDynamicCast(this, wxPaintDC);
+ wxWindowDC* pWindowDC = wxDynamicCast(this, wxWindowDC);
- lColor = pPaintDC->m_pCanvas->GetBackgroundColour().GetPixel();
+ lColor = pWindowDC->m_pCanvas->GetBackgroundColour().GetPixel();
}
else if (GetBrush() != wxNullBrush)
lColor = GetBrush().GetColour().GetPixel();
m_vRclPaint.yBottom == 0 &&
m_vRclPaint.xRight == 0 &&
m_vRclPaint.xLeft == 0))
- vPtlStart.y = OS2Y(vY,vTextY);
+ {
+ //
+ // Position Text a little differently in the Statusbar from other panels
+ //
+ if (m_pCanvas && m_pCanvas->IsKindOf(CLASSINFO(wxStatusBar)))
+ vPtlStart.y = OS2Y(vY,vTextY);
+ else
+ vPtlStart.y = OS2Y(vY,vTextY/1.5); // Full extent is a bit much
+ }
else
{
if (m_vSelectedBitmap != wxNullBitmap)
{
m_vRclPaint.yTop = m_vSelectedBitmap.GetHeight();
m_vRclPaint.xRight = m_vSelectedBitmap.GetWidth();
- vPtlStart.y = OS2Y(vY,vTextY);
+ if (m_pCanvas && m_pCanvas->IsKindOf(CLASSINFO(wxStatusBar)))
+ vPtlStart.y = OS2Y(vY,vTextY);
+ else
+ vPtlStart.y = OS2Y(vY,vTextY/1.5);
}
else
vPtlStart.y = vY;
return;
if (m_pCanvas)
{
- bool bCustomColours = TRUE;
+ bool bCustomColours = true;
//
// If we haven't specified wxUSER_COLOURS, don't allow the panel/dialog box to
//
if (m_pCanvas->IsKindOf(CLASSINFO(wxWindow)) &&
((m_pCanvas->GetWindowStyleFlag() & wxUSER_COLOURS) != wxUSER_COLOURS))
- bCustomColours = FALSE;
+ bCustomColours = false;
if (bCustomColours)
{
if (m_backgroundBrush.GetStyle()==wxTRANSPARENT)
{
- m_pCanvas->SetTransparent(TRUE);
+ m_pCanvas->SetTransparent(true);
}
else
{
// parent?
// m_canvas->SetBackgroundColour(m_backgroundBrush.GetColour());
//
- m_pCanvas->SetTransparent(FALSE);
+ m_pCanvas->SetTransparent(false);
}
}
}
const wxString& rsMessage
)
{
- // We might be previewing, so return TRUE to let it continue.
- return TRUE;
+ // We might be previewing, so return true to let it continue.
+ return true;
} // end of wxDC::StartDoc
void wxDC::EndDoc()
wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
{
- // axis orientation is not taken into account for conversion of a distance
+ // axis orientation is not taken into account for conversion of a distance
return (wxCoord) ((x)/(m_logicalScaleX*m_userScaleX*m_scaleX));
}
wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
{
- // axis orientation is not taken into account for conversion of a distance
+ // axis orientation is not taken into account for conversion of a distance
return (wxCoord) ((y)/(m_logicalScaleY*m_userScaleY*m_scaleY));
}
wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
{
- // axis orientation is not taken into account for conversion of a distance
+ // axis orientation is not taken into account for conversion of a distance
return (wxCoord) (x*m_logicalScaleX*m_userScaleX*m_scaleX);
}
wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
{
- // axis orientation is not taken into account for conversion of a distance
+ // axis orientation is not taken into account for conversion of a distance
return (wxCoord) (y*m_logicalScaleY*m_userScaleY*m_scaleY);
}
pMask = rBmp.GetMask();
if (!(rBmp.Ok() && pMask && pMask->GetMaskBitmap()))
{
- bUseMask = FALSE;
+ bUseMask = false;
}
}
case wxNOR: lRop = ROP_NOTSRCCOPY; break;
default:
wxFAIL_MSG( wxT("unsupported logical function") );
- return FALSE;
+ return false;
}
bool bSuccess;
vBmpHdr.cBitCount = 24;
#if wxUSE_DC_CACHEING
- if (TRUE)
+ if (true)
{
//
// create a temp buffer bitmap and DCs to access it and the mask
hBufBitmap = ::GpiCreateBitmap(GetHPS(), &vBmpHdr, 0L, NULL, NULL);
}
- POINTL aPoint1[4] = { 0, 0
- ,vWidth, vHeight
- ,vXdest, vYdest
- ,vXdest + vWidth, vYdest + vHeight
+ POINTL aPoint1[4] = { {0, 0}
+ ,{vWidth, vHeight}
+ ,{vXdest, vYdest}
+ ,{vXdest + vWidth, vYdest + vHeight}
};
- POINTL aPoint2[4] = { 0, 0
- ,vWidth, vHeight
- ,vXsrc, vYsrc
- ,vXsrc + vWidth, vYsrc + vHeight
+ POINTL aPoint2[4] = { {0, 0}
+ ,{vWidth, vHeight}
+ ,{vXsrc, vYsrc}
+ ,{vXsrc + vWidth, vYsrc + vHeight}
};
- POINTL aPoint3[4] = { vXdest, vYdest
- ,vXdest + vWidth, vYdest + vHeight
- ,vXsrc, vYsrc
- ,vXsrc + vWidth, vYsrc + vHeight
+ POINTL aPoint3[4] = { {vXdest, vYdest}
+ ,{vXdest + vWidth, vYdest + vHeight}
+ ,{vXsrc, vYsrc}
+ ,{vXsrc + vWidth, vYsrc + vHeight}
};
- POINTL aPoint4[4] = { vXdest, vYdest
- ,vXdest + vWidth, vYdest + vHeight
- ,0, 0
- ,vWidth, vHeight
+ POINTL aPoint4[4] = { {vXdest, vYdest}
+ ,{vXdest + vWidth, vYdest + vHeight}
+ ,{0, 0}
+ ,{vWidth, vHeight}
};
::GpiSetBitmap(hPSMask, (HBITMAP) pMask->GetMaskBitmap());
::GpiSetBitmap(hPSBuffer, (HBITMAP) hBufBitmap);
);
if (rc == GPI_ERROR)
{
- bSuccess = FALSE;
+ bSuccess = false;
wxLogLastError(wxT("BitBlt"));
}
::DevCloseDC(hDCBuffer);
::GpiDeleteBitmap(hBufBitmap);
#endif
- bSuccess = TRUE;
+ bSuccess = true;
}
else // no mask, just BitBlt() it
{
- POINTL aPoint[4] = { vXdest, vYdest
- ,vXdest + vWidth, vYdest + vHeight
- ,vXsrc, vYsrc
- ,vXsrc + vWidth, vYsrc + vHeight
+ POINTL aPoint[4] = { {vXdest, vYdest}
+ ,{vXdest + vWidth, vYdest + vHeight}
+ ,{vXsrc, vYsrc}
+ ,{vXsrc + vWidth, vYsrc + vHeight}
};
bSuccess = (::GpiBitBlt( m_hPS
m_logicalScaleY = dY;
}; // end of wxDC::SetLogicalScale
-#if WXWIN_COMPATIBILITY
-void wxDC::DoGetTextExtent(const wxString& string, float *x, float *y,
- float *descent, float *externalLeading,
- wxFont *theFont, bool use16bit) const
-{
- wxCoord x1, y1, descent1, externalLeading1;
- GetTextExtent(string, & x1, & y1, & descent1, & externalLeading1, theFont, use16bit);
- *x = x1; *y = y1;
- if (descent)
- *descent = descent1;
- if (externalLeading)
- *externalLeading = externalLeading1;
-}
-#endif
+