]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/msw/private.h
Old API clearly deprecated. Source cleaning.
[wxWidgets.git] / include / wx / msw / private.h
index 31d97c60f2b72bc889a90ae5c675d319d7831228..a7b41605a0dfbc2e14063c80f7989501e93e7523 100644 (file)
@@ -33,19 +33,6 @@ class WXDLLEXPORT wxWindow;
 // private constants
 // ---------------------------------------------------------------------------
 
-// Conversion
-static const double METRIC_CONVERSION_CONSTANT = 0.0393700787;
-
-// Scaling factors for various unit conversions
-static const double mm2inches = (METRIC_CONVERSION_CONSTANT);
-static const double inches2mm = (1/METRIC_CONVERSION_CONSTANT);
-
-static const double mm2twips = (METRIC_CONVERSION_CONSTANT*1440);
-static const double twips2mm = (1/(METRIC_CONVERSION_CONSTANT*1440));
-
-static const double mm2pt = (METRIC_CONVERSION_CONSTANT*72);
-static const double pt2mm = (1/(METRIC_CONVERSION_CONSTANT*72));
-
 // 260 was taken from windef.h
 #ifndef MAX_PATH
     #define MAX_PATH  260
@@ -236,13 +223,16 @@ struct WXDLLEXPORT wxCOLORMAP
 // this function is implemented in src/msw/window.cpp
 extern wxCOLORMAP *wxGetStdColourMap();
 
+// create a wxRect from Windows RECT
+inline wxRect wxRectFromRECT(const RECT& r)
+{
+    return wxRect(r.left, r.top, r.right - r.left, r.bottom - r.top);
+}
+
 // copy Windows RECT to our wxRect
 inline void wxCopyRECTToRect(const RECT& r, wxRect& rect)
 {
-    rect.y = r.top;
-    rect.x = r.left;
-    rect.width = r.right - r.left;
-    rect.height = r.bottom - r.top;
+    rect = wxRectFromRECT(r);
 }
 
 // translations between HIMETRIC units (which OLE likes) and pixels (which are
@@ -405,6 +395,27 @@ private:
    DECLARE_NO_COPY_CLASS(SelectInHDC)
 };
 
+// a class for temporary bitmaps
+class CompatibleBitmap
+{
+public:
+    CompatibleBitmap(HDC hdc, int w, int h)
+    {
+        m_hbmp = ::CreateCompatibleBitmap(hdc, w, h);
+    }
+
+    ~CompatibleBitmap()
+    {
+        if ( m_hbmp )
+            ::DeleteObject(m_hbmp);
+    }
+
+    operator HBITMAP() const { return m_hbmp; }
+
+private:
+    HBITMAP m_hbmp;
+};
+
 // when working with global pointers (which is unfortunately still necessary
 // sometimes, e.g. for clipboard) it is important to unlock them exactly as
 // many times as we lock them which just asks for using a "smart lock" class